diff options
Diffstat (limited to 'engines/titanic/true_talk/tt_npc_script.cpp')
-rw-r--r-- | engines/titanic/true_talk/tt_npc_script.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 74e2f4f66b..527e33f14c 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -338,12 +338,13 @@ uint TTnpcScript::getRangeValue(uint id) { case SF_RANDOM: { uint count = range->_values.size(); - uint index = getRandomNumber(count) - 1; + int index = (int)getRandomNumber(count) - 1; if (count > 1 && range->_values[index] == range->_priorIndex) { - for (int retry = 0; retry < 8 && index != range->_priorIndex; ++retry) - index = getRandomNumber(count) - 1; + for (int retry = 0; retry < 8 && index != (int)range->_priorIndex; ++retry) + index = (int)getRandomNumber(count) - 1; } + assert(index >= 0); range->_priorIndex = index; return range->_values[index]; } @@ -699,12 +700,12 @@ int TTnpcScript::processEntries(const TTsentenceEntries *entries, uint entryCoun if (!entryCount) // No count specified, so use entire list entryCount = entries->size(); - int entryId = _field2C; + int categoryNum = sentence->_category; for (uint loopCtr = 0; loopCtr < 2; ++loopCtr) { for (uint entryCtr = 0; entryCtr < entryCount; ++entryCtr) { const TTsentenceEntry &entry = (*entries)[entryCtr]; - if (entry._field4 != entryId && (loopCtr == 0 || entry._field4)) + if (entry._category != categoryNum && (loopCtr == 0 || entry._category)) continue; bool flag; @@ -955,7 +956,7 @@ bool TTnpcScript::getStateValue() const { } bool TTnpcScript::sentence2C(const TTsentence *sentence) { - return sentence->_field2C >= 2 && sentence->_field2C <= 7; + return sentence->_category >= 2 && sentence->_category <= 7; } void TTnpcScript::getAssignedRoom(int *roomNum, int *floorNum, int *elevatorNum) const { |