Skip to content

Commit

Permalink
Code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Monsterovich committed Oct 28, 2024
1 parent f1d501c commit 6ac6013
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/droid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -991,17 +991,17 @@ void droidUpdateShields(DROID *psDroid)
}
}

uint32_t droidCalculateShieldRegenTime(DROID *psDroid)
UDWORD droidCalculateShieldRegenTime(const DROID *psDroid)
{
return DROID_INITIAL_SHIELD_REGEN_TIME - (DROID_SHIELD_REGEN_TIME_DEC * getDroidLevel(psDroid));
}

uint32_t droidCalculateShieldInterruptRegenTime(DROID *psDroid)
UDWORD droidCalculateShieldInterruptRegenTime(const DROID *psDroid)
{
return DROID_INITIAL_SHIELD_INTERRUPT_REGEN_TIME - (DROID_SHIELD_INTERRUPT_REGEN_TIME_DEC * getDroidLevel(psDroid));
}

int32_t droidGetMaxShieldPoints(DROID *psDroid)
UDWORD droidGetMaxShieldPoints(const DROID *psDroid)
{
UDWORD percent = psDroid->originalBody / 100;
return percent * (DROID_INITIAL_SHILED_POINTS_PERCENT + DROID_ADDITVE_SHILED_POINTS_PERCENT * getDroidLevel(psDroid));
Expand Down
6 changes: 3 additions & 3 deletions src/droid.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ void droidUpdate(DROID *psDroid);
void droidUpdateShields(DROID *psDroid);

/* Calculate the droid's shield regeneration step time */
uint32_t droidCalculateShieldRegenTime(DROID *psDroid);
UDWORD droidCalculateShieldRegenTime(const DROID *psDroid);

/* Calculate the droid's shield interruption time */
uint32_t droidCalculateShieldInterruptRegenTime(DROID *psDroid);
UDWORD droidCalculateShieldInterruptRegenTime(const DROID *psDroid);

/* Get droid maximum shield points */
int32_t droidGetMaxShieldPoints(DROID *psDroid);
UDWORD droidGetMaxShieldPoints(const DROID *psDroid);

/* Set up a droid to build a structure - returns true if successful */
enum DroidStartBuild {DroidStartBuildFailed, DroidStartBuildSuccess, DroidStartBuildPending};
Expand Down
6 changes: 3 additions & 3 deletions src/droiddef.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ struct DROID : public BASE_OBJECT
UDWORD baseSpeed; ///< the base speed dependent on propulsion type
UDWORD originalBody; ///< the original body points
uint32_t experience;
int32_t shieldPoints;
UDWORD shieldRegenTime;
UDWORD shieldInterruptRegenTime;
SDWORD shieldPoints; ///< Shield points of droid, which will be drained instead of health
UDWORD shieldRegenTime; ///< How long should it be before the next regeneration step
UDWORD shieldInterruptRegenTime; ///< Standby time in case the shield was destroyed to begin regenerating again
uint32_t kills;
UDWORD lastFrustratedTime; ///< Set when eg being stuck; used for eg firing indiscriminately at map features to clear the way
SWORD resistance; ///< used in Electronic Warfare
Expand Down

0 comments on commit 6ac6013

Please sign in to comment.