diff options
author | whiterandrek | 2018-05-25 17:44:21 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2018-06-28 23:51:32 +0200 |
commit | 04a0c4ead6e76f4eb4dcef8faa1d8d3138465289 (patch) | |
tree | 11e02077db22690ebf7111b7f3002652aff1511a /engines/pink | |
parent | 0b4c0b2bee299d2ea46dcb795f8fa19fa2bc4837 (diff) | |
download | scummvm-rg350-04a0c4ead6e76f4eb4dcef8faa1d8d3138465289.tar.gz scummvm-rg350-04a0c4ead6e76f4eb4dcef8faa1d8d3138465289.tar.bz2 scummvm-rg350-04a0c4ead6e76f4eb4dcef8faa1d8d3138465289.zip |
PINK: add saving/loading state of WalkMgr
Diffstat (limited to 'engines/pink')
-rw-r--r-- | engines/pink/objects/walk/walk_mgr.cpp | 22 | ||||
-rw-r--r-- | engines/pink/objects/walk/walk_mgr.h | 3 |
2 files changed, 25 insertions, 0 deletions
diff --git a/engines/pink/objects/walk/walk_mgr.cpp b/engines/pink/objects/walk/walk_mgr.cpp index 5b57107a44..0df4a544fc 100644 --- a/engines/pink/objects/walk/walk_mgr.cpp +++ b/engines/pink/objects/walk/walk_mgr.cpp @@ -143,4 +143,26 @@ void WalkMgr::end() { _leadActor->onWalkEnd(); } +void WalkMgr::loadState(Archive &archive) { + _isWalking = archive.readByte(); + _current.name = archive.readString(); + if (!_current.name.empty()) { + _current.coord = getLocationCoordinates(_current.name); + } + if (_isWalking) { + _next.name = archive.readString(); + _destination = findLocation(archive.readString()); + _next.coord = getLocationCoordinates(_next.name); + } +} + +void WalkMgr::saveState(Archive &archive) { + archive.writeByte(_isWalking); + archive.writeString(_current.name); + if (_isWalking) { + archive.writeString(_next.name); + archive.writeString(_destination->getName()); + } +} + } // End of namespace Pink diff --git a/engines/pink/objects/walk/walk_mgr.h b/engines/pink/objects/walk/walk_mgr.h index 9060f08a20..2decdd861c 100644 --- a/engines/pink/objects/walk/walk_mgr.h +++ b/engines/pink/objects/walk/walk_mgr.h @@ -45,6 +45,9 @@ public: double getLengthBetweenLocations(WalkLocation *first, WalkLocation *second); void setCurrentWayPoint(WalkLocation *location); + void loadState(Archive &archive); + void saveState(Archive &archive); + private: struct Coordinates { int x; |