From 027166a0efa4b91b4c400ef253a4b51dcea8cb6c Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Thu, 18 Feb 2021 12:37:22 -0500 Subject: Spawnblocked map sprites with already-used names i.e. Map prototypes and triggers will not be instantiated upon loading the map if there is a persistent sprite with the same name. This is important because the Claus that joins your party is originally a map prototype. --- src/game.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/game.cpp b/src/game.cpp index ffa52cf..dbd314a 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -52,6 +52,8 @@ void Game::loadMap(std::string filename) { map_ = std::make_unique(filename); for (const Prototype& p : map_->getPrototypes()) { + if (spritesByAlias_.count(p.name)) continue; + int spriteId = emplaceSprite(p.name); getSystem().initSprite(spriteId, p.pos); getSystem().setUpCollision(spriteId, p.collisionOffset, p.collisionSize, true); @@ -63,6 +65,8 @@ void Game::loadMap(std::string filename) { } for (const Trigger& t : map_->getTriggers()) { + if (spritesByAlias_.count(t.name)) continue; + int spriteId = emplaceSprite(t.name); getSystem().initSprite(spriteId, t.pos); getSystem().setUpCollision(spriteId, {0, 0}, t.size, false); -- cgit 1.4.1