diff options
author | Peter Kohaut | 2019-01-27 20:25:19 +0100 |
---|---|---|
committer | Peter Kohaut | 2019-01-27 20:27:45 +0100 |
commit | e3e55c2f4be350b42d3a172444211d9bbe898351 (patch) | |
tree | e44e118198d788eda795c556386de6c005f9ffa7 /engines | |
parent | 5c1b8a635a3c057a1a797eacc39182135e065050 (diff) | |
download | scummvm-rg350-e3e55c2f4be350b42d3a172444211d9bbe898351.tar.gz scummvm-rg350-e3e55c2f4be350b42d3a172444211d9bbe898351.tar.bz2 scummvm-rg350-e3e55c2f4be350b42d3a172444211d9bbe898351.zip |
BLADERUNNER: Fixed game-breaking bug with dialogue menus
Diffstat (limited to 'engines')
-rw-r--r-- | engines/bladerunner/dialogue_menu.cpp | 58 |
1 files changed, 53 insertions, 5 deletions
diff --git a/engines/bladerunner/dialogue_menu.cpp b/engines/bladerunner/dialogue_menu.cpp index 1b7c8713cc..65d9bf8ebf 100644 --- a/engines/bladerunner/dialogue_menu.cpp +++ b/engines/bladerunner/dialogue_menu.cpp @@ -135,15 +135,26 @@ bool DialogueMenu::addToList(int answer, bool done, int priorityPolite, int prio } bool DialogueMenu::addToListNeverRepeatOnceSelected(int answer, int priorityPolite, int priorityNormal, int prioritySurly) { + int foundIndex = -1; for (int i = 0; i != _neverRepeatListSize; ++i) { - if (answer == _neverRepeatValues[i] && _neverRepeatWasSelected[i]) { - return true; + if (answer == _neverRepeatValues[i]) { + foundIndex = i; + break; } } - _neverRepeatValues[_neverRepeatListSize] = answer; - _neverRepeatWasSelected[_neverRepeatListSize] = false; - ++_neverRepeatListSize; + if (foundIndex > 0 && _neverRepeatWasSelected[foundIndex]) { + return true; + } + + if (foundIndex == -1) { + _neverRepeatValues[_neverRepeatListSize] = answer; + _neverRepeatWasSelected[_neverRepeatListSize] = false; + ++_neverRepeatListSize; + + assert(_neverRepeatListSize <= 100); + } + return addToList(answer, false, priorityPolite, priorityNormal, prioritySurly); } @@ -412,6 +423,41 @@ void DialogueMenu::load(SaveFileReadStream &f) { _selectedItemIndex = f.readInt(); _listSize = f.readInt(); +#if 0 + /* fix for duplicated non-repeated entries in the save game */ + f.readInt(); + _neverRepeatListSize = 0; + int answer[100]; + bool selected[100]; + for (int i = 0; i < 100; ++i) { + _neverRepeatValues[i] = -1; + answer[i] = f.readInt(); + } + for (int i = 0; i < 100; ++i) { + _neverRepeatWasSelected[i] = false; + selected[i] = f.readBool(); + } + for (int i = 0; i < 100; ++i) { + int found = false; + bool value = false; + + for (int j = 0; j < 100; ++j) { + if (_neverRepeatValues[j] == answer[i]) { + found = true; + } + if (answer[j] == answer[i]) { + value |= selected[j]; + } + } + + if (!found) { + _neverRepeatValues[_neverRepeatListSize] = answer[i]; + _neverRepeatWasSelected[_neverRepeatListSize] = value; + ++_neverRepeatListSize; + debug("- %i, %i", answer[i], value); + } + } +#else _neverRepeatListSize = f.readInt(); for (int i = 0; i < 100; ++i) { _neverRepeatValues[i] = f.readInt(); @@ -419,6 +465,8 @@ void DialogueMenu::load(SaveFileReadStream &f) { for (int i = 0; i < 100; ++i) { _neverRepeatWasSelected[i] = f.readBool(); } +#endif + for (int i = 0; i < 10; ++i) { _items[i].text = f.readStringSz(50); _items[i].answerValue = f.readInt(); |