DM: Add getIndexInCell function in ChampionMan

This commit is contained in:
Bendegúz Nagy 2016-06-18 11:47:17 +02:00
parent 3ff3512c64
commit 332a515d2c
3 changed files with 10 additions and 5 deletions

View File

@ -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;
}

View File

@ -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
};
}

View File

@ -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 {