[TexturePackSelectionState] World reload request added. Prevents a bug with incomplete texture packs (see #167).

master
Quentin Bazin 2020-07-28 12:26:30 +02:00
parent 6202717443
commit 4337868fde
2 changed files with 4 additions and 1 deletions

View File

@ -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);

View File

@ -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<TextureAtlas>("atlas-blocks");
atlas.clear();
atlas.loadFromRegistry(Config::texturePack);
World::isReloadRequested = true;
}
}
}