[Scummvm-git-logs] scummvm master -> d8d11ba17bf9bc6f48b3b861f4ec78d62d8ef117

dreammaster dreammaster at scummvm.org
Sun Nov 6 04:15:25 CET 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
d8d11ba17b TITANIC: Cleanup of class handling in PET Rooms tab


Commit: d8d11ba17bf9bc6f48b3b861f4ec78d62d8ef117
    https://github.com/scummvm/scummvm/commit/d8d11ba17bf9bc6f48b3b861f4ec78d62d8ef117
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-11-05T23:15:15-04:00

Commit Message:
TITANIC: Cleanup of class handling in PET Rooms tab

Changed paths:
    engines/titanic/pet_control/pet_rooms.cpp
    engines/titanic/pet_control/pet_rooms_glyphs.cpp
    engines/titanic/pet_control/pet_rooms_glyphs.h
    engines/titanic/room_flags.cpp
    engines/titanic/room_flags.h



diff --git a/engines/titanic/pet_control/pet_rooms.cpp b/engines/titanic/pet_control/pet_rooms.cpp
index a10bd0d..fb3b7d1 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 e89e807..6855e5b 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 11de6c4..1c060c5 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 8b1c15d..8064554 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 5e21173..a2c40f6 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





More information about the Scummvm-git-logs mailing list