nice
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include <vector>
|
||||
#include <td/protocol/command/Commands.h>
|
||||
#include <td/common/Array.h>
|
||||
#include <td/game/WorldTypes.h>
|
||||
|
||||
// Make it dynamic ?
|
||||
#define LOCKSTEP_BUFFER_SIZE 10
|
||||
@@ -60,7 +61,6 @@ struct ChatMessage {
|
||||
// TODO: handle players joining in the first second
|
||||
|
||||
struct BeginGame {
|
||||
MapData m_Map;
|
||||
std::vector<PlayerInfo> m_BlueTeam;
|
||||
std::vector<PlayerInfo> m_RedTeam;
|
||||
// optional, used for players joining mid game
|
||||
@@ -72,6 +72,24 @@ struct LockSteps {
|
||||
Array<LockStep, LOCKSTEP_BUFFER_SIZE> m_LockSteps;
|
||||
};
|
||||
|
||||
struct WorldHeader {
|
||||
game::TowerTileColorPalette m_TowerPlacePalette;
|
||||
Color m_WalkablePalette;
|
||||
std::vector<Color> m_DecorationPalette;
|
||||
Color m_Background;
|
||||
|
||||
game::SpawnColorPalette m_SpawnColorPalette;
|
||||
|
||||
game::TilePalette m_TilePalette;
|
||||
|
||||
game::Spawn m_RedSpawn, m_BlueSpawn;
|
||||
game::TeamCastle m_RedCastle, m_BlueCastle;
|
||||
};
|
||||
|
||||
struct WorldData {
|
||||
std::unordered_map<game::ChunkCoord, game::ChunkPtr> m_Chunks;
|
||||
};
|
||||
|
||||
} // namespace pdata
|
||||
} // namespace protocol
|
||||
} // namespace td
|
||||
|
||||
@@ -26,7 +26,9 @@ enum class PacketID : std::uint8_t {
|
||||
LoggingSuccess,
|
||||
PlayerJoin,
|
||||
PlayerLeave,
|
||||
PlayerLogin
|
||||
PlayerLogin,
|
||||
WorldHeader,
|
||||
WorldData,
|
||||
};
|
||||
|
||||
class PacketHandler;
|
||||
@@ -49,13 +51,15 @@ using LoggingSuccessPacket = PacketMessage<pdata::LoggingSuccess, PacketID::Logg
|
||||
using PlayerJoinPacket = PacketMessage<pdata::PlayerJoin, PacketID::PlayerJoin>;
|
||||
using PlayerLeavePacket = PacketMessage<pdata::PlayerLeave, PacketID::PlayerLeave>;
|
||||
using PlayerLoginPacket = PacketMessage<pdata::PlayerLogin, PacketID::PlayerLogin>;
|
||||
using WorldHeaderPacket = PacketMessage<pdata::WorldHeader, PacketID::WorldHeader>;
|
||||
using WorldDataPacket = PacketMessage<pdata::WorldData, PacketID::WorldData>;
|
||||
|
||||
|
||||
} // namespace packets
|
||||
|
||||
using AllPackets = std::tuple<packets::BeginGamePacket, packets::ChatMessagePacket, packets::DisconnectPacket,
|
||||
packets::KeepAlivePacket, packets::LockStepsPacket, packets::LoggingSuccessPacket, packets::PlayerJoinPacket,
|
||||
packets::PlayerLeavePacket, packets::PlayerLoginPacket>;
|
||||
packets::PlayerLeavePacket, packets::PlayerLoginPacket, packets::WorldHeaderPacket, packets::WorldDataPacket>;
|
||||
|
||||
class PacketHandler : public sp::MessageHandler<AllPackets> {};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user