From 6a16dfa670bf33d7d5f492648c459b5d563b56cf Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 5 Jul 2017 21:19:12 -0400 Subject: TITANIC: Fix Rooms Glyphs list only allowing a single custom entry --- engines/titanic/pet_control/pet_rooms.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/engines/titanic/pet_control/pet_rooms.cpp b/engines/titanic/pet_control/pet_rooms.cpp index 4bc27094d7..f26f98aea3 100644 --- a/engines/titanic/pet_control/pet_rooms.cpp +++ b/engines/titanic/pet_control/pet_rooms.cpp @@ -299,17 +299,15 @@ CPetRoomsGlyph *CPetRooms::addRoom(uint roomFlags, bool highlight_) { if (_glyphs.hasFlags(roomFlags)) return nullptr; - if (_glyphs.size() >= 32) - // Too many rooms already - return nullptr; - - // Do a preliminary scan of the glyph list for any glyph that is - // no longer valid, and thus can be removed - for (CPetRoomsGlyphs::iterator i = _glyphs.begin(); i != _glyphs.end(); ++i) { - CPetRoomsGlyph *glyph = dynamic_cast(*i); - if (!glyph->isAssigned()) { - _glyphs.erase(i); - break; + if (_glyphs.size() >= 32) { + // Too many room glyphs present. Scan for and remove the first + // glyph that isn't for an assigned bedroom + for (CPetRoomsGlyphs::iterator i = _glyphs.begin(); i != _glyphs.end(); ++i) { + CPetRoomsGlyph *glyph = dynamic_cast(*i); + if (!glyph->isAssigned()) { + _glyphs.erase(i); + break; + } } } -- cgit v1.2.3