X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fclient%2Fclient.cpp;h=4be9dbe88430cc8a77f677db8243af5520c6ee54;hb=ae5a7e7d8517fac406a88e9bf98fd3d5bb1728b9;hp=72d860d97772e75706d8ae81e2f5df5ec90fa756;hpb=8e7e042296946ba2aed73b77ab02feb267eb17d4;p=blank.git diff --git a/src/client/client.cpp b/src/client/client.cpp index 72d860d..4be9dbe 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -54,6 +54,7 @@ InteractiveState::InteractiveState(MasterState &master, uint32_t player_id) world, world.AddPlayer(master.GetInterfaceConf().player_name, player_id) ) +, chunk_receiver(world.Chunks()) , chunk_renderer(*interface.GetPlayer().chunks) , skeletons() , loop_timer(16) @@ -103,6 +104,7 @@ void InteractiveState::Handle(const SDL_Event &event) { void InteractiveState::Update(int dt) { loop_timer.Update(dt); master.Update(dt); + chunk_receiver.Update(dt); interface.Update(dt); int world_dt = 0; @@ -417,5 +419,23 @@ void MasterState::On(const Packet::PlayerCorrection &pack) { state->MergePlayerCorrection(pack_seq, corrected_state); } +void MasterState::On(const Packet::ChunkBegin &pack) { + if (!state) { + cout << "got chunk data, but the world has not been created yet" << endl; + cout << "great, this will totally screw up everything :(" << endl; + return; + } + state->GetChunkReceiver().Handle(pack); +} + +void MasterState::On(const Packet::ChunkData &pack) { + if (!state) { + cout << "got chunk data, but the world has not been created yet" << endl; + cout << "great, this will totally screw up everything :(" << endl; + return; + } + state->GetChunkReceiver().Handle(pack); +} + } }