Fix VTOLs sometimes forgetting to rearm before flying off.
A VTOL would be waiting for a rearming pad to become available, but also happen to be covering a rearming pad, and get asked to clear off since it wasn't actually using that pad. The VTOLs would then get confused, and fly off as if it had rearmed itself already.master
parent
2817c7142b
commit
f335b2173a
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
This file is part of Warzone 2100.
|
||||
Copyright (C) 1999-2004 Eidos Interactive
|
||||
Copyright (C) 2005-2010 Warzone 2100 Project
|
||||
Copyright (C) 2005-2011 Warzone 2100 Project
|
||||
|
||||
Warzone 2100 is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -2227,6 +2227,10 @@ void actionUpdateDroid(DROID *psDroid)
|
|||
if (DROID_STOPPED(psDroid))
|
||||
{
|
||||
psDroid->action = DACTION_NONE;
|
||||
if (!vtolHappy(psDroid)) // Droid has cleared the rearm pad without getting rearmed. One way this can happen if a rearming pad was built under the VTOL while it was waiting for a pad.
|
||||
{
|
||||
moveToRearm(psDroid); // Rearm somewhere else instead.
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DACTION_WAITDURINGREARM:
|
||||
|
|
|
@ -7207,14 +7207,9 @@ BOOL structVTOLCBSensor(const STRUCTURE* psStruct)
|
|||
// check whether a rearm pad is clear
|
||||
BOOL clearRearmPad(STRUCTURE *psStruct)
|
||||
{
|
||||
if (psStruct->pStructureType->type == REF_REARM_PAD
|
||||
&& (psStruct->pFunctionality->rearmPad.psObj == NULL
|
||||
|| vtolHappy((DROID*)psStruct->pFunctionality->rearmPad.psObj)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return psStruct->pStructureType->type == REF_REARM_PAD
|
||||
&& (psStruct->pFunctionality->rearmPad.psObj == NULL
|
||||
|| vtolHappy((DROID*)psStruct->pFunctionality->rearmPad.psObj));
|
||||
}
|
||||
|
||||
|
||||
|
@ -7319,38 +7314,28 @@ BOOL vtolOnRearmPad(STRUCTURE *psStruct, DROID *psDroid)
|
|||
{
|
||||
DROID *psCurr;
|
||||
SDWORD tx,ty;
|
||||
BOOL found;
|
||||
|
||||
tx = map_coord(psStruct->pos.x);
|
||||
ty = map_coord(psStruct->pos.y);
|
||||
|
||||
found = false;
|
||||
for (psCurr = apsDroidLists[psStruct->player]; psCurr; psCurr=psCurr->psNext)
|
||||
{
|
||||
if (psCurr != psDroid
|
||||
&& map_coord(psCurr->pos.x) == tx
|
||||
&& map_coord(psCurr->pos.y) == ty)
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return found;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* Just returns true if the structure's present body points aren't as high as the original*/
|
||||
BOOL structIsDamaged(STRUCTURE *psStruct)
|
||||
{
|
||||
if(psStruct->body < structureBody(psStruct))
|
||||
{
|
||||
return(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
return(false);
|
||||
}
|
||||
return psStruct->body < structureBody(psStruct);
|
||||
}
|
||||
|
||||
// give a structure from one player to another - used in Electronic Warfare
|
||||
|
|
Loading…
Reference in New Issue