1er commit
This commit is contained in:
30
src/game/client/WorldClient.cpp
Normal file
30
src/game/client/WorldClient.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#include "game/client/WorldClient.h"
|
||||
#include "protocol/PacketDispatcher.h"
|
||||
#include "game/client/ClientGame.h"
|
||||
#include "render/WorldRenderer.h"
|
||||
|
||||
namespace td{
|
||||
namespace client{
|
||||
|
||||
WorldClient::WorldClient(ClientGame* game) : m_Game(game), game::World(game), protocol::PacketHandler(game->GetDispatcher()){
|
||||
GetDispatcher()->RegisterHandler(protocol::PacketType::WorldBeginData, this);
|
||||
GetDispatcher()->RegisterHandler(protocol::PacketType::WorldData, this);
|
||||
GetDispatcher()->RegisterHandler(protocol::PacketType::SpawnMob, this);
|
||||
}
|
||||
|
||||
void WorldClient::HandlePacket(protocol::WorldBeginDataPacket* packet){
|
||||
loadMap(packet);
|
||||
}
|
||||
|
||||
void WorldClient::HandlePacket(protocol::WorldDataPacket* packet){
|
||||
loadMap(packet);
|
||||
render::WorldRenderer::init(this);
|
||||
}
|
||||
|
||||
void WorldClient::HandlePacket(protocol::SpawnMobPacket* packet){
|
||||
spawnMobAt(packet->getMobID(), packet->getMobType(), packet->getMobLevel(), packet->getSender(),
|
||||
packet->getMobX(), packet->getMobY(), packet->getMobDirection());
|
||||
}
|
||||
|
||||
} // namespace client
|
||||
} // namespace td
|
||||
Reference in New Issue
Block a user