Patch by Watermelon: Commander and transport fixes (cmdfix1)
1.Fixed a potential crash with transport. 2.Fixed a crash/repair units disorder when linked to a commander(found by hikaru-orly) git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@875 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
da3e52a447
commit
f2d84cf386
18
src/action.c
18
src/action.c
|
@ -1249,14 +1249,14 @@ static void actionUpdateTransporter( DROID *psDroid )
|
|||
{
|
||||
if (psDroid->asWeaps[i].nStat > 0)
|
||||
{
|
||||
if (psDroid->psActionTarget[i] == NULL)
|
||||
if (psDroid->psActionTarget[0] == NULL)
|
||||
{
|
||||
aiBestNearestTarget(psDroid, &psDroid->psActionTarget[i], i);
|
||||
aiBestNearestTarget(psDroid, &psDroid->psActionTarget[0], i);
|
||||
}
|
||||
|
||||
if ( psDroid->psActionTarget[i] != NULL )
|
||||
if ( psDroid->psActionTarget[0] != NULL )
|
||||
{
|
||||
if ( visibleObject((BASE_OBJECT*)psDroid, psDroid->psActionTarget[i]) )
|
||||
if ( visibleObject((BASE_OBJECT*)psDroid, psDroid->psActionTarget[0]) )
|
||||
{
|
||||
/*if (actionTargetTurret((BASE_OBJECT*)psDroid, psDroid->psActionTarget,
|
||||
&(psDroid->turretRotation), &(psDroid->turretPitch),
|
||||
|
@ -1264,20 +1264,20 @@ static void actionUpdateTransporter( DROID *psDroid )
|
|||
//asWeaponStats[psDroid->asWeaps->nStat].direct))
|
||||
proj_Direct(&asWeaponStats[psDroid->asWeaps->nStat]),
|
||||
TRUE))*/
|
||||
if (actionTargetTurret((BASE_OBJECT*)psDroid, psDroid->psActionTarget[i],
|
||||
if (actionTargetTurret((BASE_OBJECT*)psDroid, psDroid->psActionTarget[0],
|
||||
&(psDroid->turretRotation[i]), &(psDroid->turretPitch[i]),
|
||||
&asWeaponStats[psDroid->asWeaps[i].nStat],
|
||||
TRUE,i))
|
||||
{
|
||||
// In range - fire !!!
|
||||
combFire(&psDroid->asWeaps[i], (BASE_OBJECT *)psDroid,
|
||||
psDroid->psActionTarget[i], i);
|
||||
psDroid->psActionTarget[0], i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// lost the target
|
||||
psDroid->psActionTarget[i] = NULL;
|
||||
psDroid->psActionTarget[0] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1446,7 +1446,9 @@ BOOL actionRouteBlockingPos(DROID *psDroid, SDWORD tx, SDWORD ty)
|
|||
if (psTile->tileInfoBits & BITS_WALL)
|
||||
{
|
||||
psWall = getTileStructure((UDWORD)i,(UDWORD)j);
|
||||
if (psWall->player != psDroid->player)
|
||||
//Watermelon:fixes AI try to destroy ally's wall bug
|
||||
if (psWall->player != psDroid->player &&
|
||||
!aiCheckAlliances(psWall->player, psDroid->player))
|
||||
{
|
||||
goto done;
|
||||
}
|
||||
|
|
6
src/ai.c
6
src/ai.c
|
@ -444,13 +444,13 @@ BOOL aiChooseTarget(BASE_OBJECT *psObj,
|
|||
// has a target - (slow firing weapons will not be ready to fire otherwise).
|
||||
bCommanderBlock = TRUE;
|
||||
if (psCommander->action == DACTION_ATTACK &&
|
||||
psCommander->psActionTarget[weapon_slot] != NULL)
|
||||
psCommander->psActionTarget[0] != NULL)
|
||||
{
|
||||
// the commander has a target to fire on
|
||||
if (aiStructHasRange((STRUCTURE *)psObj, psCommander->psActionTarget[weapon_slot], weapon_slot))
|
||||
if (aiStructHasRange((STRUCTURE *)psObj, psCommander->psActionTarget[0], weapon_slot))
|
||||
{
|
||||
// target in range - fire on it
|
||||
psTarget = psCommander->psActionTarget[weapon_slot];
|
||||
psTarget = psCommander->psActionTarget[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue