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
ConstructorDescriptionConstructor 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 void
clears 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 objectint
gets the timestamp of this perceptionbyte
gets the type of this perceptiongets the id of the zone, this perception is forboolean
is this message a perceptionboolean
may this method be skipped?void
Serialize the object from an ObjectInputvoid
setMyRPObject(RPObject added, RPObject deleted)
sets the added and deleted information for the destination playervoid
setPerceptionTimestamp(int ts)
sets the timestamp of this perceptiontoString()
This method returns a String that represent the objectvoid
writeObject(OutputSerializer out)
Serialize the object into an ObjectOutputvoid
writeToJson(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:Message
Serialize the object into an ObjectOutput- Specified by:
writeObject
in interfaceSerializable
- Overrides:
writeObject
in classMessage
- Parameters:
out
- the output serializer.- Throws:
IOException
- if the serializations fails
-
readObject
Description copied from class:Message
Serialize the object from an ObjectInput- Specified by:
readObject
in interfaceSerializable
- Overrides:
readObject
in 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:Message
Serialize the object to json- Overrides:
writeToJson
in classMessage
- Parameters:
out
- output buffer
-
isSkippable
public boolean isSkippable()Description copied from class:Message
may this method be skipped?- Overrides:
isSkippable
in classMessage
- Returns:
- true, if this method may be skipped; false otherwise.
-
isPerception
public boolean isPerception()is this message a perception- Overrides:
isPerception
in classMessage
- Returns:
- true, if this message is a perception; false otherwise
-