Initialise psFeature->lastHitWeapon to avoid valgrind warning found by Safety0ff.
Also changed lastHitWeapon from UDWORD to WEAPON_SUBCLASS.master
parent
ea1e76a09d
commit
00d69c1317
|
@ -891,7 +891,7 @@ void actionUpdateDroid(DROID *psDroid)
|
|||
psDroid->actionStarted += (gameTime - psDroid->timeLastHit);
|
||||
//reset the lastHit parameters
|
||||
psDroid->timeLastHit = 0;
|
||||
psDroid->lastHitWeapon = UDWORD_MAX;
|
||||
psDroid->lastHitWeapon = WSC_NUM_WEAPON_SUBCLASSES;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -81,7 +81,7 @@ typedef struct _tilePos
|
|||
UBYTE inFire; /**< true if the object is in a fire */ \
|
||||
UWORD numWatchedTiles; /**< Number of watched tiles, zero for features */ \
|
||||
UDWORD lastEmission; /**< When did it last puff out smoke? */ \
|
||||
UDWORD lastHitWeapon; /**< The weapon that last hit it */ \
|
||||
WEAPON_SUBCLASS lastHitWeapon; /**< The weapon that last hit it */ \
|
||||
UDWORD timeLastHit; /**< The time the structure was last attacked */ \
|
||||
UDWORD body; /**< Hit points with lame name */ \
|
||||
UDWORD burnStart; /**< When the object entered the fire */ \
|
||||
|
|
|
@ -2540,7 +2540,7 @@ DROID *reallyBuildDroid(DROID_TEMPLATE *pTemplate, UDWORD x, UDWORD y, UDWORD pl
|
|||
psDroid->lastEmission = 0;
|
||||
psDroid->bTargetted = false;
|
||||
psDroid->timeLastHit = UDWORD_MAX;
|
||||
psDroid->lastHitWeapon = UDWORD_MAX; // no such weapon
|
||||
psDroid->lastHitWeapon = WSC_NUM_WEAPON_SUBCLASSES; // no such weapon
|
||||
|
||||
// it was never drawn before
|
||||
psDroid->sDisplay.frameNumber = 0;
|
||||
|
|
|
@ -324,6 +324,7 @@ FEATURE * buildFeature(FEATURE_STATS *psStats, UDWORD x, UDWORD y,BOOL FromSave)
|
|||
objEcmCache((BASE_OBJECT *)psFeature, NULL);
|
||||
psFeature->bTargetted = false;
|
||||
psFeature->timeLastHit = 0;
|
||||
psFeature->lastHitWeapon = WSC_NUM_WEAPON_SUBCLASSES; // no such weapon
|
||||
|
||||
// it has never been drawn
|
||||
psFeature->sDisplay.frameNumber = 0;
|
||||
|
|
|
@ -1745,7 +1745,7 @@ STRUCTURE* buildStructureDir(STRUCTURE_STATS *pStructureType, UDWORD x, UDWORD y
|
|||
|
||||
psBuilding->lastEmission = 0;
|
||||
psBuilding->timeLastHit = 0;
|
||||
psBuilding->lastHitWeapon = UDWORD_MAX; // no such weapon
|
||||
psBuilding->lastHitWeapon = WSC_NUM_WEAPON_SUBCLASSES; // no such weapon
|
||||
|
||||
psBuilding->inFire = 0;
|
||||
psBuilding->burnStart = 0;
|
||||
|
|
Loading…
Reference in New Issue