diff options
author | Eugene Sandulenko | 2015-12-28 19:09:16 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2015-12-28 19:13:13 +0100 |
commit | 438eb457047f0dee7a4555de91b1ea46c34082e7 (patch) | |
tree | d047a2169d96749c5935ed02055416d3660d0fba | |
parent | 3fe3ad7ee35c8bdb4aef298e2cfa52b43b94d88e (diff) | |
download | scummvm-rg350-438eb457047f0dee7a4555de91b1ea46c34082e7.tar.gz scummvm-rg350-438eb457047f0dee7a4555de91b1ea46c34082e7.tar.bz2 scummvm-rg350-438eb457047f0dee7a4555de91b1ea46c34082e7.zip |
WAGE: Increased startup speed
-rw-r--r-- | engines/wage/wage.cpp | 16 | ||||
-rw-r--r-- | engines/wage/world.cpp | 10 | ||||
-rw-r--r-- | engines/wage/world.h | 4 |
3 files changed, 20 insertions, 10 deletions
diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp index 9e30fe6c44..ff867e5bb4 100644 --- a/engines/wage/wage.cpp +++ b/engines/wage/wage.cpp @@ -186,11 +186,19 @@ void WageEngine::gameOver() { } void WageEngine::performInitialSetup() { - for (int i = 0; i < _world->_orderedObjs.size(); i++) - _world->move(_world->_orderedObjs[i], _world->_storageScene); - for (int i = 0; i < _world->_orderedChrs.size(); i++) - _world->move(_world->_orderedChrs[i], _world->_storageScene); + debug(5, "Resetting Objs: %d", _world->_orderedObjs.size()); + for (int i = 0; i < _world->_orderedObjs.size() - 1; i++) + _world->move(_world->_orderedObjs[i], _world->_storageScene, true); + _world->move(_world->_orderedObjs[_world->_orderedObjs.size() - 1], _world->_storageScene); + + debug(5, "Resetting Chrs: %d", _world->_orderedChrs.size()); + for (int i = 0; i < _world->_orderedChrs.size() - 1; i++) + _world->move(_world->_orderedChrs[i], _world->_storageScene, true); + + _world->move(_world->_orderedChrs[_world->_orderedChrs.size() - 1], _world->_storageScene); + + debug(5, "Resetting Owners: %d", _world->_orderedObjs.size()); for (int i = 0; i < _world->_orderedObjs.size(); i++) { Obj *obj = _world->_orderedObjs[i]; if (!obj->_sceneOrOwner.equalsIgnoreCase(STORAGESCENE)) { diff --git a/engines/wage/world.cpp b/engines/wage/world.cpp index 65c562de40..e4ce93625d 100644 --- a/engines/wage/world.cpp +++ b/engines/wage/world.cpp @@ -387,7 +387,7 @@ bool ObjComparator(Obj *o1, Obj *o2) { return o1Immobile; } -void World::move(Obj *obj, Scene *scene) { +void World::move(Obj *obj, Scene *scene, bool skipSort) { if (obj == NULL) return; @@ -395,7 +395,8 @@ void World::move(Obj *obj, Scene *scene) { obj->_currentScene = scene; scene->_objs.push_back(obj); - Common::sort(scene->_objs.begin(), scene->_objs.end(), ObjComparator); + if (!skipSort) + Common::sort(scene->_objs.begin(), scene->_objs.end(), ObjComparator); _engine->onMove(obj, from, scene); } @@ -404,7 +405,7 @@ bool ChrComparator(Chr *l, Chr *r) { return l->_index < r->_index; } -void World::move(Chr *chr, Scene *scene) { +void World::move(Chr *chr, Scene *scene, bool skipSort) { if (chr == NULL) return; Scene *from = chr->_currentScene; @@ -414,7 +415,8 @@ void World::move(Chr *chr, Scene *scene) { from->_chrs.remove(chr); scene->_chrs.push_back(chr); - Common::sort(scene->_chrs.begin(), scene->_chrs.end(), ChrComparator); + if (!skipSort) + Common::sort(scene->_chrs.begin(), scene->_chrs.end(), ChrComparator); if (scene == _storageScene) { warning("STUB: World::move (chrState)"); diff --git a/engines/wage/world.h b/engines/wage/world.h index ed933864c9..ea003220f0 100644 --- a/engines/wage/world.h +++ b/engines/wage/world.h @@ -61,8 +61,8 @@ public: void loadExternalSounds(String fname); Common::String *loadStringFromDITL(Common::MacResManager *resMan, int resourceId, int itemIndex); void move(Obj *obj, Chr *chr); - void move(Obj *obj, Scene *scene); - void move(Chr *chr, Scene *scene); + void move(Obj *obj, Scene *scene, bool skipSort = false); + void move(Chr *chr, Scene *scene, bool skipSort = false); Scene *getRandomScene(); WageEngine *_engine; |