aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic
diff options
context:
space:
mode:
authorPaul Gilbert2016-11-05 23:15:15 -0400
committerPaul Gilbert2016-11-05 23:15:15 -0400
commitd8d11ba17bf9bc6f48b3b861f4ec78d62d8ef117 (patch)
treec5e4b398928f255d52b3b5bd3d14b55363ed1531 /engines/titanic
parent0f17c9de479e8607707e6ab2a184d0e141f39904 (diff)
downloadscummvm-rg350-d8d11ba17bf9bc6f48b3b861f4ec78d62d8ef117.tar.gz
scummvm-rg350-d8d11ba17bf9bc6f48b3b861f4ec78d62d8ef117.tar.bz2
scummvm-rg350-d8d11ba17bf9bc6f48b3b861f4ec78d62d8ef117.zip
TITANIC: Cleanup of class handling in PET Rooms tab
Diffstat (limited to 'engines/titanic')
-rw-r--r--engines/titanic/pet_control/pet_rooms.cpp4
-rw-r--r--engines/titanic/pet_control/pet_rooms_glyphs.cpp6
-rw-r--r--engines/titanic/pet_control/pet_rooms_glyphs.h6
-rw-r--r--engines/titanic/room_flags.cpp12
-rw-r--r--engines/titanic/room_flags.h2
5 files changed, 17 insertions, 13 deletions
diff --git a/engines/titanic/pet_control/pet_rooms.cpp b/engines/titanic/pet_control/pet_rooms.cpp
index a10bd0d63d..fb3b7d1c17 100644
--- a/engines/titanic/pet_control/pet_rooms.cpp
+++ b/engines/titanic/pet_control/pet_rooms.cpp
@@ -67,7 +67,7 @@ bool CPetRooms::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
if (!_glyphItem.contains(getGlyphPos(), msg->_mousePos))
return false;
- _glyphItem.MouseButtonDownMsg(msg->_mousePos);
+ _glyphItem.selectGlyph(getGlyphPos(), msg->_mousePos);
return true;
}
@@ -335,7 +335,7 @@ bool CPetRooms::changeLocationClass(PassengerClass newClassNum) {
if (!glyph)
return 0;
- glyph->changeLocation(newClassNum);
+ glyph->changeClass(newClassNum);
return true;
}
diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.cpp b/engines/titanic/pet_control/pet_rooms_glyphs.cpp
index e89e8072dc..6855e5b98e 100644
--- a/engines/titanic/pet_control/pet_rooms_glyphs.cpp
+++ b/engines/titanic/pet_control/pet_rooms_glyphs.cpp
@@ -102,7 +102,7 @@ void CPetRoomsGlyph::drawAt(CScreenManager *screenManager, const Point &pt, bool
}
void CPetRoomsGlyph::selectGlyph(const Point &topLeft, const Point &pt) {
- if (isAssigned()) {
+ if (!isAssigned()) {
bool isShiftPressed = g_vm->_window->getSpecialButtons() & MK_SHIFT;
if (isShiftPressed) {
@@ -183,9 +183,9 @@ void CPetRoomsGlyph::loadFlags(SimpleFile *file, int val) {
}
}
-void CPetRoomsGlyph::changeLocation(int newClassNum) {
+void CPetRoomsGlyph::changeClass(PassengerClass newClassNum) {
CRoomFlags roomFlags(_roomFlags);
- roomFlags.changeLocation(newClassNum);
+ roomFlags.changeClass(newClassNum);
_roomFlags = roomFlags.get();
}
diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.h b/engines/titanic/pet_control/pet_rooms_glyphs.h
index 11de6c4a8e..1c060c511c 100644
--- a/engines/titanic/pet_control/pet_rooms_glyphs.h
+++ b/engines/titanic/pet_control/pet_rooms_glyphs.h
@@ -25,6 +25,7 @@
#include "titanic/pet_control/pet_glyphs.h"
#include "titanic/support/simple_file.h"
+#include "titanic/game_location.h"
namespace Titanic {
@@ -119,7 +120,10 @@ public:
*/
void setMode(RoomGlyphMode mode) { _mode = mode; }
- void changeLocation(int newClassNum);
+ /**
+ * Change the current class
+ */
+ void changeClass(PassengerClass newClassNum);
/**
* Returns true if the room is either currently or previously assigned
diff --git a/engines/titanic/room_flags.cpp b/engines/titanic/room_flags.cpp
index 8b1c15d74c..8064554ee8 100644
--- a/engines/titanic/room_flags.cpp
+++ b/engines/titanic/room_flags.cpp
@@ -369,7 +369,7 @@ CString CRoomFlags::getSuccUBusRoomName() const {
return CString();
}
-void CRoomFlags::changeLocation(int action) {
+void CRoomFlags::changeClass(PassengerClass newClassNum) {
uint floorNum = getFloorNum();
uint roomNum = getRoomNum();
uint elevatorNum = getElevatorNum();
@@ -407,23 +407,23 @@ void CRoomFlags::changeLocation(int action) {
}
// Perform action to change room or floor
- switch (action) {
- case 1:
+ switch (newClassNum) {
+ case FIRST_CLASS:
if (--roomNum < v12)
roomNum = v12;
break;
- case 2:
+ case SECOND_CLASS:
if (++roomNum > v13)
roomNum = v13;
break;
- case 3:
+ case THIRD_CLASS:
if (--floorNum < v10)
floorNum = v10;
break;
- case 4:
+ case UNCHECKED:
if (++floorNum > v11)
floorNum = v11;
}
diff --git a/engines/titanic/room_flags.h b/engines/titanic/room_flags.h
index 5e21173b64..a2c40f6e3c 100644
--- a/engines/titanic/room_flags.h
+++ b/engines/titanic/room_flags.h
@@ -201,7 +201,7 @@ public:
/**
* Change the passenger class
*/
- void changeLocation(int action);
+ void changeClass(PassengerClass newClassNum);
/**
* Sets a random destination in the flags