diff --git a/src/display.cpp b/src/display.cpp index 0fc00642e85..7996316f3b5 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -2125,7 +2125,7 @@ static void dealWithLMBDClick() { /* We clicked on structure */ psStructure = (STRUCTURE *) psClickedOn; - if (psStructure->player == selectedPlayer && !structureIsBlueprint(psStructure)) + if (psStructure->player == selectedPlayer && !psStructure->isBlueprint()) { if (psStructure->isFactory()) { @@ -2277,7 +2277,7 @@ static void dealWithRMB() triggerEventSelected(); jsDebugSelected(psStructure); } - else if (!structureIsBlueprint(psStructure)) + else if (!psStructure->isBlueprint()) { clearSelection(); diff --git a/src/display3d.cpp b/src/display3d.cpp index 63cbfe790bb..b126ceae44c 100644 --- a/src/display3d.cpp +++ b/src/display3d.cpp @@ -746,7 +746,7 @@ static PIELIGHT structureBrightness(STRUCTURE *psStructure) { PIELIGHT buildingBrightness; - if (structureIsBlueprint(psStructure)) + if (psStructure->isBlueprint()) { buildingBrightness = getBlueprintColour(psStructure->status); } @@ -2663,7 +2663,7 @@ static void renderStructureTurrets(STRUCTURE *psStructure, iIMDShape *strImd, PI } // flags for drawing weapons - if (structureIsBlueprint(psStructure)) + if (psStructure->isBlueprint()) { pieFlag = pie_TRANSLUCENT; pieFlagData = BLUEPRINT_OPACITY; @@ -2874,7 +2874,7 @@ void renderStructure(STRUCTURE *psStructure, const glm::mat4 &viewMatrix, const /* Draw the building's base first */ if (psStructure->pStructureType->pBaseIMD != nullptr) { - if (structureIsBlueprint(psStructure)) + if (psStructure->isBlueprint()) { pieFlagData = BLUEPRINT_OPACITY; } @@ -2920,7 +2920,7 @@ void renderStructure(STRUCTURE *psStructure, const glm::mat4 &viewMatrix, const return; } - if (structureIsBlueprint(psStructure)) + if (psStructure->isBlueprint()) { pieFlag = pie_TRANSLUCENT; pieFlagData = BLUEPRINT_OPACITY; @@ -2941,7 +2941,7 @@ void renderStructure(STRUCTURE *psStructure, const glm::mat4 &viewMatrix, const while (strImd) { float stretch = 0.f; - if (defensive && !structureIsBlueprint(psStructure) && !(strImd->flags & iV_IMD_NOSTRETCH)) + if (defensive && !psStructure->isBlueprint() && !(strImd->flags & iV_IMD_NOSTRETCH)) { stretch = psStructure->pos.z - psStructure->foundationDepth; } @@ -3049,7 +3049,7 @@ static bool renderWallSection(STRUCTURE *psStructure, const glm::mat4 &viewMatri } else { - if (structureIsBlueprint(psStructure)) + if (psStructure->isBlueprint()) { pieFlag = pie_TRANSLUCENT; pieFlagData = BLUEPRINT_OPACITY; diff --git a/src/structure.cpp b/src/structure.cpp index 1dce1b02b27..3f9e7335bc2 100644 --- a/src/structure.cpp +++ b/src/structure.cpp @@ -226,17 +226,17 @@ static int numStructureModules(STRUCTURE const *psStruct) return psStruct->capacity; } -bool structureIsBlueprint(const STRUCTURE *psStructure) +bool STRUCTURE::isBlueprint() const { - return (psStructure->status == SS_BLUEPRINT_VALID || - psStructure->status == SS_BLUEPRINT_INVALID || - psStructure->status == SS_BLUEPRINT_PLANNED || - psStructure->status == SS_BLUEPRINT_PLANNED_BY_ALLY); + return (status == SS_BLUEPRINT_VALID || + status == SS_BLUEPRINT_INVALID || + status == SS_BLUEPRINT_PLANNED || + status == SS_BLUEPRINT_PLANNED_BY_ALLY); } bool isBlueprint(const BASE_OBJECT *psObject) { - return psObject != nullptr && psObject->type == OBJ_STRUCTURE && structureIsBlueprint((const STRUCTURE *)psObject); + return psObject != nullptr && psObject->type == OBJ_STRUCTURE && ((const STRUCTURE*)psObject)->isBlueprint(); } void initStructLimits() diff --git a/src/structure.h b/src/structure.h index 7db3fe24cff..8056d7491ce 100644 --- a/src/structure.h +++ b/src/structure.h @@ -317,7 +317,6 @@ void changeProductionPlayer(UBYTE player); bool IsStatExpansionModule(const STRUCTURE_STATS *psStats); /// is this a blueprint and not a real structure? -bool structureIsBlueprint(const STRUCTURE *psStructure); bool isBlueprint(const BASE_OBJECT *psObject); /*returns the power cost to build this structure, or to add its next module */ diff --git a/src/structuredef.h b/src/structuredef.h index 1c32c2610a2..40ecdcb40f4 100644 --- a/src/structuredef.h +++ b/src/structuredef.h @@ -287,6 +287,8 @@ struct STRUCTURE : public BASE_OBJECT uint32_t structureBody() const; // Just returns true if the structure's present body points aren't as high as the original bool isDamaged() const; + // is this a blueprint and not a real structure? + bool isBlueprint() 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 */