less serialize code
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#include <td/protocol/packet/PacketData.h>
|
||||
#include <td/protocol/packet/PacketSerialize.h>
|
||||
|
||||
#include <sp/common/DataBufferOperators.h>
|
||||
|
||||
namespace td {
|
||||
namespace game {
|
||||
|
||||
@@ -15,5 +17,17 @@ sp::DataBuffer& operator>>(sp::DataBuffer& a_Buffer, TeamCastle& a_Castle) {
|
||||
return a_Buffer;
|
||||
}
|
||||
|
||||
sp::DataBuffer& operator<<(sp::DataBuffer& a_Buffer, const Spawn& a_Spawn) {
|
||||
return a_Buffer << a_Spawn.GetCenterX() << a_Spawn.GetCenterY();
|
||||
}
|
||||
|
||||
sp::DataBuffer& operator>>(sp::DataBuffer& a_Buffer, Spawn& a_Spawn) {
|
||||
float x, y;
|
||||
a_Buffer >> x >> y;
|
||||
a_Spawn.SetCenter({x, y});
|
||||
return a_Buffer;
|
||||
}
|
||||
|
||||
|
||||
} // namespace game
|
||||
} // namespace td
|
||||
|
||||
Reference in New Issue
Block a user