diff options
author | Paul Gilbert | 2016-12-17 22:26:16 -0500 |
---|---|---|
committer | Paul Gilbert | 2016-12-17 22:26:16 -0500 |
commit | d356d873788478fad993c5297e42e2bae57d2539 (patch) | |
tree | a68c91cd209fc5442cd8b2d8ef8d11a996564331 | |
parent | 6338496dffd3e1dc07fa4cd17654a2daa95f60fe (diff) | |
download | scummvm-rg350-d356d873788478fad993c5297e42e2bae57d2539.tar.gz scummvm-rg350-d356d873788478fad993c5297e42e2bae57d2539.tar.bz2 scummvm-rg350-d356d873788478fad993c5297e42e2bae57d2539.zip |
TITANIC: Fix saving games when there is range data to be included
-rw-r--r-- | engines/titanic/true_talk/tt_npc_script.cpp | 7 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_npc_script.h | 6 |
2 files changed, 9 insertions, 4 deletions
diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 7540a738b5..ba205b6498 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -416,6 +416,7 @@ void TTnpcScript::load(SimpleFile *file) { loadBody(file); int count = file->readNumber(); + assert(count == 4); _rangeResetCtr = file->readNumber(); _currentDialNum = file->readNumber(); _dialDelta = file->readNumber(); @@ -434,13 +435,13 @@ void TTnpcScript::load(SimpleFile *file) { } void TTnpcScript::saveBody(SimpleFile *file) { - int count = proc31(); + int count = getRangesCount(); file->writeNumber(count); if (count > 0) { for (uint idx = 0; idx < _ranges.size(); ++idx) { const TTscriptRange &item = _ranges[idx]; - if (item._mode == SF_RANDOM && item._priorIndex) { + if (item._mode != SF_RANDOM && item._priorIndex) { file->writeNumber(item._id); file->writeNumber(item._priorIndex); } @@ -466,7 +467,7 @@ void TTnpcScript::loadBody(SimpleFile *file) { } } -int TTnpcScript::proc31() const { +int TTnpcScript::getRangesCount() const { int count = 0; for (uint idx = 0; idx < _ranges.size(); ++idx) { const TTscriptRange &item = _ranges[idx]; diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index bdca568b09..e5be7d7296 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -308,7 +308,11 @@ public: virtual void load(SimpleFile *file); virtual void saveBody(SimpleFile *file); virtual void loadBody(SimpleFile *file); - virtual int proc31() const; + + /** + * Returns the number of range records that are non-random + */ + virtual int getRangesCount() const; /** * Sets a given dial to be pointing in a specified region (0 to 2) |