diff options
author | Arnaud Boutonné | 2010-11-11 23:04:04 +0000 |
---|---|---|
committer | Arnaud Boutonné | 2010-11-11 23:04:04 +0000 |
commit | a0199df818a90fcd142ef7d0adbc3bbda98003ac (patch) | |
tree | 6233a08e2bc5146387bd7728ab4339df6ac6c656 /engines/hugo/file.cpp | |
parent | a65ab98726442b0e207c2466b238535bb2a6b016 (diff) | |
download | scummvm-rg350-a0199df818a90fcd142ef7d0adbc3bbda98003ac.tar.gz scummvm-rg350-a0199df818a90fcd142ef7d0adbc3bbda98003ac.tar.bz2 scummvm-rg350-a0199df818a90fcd142ef7d0adbc3bbda98003ac.zip |
HUGO: Cleanup, move several functions and variables to the object class
svn-id: r54212
Diffstat (limited to 'engines/hugo/file.cpp')
-rw-r--r-- | engines/hugo/file.cpp | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/engines/hugo/file.cpp b/engines/hugo/file.cpp index 2979271bc5..b05b3114a3 100644 --- a/engines/hugo/file.cpp +++ b/engines/hugo/file.cpp @@ -318,12 +318,7 @@ void FileManager::saveGame(int16 slot, const char *descrip) { // Save description of saved game out->write(descrip, DESCRIPLEN); - // Save objects - for (int i = 0; i < _vm->_numObj; i++) { - // Save where curr_seq_p is pointing to - _vm->_object->saveSeq(&_vm->_object->_objects[i]); - out->write(&_vm->_object->_objects[i], sizeof(object_t)); - } + _vm->_object->saveObjects(out); const status_t &gameStatus = _vm->getGameStatus(); @@ -399,17 +394,7 @@ void FileManager::restoreGame(int16 slot) { if (_vm->_heroImage != HERO) _vm->_object->swapImages(HERO, _vm->_heroImage); - // Restore objects, retain current seqList which points to dynamic mem - // Also, retain cmnd_t pointers - for (int i = 0; i < _vm->_numObj; i++) { - object_t *p = &_vm->_object->_objects[i]; - seqList_t seqList[MAX_SEQUENCES]; - memcpy(seqList, p->seqList, sizeof(seqList_t)); - uint16 cmdIndex = p->cmdIndex; - in->read(p, sizeof(object_t)); - p->cmdIndex = cmdIndex; - memcpy(p->seqList, seqList, sizeof(seqList_t)); - } + _vm->_object->restoreObjects(in); in->read(&_vm->_heroImage, sizeof(_vm->_heroImage)); @@ -433,9 +418,7 @@ void FileManager::restoreGame(int16 slot) { // Restore points table in->read(_vm->_points, sizeof(point_t) * _vm->_numBonuses); - // Restore ptrs to currently loaded objects - for (int i = 0; i < _vm->_numObj; i++) - _vm->_object->restoreSeq(&_vm->_object->_objects[i]); + _vm->_object->restoreAllSeq(); // Now restore time of the save and the event queue _vm->_scheduler->restoreEvents(in); |