From 4337868fde906d20625ed8a29af8f93d15e1e184 Mon Sep 17 00:00:00 2001 From: Quentin Bazin Date: Tue, 28 Jul 2020 12:26:30 +0200 Subject: [PATCH] [TexturePackSelectionState] World reload request added. Prevents a bug with incomplete texture packs (see #167). --- source/client/states/GameState.cpp | 2 +- source/client/states/TexturePackSelectionState.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/source/client/states/GameState.cpp b/source/client/states/GameState.cpp index da7cfc7e6..f01350959 100644 --- a/source/client/states/GameState.cpp +++ b/source/client/states/GameState.cpp @@ -167,7 +167,7 @@ void GameState::onEvent(const SDL_Event &event) { void GameState::update() { m_world.checkPlayerChunk(m_player.x(), m_player.y(), m_player.z()); - m_world.update(!m_stateStack->empty() && &m_stateStack->top() == this); + m_world.update(!m_stateStack->empty() && (&m_stateStack->top() == this || m_stateStack->top().parent() == this)); if (m_camera.getFieldOfView() != Config::cameraFOV) m_camera.setFieldOfView(Config::cameraFOV); diff --git a/source/client/states/TexturePackSelectionState.cpp b/source/client/states/TexturePackSelectionState.cpp index 3b2bc2a91..cf2385572 100644 --- a/source/client/states/TexturePackSelectionState.cpp +++ b/source/client/states/TexturePackSelectionState.cpp @@ -33,6 +33,7 @@ #include "GameConfig.hpp" #include "TextureAtlas.hpp" #include "TexturePackSelectionState.hpp" +#include "World.hpp" namespace fs = ghc::filesystem; @@ -61,6 +62,8 @@ TexturePackSelectionState::TexturePackSelectionState(gk::ApplicationState *paren auto &atlas = gk::ResourceHandler::getInstance().get("atlas-blocks"); atlas.clear(); atlas.loadFromRegistry(Config::texturePack); + + World::isReloadRequested = true; } } }