TITANIC: Only allow moving to SGT TV in assigned room

This commit is contained in:
Paul Gilbert 2017-10-10 19:19:46 -04:00
parent 1f5908c9bd
commit 3fd2cf29b1
5 changed files with 20 additions and 12 deletions

View File

@ -49,7 +49,7 @@ bool CEarSweetBowl::MovieEndMsg(CMovieEndMsg *msg) {
if (!doneMsg._value) {
CPetControl *pet = getPetControl();
if (pet)
pet->hasRoomFlags();
pet->isInAssignedRoom();
CIsParrotPresentMsg parrotMsg;
parrotMsg.execute(findRoom());

View File

@ -21,6 +21,7 @@
*/
#include "titanic/game/sgt/sgt_nav.h"
#include "titanic/pet_control/pet_control.h"
namespace Titanic {
@ -43,7 +44,9 @@ bool SGTNav::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
CTurnOn onMsg;
CTurnOff offMsg;
if (_statics->_chestOfDrawers == "Open" && _statics->_bedhead == "Open") {
CPetControl *pet = getPetControl();
if (_statics->_chestOfDrawers == "Open" && _statics->_bedhead == "Open"
&& pet->isInAssignedRoom()) {
if (_statics->_vase == "Open")
offMsg.execute("Vase");
if (_statics->_tv == "Closed")
@ -68,10 +71,14 @@ bool SGTNav::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
}
bool SGTNav::MouseMoveMsg(CMouseMoveMsg *msg) {
if (_statics->_chestOfDrawers == "Open" && _statics->_bedhead == "Open")
_cursorId = CURSOR_MOVE_FORWARD;
else
_cursorId = CURSOR_ARROW;
_cursorId = CURSOR_ARROW;
if (_statics->_chestOfDrawers == "Open" && _statics->_bedhead == "Open") {
CPetControl *pet = getPetControl();
if (pet->isInAssignedRoom()) {
_cursorId = CURSOR_MOVE_FORWARD;
}
}
return true;
}

View File

@ -438,10 +438,10 @@ public:
}
/**
* Returns true if the Rooms list has a room with the given flags
* Returns true if the player is in the current or previously assigned rooms
*/
bool hasRoomFlags() const {
return _rooms.hasRoomFlags(getRoomFlags());
bool isInAssignedRoom() const {
return _rooms.isAssignedRoom(getRoomFlags());
}
uint getRoomFlags() const {

View File

@ -339,7 +339,7 @@ bool CPetRooms::changeLocationClass(PassengerClass newClassNum) {
return true;
}
bool CPetRooms::hasRoomFlags(uint roomFlags) const {
bool CPetRooms::isAssignedRoom(uint roomFlags) const {
for (CPetRoomsGlyphs::const_iterator i = _glyphs.begin(); i != _glyphs.end(); ++i) {
const CPetRoomsGlyph *glyph = static_cast<const CPetRoomsGlyph *>(*i);
if (glyph->isAssigned() && glyph->getRoomFlags() == roomFlags)

View File

@ -164,9 +164,10 @@ public:
bool changeLocationClass(PassengerClass newClassNum);
/**
* Returns true if a room glyph exists with the given flags
* Returns true if the specified location is the current or
* previously assigned room
*/
bool hasRoomFlags(uint roomFlags) const;
bool isAssignedRoom(uint roomFlags) const;
/**
* Returns the room flags for the player's currently assigned room