diff options
author | Eugene Sandulenko | 2015-12-25 12:57:54 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2015-12-27 15:41:02 +0100 |
commit | 113a274027f41a4c51b8d5bbbf8fec46ce176bf0 (patch) | |
tree | c702c66f7520103fb8dfcf1de0e612575645a9ce /engines | |
parent | 5f2ef620c18b36fe0d480474135aa78eb9eb0c01 (diff) | |
download | scummvm-rg350-113a274027f41a4c51b8d5bbbf8fec46ce176bf0.tar.gz scummvm-rg350-113a274027f41a4c51b8d5bbbf8fec46ce176bf0.tar.bz2 scummvm-rg350-113a274027f41a4c51b8d5bbbf8fec46ce176bf0.zip |
WAGE: Implemented World::move(Obj *obj, Scene *scene)
Diffstat (limited to 'engines')
-rw-r--r-- | engines/wage/world.cpp | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/engines/wage/world.cpp b/engines/wage/world.cpp index a177d32930..c04fc14393 100644 --- a/engines/wage/world.cpp +++ b/engines/wage/world.cpp @@ -352,7 +352,7 @@ Common::String *World::loadStringFromDITL(Common::MacResManager *resMan, int res return NULL; } -bool ChrComparator(Obj *l, Obj *r) { +bool InvComparator(Obj *l, Obj *r) { return l->_index < r->_index; } @@ -364,13 +364,31 @@ void World::move(Obj *obj, Chr *chr) { obj->_currentOwner = chr; chr->_inventory.push_back(obj); - Common::sort(chr->_inventory.begin(), chr->_inventory.end(), ChrComparator); + Common::sort(chr->_inventory.begin(), chr->_inventory.end(), InvComparator); _engine->onMove(obj, from, chr); } +bool ObjComparator(Obj *o1, Obj *o2) { + bool o1Immobile = (o1->_type == Obj::IMMOBILE_OBJECT); + bool o2Immobile = (o2->_type == Obj::IMMOBILE_OBJECT); + if (o1Immobile == o2Immobile) { + return o1->_index - o2->_index; + } + return o1Immobile; +} + void World::move(Obj *obj, Scene *scene) { - warning("STUB: World::move(obj, scene)"); + if (obj == NULL) + return; + + Designed *from = obj->removeFromCharOrScene(); + obj->_currentScene = scene; + scene->_objs.push_back(obj); + + Common::sort(scene->_objs.begin(), scene->_objs.end(), ObjComparator); + + _engine->onMove(obj, from, scene); } void World::move(Chr *chr, Scene *scene) { |