Skip to content

Commit

Permalink
Some cosmetic cleanups.
Browse files Browse the repository at this point in the history
  • Loading branch information
perim committed Nov 3, 2017
1 parent 10b39fc commit a81b3cf
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 16 deletions.
7 changes: 1 addition & 6 deletions src/action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1919,16 +1919,11 @@ static void actionDroidBase(DROID *psDroid, DROID_ACTION_DATA *psAction)
break;

case DACTION_ATTACK:
// can't attack without a weapon
// or yourself
if ((psDroid->asWeaps[0].nStat == 0) ||
isTransporter(psDroid) ||
(psAction->psObj == psDroid))
if (psDroid->asWeaps[0].nStat == 0 || isTransporter(psDroid) || psAction->psObj == psDroid)
{
break;
}

//check electronic droids only attack structures - not so anymore!
if (electronicDroid(psDroid))
{
//check for low or zero resistance - just zero resistance!
Expand Down
6 changes: 3 additions & 3 deletions src/combat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ int objArmour(BASE_OBJECT *psObj, WEAPON_CLASS weaponClass)
*/
int32_t objDamage(BASE_OBJECT *psObj, unsigned damage, unsigned originalhp, WEAPON_CLASS weaponClass, WEAPON_SUBCLASS weaponSubClass, bool isDamagePerSecond, int minDamage)
{
int actualDamage, level = 1, lastHit = psObj->timeLastHit;
int level = 1;
int armour = objArmour(psObj, weaponClass);

// If the previous hit was by an EMP cannon and this one is not:
Expand Down Expand Up @@ -401,7 +401,7 @@ int32_t objDamage(BASE_OBJECT *psObj, unsigned damage, unsigned originalhp, WEAP
bMultiMessages = bMultiPlayer;

clustObjectAttacked((BASE_OBJECT *)psObj);
triggerEventAttacked(psObj, g_pProjLastAttacker, lastHit);
triggerEventAttacked(psObj, g_pProjLastAttacker, psObj->timeLastHit);

bMultiMessages = bMultiMessagesBackup;
}
Expand All @@ -416,7 +416,7 @@ int32_t objDamage(BASE_OBJECT *psObj, unsigned damage, unsigned originalhp, WEAP
}

// Reduce damage taken by EXP_REDUCE_DAMAGE % for each experience level
actualDamage = (damage * (100 - EXP_REDUCE_DAMAGE * level)) / 100;
int actualDamage = (damage * (100 - EXP_REDUCE_DAMAGE * level)) / 100;

// Apply at least the minimum damage amount
actualDamage = MAX(actualDamage - armour, actualDamage * minDamage / 100);
Expand Down
10 changes: 4 additions & 6 deletions src/display3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2686,15 +2686,13 @@ bool eitherSelected(DROID *psDroid)
static void drawDroidSelections()
{
UDWORD scrX, scrY, scrR;
DROID *psDroid;
UDWORD damage;
PIELIGHT powerCol = WZCOL_BLACK, powerColShadow = WZCOL_BLACK;
PIELIGHT boxCol;
BASE_OBJECT *psClickedOn;
bool bMouseOverDroid = false;
bool bMouseOverOwnDroid = false;
UDWORD i, index;
FEATURE *psFeature;
float mulH;

psClickedOn = mouseTarget();
Expand All @@ -2709,7 +2707,7 @@ static void drawDroidSelections()

pie_SetDepthBufferStatus(DEPTH_CMP_ALWAYS_WRT_ON);
pie_SetFogStatus(false);
for (psDroid = apsDroidLists[selectedPlayer]; psDroid; psDroid = psDroid->psNext)
for (DROID *psDroid = apsDroidLists[selectedPlayer]; psDroid; psDroid = psDroid->psNext)
{
if (psDroid->sDisplay.frameNumber != currentGameFrame || !clipXY(psDroid->pos.x, psDroid->pos.y))
{
Expand Down Expand Up @@ -2793,7 +2791,7 @@ static void drawDroidSelections()
{
if (psClickedOn->player != selectedPlayer && psClickedOn->sDisplay.frameNumber == currentGameFrame)
{
psDroid = (DROID *)psClickedOn;
DROID *psDroid = (DROID *)psClickedOn;
//show resistance values if CTRL/SHIFT depressed
if (ctrlShiftDown())
{
Expand Down Expand Up @@ -2873,7 +2871,7 @@ static void drawDroidSelections()
for (i = 0; i < MAX_PLAYERS; i++)
{
/* Go thru' all the droidss */
for (psDroid = apsDroidLists[i]; psDroid; psDroid = psDroid->psNext)
for (const DROID *psDroid = apsDroidLists[i]; psDroid; psDroid = psDroid->psNext)
{
if (i != selectedPlayer && !psDroid->died && psDroid->sDisplay.frameNumber == currentGameFrame)
{
Expand All @@ -2889,7 +2887,7 @@ static void drawDroidSelections()
}
}

for (psFeature = apsFeatureLists[0]; psFeature; psFeature = psFeature->psNext)
for (const FEATURE *psFeature = apsFeatureLists[0]; psFeature; psFeature = psFeature->psNext)
{
if (!psFeature->died && psFeature->sDisplay.frameNumber == currentGameFrame)
{
Expand Down
1 change: 0 additions & 1 deletion src/order.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,6 @@ static bool tryDoRepairlikeAction(DROID *psDroid)
}

/** This function updates all the orders status, according with psdroid's current order and state.
* @todo This is as quite complex function. Suggestion to try to refactor it.
*/
void orderUpdateDroid(DROID *psDroid)
{
Expand Down

0 comments on commit a81b3cf

Please sign in to comment.