From 9e346a32fdc0fd0db2fab23cfc3a618219acd09c Mon Sep 17 00:00:00 2001 From: Pavel Solodovnikov Date: Sun, 14 Jan 2024 14:22:49 +0300 Subject: [PATCH] STRUCTURE: change `structIsDamaged()` free function into `isDamaged()` member function Signed-off-by: Pavel Solodovnikov --- src/order.cpp | 2 +- src/structure.cpp | 4 ++-- src/structure.h | 3 --- src/structuredef.h | 2 ++ 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/order.cpp b/src/order.cpp index 3dc93b7aa5f..d3efc6c1571 100644 --- a/src/order.cpp +++ b/src/order.cpp @@ -319,7 +319,7 @@ static std::pair 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}; diff --git a/src/structure.cpp b/src/structure.cpp index 441f6d30ef8..1dce1b02b27 100644 --- a/src/structure.cpp +++ b/src/structure.cpp @@ -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 diff --git a/src/structure.h b/src/structure.h index 7ba5e401d1e..7db3fe24cff 100644 --- a/src/structure.h +++ b/src/structure.h @@ -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); diff --git a/src/structuredef.h b/src/structuredef.h index a69278f043e..1c32c2610a2 100644 --- a/src/structuredef.h +++ b/src/structuredef.h @@ -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 */