Further cleanup/refactor vtolHappy:

* Trash the bool-array (previously bitmask) code
 * Simply return false as soon as we've determined a VTOL isn't "happy" (i.e. marked as fully armed and healed)


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5409 4a71c877-e1ca-e34f-864e-861f7616d084
master
Giel van Schijndel 2008-07-07 12:51:57 +00:00
parent 316eae3a37
commit 81c8aa657c
1 changed files with 1 additions and 14 deletions

View File

@ -4588,31 +4588,18 @@ BOOL vtolHappy(const DROID* psDroid)
if (psDroid->numWeaps > 0) if (psDroid->numWeaps > 0)
{ {
unsigned int i; unsigned int i;
bool numVtolWeaps[8];
bool rearmedWeaps[8];
memset(numVtolWeaps, 0, sizeof(numVtolWeaps));
memset(rearmedWeaps, 0, sizeof(rearmedWeaps));
for (i = 0; i < psDroid->numWeaps; ++i) for (i = 0; i < psDroid->numWeaps; ++i)
{ {
if (asWeaponStats[psDroid->asWeaps[i].nStat].vtolAttackRuns > 0) if (asWeaponStats[psDroid->asWeaps[i].nStat].vtolAttackRuns > 0)
{ {
numVtolWeaps[i] = true;
if (psDroid->sMove.iAttackRuns[i] == 0) if (psDroid->sMove.iAttackRuns[i] == 0)
{ {
rearmedWeaps[i] = true; return false;
} }
} }
} }
for (i = 0; i < psDroid->numWeaps; ++i)
{
if (numVtolWeaps[i]
&& !rearmedWeaps[i])
return false;
}
return true; return true;
} }