Created
June 4, 2011 19:49
-
-
Save Kronos11/1008271 to your computer and use it in GitHub Desktop.
Packet Layout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace packets { | |
struct BasePacket | |
{ | |
BasePacket(){} | |
explicit BasePacket(uint32_t session_, uint32_t crc_) | |
, session(session_) | |
, crc(crc_) | |
{} | |
uint32_t session; | |
uint32_t crc; | |
}; | |
typedef anh::event_dispatcher::BasicEvent<BasePacket> BasePacketEvent; | |
} // packets | |
#include <packets/BasePacket.h> | |
// Originates on Server [ S -> C ] | |
namespace packets { | |
struct CmdStartScene : public BasePacket | |
{ | |
CmdStartScene(uint32_t session_, uint32_t crc_) : BasePacket(session_, crc_){} | |
uint8_t ignore_layout_files; | |
uint64_t character_id; | |
std::string terrain_map; | |
float x; | |
float y; | |
float z; | |
std::string shared_race_template; | |
uint64_t galactic_time; | |
}; | |
class CmdStartSceneEvent : public anh::event_dispatcher::BasicEvent<CmdStartScene>{ | |
public: | |
CmdStartSceneEvent(CmdStartScene scene) | |
: anh::event_dispatcher::BasicEvent<CmdStartScene>(0x3AE6DFAE){} | |
void serialize(anh::ByteBuffer& buffer) { | |
buffer.write<uint8_t>(ignore_layout_files); | |
buffer.write<uint64_t>(character_id); | |
buffer.write<std::string>(terrain_map); | |
buffer.write<float>(x); | |
buffer.write<float>(y); | |
buffer.write<float>(z); | |
buffer.write<std::string>(shared_race_template); | |
buffer.write<uint64_t>(galactic_time); | |
} | |
void deserialize(anh::ByteBuffer& buffer) { | |
crc = buffer.read<uint32_t>(); | |
ignore_layout_files = buffer.read<uint8_t>(); | |
character_id = buffer.read<uint64_t>(); | |
terrain_map = buffer.read<std::string>(); | |
x = buffer.read<float>(); | |
y = buffer.read<float>(); | |
z = buffer.read<float>(); | |
shared_race_template = buffer.read<std::string>(); | |
galactic_time = buffer.read<uint64_t>(); | |
} | |
}; | |
} // packets |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment