megamek.common
Class GameTurn.EntityClassTurn

java.lang.Object
  extended by megamek.common.GameTurn
      extended by megamek.common.GameTurn.EntityClassTurn
All Implemented Interfaces:
java.io.Serializable
Enclosing class:
GameTurn

public static class GameTurn.EntityClassTurn
extends GameTurn

A type of game turn that allows only certain types of units to move.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class megamek.common.GameTurn
GameTurn.CounterGrappleTurn, GameTurn.EntityClassTurn, GameTurn.SpecificEntityTurn, GameTurn.TriggerAPPodTurn, GameTurn.TriggerBPodTurn, GameTurn.UnitNumberTurn, GameTurn.UnloadStrandedTurn
 
Field Summary
 
Fields inherited from class megamek.common.GameTurn
CLASS_AERO, CLASS_DROPSHIP, CLASS_GUN_EMPLACEMENT, CLASS_INFANTRY, CLASS_JUMPSHIP, CLASS_MECH, CLASS_PROTOMECH, CLASS_SMALL_CRAFT, CLASS_SPACE_STATION, CLASS_TANK, CLASS_WARSHIP
 
Constructor Summary
GameTurn.EntityClassTurn(int playerId, int classMask)
          Only allow entities for the given player which have types in the class mask to move.
 
Method Summary
 boolean isValidClass(int classCode)
          Determine if entities of the given class get to move.
 boolean isValidEntity(Entity entity, IGame game)
          Determine if the given entity is a valid one to use for this turn.
 
Methods inherited from class megamek.common.GameTurn
getClassCode, getPlayerNum, isValid, isValid, setPlayerNum, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GameTurn.EntityClassTurn

public GameTurn.EntityClassTurn(int playerId,
                                int classMask)
Only allow entities for the given player which have types in the class mask to move.

Parameters:
playerId - the int ID of the player
classMask - the int bitmask containing all the valid class types for this move.
Method Detail

isValidEntity

public boolean isValidEntity(Entity entity,
                             IGame game)
Determine if the given entity is a valid one to use for this turn.

Overrides:
isValidEntity in class GameTurn
Parameters:
entity - the Entity being tested for the move.
game - the IGame the entity belongs to
Returns:
true if the entity can be moved.

isValidClass

public boolean isValidClass(int classCode)
Determine if entities of the given class get to move.

Parameters:
classCode - the int class code being tested
Returns:
true if entities of that class can move.