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-861f7616d084master
parent
316eae3a37
commit
81c8aa657c
15
src/droid.c
15
src/droid.c
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue