aboutsummaryrefslogtreecommitdiff
path: root/queen
diff options
context:
space:
mode:
authorDavid Eriksson2003-11-06 17:54:59 +0000
committerDavid Eriksson2003-11-06 17:54:59 +0000
commitbd23b7dce0d715bcbf238274378241cf4ad08274 (patch)
tree36fe4613697f07f3de0713d195ab2b5064fedede /queen
parentd03ff2a119dd379243030b2ebcbea6cac96c3b8f (diff)
downloadscummvm-rg350-bd23b7dce0d715bcbf238274378241cf4ad08274.tar.gz
scummvm-rg350-bd23b7dce0d715bcbf238274378241cf4ad08274.tar.bz2
scummvm-rg350-bd23b7dce0d715bcbf238274378241cf4ad08274.zip
Do not allow invalid room numbers.
svn-id: r11164
Diffstat (limited to 'queen')
-rw-r--r--queen/logic.h21
1 files changed, 18 insertions, 3 deletions
diff --git a/queen/logic.h b/queen/logic.h
index 8c67c1d89c..923fa8bb73 100644
--- a/queen/logic.h
+++ b/queen/logic.h
@@ -122,13 +122,28 @@ public:
~Logic();
uint16 currentRoom() const { return _currentRoom; }
- void currentRoom(uint16 room) { _currentRoom = room; }
+ void currentRoom(uint16 room) {
+ if (room >= 1 && room <= _numRooms)
+ _currentRoom = room;
+ else
+ error("Invalid room number: %i", room);
+ }
uint16 oldRoom() const { return _oldRoom; }
- void oldRoom(uint16 room) { _oldRoom = room; }
+ void oldRoom(uint16 room) {
+ if (room <= _numRooms)
+ _oldRoom = room;
+ else
+ error("Invalid room number: %i", room);
+ }
uint16 newRoom() const { return _newRoom; }
- void newRoom(uint16 room) { _newRoom = room; }
+ void newRoom(uint16 room) {
+ if (room <= _numRooms)
+ _newRoom = room;
+ else
+ error("Invalid room number: %i", room);
+ }
ObjectData *objectData(int index);
uint16 roomData(int room);