Skip to content

Commit

Permalink
Map: Fix incorrect layers being deleted on FOW load failure
Browse files Browse the repository at this point in the history
  • Loading branch information
dorkster committed Jan 19, 2025
1 parent 7ecbaad commit 420487e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions src/Map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,14 @@ int Map::load(const std::string& fname) {
if (infile.section == "layer") {
if (!loadLayer(infile, !EXIT_ON_FAIL)) {
for (size_t i = layers.size(); i > 0; i--) {
if (layernames[i] == "fow_fog") {
layernames.erase(layernames.begin() + i);
layers.erase(layers.begin() + i);
size_t layer_index = i-1;
if (layernames[layer_index] == "fow_fog") {
layernames.erase(layernames.begin() + layer_index);
layers.erase(layers.begin() + layer_index);
}
else if (layernames[i] == "fow_dark") {
layernames.erase(layernames.begin() + i);
layers.erase(layers.begin() + i);
else if (layernames[layer_index] == "fow_dark") {
layernames.erase(layernames.begin() + layer_index);
layers.erase(layers.begin() + layer_index);
}
}
break;
Expand Down
2 changes: 1 addition & 1 deletion src/Version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ FLARE. If not, see http://www.gnu.org/licenses/

#include <SDL.h>

Version VersionInfo::ENGINE(1, 14, 94);
Version VersionInfo::ENGINE(1, 14, 95);
Version VersionInfo::MIN(0, 0, 0);
Version VersionInfo::MAX(USHRT_MAX, USHRT_MAX, USHRT_MAX);

Expand Down

0 comments on commit 420487e

Please sign in to comment.