[Scummvm-cvs-logs] scummvm master -> d3b8152a714d8ec4a573d51bc844a129c80b533c

dreammaster dreammaster at scummvm.org
Tue Aug 18 02:17:03 CEST 2015


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:
d3b8152a71 SHERLOCK: RT: Extra integrity checks for the _talkSequenceStack


Commit: d3b8152a714d8ec4a573d51bc844a129c80b533c
    https://github.com/scummvm/scummvm/commit/d3b8152a714d8ec4a573d51bc844a129c80b533c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-08-17T20:16:22-04:00

Commit Message:
SHERLOCK: RT: Extra integrity checks for the _talkSequenceStack

Changed paths:
    engines/sherlock/scalpel/scalpel_talk.h
    engines/sherlock/talk.h
    engines/sherlock/tattoo/tattoo_scene.cpp
    engines/sherlock/tattoo/tattoo_talk.cpp
    engines/sherlock/tattoo/tattoo_talk.h
    engines/sherlock/tattoo/tattoo_user_interface.cpp



diff --git a/engines/sherlock/scalpel/scalpel_talk.h b/engines/sherlock/scalpel/scalpel_talk.h
index 6f8b62c..1d70db1 100644
--- a/engines/sherlock/scalpel/scalpel_talk.h
+++ b/engines/sherlock/scalpel/scalpel_talk.h
@@ -107,6 +107,11 @@ public:
 	 * object's sequence
 	 */
 	virtual void pullSequence();
+
+	/**
+	 * Returns true if the script stack is empty
+	 */
+	virtual bool isSequencesEmpty() const { return _scriptStack.empty(); }
 };
 
 } // End of namespace Scalpel
diff --git a/engines/sherlock/talk.h b/engines/sherlock/talk.h
index dcc970a..8352435 100644
--- a/engines/sherlock/talk.h
+++ b/engines/sherlock/talk.h
@@ -337,11 +337,6 @@ public:
 	void pushTalkSequence(Object *obj);
 
 	/**
-	 * Returns true if the script stack is empty
-	 */
-	bool isSequencesEmpty() const { return _scriptStack.empty(); }
-
-	/**
 	 * Pops an entry off of the script stack
 	 */
 	void popStack();
@@ -372,6 +367,11 @@ public:
 	 * object's sequence
 	 */
 	virtual void pullSequence() = 0;
+
+	/**
+	 * Returns true if the script stack is empty
+	 */
+	virtual bool isSequencesEmpty() const = 0;
 };
 
 } // End of namespace Sherlock
diff --git a/engines/sherlock/tattoo/tattoo_scene.cpp b/engines/sherlock/tattoo/tattoo_scene.cpp
index 78100eb..e94e10c 100644
--- a/engines/sherlock/tattoo/tattoo_scene.cpp
+++ b/engines/sherlock/tattoo/tattoo_scene.cpp
@@ -22,6 +22,7 @@
 
 #include "sherlock/tattoo/tattoo_scene.h"
 #include "sherlock/tattoo/tattoo_people.h"
+#include "sherlock/tattoo/tattoo_talk.h"
 #include "sherlock/tattoo/tattoo_user_interface.h"
 #include "sherlock/tattoo/tattoo.h"
 #include "sherlock/events.h"
@@ -292,12 +293,17 @@ void TattooScene::checkBgShapes() {
 }
 
 void TattooScene::freeScene() {
+	TattooTalk &talk = *(TattooTalk *)_vm->_talk;
 	TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
 	Scene::freeScene();
 
+	// Delete any scene overlays that were used by the scene
 	delete ui._mask;
 	delete ui._mask1;
 	ui._mask = ui._mask1 = nullptr;
+
+	// Ensure that there wasn't anything left on the talk stack, since their _obj pointers will no longer be valid
+	assert(talk.isSequencesEmpty());
 }
 
 void TattooScene::doBgAnimCheckCursor() {
diff --git a/engines/sherlock/tattoo/tattoo_talk.cpp b/engines/sherlock/tattoo/tattoo_talk.cpp
index b8b8944..49becbe 100644
--- a/engines/sherlock/tattoo/tattoo_talk.cpp
+++ b/engines/sherlock/tattoo/tattoo_talk.cpp
@@ -948,6 +948,15 @@ void TattooTalk::pullSequence() {
 	}
 }
 
+bool TattooTalk::isSequencesEmpty() const {
+	for (int idx = 0; idx < TALK_SEQUENCE_STACK_SIZE; ++idx) {
+		if (_talkSequenceStack[idx]._obj)
+			return false;
+	}
+
+	return true;
+}
+
 } // End of namespace Tattoo
 
 } // End of namespace Sherlock
diff --git a/engines/sherlock/tattoo/tattoo_talk.h b/engines/sherlock/tattoo/tattoo_talk.h
index 22ac3fc..68db063 100644
--- a/engines/sherlock/tattoo/tattoo_talk.h
+++ b/engines/sherlock/tattoo/tattoo_talk.h
@@ -106,6 +106,11 @@ public:
 	 * object's sequence
 	 */
 	virtual void pullSequence();
+
+	/**
+	 * Returns true if the script stack is empty
+	 */
+	virtual bool isSequencesEmpty() const;
 };
 
 } // End of namespace Tattoo
diff --git a/engines/sherlock/tattoo/tattoo_user_interface.cpp b/engines/sherlock/tattoo/tattoo_user_interface.cpp
index 62fd890..68bc29b 100644
--- a/engines/sherlock/tattoo/tattoo_user_interface.cpp
+++ b/engines/sherlock/tattoo/tattoo_user_interface.cpp
@@ -378,6 +378,9 @@ void TattooUserInterface::doStandardControl() {
 	if (vm._runningProlog)
 		return;
 
+	// There shouldn't be anything left on the talk sequence stack since we're back in control
+	assert(talk.isSequencesEmpty());
+
 	// When the end credits are active, any press will open the ScummVM global main menu
 	if (_creditsWidget.active()) {
 		if (_keyState.keycode || events._released || events._rightReleased) {






More information about the Scummvm-git-logs mailing list