Don't deselect all but 1 truck, when selecting demolish from the build menu.

master
Cyp 2011-02-25 18:22:08 +01:00
parent 6aedc62db4
commit 938bd28a56
6 changed files with 18 additions and 53 deletions

View File

@ -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
@ -147,7 +147,7 @@ static inline int objPosDiffSq(SIMPLE_OBJECT const *pos1, SIMPLE_OBJECT const *p
}
// True iff object is a droid, structure or feature (not a projectile). Will incorrectly return true if passed a nonsense object of type OBJ_TARGET or OBJ_NUM_TYPES.
static inline bool isBaseObject(SIMPLE_OBJECT const *psObject) { return psObject->type != OBJ_PROJECTILE; }
static inline bool isBaseObject(SIMPLE_OBJECT const *psObject) { return psObject != NULL && psObject->type != OBJ_PROJECTILE; }
// Returns BASE_OBJECT * if base_object or NULL if not.
static inline BASE_OBJECT *castBaseObject(SIMPLE_OBJECT *psObject) { return isBaseObject(psObject)? (BASE_OBJECT *)psObject : (BASE_OBJECT *)NULL; }
// Returns BASE_OBJECT const * if base_object or NULL if not.

View File

@ -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
@ -556,7 +556,7 @@ void _syncDebugDroid(const char *function, DROID const *psDroid, char ch);
// True iff object is a droid.
static inline bool isDroid(SIMPLE_OBJECT const *psObject) { return psObject->type == OBJ_DROID; }
static inline bool isDroid(SIMPLE_OBJECT const *psObject) { return psObject != NULL && psObject->type == OBJ_DROID; }
// Returns DROID * if droid or NULL if not.
static inline DROID *castDroid(SIMPLE_OBJECT *psObject) { return isDroid(psObject)? (DROID *)psObject : (DROID *)NULL; }
// Returns DROID const * if droid or NULL if not.

View File

@ -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
@ -67,7 +67,7 @@ void _syncDebugFeature(const char *function, FEATURE const *psFeature, char ch);
// True iff object is a feature.
static inline bool isFeature(SIMPLE_OBJECT const *psObject) { return psObject->type == OBJ_FEATURE; }
static inline bool isFeature(SIMPLE_OBJECT const *psObject) { return psObject != NULL && psObject->type == OBJ_FEATURE; }
// Returns FEATURE * if feature or NULL if not.
static inline FEATURE *castFeature(SIMPLE_OBJECT *psObject) { return isFeature(psObject)? (FEATURE *)psObject : (FEATURE *)NULL; }
// Returns FEATURE const * if feature or NULL if not.

View File

@ -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
@ -5347,32 +5347,17 @@ static BASE_STATS *getConstructionStats(BASE_OBJECT *psObj)
/* Set the stats for a construction droid */
static BOOL setConstructionStats(BASE_OBJECT *psObj, BASE_STATS *psStats)
{
STRUCTURE_STATS *psSStats;
DROID *psDroid;
DROID *psDroid = castDroid(psObj);
ASSERT(psDroid != NULL, "invalid droid pointer");
ASSERT( psObj != NULL && psObj->type == OBJ_DROID,
"setConstructionStats: invalid droid pointer" );
/* psStats might be NULL if the operation is canceled in the middle */
if (psStats != NULL)
{
psSStats = (STRUCTURE_STATS *)psStats;
psDroid = (DROID *)psObj;
//check for demolish first
if (psSStats == structGetDemolishStat())
if (psStats == structGetDemolishStat())
{
objMode = IOBJ_DEMOLISHSEL;
// When demolish requested, need to select a construction droid, not really any
// choice in this as demolishing uses the droid targeting interface rather than
// the build positioning interface and therefore requires a construction droid
// to be selected.
clearSel();
SelectDroid(psDroid);
if(driveModeActive()) {
driveSelectionChanged();
}
return true;
}
@ -5380,33 +5365,13 @@ static BOOL setConstructionStats(BASE_OBJECT *psObj, BASE_STATS *psStats)
psPositionStats = psStats;
/* Now start looking for a location for the structure */
if (psSStats)
{
{
objMode = IOBJ_BUILDSEL;
objMode = IOBJ_BUILDSEL;
intStartStructPosition(psStats);
intStartStructPosition(psStats);
//set the droids current program
/*for (i=0; i < psDroid->numProgs; i++)
{
if (psDroid->asProgs[i].psStats->order == ORDER_BUILD)
{
psDroid->activeProg = i;
}
}*/
}
}
else
{
orderDroid(psDroid, DORDER_STOP, ModeQueue);
}
}
else
{
psDroid = (DROID *)psObj;
orderDroid(psDroid, DORDER_STOP, ModeQueue);
return true;
}
orderDroid(psDroid, DORDER_STOP, ModeQueue);
return true;
}

View File

@ -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
@ -64,7 +64,7 @@ typedef std::vector<PROJECTILE *>::const_iterator ProjectileIterator;
/// True iff object is a projectile.
static inline bool isProjectile(SIMPLE_OBJECT const *psObject) { return psObject->type == OBJ_PROJECTILE; }
static inline bool isProjectile(SIMPLE_OBJECT const *psObject) { return psObject != NULL && psObject->type == OBJ_PROJECTILE; }
/// Returns PROJECTILE * if projectile or NULL if not.
static inline PROJECTILE *castProjectile(SIMPLE_OBJECT *psObject) { return isProjectile(psObject)? (PROJECTILE *)psObject : (PROJECTILE *)NULL; }
/// Returns PROJECTILE const * if projectile or NULL if not.

View File

@ -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
@ -459,7 +459,7 @@ void _syncDebugStructure(const char *function, STRUCTURE const *psStruct, char c
// True iff object is a structure.
static inline bool isStructure(SIMPLE_OBJECT const *psObject) { return psObject->type == OBJ_STRUCTURE; }
static inline bool isStructure(SIMPLE_OBJECT const *psObject) { return psObject != NULL && psObject->type == OBJ_STRUCTURE; }
// Returns STRUCTURE * if structure or NULL if not.
static inline STRUCTURE *castStructure(SIMPLE_OBJECT *psObject) { return isStructure(psObject)? (STRUCTURE *)psObject : (STRUCTURE *)NULL; }
// Returns STRUCTURE const * if structure or NULL if not.