diff options
author | Eugene Sandulenko | 2015-12-25 13:12:11 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2015-12-27 15:41:02 +0100 |
commit | 81dc7cd98ff385fed4523f6b3f8ddc04ed7bea62 (patch) | |
tree | e87c1480e2345dbfa1024d0f67868b0d3b59b75a /engines/wage/world.cpp | |
parent | 113a274027f41a4c51b8d5bbbf8fec46ce176bf0 (diff) | |
download | scummvm-rg350-81dc7cd98ff385fed4523f6b3f8ddc04ed7bea62.tar.gz scummvm-rg350-81dc7cd98ff385fed4523f6b3f8ddc04ed7bea62.tar.bz2 scummvm-rg350-81dc7cd98ff385fed4523f6b3f8ddc04ed7bea62.zip |
WAGE: Implement World::move(Chr *chr, Scene *scene)
Diffstat (limited to 'engines/wage/world.cpp')
-rw-r--r-- | engines/wage/world.cpp | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/engines/wage/world.cpp b/engines/wage/world.cpp index c04fc14393..a99300e9c2 100644 --- a/engines/wage/world.cpp +++ b/engines/wage/world.cpp @@ -58,9 +58,11 @@ namespace Wage { World::World(WageEngine *engine) { - _storageScene._name = STORAGESCENE; - _orderedScenes.push_back(&_storageScene); - _scenes[STORAGESCENE] = &_storageScene; + _storageScene = new Scene; + _storageScene->_name = STORAGESCENE; + + _orderedScenes.push_back(_storageScene); + _scenes[STORAGESCENE] = _storageScene; _gameOverMessage = nullptr; _saveBeforeQuitMessage = nullptr; @@ -70,6 +72,10 @@ World::World(WageEngine *engine) { _engine = engine; } +World::~World() { + delete _storageScene; +} + bool World::loadWorld(Common::MacResManager *resMan) { Common::MacResIDArray resArray; Common::SeekableReadStream *res; @@ -391,8 +397,34 @@ void World::move(Obj *obj, Scene *scene) { _engine->onMove(obj, from, scene); } +bool ChrComparator(Chr *l, Chr *r) { + return l->_index < r->_index; +} + void World::move(Chr *chr, Scene *scene) { - warning("STUB: World::move(chr, scene)"); + if (chr == NULL) + return; + Scene *from = chr->_currentScene; + if (from == scene) + return; + if (from != NULL) + from->_chrs.remove(chr); + scene->_chrs.push_back(chr); + + Common::sort(scene->_chrs.begin(), scene->_chrs.end(), ChrComparator); + + if (scene == _storageScene) { + warning("STUB: World::move (chrState)"); + //chr.setState(new Chr.State(chr)); + } else if (chr->_playerCharacter) { + scene->_visited = true; + warning("STUB: World::move (visits)"); + //Context context = getPlayerContext(); + //context.setVisits(context.getVisits() + 1); + } + chr->_currentScene = scene; + + _engine->onMove(chr, from, scene); } Scene *World::getRandomScene() { |