]> git.localhorst.tv Git - blank.git/blobdiff - src/server/ServerState.cpp
move spawn index out of world
[blank.git] / src / server / ServerState.cpp
index cedae4ee9a8b4b4376e77f480645d45c64141217..9020aa09473bdd3ec9f094e8fcab1578de4d9168 100644 (file)
@@ -20,6 +20,7 @@ ServerState::ServerState(
 : env(env)
 , block_types()
 , world(block_types, wc)
+, spawn_index(world.Chunks().MakeIndex(wc.spawn, 3))
 , generator(gc)
 , chunk_loader(world.Chunks(), generator, ws)
 , skeletons()
@@ -37,6 +38,10 @@ ServerState::ServerState(
        std::cout << "listening on UDP port " << config.net.port << std::endl;
 }
 
+ServerState::~ServerState() {
+       world.Chunks().UnregisterIndex(spawn_index);
+}
+
 
 void ServerState::Handle(const SDL_Event &event) {
        if (event.type == SDL_QUIT) {