Skip to content

Commit

Permalink
STRUCTURE: change structIsDamaged() free function into `isDamaged()…
Browse files Browse the repository at this point in the history
…` member function

Signed-off-by: Pavel Solodovnikov <[email protected]>
  • Loading branch information
ManManson committed Jan 16, 2024
1 parent 2ae787a commit 9e346a3
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/order.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ static std::pair<STRUCTURE *, DROID_ACTION> checkForDamagedStruct(DROID *psDroid
}

// Check for structures to repair.
if (structure->status == SS_BUILT && structIsDamaged(structure))
if (structure->status == SS_BUILT && structure->isDamaged())
{
bestDistanceSq = distanceSq;
best = {structure, DACTION_REPAIR};
Expand Down
4 changes: 2 additions & 2 deletions src/structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6735,9 +6735,9 @@ bool vtolOnRearmPad(const STRUCTURE *psStruct, const DROID *psDroid)


/* Just returns true if the structure's present body points aren't as high as the original*/
bool structIsDamaged(const STRUCTURE *psStruct)
bool STRUCTURE::isDamaged() const
{
return psStruct->body < psStruct->structureBody();
return body < structureBody();
}

// give a structure from one player to another - used in Electronic Warfare
Expand Down
3 changes: 0 additions & 3 deletions src/structure.h
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,6 @@ void ensureRearmPadClear(STRUCTURE *psStruct, DROID *psDroid);
// return whether a rearm pad has a vtol on it
bool vtolOnRearmPad(const STRUCTURE *psStruct, const DROID *psDroid);

/* Just returns true if the structure's present body points aren't as high as the original*/
bool structIsDamaged(const STRUCTURE *psStruct);

// give a structure from one player to another - used in Electronic Warfare
STRUCTURE *giftSingleStructure(STRUCTURE *psStructure, UBYTE attackPlayer, bool electronic_warfare = true);

Expand Down
2 changes: 2 additions & 0 deletions src/structuredef.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ struct STRUCTURE : public BASE_OBJECT
// Return true if structure is a factory of any type.
bool isFactory() const;
uint32_t structureBody() const;
// Just returns true if the structure's present body points aren't as high as the original
bool isDamaged() const;

STRUCTURE_STATS *pStructureType; /* pointer to the structure stats for this type of building */
STRUCT_STATES status; /* defines whether the structure is being built, doing nothing or performing a function */
Expand Down

0 comments on commit 9e346a3

Please sign in to comment.