aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic
diff options
context:
space:
mode:
authorPaul Gilbert2017-07-05 21:19:12 -0400
committerPaul Gilbert2017-07-05 21:19:12 -0400
commit6a16dfa670bf33d7d5f492648c459b5d563b56cf (patch)
tree0bc2930c8cf57ff9ceb4be3270047e5466ff9252 /engines/titanic
parent6d0207c7d6bbc9c329207cd3ffa120c4b6fc72b0 (diff)
downloadscummvm-rg350-6a16dfa670bf33d7d5f492648c459b5d563b56cf.tar.gz
scummvm-rg350-6a16dfa670bf33d7d5f492648c459b5d563b56cf.tar.bz2
scummvm-rg350-6a16dfa670bf33d7d5f492648c459b5d563b56cf.zip
TITANIC: Fix Rooms Glyphs list only allowing a single custom entry
Diffstat (limited to 'engines/titanic')
-rw-r--r--engines/titanic/pet_control/pet_rooms.cpp20
1 files 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<CPetRoomsGlyph *>(*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<CPetRoomsGlyph *>(*i);
+ if (!glyph->isAssigned()) {
+ _glyphs.erase(i);
+ break;
+ }
}
}