Patch to prevent orders with impossible destination from being issued. See ticket:838
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@8071 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
f9cb87f05a
commit
54fe76b51e
14
src/order.c
14
src/order.c
|
@ -1466,6 +1466,20 @@ void orderDroidBase(DROID *psDroid, DROID_ORDER_DATA *psOrder)
|
||||||
{
|
{
|
||||||
UDWORD iFactoryDistSq;
|
UDWORD iFactoryDistSq;
|
||||||
STRUCTURE *psStruct, *psRepairFac, *psFactory;
|
STRUCTURE *psStruct, *psRepairFac, *psFactory;
|
||||||
|
const PROPULSION_STATS *psPropStats = asPropulsionStats + psDroid->asBits[COMP_PROPULSION].nStat;
|
||||||
|
const Vector2i dPos = { map_coord(psDroid->pos.x), map_coord(psDroid->pos.y) };
|
||||||
|
const Vector2i rPos = { map_coord(psOrder->x), map_coord(psOrder->y) };
|
||||||
|
|
||||||
|
if ((validOrderForLoc(psOrder->order) || psOrder->order == DORDER_BUILD) && !fpathCheck(dPos, rPos, psPropStats->propulsionType))
|
||||||
|
{
|
||||||
|
if (!isHumanPlayer(psDroid->player))
|
||||||
|
{
|
||||||
|
debug(LOG_SCRIPT, "Invalid order %s given to player %d's %s for position (%d, %d) - ignoring",
|
||||||
|
getDroidOrderName(psOrder->order), psDroid->player, droidGetName(psDroid), (int)psOrder->x, (int)psOrder->y);
|
||||||
|
}
|
||||||
|
objTrace(psDroid->id, "Invalid order %s for position (%d, %d) - ignoring", getDroidOrderName(psOrder->order), (int)psOrder->x, (int)psOrder->y);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// deal with a droid receiving a primary order
|
// deal with a droid receiving a primary order
|
||||||
if (secondaryGotPrimaryOrder(psDroid, psOrder->order))
|
if (secondaryGotPrimaryOrder(psDroid, psOrder->order))
|
||||||
|
|
Loading…
Reference in New Issue