Skip to content

Commit

Permalink
game.cpp: Additional debug logging for fixedMapIdToGeneratedId
Browse files Browse the repository at this point in the history
  • Loading branch information
past-due committed Oct 23, 2023
1 parent f9efb30 commit 96fcd1d
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5201,7 +5201,11 @@ static bool loadWzMapDroidInit(WzMap::Map &wzMap, std::unordered_map<UDWORD, UDW
if (droid.id.has_value() && droid.id.value() > 0)
{
bool addedMapping = fixedMapIdToGeneratedId.insert(std::unordered_map<UDWORD, UDWORD>::value_type(droid.id.value(), newID)).second;
if (!addedMapping)
if (addedMapping)
{
debug(LOG_MAP, "Fixed map object ID: %" PRIu32 " -> generated id: %" PRIu32, droid.id.value(), newID);
}
else
{
debug(LOG_ERROR, "Found duplicate hard-coded object ID in map data: %" PRIu32 "", droid.id.value());
}
Expand Down Expand Up @@ -6141,7 +6145,11 @@ static bool loadWzMapStructure(WzMap::Map& wzMap, std::unordered_map<UDWORD, UDW
if (structure.id.has_value() && structure.id.value() > 0)
{
bool addedMapping = fixedMapIdToGeneratedId.insert(std::unordered_map<UDWORD, UDWORD>::value_type(structure.id.value(), newID)).second;
if (!addedMapping)
if (addedMapping)
{
debug(LOG_MAP, "Fixed map object ID: %" PRIu32 " -> generated id: %" PRIu32, structure.id.value(), newID);
}
else
{
debug(LOG_ERROR, "Found duplicate hard-coded object ID in map data: %" PRIu32 "", structure.id.value());
}
Expand Down Expand Up @@ -6891,7 +6899,11 @@ static bool loadWzMapFeature(WzMap::Map &wzMap, std::unordered_map<UDWORD, UDWOR
if (feature.id.has_value() && feature.id.value() > 0)
{
bool addedMapping = fixedMapIdToGeneratedId.insert(std::unordered_map<UDWORD, UDWORD>::value_type(feature.id.value(), newID)).second;
if (!addedMapping)
if (addedMapping)
{
debug(LOG_MAP, "Fixed map object ID: %" PRIu32 " -> generated id: %" PRIu32, feature.id.value(), newID);
}
else
{
debug(LOG_ERROR, "Found duplicate hard-coded object ID in map data: %" PRIu32 "", feature.id.value());
}
Expand Down

0 comments on commit 96fcd1d

Please sign in to comment.