diff options
Diffstat (limited to 'engines/macventure')
-rw-r--r-- | engines/macventure/macventure.cpp | 2 | ||||
-rw-r--r-- | engines/macventure/world.cpp | 33 | ||||
-rw-r--r-- | engines/macventure/world.h | 2 |
3 files changed, 25 insertions, 12 deletions
diff --git a/engines/macventure/macventure.cpp b/engines/macventure/macventure.cpp index b3b3463cf5..37e1472338 100644 --- a/engines/macventure/macventure.cpp +++ b/engines/macventure/macventure.cpp @@ -304,7 +304,7 @@ void MacVentureEngine::winGame() { void MacVentureEngine::loseGame() { _gui->showPrebuiltDialog(kWinGameDialog); _paused = true; - _gameState = kGameStateLosing; + //_gameState = kGameStateLosing; } void MacVentureEngine::clickToContinue() { diff --git a/engines/macventure/world.cpp b/engines/macventure/world.cpp index 012e872272..2c9b55c6ab 100644 --- a/engines/macventure/world.cpp +++ b/engines/macventure/world.cpp @@ -8,25 +8,17 @@ namespace MacVenture { World::World(MacVentureEngine *engine, Common::MacResManager *resMan) { _resourceManager = resMan; _engine = engine; + _saveGame = NULL; - if ((_startGameFileName = _engine->getStartGameFileName()) == "") - error("Could not load initial game configuration"); - Common::File saveGameFile; - if (!saveGameFile.open(_startGameFileName)) - error("Could not load initial game configuration"); + startNewGame(); - debug("Loading save game state from %s", _startGameFileName.c_str()); - Common::SeekableReadStream *saveGameRes = saveGameFile.readStream(saveGameFile.size()); + //_-------------------- - _saveGame = new SaveGame(_engine, saveGameRes); _objectConstants = new Container(_engine->getFilePath(kObjectPathID)); calculateObjectRelations(); _gameText = new Container(_engine->getFilePath(kTextPathID)); - - delete saveGameRes; - saveGameFile.close(); } @@ -39,6 +31,25 @@ World::~World() { delete _objectConstants; } +void World::startNewGame() { + if (_saveGame) + delete _saveGame; + + if ((_startGameFileName = _engine->getStartGameFileName()) == "") + error("Could not load initial game configuration"); + + Common::File saveGameFile; + if (!saveGameFile.open(_startGameFileName)) + error("Could not load initial game configuration"); + + debug("Loading save game state from %s", _startGameFileName.c_str()); + Common::SeekableReadStream *saveGameRes = saveGameFile.readStream(saveGameFile.size()); + + _saveGame = new SaveGame(_engine, saveGameRes); + + delete saveGameRes; + saveGameFile.close(); +} uint32 World::getObjAttr(ObjID objID, uint32 attrID) { uint res; diff --git a/engines/macventure/world.h b/engines/macventure/world.h index f3933c5f7e..e78ab7f0db 100644 --- a/engines/macventure/world.h +++ b/engines/macventure/world.h @@ -92,6 +92,8 @@ public: World(MacVentureEngine *engine, Common::MacResManager *resMan); ~World(); + void startNewGame(); + void setObjAttr(ObjID objID, uint32 attrID, Attribute value); void setGlobal(uint32 attrID, Attribute value); void updateObj(ObjID objID); |