X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fclient%2Fclient.cpp;h=8dd575a0ac8bf03aa9c10068319b998f0de235f0;hb=4e3d9c23940c4511623b5bf328cbbe42641c4b30;hp=49ea4007d6a63524c392ad9953fc67812ef0dfb0;hpb=2b31a783f1bac06c7f6d7adbe5e13e4148c7a815;p=blank.git diff --git a/src/client/client.cpp b/src/client/client.cpp index 49ea400..8dd575a 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -38,13 +38,19 @@ void InitialState::Render(Viewport &viewport) { } -InteractiveState::InteractiveState(MasterState &master) +// TODO: this clutter is a giant mess +InteractiveState::InteractiveState(MasterState &master, uint32_t player_id) : master(master) , block_types() , save(master.GetEnv().config.GetWorldPath(master.GetWorldConf().name, master.GetClientConf().host)) , world(block_types, master.GetWorldConf(), save) , chunk_renderer(world, master.GetWorldConf().load.load_dist) -, interface(master.GetInterfaceConf(), master.GetEnv(), world) { +, interface( + master.GetInterfaceConf(), + master.GetEnv(), + world, + *world.AddPlayer(master.GetInterfaceConf().player_name, player_id) +) { TextureIndex tex_index; master.GetEnv().loader.LoadBlockTypes("default", block_types, tex_index); chunk_renderer.LoadTextures(master.GetEnv().loader, tex_index); @@ -175,7 +181,10 @@ void MasterState::On(const Packet::Join &pack) { // joining game std::cout << "joined game" << std::endl; } - state.reset(new InteractiveState(*this)); + + uint32_t player_id; + pack.ReadPlayerID(player_id); + state.reset(new InteractiveState(*this, player_id)); pack.ReadPlayer(state->GetInterface().Player());