Make TileElement.h adhere to code style

This commit is contained in:
Gymnasiast committed 2026-08-11 22:17:52 +02:00
1 parent bdbe9013cc
commit ac2515d483
20 files changed
+50 -50

No files matched your search

@@ -317,7 +317,7 @@ namespace OpenRCT2::Ui
return info;
}
ride = GetRide(tileElement->GetRideIndex());
ride = GetRide(tileElement->getRideIndex());
if (ride == nullptr)
{
info.interactionType = ViewportInteractionItem::none;
+1 -1
View File
@@ -7296,7 +7296,7 @@ namespace OpenRCT2::Ui::Windows
WindowBase* RideOpenTrack(TileElement* tileElement)
{
assert(tileElement != nullptr);
auto rideIndex = tileElement->GetRideIndex();
auto rideIndex = tileElement->getRideIndex();
if (!rideIndex.IsNull())
{
auto ride = GetRide(rideIndex);
+1 -1
View File
@@ -1914,7 +1914,7 @@ namespace OpenRCT2::Ui::Windows
// Copy value, in case the element gets moved
_copiedElement = *tileElement;
_copiedBanner = {};
auto bannerIndex = _copiedElement.GetBannerIndex();
auto bannerIndex = _copiedElement.getBannerIndex();
if (bannerIndex != BannerIndex::GetNull())
{
auto banner = GetBanner(bannerIndex);
@@ -129,7 +129,7 @@ namespace OpenRCT2::GameActions
res.cost = -((bannerEntry->price * 3) / 4);
}
reinterpret_cast<TileElement*>(bannerElement)->RemoveBannerEntry();
reinterpret_cast<TileElement*>(bannerElement)->removeBannerEntry();
MapInvalidateTileZoom1({ _loc, _loc.z, _loc.z + 32 });
bannerElement->remove();
@@ -151,7 +151,7 @@ namespace OpenRCT2::GameActions
return Result(Status::unknown, STR_CANT_REMOVE_THIS, kStringIdNone);
}
tileElement->RemoveBannerEntry();
tileElement->removeBannerEntry();
auto rotatedFirstTile = CoordsXYZ{ CoordsXY{ sceneryEntry->tiles[_tileIndex].offset }.Rotate(_loc.direction),
sceneryEntry->tiles[_tileIndex].offset.z };
@@ -84,7 +84,7 @@ namespace OpenRCT2::GameActions
res.position.y = _loc.y + 16;
res.position.z = _loc.z;
wallElement->RemoveBannerEntry();
wallElement->removeBannerEntry();
MapInvalidateTileZoom1({ _loc, wallElement->getBaseZ(), (wallElement->getBaseZ()) + 72 });
TileElementRemove(wallElement);
+4 -4
View File
@@ -461,11 +461,11 @@ namespace OpenRCT2
stream->WriteValue(tileElement.baseHeight);
stream->WriteValue(tileElement.clearanceHeight);
stream->WriteValue(tileElement.owner);
for (auto v : tileElement.Pad05)
for (auto v : tileElement.pad05)
{
stream->WriteValue(v);
}
for (auto v : tileElement.Pad08)
for (auto v : tileElement.pad08)
{
stream->WriteValue(v);
}
@@ -477,11 +477,11 @@ namespace OpenRCT2
tileElement.baseHeight = stream->ReadValue<uint8_t>();
tileElement.clearanceHeight = stream->ReadValue<uint8_t>();
tileElement.owner = stream->ReadValue<uint8_t>();
for (auto& v : tileElement.Pad05)
for (auto& v : tileElement.pad05)
{
v = stream->ReadValue<uint8_t>();
}
for (auto& v : tileElement.Pad08)
for (auto& v : tileElement.pad08)
{
v = stream->ReadValue<uint8_t>();
}
+1 -1
View File
@@ -38,7 +38,7 @@ namespace OpenRCT2
if (!(pathBaseZ <= mapPos.z && pathTopZ >= mapPos.z))
continue;
return !TileElementIsUnderground(tileElement);
return !tileElementIsUnderground(tileElement);
} while (!(tileElement++)->isLastForTile());
return false;
}
+2 -2
View File
@@ -1614,7 +1614,7 @@ namespace OpenRCT2::RCT1
{
// Add a default surface element, we always need at least one element per tile
auto& dstElement = tileElements.emplace_back();
dstElement.ClearAs(TileElementType::surface);
dstElement.clearAs(TileElementType::surface);
dstElement.setLastForTile(true);
}
@@ -1635,7 +1635,7 @@ namespace OpenRCT2::RCT1
{
const auto rct12type = src->getType();
const auto tileElementType = ToOpenRCT2TileElementType(rct12type);
dst->ClearAs(tileElementType);
dst->clearAs(tileElementType);
dst->setDirection(src->getDirection());
// All saved in "flags"
+2 -2
View File
@@ -1297,7 +1297,7 @@ namespace OpenRCT2::RCT2
{
// Add a default surface element, we always need at least one element per tile
auto& dstElement = tileElements.emplace_back();
dstElement.ClearAs(TileElementType::surface);
dstElement.clearAs(TileElementType::surface);
dstElement.setLastForTile(true);
}
@@ -1314,7 +1314,7 @@ namespace OpenRCT2::RCT2
void ImportTileElement(TileElement* dst, const RCT12TileElement* src, bool invisible)
{
const auto rct12Type = src->getType();
dst->ClearAs(ToOpenRCT2TileElementType(rct12Type));
dst->clearAs(ToOpenRCT2TileElementType(rct12Type));
dst->setDirection(src->getDirection());
dst->setBaseZ(src->baseHeight * kCoordsZStep);
dst->setClearanceZ(src->clearanceHeight * kCoordsZStep);
+1 -1
View File
@@ -1165,7 +1165,7 @@ namespace OpenRCT2
if (tileElement.element == nullptr)
return false;
auto rideIndex = tileElement.element->GetRideIndex();
auto rideIndex = tileElement.element->getRideIndex();
auto ride = GetRide(rideIndex);
if (ride == nullptr)
{
+1 -1
View File
@@ -2170,7 +2170,7 @@ static void TrackDesignPreviewClearMap()
for (int32_t i = 0; i < numTiles; i++)
{
auto* element = &tileElements.emplace_back();
element->ClearAs(TileElementType::surface);
element->clearAs(TileElementType::surface);
element->setLastForTile(true);
element->asSurface()->SetSlope(kTileSlopeFlat);
element->asSurface()->SetWaterHeight(0);
@@ -191,7 +191,7 @@ namespace OpenRCT2::Scripting
|| element->asLargeScenery()->GetEntry()->scrolling_mode == kScrollingModeNone
|| ScTileElement::GetOtherLargeSceneryElement(coords, element->asLargeScenery()) == nullptr)
{
element->RemoveBannerEntry();
element->removeBannerEntry();
}
TileElementRemove(&first[index]);
MapInvalidateTileFull(coords);
@@ -1666,7 +1666,7 @@ namespace OpenRCT2::Scripting
JSValue ScTileElement::bannerIndex_get(JSContext* ctx, JSValue thisValue)
{
auto data = gScTileElement.GetOpaque<OpaqueTileElementData*>(thisValue);
BannerIndex idx = data->element->GetBannerIndex();
BannerIndex idx = data->element->getBannerIndex();
if (idx == BannerIndex::GetNull())
return JS_NULL;
else
@@ -2249,7 +2249,7 @@ namespace OpenRCT2::Scripting
JSValue ScTileElement::bannerText_get(JSContext* ctx, JSValue thisValue)
{
auto data = gScTileElement.GetOpaque<OpaqueTileElementData*>(thisValue);
BannerIndex idx = data->element->GetBannerIndex();
BannerIndex idx = data->element->getBannerIndex();
if (idx == BannerIndex::GetNull())
return JS_NULL;
else
@@ -2261,7 +2261,7 @@ namespace OpenRCT2::Scripting
JS_THROW_IF_GAME_STATE_NOT_MUTABLE();
auto data = gScTileElement.GetOpaque<OpaqueTileElementData*>(thisValue);
auto element = data->element;
BannerIndex idx = element->GetBannerIndex();
BannerIndex idx = element->getBannerIndex();
if (idx != BannerIndex::GetNull())
{
auto banner = GetBanner(idx);
@@ -2356,7 +2356,7 @@ namespace OpenRCT2::Scripting
&& GetOtherLargeSceneryElement(coords, element->asLargeScenery()) != nullptr)
return;
// remove banner entry (if one exists)
element->RemoveBannerEntry();
element->removeBannerEntry();
}
void ScTileElement::CreateBannerEntryIfNeeded(TileElement* element, CoordsXY& coords)
@@ -2420,7 +2420,7 @@ namespace OpenRCT2::Scripting
}
}
element->SetBannerIndex(banner->id);
element->setBannerIndex(banner->id);
}
}
+1 -1
View File
@@ -149,7 +149,7 @@ TileElement* BannerGetTileElement(BannerIndex bannerIndex)
{
do
{
if (tileElement->GetBannerIndex() == bannerIndex)
if (tileElement->getBannerIndex() == bannerIndex)
{
return tileElement;
}
+3 -3
View File
@@ -136,7 +136,7 @@ namespace OpenRCT2
static TileElement GetDefaultSurfaceElement()
{
TileElement el;
el.ClearAs(TileElementType::surface);
el.clearAs(TileElementType::surface);
el.setLastForTile(true);
el.baseHeight = 14;
el.clearanceHeight = 14;
@@ -1152,8 +1152,8 @@ namespace OpenRCT2
newTileElement->setOccupiedQuadrants(occupiedQuadrants);
newTileElement->setClearanceZ(loc.z);
newTileElement->owner = 0;
std::memset(&newTileElement->Pad05, 0, sizeof(newTileElement->Pad05));
std::memset(&newTileElement->Pad08, 0, sizeof(newTileElement->Pad08));
std::memset(&newTileElement->pad05, 0, sizeof(newTileElement->pad05));
std::memset(&newTileElement->pad08, 0, sizeof(newTileElement->pad08));
newTileElement++;
// Insert rest of map elements above insert height
+4 -4
View File
@@ -154,13 +154,13 @@ namespace OpenRCT2::TileInspector
// Only delete the banner entry if there are no other parts of the large scenery to delete
if (NumLargeScenerySequences(loc, largeScenery) == 1)
{
tileElement->RemoveBannerEntry();
tileElement->removeBannerEntry();
}
}
else
{
// Removes any potential banners from the entry
tileElement->RemoveBannerEntry();
tileElement->removeBannerEntry();
}
TileElementRemove(tileElement);
@@ -313,7 +313,7 @@ namespace OpenRCT2::TileInspector
if (isExecuting)
{
// Check if the element to be pasted has a banner
if (element.GetBannerIndex() != BannerIndex::GetNull())
if (element.getBannerIndex() != BannerIndex::GetNull())
{
// The element to be pasted has a banner - make a copy of it from the banner provided
auto newBanner = CreateBanner();
@@ -337,7 +337,7 @@ namespace OpenRCT2::TileInspector
}
// Use the new banner index
element.SetBannerIndex(newBanner->id);
element.setBannerIndex(newBanner->id);
}
// The occupiedQuadrants will be automatically set when the element is copied over, so it's not necessary to set
+2 -2
View File
@@ -23,7 +23,7 @@ void WallRemoveAt(const CoordsXYRangedZ& wallPos)
{
for (auto wallElement = MapGetWallElementAt(wallPos); wallElement != nullptr; wallElement = MapGetWallElementAt(wallPos))
{
reinterpret_cast<TileElement*>(wallElement)->RemoveBannerEntry();
reinterpret_cast<TileElement*>(wallElement)->removeBannerEntry();
MapInvalidateTileZoom1({ wallPos, wallElement->getBaseZ(), wallElement->getBaseZ() + 72 });
TileElementRemove(reinterpret_cast<TileElement*>(wallElement));
}
@@ -58,7 +58,7 @@ void WallRemoveIntersectingWalls(const CoordsXYRangedZ& wallPos, Direction direc
if (direction != tileElement->getDirection())
continue;
tileElement->RemoveBannerEntry();
tileElement->removeBannerEntry();
MapInvalidateTileZoom1({ wallPos, tileElement->getBaseZ(), tileElement->getBaseZ() + 72 });
TileElementRemove(tileElement);
tileElement--;
@@ -24,7 +24,7 @@
namespace OpenRCT2
{
BannerIndex TileElement::GetBannerIndex() const
BannerIndex TileElement::getBannerIndex() const
{
switch (getType())
{
@@ -51,7 +51,7 @@ namespace OpenRCT2
}
}
void TileElement::SetBannerIndex(BannerIndex bannerIndex)
void TileElement::setBannerIndex(BannerIndex bannerIndex)
{
switch (getType())
{
@@ -70,9 +70,9 @@ namespace OpenRCT2
}
}
void TileElement::RemoveBannerEntry()
void TileElement::removeBannerEntry()
{
auto bannerIndex = GetBannerIndex();
auto bannerIndex = getBannerIndex();
auto banner = GetBanner(bannerIndex);
if (banner != nullptr)
{
@@ -82,7 +82,7 @@ namespace OpenRCT2
}
}
RideId TileElement::GetRideIndex() const
RideId TileElement::getRideIndex() const
{
switch (getType())
{
@@ -97,7 +97,7 @@ namespace OpenRCT2
}
}
void TileElement::ClearAs(TileElementType newType)
void TileElement::clearAs(TileElementType newType)
{
type = 0;
setType(newType);
@@ -105,11 +105,11 @@ namespace OpenRCT2
baseHeight = kMinimumLandHeight;
clearanceHeight = kMinimumLandHeight;
owner = 0;
std::fill_n(Pad05, sizeof(Pad05), 0x00);
std::fill_n(Pad08, sizeof(Pad08), 0x00);
std::fill_n(pad05, sizeof(pad05), 0x00);
std::fill_n(pad08, sizeof(pad08), 0x00);
}
bool TileElementIsUnderground(TileElement* tileElement)
bool tileElementIsUnderground(TileElement* tileElement)
{
do
{
@@ -21,20 +21,20 @@ namespace OpenRCT2
*/
struct TileElement : public TileElementBase
{
uint8_t Pad05[3];
uint8_t Pad08[8];
uint8_t pad05[3];
uint8_t pad08[8];
void ClearAs(TileElementType newType);
void clearAs(TileElementType newType);
RideId GetRideIndex() const;
RideId getRideIndex() const;
void SetBannerIndex(BannerIndex newIndex);
void RemoveBannerEntry();
BannerIndex GetBannerIndex() const;
void setBannerIndex(BannerIndex newIndex);
void removeBannerEntry();
BannerIndex getBannerIndex() const;
};
static_assert(sizeof(TileElement) == kTileElementSize);
bool TileElementIsUnderground(TileElement* tileElement);
bool tileElementIsUnderground(TileElement* tileElement);
#pragma pack(pop)
} // namespace OpenRCT2