[Scummvm-git-logs] scummvm master -> 31eb4724d3d8041fc4478f9073c743fcfb138ad3

sev- sev at scummvm.org
Tue Aug 29 20:17:52 CEST 2017


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:
31eb4724d3 WAGE: Correctly specify target name for dumped scripts


Commit: 31eb4724d3d8041fc4478f9073c743fcfb138ad3
    https://github.com/scummvm/scummvm/commit/31eb4724d3d8041fc4478f9073c743fcfb138ad3
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-29T20:15:19+02:00

Commit Message:
WAGE: Correctly specify target name for dumped scripts

Changed paths:
    engines/wage/script.cpp
    engines/wage/script.h
    engines/wage/wage.cpp
    engines/wage/wage.h
    engines/wage/world.cpp


diff --git a/engines/wage/script.cpp b/engines/wage/script.cpp
index d2fbc6c..9f8093c 100644
--- a/engines/wage/script.cpp
+++ b/engines/wage/script.cpp
@@ -76,8 +76,7 @@ Common::String Script::Operand::toString() {
 	}
 }
 
-Script::Script(Common::SeekableReadStream *data, int num) : _data(data) {
-	_engine = NULL;
+Script::Script(Common::SeekableReadStream *data, int num, WageEngine *engine) : _data(data), _engine(engine) {
 	_world = NULL;
 
 	_loopCount = 0;
@@ -93,9 +92,9 @@ Script::Script(Common::SeekableReadStream *data, int num) : _data(data) {
 		Common::String name;
 
 		if (num == -1)
-			name = Common::String::format("./dumps/%s-global.txt", ConfMan.get("gameid").c_str());
+			name = Common::String::format("./dumps/%s-global.txt", _engine->getTargetName());
 		else
-			name = Common::String::format("./dumps/%s-%d.txt", ConfMan.get("gameid").c_str(), num);
+			name = Common::String::format("./dumps/%s-%d.txt", _engine->getTargetName(), num);
 
 		if (!out.open(name)) {
 			warning("Can not open dump file %s", name.c_str());
@@ -174,12 +173,11 @@ Common::String Script::preprocessInputText(Common::String inputText) {
 	return inputText;
 }
 
-bool Script::execute(World *world, int loopCount, Common::String *inputText, Designed *inputClick, WageEngine *engine) {
+bool Script::execute(World *world, int loopCount, Common::String *inputText, Designed *inputClick) {
 	_world = world;
 	_loopCount = loopCount;
 	_inputText = inputText;
 	_inputClick = inputClick;
-	_engine = engine;
 	_handled = false;
 	Common::String input;
 
@@ -257,7 +255,7 @@ bool Script::execute(World *world, int loopCount, Common::String *inputText, Des
 
 	if (_world->_globalScript != this) {
 		debug(1, "Executing global script...");
-		bool globalHandled = _world->_globalScript->execute(_world, _loopCount, &input, _inputClick, _engine);
+		bool globalHandled = _world->_globalScript->execute(_world, _loopCount, &input, _inputClick);
 		if (globalHandled)
 			_handled = true;
 	} else if (!input.empty()) {
diff --git a/engines/wage/script.h b/engines/wage/script.h
index 0237ebe..df7ec7e 100644
--- a/engines/wage/script.h
+++ b/engines/wage/script.h
@@ -52,7 +52,7 @@ namespace Wage {
 
 class Script {
 public:
-	Script(Common::SeekableReadStream *data, int num);
+	Script(Common::SeekableReadStream *data, int num, WageEngine *engine);
 	~Script();
 
 private:
@@ -130,7 +130,7 @@ private:
 public:
 	void print();
 	void printLine(int offset);
-	bool execute(World *world, int loopCount, Common::String *inputText, Designed *inputClick, WageEngine *engine);
+	bool execute(World *world, int loopCount, Common::String *inputText, Designed *inputClick);
 
 private:
 	Common::String preprocessInputText(Common::String inputText);
diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp
index ce47e3e..c5f3673 100644
--- a/engines/wage/wage.cpp
+++ b/engines/wage/wage.cpp
@@ -431,7 +431,7 @@ void WageEngine::processTurnInternal(Common::String *textInput, Designed *clickI
 
 	bool monsterWasNull = (_monster == NULL);
 	Script *script = playerScene->_script != NULL ? playerScene->_script : _world->_globalScript;
-	bool handled = script->execute(_world, _loopCount++, textInput, clickInput, this);
+	bool handled = script->execute(_world, _loopCount++, textInput, clickInput);
 
 	playerScene = _world->_player->_currentScene;
 
diff --git a/engines/wage/wage.h b/engines/wage/wage.h
index 51a6951..cb4e8a3 100644
--- a/engines/wage/wage.h
+++ b/engines/wage/wage.h
@@ -127,6 +127,8 @@ public:
 	void processTurn(Common::String *textInput, Designed *clickInput);
 	void regen();
 
+	const char *getTargetName() { return _targetName.c_str(); }
+
 private:
 	bool loadWorld(Common::MacResManager *resMan);
 	void performInitialSetup();
diff --git a/engines/wage/world.cpp b/engines/wage/world.cpp
index a7fce3d..fa8cfd5 100644
--- a/engines/wage/world.cpp
+++ b/engines/wage/world.cpp
@@ -132,7 +132,7 @@ bool World::loadWorld(Common::MacResManager *resMan) {
 
 	// Load global script
 	res = resMan->getResource(MKTAG('G','C','O','D'), resArray[0]);
-	_globalScript = new Script(res, -1);
+	_globalScript = new Script(res, -1, _engine);
 
 	// TODO: read creator
 
@@ -209,7 +209,7 @@ bool World::loadWorld(Common::MacResManager *resMan) {
 
 		res = resMan->getResource(MKTAG('A','C','O','D'), *iter);
 		if (res != NULL)
-			scene->_script = new Script(res, *iter);
+			scene->_script = new Script(res, *iter, _engine);
 
 		res = resMan->getResource(MKTAG('A','T','X','T'), *iter);
 		if (res != NULL) {





More information about the Scummvm-git-logs mailing list