Package marauroa.common.net.message
Class MessageS2CPerception
java.lang.Object
marauroa.common.net.message.Message
marauroa.common.net.message.MessageS2CPerception
- All Implemented Interfaces:
Serializable
This message indicate the client the objects that the server has determined
that this client is able to see.
-
Nested Class Summary
Nested classes/interfaces inherited from class marauroa.common.net.message.Message
Message.MessageType -
Field Summary
Fields inherited from class marauroa.common.net.message.Message
channel, clientid, CLIENTID_INVALID, protocolVersion, timestampMessage, type -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for allowing creation of an empty messageMessageS2CPerception(Channel source, Perception perception)Constructor with a TCP/IP source/destination of the message and perception to send. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidclears the cached perceptions to start the next turn fresh.This method returns the list of modified objectsThis method returns the list of deleted objectsThis method returns the list of modified objectsThis method returns the list of modified objectsgets the added information for the personal objectgets the deleted information for the personal objectintgets the timestamp of this perceptionbytegets the type of this perceptiongets the id of the zone, this perception is forbooleanis this message a perceptionbooleanmay this method be skipped?voidSerialize the object from an ObjectInputvoidsetMyRPObject(RPObject added, RPObject deleted)sets the added and deleted information for the destination playervoidsetPerceptionTimestamp(int ts)sets the timestamp of this perceptiontoString()This method returns a String that represent the objectvoidwriteObject(OutputSerializer out)Serialize the object into an ObjectOutputvoidwriteToJson(StringBuilder out)Serialize the object to jsonMethods inherited from class marauroa.common.net.message.Message
getAddress, getChannel, getClientID, getMessageTimestamp, getProtocolVersion, getType, internalToString, readFromMap, requiresPerception, setChannel, setClientID, setProtocolVersion
-
Constructor Details
-
MessageS2CPerception
public MessageS2CPerception()Constructor for allowing creation of an empty message -
MessageS2CPerception
Constructor with a TCP/IP source/destination of the message and perception to send.- Parameters:
source- The TCP/IP address associated to this messageperception- the perception we are going to send.
-
-
Method Details
-
setMyRPObject
sets the added and deleted information for the destination player- Parameters:
added- added informationdeleted- deleted information
-
getMyRPObjectAdded
gets the added information for the personal object- Returns:
- added information to the personal object
-
getMyRPObjectDeleted
gets the deleted information for the personal object- Returns:
- deleted information from the personal object
-
setPerceptionTimestamp
public void setPerceptionTimestamp(int ts)sets the timestamp of this perception- Parameters:
ts- counter
-
getPerceptionTimestamp
public int getPerceptionTimestamp()gets the timestamp of this perception- Returns:
- counter
-
getPerceptionType
public byte getPerceptionType()gets the type of this perception- Returns:
- full or delta
-
getRPZoneID
gets the id of the zone, this perception is for- Returns:
- IRPZone.ID
-
getAddedRPObjects
This method returns the list of modified objects- Returns:
- List
of added objects
-
getModifiedAddedRPObjects
This method returns the list of modified objects- Returns:
- List
of modified objects that has attributes added
-
getModifiedDeletedRPObjects
This method returns the list of modified objects- Returns:
- List
of modified objects that has attributes removed
-
getDeletedRPObjects
This method returns the list of deleted objects- Returns:
- List
of deleted objects
-
toString
This method returns a String that represent the object -
writeObject
Description copied from class:MessageSerialize the object into an ObjectOutput- Specified by:
writeObjectin interfaceSerializable- Overrides:
writeObjectin classMessage- Parameters:
out- the output serializer.- Throws:
IOException- if the serializations fails
-
readObject
Description copied from class:MessageSerialize the object from an ObjectInput- Specified by:
readObjectin interfaceSerializable- Overrides:
readObjectin classMessage- Parameters:
in- the input serializer- Throws:
IOException- if the serializations fails
-
clearPrecomputedPerception
public static void clearPrecomputedPerception()clears the cached perceptions to start the next turn fresh. -
writeToJson
Description copied from class:MessageSerialize the object to json- Overrides:
writeToJsonin classMessage- Parameters:
out- output buffer
-
isSkippable
public boolean isSkippable()Description copied from class:Messagemay this method be skipped?- Overrides:
isSkippablein classMessage- Returns:
- true, if this method may be skipped; false otherwise.
-
isPerception
public boolean isPerception()is this message a perception- Overrides:
isPerceptionin classMessage- Returns:
- true, if this message is a perception; false otherwise
-