diff options
author | Bendegúz Nagy | 2016-06-18 11:47:17 +0200 |
---|---|---|
committer | Bendegúz Nagy | 2016-08-26 23:02:22 +0200 |
commit | 332a515d2cb718fdaa46f8c01875f430dbd03036 (patch) | |
tree | 984740b5f12bf01c79e831471c1cb1d3ae21cb81 | |
parent | 3ff3512c64fd3e5245b45506203a8d5083598a88 (diff) | |
download | scummvm-rg350-332a515d2cb718fdaa46f8c01875f430dbd03036.tar.gz scummvm-rg350-332a515d2cb718fdaa46f8c01875f430dbd03036.tar.bz2 scummvm-rg350-332a515d2cb718fdaa46f8c01875f430dbd03036.zip |
DM: Add getIndexInCell function in ChampionMan
-rw-r--r-- | engines/dm/champion.cpp | 7 | ||||
-rw-r--r-- | engines/dm/champion.h | 6 | ||||
-rw-r--r-- | engines/dm/loadsave.cpp | 2 |
3 files changed, 10 insertions, 5 deletions
diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp index 0e0d5e8eea..0ae05396f7 100644 --- a/engines/dm/champion.cpp +++ b/engines/dm/champion.cpp @@ -5,7 +5,12 @@ namespace DM { ChampionMan::ChampionMan(DMEngine *vm): _vm(vm) {} -ChampionIndex ChampionMan::getIndexInCell(int16 mapX, int16 mapY, ViewCell cell) { +ChampionIndex ChampionMan::getIndexInCell(ViewCell cell) { + for (uint16 i = 0; i < _partyChampionCount; ++i) { + if ((_champions[i]._cell == cell) && _champions[i]._currHealth) + return (ChampionIndex)i; + } + return kChampionNone; } diff --git a/engines/dm/champion.h b/engines/dm/champion.h index 36f1689b7a..536d3676b2 100644 --- a/engines/dm/champion.h +++ b/engines/dm/champion.h @@ -243,14 +243,14 @@ public: class ChampionMan { DMEngine *_vm; - Champion champions[4]; + Champion _champions[4]; public: - uint16 _partChampionCount; + uint16 _partyChampionCount; bool _partyDead; // @ G0303_B_PartyDead Thing _leaderHand; ChampionMan(DMEngine *vm); - ChampionIndex getIndexInCell(int16 mapX, int16 mapY, ViewCell cell); // @ F0285_CHAMPION_GetIndexInCell + ChampionIndex getIndexInCell(ViewCell cell); // @ F0285_CHAMPION_GetIndexInCell }; } diff --git a/engines/dm/loadsave.cpp b/engines/dm/loadsave.cpp index cd522fa508..e58b746060 100644 --- a/engines/dm/loadsave.cpp +++ b/engines/dm/loadsave.cpp @@ -15,7 +15,7 @@ LoadgameResponse LoadsaveMan::loadgame() { if (newGame) { _vm->_restartGameAllowed = false; - cm._partChampionCount = 0; + cm._partyChampionCount = 0; cm._leaderHand = Thing::thingNone; _vm->_gameId = _vm->_rnd->getRandomNumber(65536) * _vm->_rnd->getRandomNumber(65536); } else { |