diff options
Diffstat (limited to 'engines/wage/wage.cpp')
-rw-r--r-- | engines/wage/wage.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp index e0299c8da2..aa480b63fe 100644 --- a/engines/wage/wage.cpp +++ b/engines/wage/wage.cpp @@ -281,15 +281,16 @@ void WageEngine::performInitialSetup() { debug(5, "Resetting Owners: %d", _world->_orderedObjs.size()); for (uint i = 0; i < _world->_orderedObjs.size(); i++) { Obj *obj = _world->_orderedObjs[i]; - if (!obj->_sceneOrOwner.equalsIgnoreCase(STORAGESCENE)) { + if (!isStorageScene(obj->_sceneOrOwner)) { Common::String location = obj->_sceneOrOwner; location.toLowercase(); - if (_world->_scenes.contains(location)) { - _world->move(obj, _world->_scenes[location]); + Scene *scene = getSceneByName(location); + if (scene != NULL) { + _world->move(obj, scene); } else { if (!_world->_chrs.contains(location)) { // Note: PLAYER@ is not a valid target here. - warning("Couldn't move %s to %s", obj->_name.c_str(), obj->_sceneOrOwner.c_str()); + warning("Couldn't move %s to \"%s\"", obj->_name.c_str(), obj->_sceneOrOwner.c_str()); } else { // TODO: Add check for max items. _world->move(obj, _world->_chrs[location]); @@ -301,7 +302,7 @@ void WageEngine::performInitialSetup() { bool playerPlaced = false; for (uint i = 0; i < _world->_orderedChrs.size(); i++) { Chr *chr = _world->_orderedChrs[i]; - if (!chr->_initialScene.equalsIgnoreCase(STORAGESCENE)) { + if (!isStorageScene(chr->_initialScene)) { Common::String key = chr->_initialScene; key.toLowercase(); if (_world->_scenes.contains(key) && _world->_scenes[key] != NULL) { @@ -328,13 +329,14 @@ void WageEngine::doClose() { } Scene *WageEngine::getSceneByName(Common::String &location) { - Scene *scene; if (location.equals("random@")) { - scene = _world->getRandomScene(); + return _world->getRandomScene(); } else { - scene = _world->_scenes[location]; + if (_world->_scenes.contains(location)) + return _world->_scenes[location]; + else + return NULL; } - return scene; } void WageEngine::onMove(Designed *what, Designed *from, Designed *to) { |