* Make function countAssignedDroids static because it's only used in the file where it's defined
* Code clean up * Make countAssignedDroids const correct * Make countAssignedDroids return the amount of artillery ''and'' VTOL droids that are assigned to a structure * This fixes #90, patch by i-NoD, modified by me git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6464 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
5514e846ee
commit
64f87a0b8e
|
@ -5768,29 +5768,32 @@ STRUCTURE_STATS* getModuleStat(const STRUCTURE* psStruct)
|
|||
}
|
||||
}
|
||||
|
||||
/* count the artillery droids assigned to a structure (only makes sence by sensor towers and headquarters) */
|
||||
unsigned int countAssignedDroids(STRUCTURE *psStructure)
|
||||
/**
|
||||
* Count the artillery and VTOL droids assigned to a structure.
|
||||
*/
|
||||
static unsigned int countAssignedDroids(const STRUCTURE* psStructure)
|
||||
{
|
||||
DROID *psCurr;
|
||||
SDWORD weapontype, hasindirect;
|
||||
const DROID* psCurr;
|
||||
unsigned int num;
|
||||
|
||||
if(psStructure == NULL)
|
||||
CHECK_STRUCTURE(psStructure);
|
||||
|
||||
// For non-debug builds
|
||||
if (psStructure == NULL)
|
||||
return 0;
|
||||
|
||||
for (num = 0, psCurr = apsDroidLists[selectedPlayer]; psCurr; psCurr = psCurr->psNext)
|
||||
num = 0;
|
||||
for (psCurr = apsDroidLists[selectedPlayer]; psCurr; psCurr = psCurr->psNext)
|
||||
{
|
||||
if (psCurr->psTarget && psCurr->player == psStructure->player)
|
||||
if (psCurr->psTarget
|
||||
&& psCurr->psTarget->id == psStructure->id
|
||||
&& psCurr->player == psStructure->player)
|
||||
{
|
||||
hasindirect = 0;
|
||||
weapontype = asWeaponStats[psCurr->asWeaps[0].nStat].movementModel;
|
||||
const MOVEMENT_MODEL weapontype = asWeaponStats[psCurr->asWeaps[0].nStat].movementModel;
|
||||
|
||||
if(weapontype == MM_INDIRECT || weapontype == MM_HOMINGINDIRECT)
|
||||
{
|
||||
hasindirect = 1;
|
||||
}
|
||||
|
||||
if (psCurr->psTarget->id == psStructure->id && hasindirect)
|
||||
if (weapontype == MM_INDIRECT
|
||||
|| weapontype == MM_HOMINGINDIRECT
|
||||
|| isVtolDroid(psCurr))
|
||||
{
|
||||
num++;
|
||||
}
|
||||
|
|
|
@ -251,9 +251,6 @@ adjusts the associated Res Extractors so that they can link to different Power
|
|||
Gens if any are available*/
|
||||
extern void releasePowerGen(STRUCTURE *psRelease);
|
||||
|
||||
/* count the droids assigned to a structure (only sence by sensor towers and headquarters) */
|
||||
extern unsigned int countAssignedDroids(STRUCTURE *psStructure);
|
||||
|
||||
//print some info at the top of the screen dependant on the structure
|
||||
extern void printStructureInfo(STRUCTURE *psStructure);
|
||||
|
||||
|
|
Loading…
Reference in New Issue