[Scummvm-git-logs] scummvm master -> 60e41997b2f917406a3093de97d425ee399a8812
Strangerke
noreply at scummvm.org
Mon Feb 6 22:16:57 UTC 2023
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
60e41997b2 EFH: Rewrite prepareStatusRightWindowIndexes() in order to stop depending on out of bond reads
Commit: 60e41997b2f917406a3093de97d425ee399a8812
https://github.com/scummvm/scummvm/commit/60e41997b2f917406a3093de97d425ee399a8812
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2023-02-06T23:16:34+01:00
Commit Message:
EFH: Rewrite prepareStatusRightWindowIndexes() in order to stop depending on out of bond reads
Changed paths:
engines/efh/fight.cpp
engines/efh/init.cpp
engines/efh/menu.cpp
diff --git a/engines/efh/fight.cpp b/engines/efh/fight.cpp
index eee2174f940..0736f208eb0 100644
--- a/engines/efh/fight.cpp
+++ b/engines/efh/fight.cpp
@@ -491,7 +491,7 @@ void EfhEngine::handleFight_MobstersAttack(int groupId) {
maxTeamMemberId = _teamSize;
}
- if (minTeamMemberId == -1)
+ if (minTeamMemberId <= -1)
continue;
// handleFight - Loop on targetId - Start
diff --git a/engines/efh/init.cpp b/engines/efh/init.cpp
index 47bb4409b34..b9f6339618e 100644
--- a/engines/efh/init.cpp
+++ b/engines/efh/init.cpp
@@ -394,6 +394,8 @@ EfhEngine::EfhEngine(OSystem *syst, const ADGameDescription *gd) : Engine(syst),
_loadSaveSlot = -1;
_saveAuthorized = false;
+ _speakerStream = nullptr;
+
if (ConfMan.hasKey("save_slot")) {
int saveSlot = ConfMan.getInt("save_slot");
if (saveSlot >= 0 && saveSlot <= 999)
diff --git a/engines/efh/menu.cpp b/engines/efh/menu.cpp
index 2b2a8c4410b..6cf46578364 100644
--- a/engines/efh/menu.cpp
+++ b/engines/efh/menu.cpp
@@ -235,40 +235,37 @@ void EfhEngine::displayStatusMenu(int16 windowId) {
void EfhEngine::prepareStatusRightWindowIndexes(int16 menuId, int16 charId) {
debugC(6, kDebugEngine, "prepareStatusRightWindowIndexes %d %d", menuId, charId);
- int16 maxId = 0;
- int16 minId;
_menuItemCounter = 0;
switch (menuId) {
case kEfhMenuInfo:
- minId = 26;
- maxId = 36;
+ for (int16 counter = 0; counter <= 10; ++counter) {
+ if (_npcBuf[charId]._infoScore[counter] != 0) {
+ _menuStatItemArr[_menuItemCounter++] = counter + 26;
+ }
+ }
break;
case kEfhMenuPassive:
- minId = 15;
- maxId = 25;
+ for (int16 counter = 0; counter <= 10; ++counter) {
+ if (_npcBuf[charId]._passiveScore[counter] != 0) {
+ _menuStatItemArr[_menuItemCounter++] = counter + 15;
+ }
+ }
break;
case kEfhMenuActive:
- minId = 0;
- maxId = 14;
+ for (int16 counter = 0; counter <= 14; ++counter) {
+ if (_npcBuf[charId]._activeScore[counter] != 0) {
+ _menuStatItemArr[_menuItemCounter++] = counter;
+ }
+ }
break;
default:
- minId = -1;
- break;
- }
-
- if (minId == -1) {
for (uint counter = 0; counter < 10; ++counter) {
if (_npcBuf[charId]._inventory[counter]._ref != 0x7FFF) {
_menuStatItemArr[_menuItemCounter++] = counter;
}
}
- } else {
- for (int16 counter = minId; counter < maxId; ++counter) {
- if (_npcBuf[charId]._activeScore[counter] != 0) {
- _menuStatItemArr[_menuItemCounter++] = counter;
- }
- }
+ break;
}
}
More information about the Scummvm-git-logs
mailing list