Permalink
Browse files

Some cosmetic cleanups.

  • Loading branch information...
perim committed Nov 3, 2017
1 parent 10b39fc commit a81b3cf552f207fa3087ae8644edcd79fb273442
Showing with 8 additions and 16 deletions.
  1. +1 −6 src/action.cpp
  2. +3 −3 src/combat.cpp
  3. +4 −6 src/display3d.cpp
  4. +0 −1 src/order.cpp
View
@@ -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!
View
@@ -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:
@@ -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;
}
@@ -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);
View
@@ -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();
@@ -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))
{
@@ -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())
{
@@ -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)
{
@@ -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)
{
View
@@ -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)
{

0 comments on commit a81b3cf

Please sign in to comment.