Skip to content

Commit

Permalink
fix: safe call add creatures on tile get/creation (#3090)
Browse files Browse the repository at this point in the history
  • Loading branch information
dudantas authored Nov 12, 2024
1 parent 49c1540 commit af80b3d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/map/mapcache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,6 @@ std::shared_ptr<Tile> MapCache::getOrCreateTileFromCache(const std::shared_ptr<F

auto pos = Position(x, y, z);

for (const auto &creature : oldCreatureList) {
tile->internalAddThing(creature);
}

if (cachedTile->ground != nullptr) {
tile->internalAddThing(createItem(cachedTile->ground, pos));
}
Expand All @@ -146,7 +142,11 @@ std::shared_ptr<Tile> MapCache::getOrCreateTileFromCache(const std::shared_ptr<F

tile->setFlag(static_cast<TileFlags_t>(cachedTile->flags));

tile->safeCall([tile, pos] {
tile->safeCall([tile, pos, movedOldCreatureList = std::move(oldCreatureList)]() {
for (const auto &creature : movedOldCreatureList) {
tile->internalAddThing(creature);
}

for (const auto &zone : Zone::getZones(pos)) {
tile->addZone(zone);
}
Expand Down

0 comments on commit af80b3d

Please sign in to comment.