From 45afc1f67bccb2b55ffb3f02752440f5e0782104 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <5415177+ZehMatt@users.noreply.github.com> Date: Sat, 26 Aug 2023 21:01:27 +0300 Subject: [PATCH] Properly name setter/getter for edge object index --- src/openrct2-ui/windows/TileInspector.cpp | 2 +- src/openrct2/EditorObjectSelectionSession.cpp | 2 +- src/openrct2/actions/SurfaceSetStyleAction.cpp | 6 +++--- src/openrct2/paint/tile_element/Paint.Surface.cpp | 4 ++-- src/openrct2/rct1/S4Importer.cpp | 2 +- src/openrct2/rct2/S6Importer.cpp | 2 +- src/openrct2/ride/TrackDesign.cpp | 2 +- src/openrct2/scripting/bindings/world/ScTileElement.cpp | 4 ++-- src/openrct2/world/Map.cpp | 6 +++--- src/openrct2/world/MapGen.cpp | 4 ++-- src/openrct2/world/Surface.cpp | 8 ++++---- src/openrct2/world/TileElement.h | 6 +++--- 12 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/openrct2-ui/windows/TileInspector.cpp b/src/openrct2-ui/windows/TileInspector.cpp index a8642f5e8f..e821c68513 100644 --- a/src/openrct2-ui/windows/TileInspector.cpp +++ b/src/openrct2-ui/windows/TileInspector.cpp @@ -1064,7 +1064,7 @@ public: // Edge texture name StringId terrainEdgeNameId = STR_EMPTY; - auto edgeStyle = tileElement->AsSurface()->GetEdgeStyleObject(); + auto edgeStyle = tileElement->AsSurface()->GetEdgeObject(); if (edgeStyle != nullptr) terrainEdgeNameId = edgeStyle->NameStringId; ft = Formatter(); diff --git a/src/openrct2/EditorObjectSelectionSession.cpp b/src/openrct2/EditorObjectSelectionSession.cpp index de6c3a36a6..d6bd5f1fb4 100644 --- a/src/openrct2/EditorObjectSelectionSession.cpp +++ b/src/openrct2/EditorObjectSelectionSession.cpp @@ -151,7 +151,7 @@ void SetupInUseSelectionFlags() { auto surfaceEl = iter.element->AsSurface(); auto surfaceIndex = surfaceEl->GetSurfaceObjectIndex(); - auto edgeIndex = surfaceEl->GetEdgeStyle(); + auto edgeIndex = surfaceEl->GetEdgeObjectIndex(); Editor::SetSelectedObject(ObjectType::TerrainSurface, surfaceIndex, ObjectSelectionFlags::InUse); Editor::SetSelectedObject(ObjectType::TerrainEdge, edgeIndex, ObjectSelectionFlags::InUse); diff --git a/src/openrct2/actions/SurfaceSetStyleAction.cpp b/src/openrct2/actions/SurfaceSetStyleAction.cpp index 266bf1614a..e4c9e8b6b1 100644 --- a/src/openrct2/actions/SurfaceSetStyleAction.cpp +++ b/src/openrct2/actions/SurfaceSetStyleAction.cpp @@ -128,7 +128,7 @@ GameActions::Result SurfaceSetStyleAction::Query() const if (_edgeStyle != OBJECT_ENTRY_INDEX_NULL) { - uint8_t curEdgeStyle = surfaceElement->GetEdgeStyle(); + uint8_t curEdgeStyle = surfaceElement->GetEdgeObjectIndex(); if (_edgeStyle != curEdgeStyle) { @@ -202,13 +202,13 @@ GameActions::Result SurfaceSetStyleAction::Execute() const if (_edgeStyle != OBJECT_ENTRY_INDEX_NULL) { - uint8_t curEdgeStyle = surfaceElement->GetEdgeStyle(); + uint8_t curEdgeStyle = surfaceElement->GetEdgeObjectIndex(); if (_edgeStyle != curEdgeStyle) { edgeCost += 100; - surfaceElement->SetEdgeStyle(_edgeStyle); + surfaceElement->SetEdgeObjectIndex(_edgeStyle); MapInvalidateTileFull(coords); } } diff --git a/src/openrct2/paint/tile_element/Paint.Surface.cpp b/src/openrct2/paint/tile_element/Paint.Surface.cpp index ecb093a8f6..a09298289a 100644 --- a/src/openrct2/paint/tile_element/Paint.Surface.cpp +++ b/src/openrct2/paint/tile_element/Paint.Surface.cpp @@ -1306,7 +1306,7 @@ void PaintSurface(PaintSession& session, uint8_t direction, uint16_t height, con if (!(session.ViewFlags & VIEWPORT_FLAG_HIDE_VERTICAL)) { - const auto edgeStyle = tileElement.GetEdgeStyle(); + const auto edgeStyle = tileElement.GetEdgeObjectIndex(); if (static_cast(edgeStyle) >= object_entry_group_counts[EnumValue(ObjectType::TerrainEdge)]) { LOG_VERBOSE("edgeStyle: %d", edgeStyle); @@ -1346,7 +1346,7 @@ void PaintSurface(PaintSession& session, uint8_t direction, uint16_t height, con if (!(session.ViewFlags & VIEWPORT_FLAG_HIDE_VERTICAL)) { // This wasn't in the original, but the code depended on globals that were only set in a different conditional - const uint32_t edgeStyle = tileElement.GetEdgeStyle(); + const uint32_t edgeStyle = tileElement.GetEdgeObjectIndex(); // end new code ViewportSurfaceDrawWaterSideBottom( diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 16c7a26e58..d17d7bf052 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1580,7 +1580,7 @@ namespace RCT1 dst2->SetSlope(src2->GetSlope()); dst2->SetSurfaceObjectIndex(surfaceStyle); - dst2->SetEdgeStyle(edgeStyle); + dst2->SetEdgeObjectIndex(edgeStyle); dst2->SetGrassLength(src2->GetGrassLength()); dst2->SetOwnership(src2->GetOwnership()); dst2->SetParkFences(src2->GetParkFences()); diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index e38f701a2f..0c9b780677 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1374,7 +1374,7 @@ namespace RCT2 dst2->SetSlope(src2->GetSlope()); dst2->SetSurfaceObjectIndex(src2->GetSurfaceStyle()); - dst2->SetEdgeStyle(src2->GetEdgeStyle()); + dst2->SetEdgeObjectIndex(src2->GetEdgeStyle()); dst2->SetGrassLength(src2->GetGrassLength()); dst2->SetOwnership(src2->GetOwnership()); diff --git a/src/openrct2/ride/TrackDesign.cpp b/src/openrct2/ride/TrackDesign.cpp index 2f4356f01a..c400d922d2 100644 --- a/src/openrct2/ride/TrackDesign.cpp +++ b/src/openrct2/ride/TrackDesign.cpp @@ -2229,7 +2229,7 @@ static void TrackDesignPreviewClearMap() element->AsSurface()->SetSlope(TILE_ELEMENT_SLOPE_FLAT); element->AsSurface()->SetWaterHeight(0); element->AsSurface()->SetSurfaceObjectIndex(0); - element->AsSurface()->SetEdgeStyle(0); + element->AsSurface()->SetEdgeObjectIndex(0); element->AsSurface()->SetGrassLength(GRASS_LENGTH_CLEAR_0); element->AsSurface()->SetOwnership(OWNERSHIP_OWNED); element->AsSurface()->SetParkFences(0); diff --git a/src/openrct2/scripting/bindings/world/ScTileElement.cpp b/src/openrct2/scripting/bindings/world/ScTileElement.cpp index 94c494b702..17f7072ac4 100644 --- a/src/openrct2/scripting/bindings/world/ScTileElement.cpp +++ b/src/openrct2/scripting/bindings/world/ScTileElement.cpp @@ -254,7 +254,7 @@ namespace OpenRCT2::Scripting auto* el = _element->AsSurface(); if (el != nullptr) { - duk_push_int(ctx, el->GetEdgeStyle()); + duk_push_int(ctx, el->GetEdgeObjectIndex()); } else { @@ -274,7 +274,7 @@ namespace OpenRCT2::Scripting return; } - el->SetEdgeStyle(value); + el->SetEdgeObjectIndex(value); Invalidate(); } diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index 6d7a5eab54..921d887654 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -159,7 +159,7 @@ static TileElement GetDefaultSurfaceElement() el.AsSurface()->SetOwnership(OWNERSHIP_UNOWNED); el.AsSurface()->SetParkFences(0); el.AsSurface()->SetSurfaceObjectIndex(0); - el.AsSurface()->SetEdgeStyle(0); + el.AsSurface()->SetEdgeObjectIndex(0); return el; } @@ -1353,7 +1353,7 @@ void MapRemoveOutOfRangeElements() static void MapExtendBoundarySurfaceExtendTile(const SurfaceElement& sourceTile, SurfaceElement& destTile) { destTile.SetSurfaceObjectIndex(sourceTile.GetSurfaceObjectIndex()); - destTile.SetEdgeStyle(sourceTile.GetEdgeStyle()); + destTile.SetEdgeObjectIndex(sourceTile.GetEdgeObjectIndex()); destTile.SetGrassLength(sourceTile.GetGrassLength()); destTile.SetOwnership(OWNERSHIP_UNOWNED); destTile.SetWaterHeight(sourceTile.GetWaterHeight()); @@ -1440,7 +1440,7 @@ static void ClearElementAt(const CoordsXY& loc, TileElement** elementPtr) element->Owner = 0; element->AsSurface()->SetSlope(TILE_ELEMENT_SLOPE_FLAT); element->AsSurface()->SetSurfaceObjectIndex(0); - element->AsSurface()->SetEdgeStyle(0); + element->AsSurface()->SetEdgeObjectIndex(0); element->AsSurface()->SetGrassLength(GRASS_LENGTH_CLEAR_0); element->AsSurface()->SetOwnership(OWNERSHIP_UNOWNED); element->AsSurface()->SetParkFences(0); diff --git a/src/openrct2/world/MapGen.cpp b/src/openrct2/world/MapGen.cpp index cd8026565d..3111d04391 100644 --- a/src/openrct2/world/MapGen.cpp +++ b/src/openrct2/world/MapGen.cpp @@ -130,7 +130,7 @@ void MapGenGenerateBlank(MapGenSettings* settings) if (surfaceElement != nullptr) { surfaceElement->SetSurfaceObjectIndex(settings->floor); - surfaceElement->SetEdgeStyle(settings->wall); + surfaceElement->SetEdgeObjectIndex(settings->wall); surfaceElement->BaseHeight = settings->height; surfaceElement->ClearanceHeight = settings->height; } @@ -194,7 +194,7 @@ void MapGenGenerate(MapGenSettings* settings) if (surfaceElement != nullptr) { surfaceElement->SetSurfaceObjectIndex(floorTextureId); - surfaceElement->SetEdgeStyle(edgeTextureId); + surfaceElement->SetEdgeObjectIndex(edgeTextureId); surfaceElement->BaseHeight = settings->height; surfaceElement->ClearanceHeight = settings->height; } diff --git a/src/openrct2/world/Surface.cpp b/src/openrct2/world/Surface.cpp index 347a767088..8ad69c7236 100644 --- a/src/openrct2/world/Surface.cpp +++ b/src/openrct2/world/Surface.cpp @@ -28,15 +28,15 @@ TerrainSurfaceObject* SurfaceElement::GetSurfaceStyleObject() const return static_cast(objManager.GetLoadedObject(ObjectType::TerrainSurface, GetSurfaceObjectIndex())); } -ObjectEntryIndex SurfaceElement::GetEdgeStyle() const +ObjectEntryIndex SurfaceElement::GetEdgeObjectIndex() const { return EdgeObjectIndex; } -TerrainEdgeObject* SurfaceElement::GetEdgeStyleObject() const +TerrainEdgeObject* SurfaceElement::GetEdgeObject() const { auto& objManager = OpenRCT2::GetContext()->GetObjectManager(); - return static_cast(objManager.GetLoadedObject(ObjectType::TerrainEdge, GetEdgeStyle())); + return static_cast(objManager.GetLoadedObject(ObjectType::TerrainEdge, GetEdgeObjectIndex())); } void SurfaceElement::SetSurfaceObjectIndex(ObjectEntryIndex newStyle) @@ -44,7 +44,7 @@ void SurfaceElement::SetSurfaceObjectIndex(ObjectEntryIndex newStyle) SurfaceStyle = static_cast(newStyle); } -void SurfaceElement::SetEdgeStyle(ObjectEntryIndex newIndex) +void SurfaceElement::SetEdgeObjectIndex(ObjectEntryIndex newIndex) { EdgeObjectIndex = static_cast(newIndex); } diff --git a/src/openrct2/world/TileElement.h b/src/openrct2/world/TileElement.h index e5d0bff3cc..d71716ab04 100644 --- a/src/openrct2/world/TileElement.h +++ b/src/openrct2/world/TileElement.h @@ -209,9 +209,9 @@ public: TerrainSurfaceObject* GetSurfaceStyleObject() const; void SetSurfaceObjectIndex(ObjectEntryIndex newStyle); - ObjectEntryIndex GetEdgeStyle() const; - TerrainEdgeObject* GetEdgeStyleObject() const; - void SetEdgeStyle(ObjectEntryIndex newStyle); + ObjectEntryIndex GetEdgeObjectIndex() const; + TerrainEdgeObject* GetEdgeObject() const; + void SetEdgeObjectIndex(ObjectEntryIndex newStyle); bool CanGrassGrow() const; uint8_t GetGrassLength() const;