Skip to content

Commit

Permalink
[TexturePackSelectionState] World reload request added. Prevents a bu…
Browse files Browse the repository at this point in the history
…g with incomplete texture packs (see #167).
  • Loading branch information
Unarelith committed Jul 28, 2020
1 parent 6202717 commit 4337868
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion source/client/states/GameState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions source/client/states/TexturePackSelectionState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "GameConfig.hpp"
#include "TextureAtlas.hpp"
#include "TexturePackSelectionState.hpp"
#include "World.hpp"

namespace fs = ghc::filesystem;

Expand Down Expand Up @@ -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;
}
}
}
Expand Down

0 comments on commit 4337868

Please sign in to comment.