send world to client
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include <td/game/World.h>
|
||||
|
||||
#include <td/simulation/WorldTicker.h>
|
||||
#include <td/protocol/packet/PacketSerialize.h>
|
||||
|
||||
namespace td {
|
||||
namespace game {
|
||||
@@ -14,7 +15,7 @@ class ColorTileVisitor : public TileHandler {
|
||||
ColorTileVisitor(const World& a_World) : m_World(a_World), m_Result(nullptr) {}
|
||||
|
||||
virtual void Handle(const EmptyTile& a_Tile) override {}
|
||||
|
||||
|
||||
virtual void Handle(const TowerTile& a_Tile) override {
|
||||
m_Result = &m_World.GetTowerTileColorPalette()[a_Tile->m_ColorPaletteRef];
|
||||
}
|
||||
@@ -62,6 +63,16 @@ bool World::LoadMap(const protocol::pdata::WorldHeader& a_WorldHeader) {
|
||||
return true;
|
||||
}
|
||||
|
||||
protocol::packets::WorldHeaderPacket World::GetPacketHeader() const {
|
||||
return protocol::packets::WorldHeaderPacket(m_TowerPlacePalette, m_WalkablePalette, m_DecorationPalette, m_Background,
|
||||
m_SpawnColorPalette, m_TilePalette, GetRedTeam().GetSpawn(), GetBlueTeam().GetSpawn(), GetRedTeam().GetCastle(),
|
||||
GetBlueTeam().GetCastle());
|
||||
}
|
||||
|
||||
protocol::packets::WorldDataPacket World::GetPacketData() const {
|
||||
return protocol::packets::WorldDataPacket(m_Chunks);
|
||||
}
|
||||
|
||||
bool World::LoadMap(const protocol::pdata::WorldData& a_WorldData) {
|
||||
m_Chunks = a_WorldData.m_Chunks;
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user