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

dreammaster dreammaster at scummvm.org
Mon Feb 20 21:42:40 CET 2017


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

Summary:
52dbc31370 TITANIC: Cleanup and renaming for CBrain base class
deba34cc05 TITANIC: Handle trying to put multiple brain cards in the same slot


Commit: 52dbc31370ad4a2d0f4ff6993ea4aeffdd23b4bd
    https://github.com/scummvm/scummvm/commit/52dbc31370ad4a2d0f4ff6993ea4aeffdd23b4bd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-02-20T15:37:38-05:00

Commit Message:
TITANIC: Cleanup and renaming for CBrain base class

Changed paths:
    engines/titanic/carry/brain.cpp
    engines/titanic/carry/brain.h


diff --git a/engines/titanic/carry/brain.cpp b/engines/titanic/carry/brain.cpp
index 49178d1..09ebd42 100644
--- a/engines/titanic/carry/brain.cpp
+++ b/engines/titanic/carry/brain.cpp
@@ -33,14 +33,14 @@ BEGIN_MESSAGE_MAP(CBrain, CCarry)
 	ON_MESSAGE(PETGainedObjectMsg)
 END_MESSAGE_MAP()
 
-CBrain::CBrain() : CCarry(), _field134(0), _field138(0) {
+CBrain::CBrain() : CCarry(), _pieceAdded(false), _perchGained(false) {
 }
 
 void CBrain::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
 	file->writePoint(_pos1, indent);
-	file->writeNumberLine(_field134, indent);
-	file->writeNumberLine(_field138, indent);
+	file->writeNumberLine(_pieceAdded, indent);
+	file->writeNumberLine(_perchGained, indent);
 
 	CCarry::save(file, indent);
 }
@@ -48,8 +48,8 @@ void CBrain::save(SimpleFile *file, int indent) {
 void CBrain::load(SimpleFile *file) {
 	file->readNumber();
 	_pos1 = file->readPoint();
-	_field134 = file->readNumber();
-	_field138 = file->readNumber();
+	_pieceAdded = file->readNumber();
+	_perchGained = file->readNumber();
 
 	CCarry::load(file);
 }
@@ -71,7 +71,7 @@ bool CBrain::UseWithOtherMsg(CUseWithOtherMsg *msg) {
 		playSound("z#116.wav");
 		setPosition(Point(0, 0));
 		setVisible(false);
-		_field134 = 1;
+		_pieceAdded = true;
 	}
 
 	return true;
@@ -86,11 +86,11 @@ bool CBrain::MouseDragStartMsg(CMouseDragStartMsg *msg) {
 	if (!checkStartDragging(msg))
 		return false;
 
-	if (_field134) {
+	if (_pieceAdded) {
 		CTakeHeadPieceMsg headpieceMsg(getName());
 		headpieceMsg.execute("TitaniaControl");
 
-		_field134 = 0;
+		_pieceAdded = false;
 		setVisible(true);
 		moveToView();
 
@@ -102,10 +102,10 @@ bool CBrain::MouseDragStartMsg(CMouseDragStartMsg *msg) {
 }
 
 bool CBrain::PassOnDragStartMsg(CPassOnDragStartMsg *msg) {
-	if (_field134) {
+	if (_pieceAdded) {
 		CTakeHeadPieceMsg headpieceMsg(getName());
 		headpieceMsg.execute("TitaniaControl");
-		_field134 = 0;
+		_pieceAdded = false;
 
 		setVisible(true);
 		moveToView();
@@ -117,10 +117,10 @@ bool CBrain::PassOnDragStartMsg(CPassOnDragStartMsg *msg) {
 }
 
 bool CBrain::PETGainedObjectMsg(CPETGainedObjectMsg *msg) {
-	if (!_field138) {
+	if (!_perchGained) {
 		if (getName() == "Perch") {
 			incParrotResponse();
-			_field138 = 1;
+			_perchGained = true;
 		}
 	}
 
diff --git a/engines/titanic/carry/brain.h b/engines/titanic/carry/brain.h
index bcba161..4c41378 100644
--- a/engines/titanic/carry/brain.h
+++ b/engines/titanic/carry/brain.h
@@ -39,8 +39,8 @@ class CBrain : public CCarry {
 	bool PETGainedObjectMsg(CPETGainedObjectMsg *msg);
 private:
 	Point _pos1;
-	int _field134;
-	int _field138;
+	bool _pieceAdded;
+	bool _perchGained;
 public:
 	CLASSDEF;
 	CBrain();


Commit: deba34cc05c8bf00de72a5db68e288d4a3584b27
    https://github.com/scummvm/scummvm/commit/deba34cc05c8bf00de72a5db68e288d4a3584b27
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-02-20T15:42:34-05:00

Commit Message:
TITANIC: Handle trying to put multiple brain cards in the same slot

Changed paths:
    engines/titanic/carry/brain.cpp


diff --git a/engines/titanic/carry/brain.cpp b/engines/titanic/carry/brain.cpp
index 09ebd42..73970c4 100644
--- a/engines/titanic/carry/brain.cpp
+++ b/engines/titanic/carry/brain.cpp
@@ -56,14 +56,16 @@ void CBrain::load(SimpleFile *file) {
 
 bool CBrain::UseWithOtherMsg(CUseWithOtherMsg *msg) {
 	CBrainSlot *slot = dynamic_cast<CBrainSlot *>(msg->_other);
-	if (!slot) {
+	if (!slot)
 		return CCarry::UseWithOtherMsg(msg);
-	} else if (isEquals("CentralCore")) {
+
+	if (isEquals("CentralCore")) {
 		setVisible(false);
 		petMoveToHiddenRoom();
 		CAddHeadPieceMsg headpieceMsg(getName());
 		headpieceMsg.execute("CentralCoreSlot");
 	} else if (!slot->_occupied && slot->getName() != "CentralCoreSlot") {
+		// Brain card goes into vacant slot
 		setVisible(false);
 		petMoveToHiddenRoom();
 		CAddHeadPieceMsg headpieceMsg(getName());
@@ -72,6 +74,9 @@ bool CBrain::UseWithOtherMsg(CUseWithOtherMsg *msg) {
 		setPosition(Point(0, 0));
 		setVisible(false);
 		_pieceAdded = true;
+	} else {
+		// Trying to put brain card into an already occupied slot
+		petAddToInventory();
 	}
 
 	return true;





More information about the Scummvm-git-logs mailing list