Skip to content

Commit 61a79c7

Browse files
committed
Fix health bars being shown where a droid used to be, when always displaying bars.
Fixes ticket:912. Changelog: Fix health bars displayed over empty terrain, when set to always display energy bars.
1 parent e192e8a commit 61a79c7

File tree

2 files changed

+58
-17
lines changed

2 files changed

+58
-17
lines changed

fixbrokendependencies

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
3+
# HACK Don't give make errors when switching between trunk and branches.
4+
# 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.
5+
# Now with PD-ksh support.
6+
7+
if ! rootdir="`git rev-parse --show-cdup 2> /dev/null`"
8+
then
9+
echo "Not in a git repository."
10+
exit 0
11+
fi
12+
13+
for path in src/ lib/*/ lib/*/*/
14+
do
15+
srcpath="${rootdir}${path}"
16+
deppath="${path}.deps/"
17+
if [ -d "${srcpath}" -a -d "${deppath}" ]
18+
then
19+
for ext in c cpp
20+
do
21+
# Iterate over all files that might have broken dependencies.
22+
for fname in `cd ${srcpath} ; echo *.${ext}`
23+
do
24+
fpref="`echo "${fname}" | sed "s/\.${ext}//"`"
25+
srcfile="${srcpath}${fname}"
26+
depfile="${deppath}${fpref}.Po"
27+
28+
# Check if the dependency file ${depfile} exists and is broken. (The ${srcfile} check prevents looking for files literally called "*.cpp".)
29+
if [ -f "${srcfile}" -a -f "${depfile}" ] && ! grep -q "\b${fname}\b" "${depfile}" 2> /dev/null
30+
then
31+
relpath="`echo "${path}" | sed "s/[^./]*\//..\//g"`"
32+
echo "${fpref}.o: ${relpath}${srcfile}" | tee "${depfile}"
33+
fi
34+
done
35+
done
36+
fi
37+
done
38+
39+
exit 0

src/display3d.c

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3246,16 +3246,13 @@ static void drawStructureSelections( void )
32463246
/* Go thru' all the buildings */
32473247
for(psStruct = apsStructLists[selectedPlayer]; psStruct; psStruct = psStruct->psNext)
32483248
{
3249-
if(clipXY(psStruct->pos.x,psStruct->pos.y))
3249+
if (clipXY(psStruct->pos.x,psStruct->pos.y) && psStruct->sDisplay.frameNumber == currentGameFrame)
32503250
{
32513251
/* If it's selected */
3252-
if (psStruct->selected
3253-
|| (barMode == BAR_DROIDS_AND_STRUCTURES
3254-
&& (psStruct->pStructureType->type != REF_WALL && psStruct->pStructureType->type != REF_WALLCORNER))
3255-
|| (bMouseOverOwnStructure
3256-
&& psStruct == (STRUCTURE *) psClickedOn
3257-
&& ((STRUCTURE * )psClickedOn)->status == SS_BUILT
3258-
&& psStruct->sDisplay.frameNumber == currentGameFrame))
3252+
if (psStruct->selected ||
3253+
(barMode == BAR_DROIDS_AND_STRUCTURES && psStruct->pStructureType->type != REF_WALL && psStruct->pStructureType->type != REF_WALLCORNER) ||
3254+
(bMouseOverOwnStructure && psStruct == (STRUCTURE *)psClickedOn)
3255+
)
32593256
{
32603257
drawStructureHealth(psStruct);
32613258

@@ -3264,12 +3261,10 @@ static void drawStructureSelections( void )
32643261
drawWeaponReloadBar((BASE_OBJECT *)psStruct, &psStruct->asWeaps[i], i);
32653262
}
32663263
}
3267-
else
3264+
3265+
if (psStruct->status == SS_BEING_BUILT)
32683266
{
3269-
if(psStruct->status == SS_BEING_BUILT && psStruct->sDisplay.frameNumber == currentGameFrame)
3270-
{
3271-
drawStructureBuildProgress(psStruct);
3272-
}
3267+
drawStructureBuildProgress(psStruct);
32733268
}
32743269
}
32753270
}
@@ -3407,12 +3402,19 @@ static void drawDroidSelections( void )
34073402
pie_SetFogStatus(false);
34083403
for(psDroid = apsDroidLists[selectedPlayer]; psDroid; psDroid = psDroid->psNext)
34093404
{
3405+
if (psDroid->sDisplay.frameNumber != currentGameFrame || !clipXY(psDroid->pos.x, psDroid->pos.y))
3406+
{
3407+
continue; // Not visible, anyway. Don't bother with health bars.
3408+
}
3409+
34103410
/* If it's selected and on screen or it's the one the mouse is over ||*/
34113411
// ABSOLUTELY MAD LOGICAL EXPRESSION!!! :-)
3412-
if ((eitherSelected(psDroid) && psDroid->sDisplay.frameNumber == currentGameFrame)
3413-
|| (bMouseOverOwnDroid && psDroid == (DROID *) psClickedOn)
3414-
|| (droidUnderRepair(psDroid) && psDroid->sDisplay.frameNumber == currentGameFrame)
3415-
|| (barMode == BAR_DROIDS || barMode == BAR_DROIDS_AND_STRUCTURES))
3412+
// Now slightly less mad and slightly less buggy.
3413+
if (eitherSelected(psDroid) ||
3414+
(bMouseOverOwnDroid && psDroid == (DROID *) psClickedOn) ||
3415+
droidUnderRepair(psDroid) ||
3416+
barMode == BAR_DROIDS || barMode == BAR_DROIDS_AND_STRUCTURES
3417+
)
34163418
{
34173419
damage = PERCENT(psDroid->body, psDroid->originalBody);
34183420

0 commit comments

Comments
 (0)