mdh.hephaestus2
Class MoveResult

java.lang.Object
  |
  +--mdh.hephaestus2.MoveResult

public final class MoveResult
extends Object

MoveResult is the return code from movement or from callbacks. Callbacks should usually return MoveResult.MR_Okay or MoveResult.MR_Blocked.


Field Summary
static int BLOCKED
          For a move, indicates that the move is blocked, and you should be moved back to your previous position; for a non-move callback, it indicates failure.
static int BORDER
          For a move, indicates that you hit the border of a map; for a non-move callback, it's equivalent to BLOCKED.
static MoveResult MR_Blocked
          A predefined MoveResult(BLOCKED)
static MoveResult MR_Border
          A predefined MoveResult(BORDER, null)
static MoveResult MR_NoMove
          A predefined MoveResult(NOMOVE, null)
static MoveResult MR_Okay
          A predefined MoveResult(OKAY, null)
static int NOMOVE
          For a move, indicates that a move is okay, but that no further movement should be done by the system - this is usually returned when a callback teleports the actor somewhere; for a non-move callback, it's equivalent to OKAY.
static int OKAY
          For a move, indicates that the move is okay, and should be completed for you; for a non-move callback, it indicates normal success.
 
Constructor Summary
MoveResult(int result)
          Creates a new MoveResult with a null arg.
MoveResult(int result, Stuff arg)
          Creates a new MoveResult.
 
Method Summary
 boolean booleanValue()
          Returns true if the result is OKAY or NOMOVE, otherwise false.
 Object getArg()
          Returns the arg - this should be null for all results except BLOCKED.
 int getResult()
          Returns the result code.
 String toString()
          Returns a text representation of the result and arg.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BLOCKED

public static final int BLOCKED
For a move, indicates that the move is blocked, and you should be moved back to your previous position; for a non-move callback, it indicates failure. Arg can be null, or the Thing which blocked you; if a Thing is given, its trigger callback is called.

See Also:
Constant Field Values

OKAY

public static final int OKAY
For a move, indicates that the move is okay, and should be completed for you; for a non-move callback, it indicates normal success. Arg must be null.

See Also:
Constant Field Values

BORDER

public static final int BORDER
For a move, indicates that you hit the border of a map; for a non-move callback, it's equivalent to BLOCKED. Arg must be null.

See Also:
Constant Field Values

NOMOVE

public static final int NOMOVE
For a move, indicates that a move is okay, but that no further movement should be done by the system - this is usually returned when a callback teleports the actor somewhere; for a non-move callback, it's equivalent to OKAY. Arg must be null.

See Also:
Constant Field Values

MR_Blocked

public static MoveResult MR_Blocked
A predefined MoveResult(BLOCKED)


MR_Okay

public static MoveResult MR_Okay
A predefined MoveResult(OKAY, null)


MR_Border

public static MoveResult MR_Border
A predefined MoveResult(BORDER, null)


MR_NoMove

public static MoveResult MR_NoMove
A predefined MoveResult(NOMOVE, null)

Constructor Detail

MoveResult

public MoveResult(int result)
Creates a new MoveResult with a null arg.


MoveResult

public MoveResult(int result,
                  Stuff arg)
Creates a new MoveResult.

Method Detail

booleanValue

public boolean booleanValue()
Returns true if the result is OKAY or NOMOVE, otherwise false.


getArg

public Object getArg()
Returns the arg - this should be null for all results except BLOCKED.


getResult

public int getResult()
Returns the result code.


toString

public String toString()
Returns a text representation of the result and arg.

Overrides:
toString in class Object