From 3adc3f0c991a7b705807992e3e1b35263411d9af Mon Sep 17 00:00:00 2001 From: fgenesis Date: Mon, 6 May 2024 04:26:54 +0200 Subject: [PATCH] Fix map grid not drawing and tiles not regenerating after editor obs regen (F11) forgot to get max grid dimensions after clearing and recomputing the grid --- Aquaria/Game.cpp | 10 +++++++++- Aquaria/Game.h | 2 ++ Aquaria/SceneEditor.cpp | 3 +-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Aquaria/Game.cpp b/Aquaria/Game.cpp index 3f19ce6..56237b6 100644 --- a/Aquaria/Game.cpp +++ b/Aquaria/Game.cpp @@ -556,7 +556,7 @@ void Game::reconstructGrid(bool force) dsq->tilemgr.exportGridFillers(fillers); std::ostringstream os; - os << "ReconstructGrid using " << fillers.size() << " tiles"; + os << "ReconstructGrid using " << fillers.size() << " solid tiles"; debugLog(os.str()); for (size_t i = 0; i < fillers.size(); i++) @@ -1802,6 +1802,14 @@ next_SE: return true; } + +void Game::handleEditorMapGridUpdate() +{ + reconstructGrid(true); + findMaxCameraValues(); + updateGridRender(OT_MASK_BLACK); +} + void Game::spawnEntities(const EntitySaveData *sav, size_t n) { std::vector conflicting, usable; diff --git a/Aquaria/Game.h b/Aquaria/Game.h index d3296bf..ff841c6 100644 --- a/Aquaria/Game.h +++ b/Aquaria/Game.h @@ -400,6 +400,8 @@ public: void onContinuityReset(); void onPrepareRender(); + void handleEditorMapGridUpdate(); + protected: unsigned highestLoadedEntityID; diff --git a/Aquaria/SceneEditor.cpp b/Aquaria/SceneEditor.cpp index 346a9b9..1c0dd8c 100644 --- a/Aquaria/SceneEditor.cpp +++ b/Aquaria/SceneEditor.cpp @@ -1623,8 +1623,7 @@ void SceneEditor::generateLevel() } } - game->reconstructGrid(true); - game->updateGridRender(OT_MASK_BLACK); + game->handleEditorMapGridUpdate(); maxX--; maxY--;