aboutsummaryrefslogtreecommitdiff
path: root/engines/wage
diff options
context:
space:
mode:
authorEugene Sandulenko2017-08-29 20:15:19 +0200
committerEugene Sandulenko2017-08-29 20:15:19 +0200
commit31eb4724d3d8041fc4478f9073c743fcfb138ad3 (patch)
tree23d648378bf4859a04f5d9692a7e19037e450c92 /engines/wage
parent5eaa48ec965f4c1701f4fb310c43fa3042845190 (diff)
downloadscummvm-rg350-31eb4724d3d8041fc4478f9073c743fcfb138ad3.tar.gz
scummvm-rg350-31eb4724d3d8041fc4478f9073c743fcfb138ad3.tar.bz2
scummvm-rg350-31eb4724d3d8041fc4478f9073c743fcfb138ad3.zip
WAGE: Correctly specify target name for dumped scripts
Diffstat (limited to 'engines/wage')
-rw-r--r--engines/wage/script.cpp12
-rw-r--r--engines/wage/script.h4
-rw-r--r--engines/wage/wage.cpp2
-rw-r--r--engines/wage/wage.h2
-rw-r--r--engines/wage/world.cpp4
5 files changed, 12 insertions, 12 deletions
diff --git a/engines/wage/script.cpp b/engines/wage/script.cpp
index d2fbc6c9b7..9f8093c50c 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 0237ebea6e..df7ec7e4d6 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 ce47e3ebea..c5f3673255 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 51a6951d9f..cb4e8a3520 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 a7fce3d816..fa8cfd57a1 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) {