Skip to content

Commit

Permalink
Fix health bars being shown where a droid used to be, when always dis…
Browse files Browse the repository at this point in the history
…playing bars.

Fixes ticket:912.

Changelog: Fix health bars displayed over empty terrain, when set to always display energy bars.
  • Loading branch information
Cyp committed Jan 17, 2011
1 parent e192e8a commit 61a79c7
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 17 deletions.
39 changes: 39 additions & 0 deletions fixbrokendependencies
@@ -0,0 +1,39 @@
#!/bin/bash

# HACK Don't give make errors when switching between trunk and branches.
# Works by finding the .deps/*.Po files which refer to source files that don't exist, and replacing them with a single dependency on the correct source file.
# Now with PD-ksh support.

if ! rootdir="`git rev-parse --show-cdup 2> /dev/null`"
then
echo "Not in a git repository."
exit 0
fi

for path in src/ lib/*/ lib/*/*/
do
srcpath="${rootdir}${path}"
deppath="${path}.deps/"
if [ -d "${srcpath}" -a -d "${deppath}" ]
then
for ext in c cpp
do
# Iterate over all files that might have broken dependencies.
for fname in `cd ${srcpath} ; echo *.${ext}`
do
fpref="`echo "${fname}" | sed "s/\.${ext}//"`"
srcfile="${srcpath}${fname}"
depfile="${deppath}${fpref}.Po"

# Check if the dependency file ${depfile} exists and is broken. (The ${srcfile} check prevents looking for files literally called "*.cpp".)
if [ -f "${srcfile}" -a -f "${depfile}" ] && ! grep -q "\b${fname}\b" "${depfile}" 2> /dev/null
then
relpath="`echo "${path}" | sed "s/[^./]*\//..\//g"`"
echo "${fpref}.o: ${relpath}${srcfile}" | tee "${depfile}"
fi
done
done
fi
done

exit 0
36 changes: 19 additions & 17 deletions src/display3d.c
Expand Up @@ -3246,16 +3246,13 @@ static void drawStructureSelections( void )
/* Go thru' all the buildings */
for(psStruct = apsStructLists[selectedPlayer]; psStruct; psStruct = psStruct->psNext)
{
if(clipXY(psStruct->pos.x,psStruct->pos.y))
if (clipXY(psStruct->pos.x,psStruct->pos.y) && psStruct->sDisplay.frameNumber == currentGameFrame)
{
/* If it's selected */
if (psStruct->selected
|| (barMode == BAR_DROIDS_AND_STRUCTURES
&& (psStruct->pStructureType->type != REF_WALL && psStruct->pStructureType->type != REF_WALLCORNER))
|| (bMouseOverOwnStructure
&& psStruct == (STRUCTURE *) psClickedOn
&& ((STRUCTURE * )psClickedOn)->status == SS_BUILT
&& psStruct->sDisplay.frameNumber == currentGameFrame))
if (psStruct->selected ||
(barMode == BAR_DROIDS_AND_STRUCTURES && psStruct->pStructureType->type != REF_WALL && psStruct->pStructureType->type != REF_WALLCORNER) ||
(bMouseOverOwnStructure && psStruct == (STRUCTURE *)psClickedOn)
)
{
drawStructureHealth(psStruct);

Expand All @@ -3264,12 +3261,10 @@ static void drawStructureSelections( void )
drawWeaponReloadBar((BASE_OBJECT *)psStruct, &psStruct->asWeaps[i], i);
}
}
else

if (psStruct->status == SS_BEING_BUILT)
{
if(psStruct->status == SS_BEING_BUILT && psStruct->sDisplay.frameNumber == currentGameFrame)
{
drawStructureBuildProgress(psStruct);
}
drawStructureBuildProgress(psStruct);
}
}
}
Expand Down Expand Up @@ -3407,12 +3402,19 @@ static void drawDroidSelections( void )
pie_SetFogStatus(false);
for(psDroid = apsDroidLists[selectedPlayer]; psDroid; psDroid = psDroid->psNext)
{
if (psDroid->sDisplay.frameNumber != currentGameFrame || !clipXY(psDroid->pos.x, psDroid->pos.y))
{
continue; // Not visible, anyway. Don't bother with health bars.
}

/* If it's selected and on screen or it's the one the mouse is over ||*/
// ABSOLUTELY MAD LOGICAL EXPRESSION!!! :-)
if ((eitherSelected(psDroid) && psDroid->sDisplay.frameNumber == currentGameFrame)
|| (bMouseOverOwnDroid && psDroid == (DROID *) psClickedOn)
|| (droidUnderRepair(psDroid) && psDroid->sDisplay.frameNumber == currentGameFrame)
|| (barMode == BAR_DROIDS || barMode == BAR_DROIDS_AND_STRUCTURES))
// Now slightly less mad and slightly less buggy.
if (eitherSelected(psDroid) ||
(bMouseOverOwnDroid && psDroid == (DROID *) psClickedOn) ||
droidUnderRepair(psDroid) ||
barMode == BAR_DROIDS || barMode == BAR_DROIDS_AND_STRUCTURES
)
{
damage = PERCENT(psDroid->body, psDroid->originalBody);

Expand Down

0 comments on commit 61a79c7

Please sign in to comment.