Skip to content

Commit

Permalink
TilesObjectOption: Parse tile_changes as a uint32_t vector
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
Vankata453 authored Oct 26, 2024
1 parent 196844f commit a3cfb55
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/editor/object_option.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -744,15 +744,15 @@ TilesObjectOption::parse_state(const ReaderMapping& reader)
{
parse(reader);

std::vector<int> tile_changes; // Array of pairs (index, old/new tile ID).
std::vector<uint32_t> tile_changes; // Array of pairs (index, old/new tile ID).
if (!reader.get("tile-changes", tile_changes))
return;

if (tile_changes.size() % 2 != 0)
throw std::runtime_error("'tile-changes' does not contain number pairs.");

for (size_t i = 0; i < tile_changes.size(); i += 2)
m_value_pointer->change(tile_changes[i], static_cast<uint32_t>(tile_changes[i + 1]));
m_value_pointer->change(static_cast<int>(tile_changes[i]), tile_changes[i + 1]);
}

void
Expand Down

0 comments on commit a3cfb55

Please sign in to comment.