forked from rosebudai/OpenRCT2-Web
Merge pull request #25798 from Gymnasiast/refactor/footpath-related-names-b
Rename footpath related struct members
This commit is contained in:
9 files changed
+124
-123
No files matched your search
@@ -203,8 +203,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
ParkEntranceRemoveGhost();
|
||||
|
||||
bool isLegacyPath = (gFootpathSelection.LegacyPath != kObjectEntryIndexNull);
|
||||
auto pathIndex = isLegacyPath ? gFootpathSelection.LegacyPath : gFootpathSelection.NormalSurface;
|
||||
bool isLegacyPath = (gFootpathSelection.legacyPath != kObjectEntryIndexNull);
|
||||
auto pathIndex = isLegacyPath ? gFootpathSelection.legacyPath : gFootpathSelection.normalSurface;
|
||||
auto gameAction = GameActions::ParkEntrancePlaceAction(
|
||||
parkEntrancePosition, pathIndex, _selectedEntranceType, isLegacyPath);
|
||||
gameAction.SetFlags({ CommandFlag::ghost });
|
||||
@@ -226,8 +226,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
CoordsXYZD parkEntrancePosition = PlaceParkEntranceGetMapPosition(screenCoords);
|
||||
if (!parkEntrancePosition.IsNull())
|
||||
{
|
||||
bool isLegacyPath = (gFootpathSelection.LegacyPath != kObjectEntryIndexNull);
|
||||
auto pathIndex = isLegacyPath ? gFootpathSelection.LegacyPath : gFootpathSelection.NormalSurface;
|
||||
bool isLegacyPath = (gFootpathSelection.legacyPath != kObjectEntryIndexNull);
|
||||
auto pathIndex = isLegacyPath ? gFootpathSelection.legacyPath : gFootpathSelection.normalSurface;
|
||||
auto gameAction = GameActions::ParkEntrancePlaceAction(
|
||||
parkEntrancePosition, pathIndex, _selectedEntranceType, isLegacyPath);
|
||||
gameAction.SetCallback(
|
||||
|
||||
@@ -413,33 +413,33 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto entryIndex = _dropdownEntries[selectedIndex];
|
||||
if (widgetIndex == WIDX_FOOTPATH_TYPE)
|
||||
{
|
||||
gFootpathSelection.IsQueueSelected = false;
|
||||
gFootpathSelection.isQueueSelected = false;
|
||||
if (entryIndex.first == ObjectType::paths)
|
||||
{
|
||||
gFootpathSelection.LegacyPath = entryIndex.second;
|
||||
gFootpathSelection.legacyPath = entryIndex.second;
|
||||
}
|
||||
else
|
||||
{
|
||||
gFootpathSelection.LegacyPath = kObjectEntryIndexNull;
|
||||
gFootpathSelection.NormalSurface = entryIndex.second;
|
||||
gFootpathSelection.legacyPath = kObjectEntryIndexNull;
|
||||
gFootpathSelection.normalSurface = entryIndex.second;
|
||||
}
|
||||
}
|
||||
else if (widgetIndex == WIDX_QUEUELINE_TYPE)
|
||||
{
|
||||
gFootpathSelection.IsQueueSelected = true;
|
||||
gFootpathSelection.isQueueSelected = true;
|
||||
if (entryIndex.first == ObjectType::paths)
|
||||
{
|
||||
gFootpathSelection.LegacyPath = entryIndex.second;
|
||||
gFootpathSelection.legacyPath = entryIndex.second;
|
||||
}
|
||||
else
|
||||
{
|
||||
gFootpathSelection.LegacyPath = kObjectEntryIndexNull;
|
||||
gFootpathSelection.QueueSurface = entryIndex.second;
|
||||
gFootpathSelection.legacyPath = kObjectEntryIndexNull;
|
||||
gFootpathSelection.queueSurface = entryIndex.second;
|
||||
}
|
||||
}
|
||||
else if (widgetIndex == WIDX_RAILINGS_TYPE)
|
||||
{
|
||||
gFootpathSelection.Railings = entryIndex.second;
|
||||
gFootpathSelection.railings = entryIndex.second;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -527,7 +527,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
// Press / unpress footpath and queue type buttons
|
||||
pressedWidgets &= ~(1uLL << WIDX_FOOTPATH_TYPE);
|
||||
pressedWidgets &= ~(1uLL << WIDX_QUEUELINE_TYPE);
|
||||
pressedWidgets |= gFootpathSelection.IsQueueSelected ? (1uLL << WIDX_QUEUELINE_TYPE) : (1uLL << WIDX_FOOTPATH_TYPE);
|
||||
pressedWidgets |= gFootpathSelection.isQueueSelected ? (1uLL << WIDX_QUEUELINE_TYPE) : (1uLL << WIDX_FOOTPATH_TYPE);
|
||||
|
||||
// Enable / disable construct button
|
||||
widgets[WIDX_CONSTRUCT].type = _footpathConstructionMode == PathConstructionMode::bridgeOrTunnel
|
||||
@@ -546,7 +546,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
disabledWidgets |= (1uLL << WIDX_CONSTRUCT_DRAG_AREA);
|
||||
#endif
|
||||
|
||||
if (gFootpathSelection.LegacyPath == kObjectEntryIndexNull)
|
||||
if (gFootpathSelection.legacyPath == kObjectEntryIndexNull)
|
||||
{
|
||||
widgets[WIDX_RAILINGS_TYPE].type = WidgetType::flatBtn;
|
||||
}
|
||||
@@ -569,9 +569,9 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto slopeOffset = EnumValue(_footpathConstructSlope);
|
||||
|
||||
std::optional<uint32_t> baseImage;
|
||||
if (gFootpathSelection.LegacyPath == kObjectEntryIndexNull)
|
||||
if (gFootpathSelection.legacyPath == kObjectEntryIndexNull)
|
||||
{
|
||||
auto selectedPath = gFootpathSelection.GetSelectedSurface();
|
||||
auto selectedPath = gFootpathSelection.getSelectedSurface();
|
||||
const auto* pathType = GetPathSurfaceEntry(selectedPath);
|
||||
if (pathType != nullptr)
|
||||
{
|
||||
@@ -581,11 +581,11 @@ namespace OpenRCT2::Ui::Windows
|
||||
else
|
||||
{
|
||||
auto& objManager = OpenRCT2::GetContext()->GetObjectManager();
|
||||
const auto* pathObj = objManager.GetLoadedObject<FootpathObject>(gFootpathSelection.LegacyPath);
|
||||
const auto* pathObj = objManager.GetLoadedObject<FootpathObject>(gFootpathSelection.legacyPath);
|
||||
if (pathObj != nullptr)
|
||||
{
|
||||
auto pathEntry = reinterpret_cast<const FootpathEntry*>(pathObj->GetLegacyData());
|
||||
if (gFootpathSelection.IsQueueSelected)
|
||||
if (gFootpathSelection.isQueueSelected)
|
||||
baseImage = pathEntry->GetQueueImage();
|
||||
else
|
||||
baseImage = pathEntry->image;
|
||||
@@ -647,7 +647,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
if (!_provisionalFootpath.flags.has(ProvisionalPathFlag::placed))
|
||||
{
|
||||
ObjectEntryIndex type;
|
||||
ObjectEntryIndex railings = gFootpathSelection.Railings;
|
||||
ObjectEntryIndex railings = gFootpathSelection.railings;
|
||||
|
||||
CoordsXYZ footpathLoc;
|
||||
FootpathSlope slope;
|
||||
@@ -686,18 +686,18 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void WindowFootpathDrawDropdownButtons(Drawing::RenderTarget& rt)
|
||||
{
|
||||
if (gFootpathSelection.LegacyPath == kObjectEntryIndexNull)
|
||||
if (gFootpathSelection.legacyPath == kObjectEntryIndexNull)
|
||||
{
|
||||
// Set footpath and queue type button images
|
||||
auto pathImage = kImageIndexUndefined;
|
||||
auto queueImage = kImageIndexUndefined;
|
||||
auto pathEntry = GetPathSurfaceEntry(gFootpathSelection.NormalSurface);
|
||||
auto pathEntry = GetPathSurfaceEntry(gFootpathSelection.normalSurface);
|
||||
if (pathEntry != nullptr)
|
||||
{
|
||||
pathImage = pathEntry->PreviewImageId;
|
||||
}
|
||||
|
||||
pathEntry = GetPathSurfaceEntry(gFootpathSelection.QueueSurface);
|
||||
pathEntry = GetPathSurfaceEntry(gFootpathSelection.queueSurface);
|
||||
if (pathEntry != nullptr)
|
||||
{
|
||||
queueImage = pathEntry->PreviewImageId;
|
||||
@@ -708,7 +708,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
// Set railing
|
||||
auto railingsImage = kImageIndexUndefined;
|
||||
auto railingsEntry = GetPathRailingsEntry(gFootpathSelection.Railings);
|
||||
auto railingsEntry = GetPathRailingsEntry(gFootpathSelection.railings);
|
||||
if (railingsEntry != nullptr)
|
||||
{
|
||||
railingsImage = railingsEntry->PreviewImageId;
|
||||
@@ -722,7 +722,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
// Set footpath and queue type button images
|
||||
auto pathImage = kImageIndexUndefined;
|
||||
auto queueImage = kImageIndexUndefined;
|
||||
const auto* pathObj = objManager.GetLoadedObject<FootpathObject>(gFootpathSelection.LegacyPath);
|
||||
const auto* pathObj = objManager.GetLoadedObject<FootpathObject>(gFootpathSelection.legacyPath);
|
||||
if (pathObj != nullptr)
|
||||
{
|
||||
auto pathEntry = reinterpret_cast<const FootpathEntry*>(pathObj->GetLegacyData());
|
||||
@@ -781,8 +781,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
continue;
|
||||
}
|
||||
|
||||
if (gFootpathSelection.LegacyPath == kObjectEntryIndexNull
|
||||
&& i == (showQueues ? gFootpathSelection.QueueSurface : gFootpathSelection.NormalSurface))
|
||||
if (gFootpathSelection.legacyPath == kObjectEntryIndexNull
|
||||
&& i == (showQueues ? gFootpathSelection.queueSurface : gFootpathSelection.normalSurface))
|
||||
{
|
||||
defaultIndex = numPathTypes;
|
||||
}
|
||||
@@ -806,7 +806,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
continue;
|
||||
}
|
||||
|
||||
if (gFootpathSelection.LegacyPath != kObjectEntryIndexNull && gFootpathSelection.LegacyPath == i)
|
||||
if (gFootpathSelection.legacyPath != kObjectEntryIndexNull && gFootpathSelection.legacyPath == i)
|
||||
{
|
||||
defaultIndex = numPathTypes;
|
||||
}
|
||||
@@ -842,7 +842,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (i == gFootpathSelection.Railings)
|
||||
if (i == gFootpathSelection.railings)
|
||||
{
|
||||
defaultIndex = numRailingsTypes;
|
||||
}
|
||||
@@ -1081,12 +1081,12 @@ namespace OpenRCT2::Ui::Windows
|
||||
}
|
||||
|
||||
// Set provisional path
|
||||
auto pathType = gFootpathSelection.GetSelectedSurface();
|
||||
auto pathType = gFootpathSelection.getSelectedSurface();
|
||||
auto constructFlags = FootpathCreateConstructFlags(pathType);
|
||||
auto footpathLoc = CoordsXYZ(*mapPos, placement.baseZ);
|
||||
auto tiles = std::array<ProvisionalTile, 1>({ footpathLoc, placement.slope });
|
||||
const auto footpathCost = FootpathProvisionalSet(
|
||||
pathType, gFootpathSelection.Railings, *mapPos, *mapPos, placement.baseZ, tiles, constructFlags);
|
||||
pathType, gFootpathSelection.railings, *mapPos, *mapPos, placement.baseZ, tiles, constructFlags);
|
||||
|
||||
if (_windowFootpathCost != footpathCost)
|
||||
{
|
||||
@@ -1133,10 +1133,10 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
// Set provisional path
|
||||
auto tiles = buildTileVector(range, baseZ);
|
||||
auto pathType = gFootpathSelection.GetSelectedSurface();
|
||||
auto pathType = gFootpathSelection.getSelectedSurface();
|
||||
auto constructFlags = FootpathCreateConstructFlags(pathType);
|
||||
const auto footpathCost = FootpathProvisionalSet(
|
||||
pathType, gFootpathSelection.Railings, range.Point1, range.Point2, baseZ, tiles, constructFlags);
|
||||
pathType, gFootpathSelection.railings, range.Point1, range.Point2, baseZ, tiles, constructFlags);
|
||||
|
||||
if (_windowFootpathCost != footpathCost)
|
||||
{
|
||||
@@ -1239,7 +1239,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto correctedPos = mapPos->ToTileStart();
|
||||
|
||||
// For queues, only allow selecting a single line.
|
||||
if (gFootpathSelection.IsQueueSelected)
|
||||
if (gFootpathSelection.isQueueSelected)
|
||||
{
|
||||
auto xDiff = correctedPos.x - _dragStartPos.x;
|
||||
auto yDiff = correctedPos.y - _dragStartPos.y;
|
||||
@@ -1278,7 +1278,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
return;
|
||||
|
||||
// Try and place path
|
||||
auto selectedType = gFootpathSelection.GetSelectedSurface();
|
||||
auto selectedType = gFootpathSelection.getSelectedSurface();
|
||||
PathConstructFlags constructFlags = FootpathCreateConstructFlags(selectedType);
|
||||
|
||||
bool anySuccess = false;
|
||||
@@ -1288,7 +1288,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
for (const auto& tile : _provisionalFootpath.tiles)
|
||||
{
|
||||
auto footpathPlaceAction = GameActions::FootpathPlaceAction(
|
||||
tile.position, tile.slope, selectedType, gFootpathSelection.Railings, kInvalidDirection, constructFlags);
|
||||
tile.position, tile.slope, selectedType, gFootpathSelection.railings, kInvalidDirection, constructFlags);
|
||||
auto result = GameActions::Execute(&footpathPlaceAction, getGameState());
|
||||
if (result.error == GameActions::Status::ok)
|
||||
{
|
||||
@@ -1333,11 +1333,11 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto placement = WindowFootpathGetPlacementFromScreenCoords(screenCoords);
|
||||
|
||||
// Try and place path
|
||||
auto selectedType = gFootpathSelection.GetSelectedSurface();
|
||||
auto selectedType = gFootpathSelection.getSelectedSurface();
|
||||
PathConstructFlags constructFlags = FootpathCreateConstructFlags(selectedType);
|
||||
|
||||
auto footpathPlaceAction = GameActions::FootpathPlaceAction(
|
||||
{ *mapPos, placement.baseZ }, placement.slope, selectedType, gFootpathSelection.Railings, kInvalidDirection,
|
||||
{ *mapPos, placement.baseZ }, placement.slope, selectedType, gFootpathSelection.railings, kInvalidDirection,
|
||||
constructFlags);
|
||||
footpathPlaceAction.SetCallback([this](const GameActions::GameAction* ga, const GameActions::Result* result) {
|
||||
if (result->error == GameActions::Status::ok)
|
||||
@@ -1430,7 +1430,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
PathConstructFlags constructFlags = FootpathCreateConstructFlags(type);
|
||||
|
||||
auto footpathPlaceAction = GameActions::FootpathPlaceAction(
|
||||
footpathLoc, slope, type, gFootpathSelection.Railings, _footpathConstructDirection, constructFlags);
|
||||
footpathLoc, slope, type, gFootpathSelection.railings, _footpathConstructDirection, constructFlags);
|
||||
|
||||
footpathPlaceAction.SetCallback(
|
||||
[footpathLoc](const GameActions::GameAction* ga, const GameActions::Result* result) {
|
||||
@@ -1678,7 +1678,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
footpathLoc.z = _footpathConstructFromPosition.z;
|
||||
if (type != nullptr)
|
||||
{
|
||||
*type = gFootpathSelection.GetSelectedSurface();
|
||||
*type = gFootpathSelection.getSelectedSurface();
|
||||
}
|
||||
*slope = {};
|
||||
if (_footpathConstructSlope != SlopePitch::flat)
|
||||
@@ -1695,12 +1695,12 @@ namespace OpenRCT2::Ui::Windows
|
||||
PathConstructFlags FootpathCreateConstructFlags(ObjectEntryIndex& type)
|
||||
{
|
||||
PathConstructFlags pathConstructFlags = 0;
|
||||
if (gFootpathSelection.IsQueueSelected)
|
||||
if (gFootpathSelection.isQueueSelected)
|
||||
pathConstructFlags |= PathConstructFlag::IsQueue;
|
||||
if (gFootpathSelection.LegacyPath != kObjectEntryIndexNull)
|
||||
if (gFootpathSelection.legacyPath != kObjectEntryIndexNull)
|
||||
{
|
||||
pathConstructFlags |= PathConstructFlag::IsLegacyPathObject;
|
||||
type = gFootpathSelection.LegacyPath;
|
||||
type = gFootpathSelection.legacyPath;
|
||||
}
|
||||
return pathConstructFlags;
|
||||
}
|
||||
@@ -2150,39 +2150,39 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
// Select default footpath
|
||||
auto surfaceIndex = FootpathGetDefaultSurface(false);
|
||||
if (FootpathIsSurfaceEntryOkay(gFootpathSelection.NormalSurface, false))
|
||||
if (FootpathIsSurfaceEntryOkay(gFootpathSelection.normalSurface, false))
|
||||
{
|
||||
surfaceIndex = gFootpathSelection.NormalSurface;
|
||||
surfaceIndex = gFootpathSelection.normalSurface;
|
||||
}
|
||||
|
||||
// Select default queue
|
||||
auto queueIndex = FootpathGetDefaultSurface(true);
|
||||
if (FootpathIsSurfaceEntryOkay(gFootpathSelection.QueueSurface, true))
|
||||
if (FootpathIsSurfaceEntryOkay(gFootpathSelection.queueSurface, true))
|
||||
{
|
||||
queueIndex = gFootpathSelection.QueueSurface;
|
||||
queueIndex = gFootpathSelection.queueSurface;
|
||||
}
|
||||
|
||||
// Select default railing
|
||||
auto railingIndex = FootpathGetDefaultRailings();
|
||||
const auto* railingEntry = GetPathRailingsEntry(gFootpathSelection.Railings);
|
||||
const auto* railingEntry = GetPathRailingsEntry(gFootpathSelection.railings);
|
||||
if (railingEntry != nullptr)
|
||||
{
|
||||
railingIndex = gFootpathSelection.Railings;
|
||||
railingIndex = gFootpathSelection.railings;
|
||||
}
|
||||
|
||||
// Select default legacy path
|
||||
auto legacyPathIndex = FootpathGetDefaultLegacyPath();
|
||||
if (gFootpathSelection.LegacyPath != kObjectEntryIndexNull)
|
||||
if (gFootpathSelection.legacyPath != kObjectEntryIndexNull)
|
||||
{
|
||||
if (FootpathIsLegacyPathEntryOkay(gFootpathSelection.LegacyPath))
|
||||
if (FootpathIsLegacyPathEntryOkay(gFootpathSelection.legacyPath))
|
||||
{
|
||||
// Keep legacy path selected
|
||||
legacyPathIndex = gFootpathSelection.LegacyPath;
|
||||
legacyPathIndex = gFootpathSelection.legacyPath;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Reset legacy path, we default to a surface (if there are any)
|
||||
gFootpathSelection.LegacyPath = kObjectEntryIndexNull;
|
||||
gFootpathSelection.legacyPath = kObjectEntryIndexNull;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2195,12 +2195,12 @@ namespace OpenRCT2::Ui::Windows
|
||||
}
|
||||
|
||||
// No surfaces available, so default to legacy path
|
||||
gFootpathSelection.LegacyPath = legacyPathIndex;
|
||||
gFootpathSelection.legacyPath = legacyPathIndex;
|
||||
}
|
||||
|
||||
gFootpathSelection.NormalSurface = surfaceIndex;
|
||||
gFootpathSelection.QueueSurface = queueIndex;
|
||||
gFootpathSelection.Railings = railingIndex;
|
||||
gFootpathSelection.normalSurface = surfaceIndex;
|
||||
gFootpathSelection.queueSurface = queueIndex;
|
||||
gFootpathSelection.railings = railingIndex;
|
||||
return true;
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
@@ -29,7 +29,7 @@ namespace OpenRCT2
|
||||
GetImageTable().Read(context, stream);
|
||||
|
||||
// Validate properties
|
||||
if (_legacyType.support_type >= RailingEntrySupportType::Count)
|
||||
if (_legacyType.support_type >= RailingEntrySupportType::count)
|
||||
{
|
||||
context->LogError(ObjectError::invalidProperty, "RailingEntrySupportType not supported.");
|
||||
}
|
||||
@@ -42,23 +42,23 @@ namespace OpenRCT2
|
||||
_legacyType.image = LoadImages();
|
||||
_legacyType.bridge_image = _legacyType.image + 109;
|
||||
|
||||
_pathSurfaceDescriptor.Name = _legacyType.string_idx;
|
||||
_pathSurfaceDescriptor.Image = _legacyType.image;
|
||||
_pathSurfaceDescriptor.PreviewImage = _legacyType.GetPreviewImage();
|
||||
_pathSurfaceDescriptor.Flags = _legacyType.flags;
|
||||
_pathSurfaceDescriptor.name = _legacyType.string_idx;
|
||||
_pathSurfaceDescriptor.image = _legacyType.image;
|
||||
_pathSurfaceDescriptor.previewImage = _legacyType.GetPreviewImage();
|
||||
_pathSurfaceDescriptor.flags = _legacyType.flags;
|
||||
|
||||
_queueSurfaceDescriptor.Name = _legacyType.string_idx;
|
||||
_queueSurfaceDescriptor.Image = _legacyType.GetQueueImage();
|
||||
_queueSurfaceDescriptor.PreviewImage = _legacyType.GetQueuePreviewImage();
|
||||
_queueSurfaceDescriptor.Flags = _legacyType.flags | FOOTPATH_ENTRY_FLAG_IS_QUEUE;
|
||||
_queueSurfaceDescriptor.name = _legacyType.string_idx;
|
||||
_queueSurfaceDescriptor.image = _legacyType.GetQueueImage();
|
||||
_queueSurfaceDescriptor.previewImage = _legacyType.GetQueuePreviewImage();
|
||||
_queueSurfaceDescriptor.flags = _legacyType.flags | FOOTPATH_ENTRY_FLAG_IS_QUEUE;
|
||||
|
||||
_pathRailingsDescriptor.Name = _legacyType.string_idx;
|
||||
_pathRailingsDescriptor.BridgeImage = _legacyType.bridge_image;
|
||||
_pathRailingsDescriptor.PreviewImage = _legacyType.GetPreviewImage();
|
||||
_pathRailingsDescriptor.Flags = _legacyType.flags;
|
||||
_pathRailingsDescriptor.ScrollingMode = _legacyType.scrolling_mode;
|
||||
_pathRailingsDescriptor.SupportType = _legacyType.support_type;
|
||||
_pathRailingsDescriptor.RailingsImage = _legacyType.GetRailingsImage();
|
||||
_pathRailingsDescriptor.name = _legacyType.string_idx;
|
||||
_pathRailingsDescriptor.bridgeImage = _legacyType.bridge_image;
|
||||
_pathRailingsDescriptor.previewImage = _legacyType.GetPreviewImage();
|
||||
_pathRailingsDescriptor.flags = _legacyType.flags;
|
||||
_pathRailingsDescriptor.scrollingMode = _legacyType.scrolling_mode;
|
||||
_pathRailingsDescriptor.supportType = _legacyType.support_type;
|
||||
_pathRailingsDescriptor.railingsImage = _legacyType.GetRailingsImage();
|
||||
}
|
||||
|
||||
void FootpathObject::Unload()
|
||||
@@ -73,8 +73,8 @@ namespace OpenRCT2
|
||||
void FootpathObject::DrawPreview(Drawing::RenderTarget& rt, int32_t width, int32_t height) const
|
||||
{
|
||||
auto screenCoords = ScreenCoordsXY{ width / 2, height / 2 };
|
||||
GfxDrawSprite(rt, ImageId(_pathSurfaceDescriptor.PreviewImage), screenCoords - ScreenCoordsXY{ 49, 17 });
|
||||
GfxDrawSprite(rt, ImageId(_queueSurfaceDescriptor.PreviewImage), screenCoords + ScreenCoordsXY{ 4, -17 });
|
||||
GfxDrawSprite(rt, ImageId(_pathSurfaceDescriptor.previewImage), screenCoords - ScreenCoordsXY{ 49, 17 });
|
||||
GfxDrawSprite(rt, ImageId(_queueSurfaceDescriptor.previewImage), screenCoords + ScreenCoordsXY{ 4, -17 });
|
||||
}
|
||||
|
||||
void FootpathObject::ReadJson(IReadObjectContext* context, json_t& root)
|
||||
|
||||
@@ -29,14 +29,14 @@ namespace OpenRCT2
|
||||
RailingsImageId = PreviewImageId + 1;
|
||||
}
|
||||
|
||||
_descriptor.Name = NameStringId;
|
||||
_descriptor.BridgeImage = BridgeImageId;
|
||||
_descriptor.PreviewImage = PreviewImageId;
|
||||
_descriptor.Flags = Flags;
|
||||
_descriptor.ScrollingMode = ScrollingMode;
|
||||
_descriptor.SupportType = SupportType;
|
||||
_descriptor.SupportColour = Colour;
|
||||
_descriptor.RailingsImage = RailingsImageId;
|
||||
_descriptor.name = NameStringId;
|
||||
_descriptor.bridgeImage = BridgeImageId;
|
||||
_descriptor.previewImage = PreviewImageId;
|
||||
_descriptor.flags = Flags;
|
||||
_descriptor.scrollingMode = ScrollingMode;
|
||||
_descriptor.supportType = SupportType;
|
||||
_descriptor.supportColour = Colour;
|
||||
_descriptor.railingsImage = RailingsImageId;
|
||||
}
|
||||
|
||||
void FootpathRailingsObject::Unload()
|
||||
@@ -58,7 +58,7 @@ namespace OpenRCT2
|
||||
if (Colour != COLOUR_NULL)
|
||||
helper = helper.WithPrimary(Colour);
|
||||
|
||||
if (SupportType == RailingEntrySupportType::Pole)
|
||||
if (SupportType == RailingEntrySupportType::pole)
|
||||
{
|
||||
auto img = helper.WithIndex(BridgeImageId + 20 + 15);
|
||||
for (int i = 0; i < 2; i++)
|
||||
@@ -106,8 +106,8 @@ namespace OpenRCT2
|
||||
RailingEntrySupportType FootpathRailingsObject::ParseSupportType(std::string_view s)
|
||||
{
|
||||
if (s == "pole")
|
||||
return RailingEntrySupportType::Pole;
|
||||
return RailingEntrySupportType::pole;
|
||||
else /* if (s == "box") */
|
||||
return RailingEntrySupportType::Box;
|
||||
return RailingEntrySupportType::box;
|
||||
}
|
||||
} // namespace OpenRCT2
|
||||
@@ -31,10 +31,10 @@ namespace OpenRCT2
|
||||
BaseImageId = PreviewImageId + 1;
|
||||
}
|
||||
|
||||
_descriptor.Name = NameStringId;
|
||||
_descriptor.Image = BaseImageId;
|
||||
_descriptor.PreviewImage = PreviewImageId;
|
||||
_descriptor.Flags = Flags;
|
||||
_descriptor.name = NameStringId;
|
||||
_descriptor.image = BaseImageId;
|
||||
_descriptor.previewImage = PreviewImageId;
|
||||
_descriptor.flags = Flags;
|
||||
}
|
||||
|
||||
void FootpathSurfaceObject::Unload()
|
||||
|
||||
@@ -309,7 +309,7 @@ static void PaintParkEntrance(PaintSession& session, uint8_t direction, int32_t
|
||||
auto surfaceDescriptor = entranceEl.GetPathSurfaceDescriptor();
|
||||
if (surfaceDescriptor != nullptr)
|
||||
{
|
||||
auto imageIndex = (surfaceDescriptor->Image + 5 * (1 + (direction & 1)));
|
||||
auto imageIndex = (surfaceDescriptor->image + 5 * (1 + (direction & 1)));
|
||||
PaintAddImageAsParent(
|
||||
session, imageTemplate.WithIndex(imageIndex), { 0, 0, height }, { { 0, 2, height }, { 32, 28, 0 } });
|
||||
}
|
||||
|
||||
@@ -685,19 +685,19 @@ static FootpathPaintInfo GetFootpathPaintInfo(const PathElement& pathEl)
|
||||
const auto* surfaceDescriptor = pathEl.GetSurfaceDescriptor();
|
||||
if (surfaceDescriptor != nullptr)
|
||||
{
|
||||
pathPaintInfo.SurfaceImageId = surfaceDescriptor->Image;
|
||||
pathPaintInfo.SurfaceFlags = surfaceDescriptor->Flags;
|
||||
pathPaintInfo.SurfaceImageId = surfaceDescriptor->image;
|
||||
pathPaintInfo.SurfaceFlags = surfaceDescriptor->flags;
|
||||
}
|
||||
|
||||
const auto* railingsDescriptor = pathEl.GetRailingsDescriptor();
|
||||
if (railingsDescriptor != nullptr)
|
||||
{
|
||||
pathPaintInfo.BridgeImageId = railingsDescriptor->BridgeImage;
|
||||
pathPaintInfo.RailingsImageId = railingsDescriptor->RailingsImage;
|
||||
pathPaintInfo.RailingFlags = railingsDescriptor->Flags;
|
||||
pathPaintInfo.ScrollingMode = railingsDescriptor->ScrollingMode;
|
||||
pathPaintInfo.SupportType = railingsDescriptor->SupportType;
|
||||
pathPaintInfo.SupportColour = railingsDescriptor->SupportColour;
|
||||
pathPaintInfo.BridgeImageId = railingsDescriptor->bridgeImage;
|
||||
pathPaintInfo.RailingsImageId = railingsDescriptor->railingsImage;
|
||||
pathPaintInfo.RailingFlags = railingsDescriptor->flags;
|
||||
pathPaintInfo.ScrollingMode = railingsDescriptor->scrollingMode;
|
||||
pathPaintInfo.SupportType = railingsDescriptor->supportType;
|
||||
pathPaintInfo.SupportColour = railingsDescriptor->supportColour;
|
||||
}
|
||||
|
||||
return pathPaintInfo;
|
||||
@@ -834,7 +834,7 @@ void PaintPath(PaintSession& session, uint16_t height, const PathElement& tileEl
|
||||
|
||||
auto hasSupports = ShouldDrawSupports(session, tileElement, height);
|
||||
auto pathPaintInfo = GetFootpathPaintInfo(tileElement);
|
||||
if (pathPaintInfo.SupportType == RailingEntrySupportType::Pole)
|
||||
if (pathPaintInfo.SupportType == RailingEntrySupportType::pole)
|
||||
{
|
||||
PathPaintPoleSupport(session, tileElement, height, pathPaintInfo, hasSupports, imageTemplate, sceneryImageTemplate);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include "../Identifiers.h"
|
||||
#include "../actions/CommandFlag.h"
|
||||
#include "../drawing/ImageIndexType.h"
|
||||
#include "../interface/Colour.h"
|
||||
#include "../localisation/StringIdType.h"
|
||||
#include "../object/ObjectTypes.h"
|
||||
@@ -36,29 +37,29 @@ constexpr auto kPathClearance = 4 * kCoordsZStep;
|
||||
|
||||
enum class RailingEntrySupportType : uint8_t
|
||||
{
|
||||
Box = 0,
|
||||
Pole = 1,
|
||||
Count
|
||||
box = 0,
|
||||
pole = 1,
|
||||
count
|
||||
};
|
||||
|
||||
struct PathSurfaceDescriptor
|
||||
{
|
||||
StringId Name;
|
||||
uint32_t Image;
|
||||
uint32_t PreviewImage;
|
||||
uint8_t Flags;
|
||||
StringId name;
|
||||
ImageIndex image;
|
||||
ImageIndex previewImage;
|
||||
uint8_t flags;
|
||||
};
|
||||
|
||||
struct PathRailingsDescriptor
|
||||
{
|
||||
StringId Name;
|
||||
uint32_t PreviewImage;
|
||||
uint32_t BridgeImage;
|
||||
uint32_t RailingsImage;
|
||||
RailingEntrySupportType SupportType;
|
||||
colour_t SupportColour;
|
||||
uint8_t Flags;
|
||||
uint8_t ScrollingMode;
|
||||
StringId name;
|
||||
ImageIndex previewImage;
|
||||
ImageIndex bridgeImage;
|
||||
ImageIndex railingsImage;
|
||||
RailingEntrySupportType supportType;
|
||||
colour_t supportColour;
|
||||
uint8_t flags;
|
||||
uint8_t scrollingMode;
|
||||
};
|
||||
|
||||
using PathConstructFlags = uint8_t;
|
||||
@@ -70,15 +71,15 @@ namespace OpenRCT2::PathConstructFlag
|
||||
|
||||
struct FootpathSelection
|
||||
{
|
||||
OpenRCT2::ObjectEntryIndex LegacyPath = OpenRCT2::kObjectEntryIndexNull;
|
||||
OpenRCT2::ObjectEntryIndex NormalSurface = OpenRCT2::kObjectEntryIndexNull;
|
||||
OpenRCT2::ObjectEntryIndex QueueSurface = OpenRCT2::kObjectEntryIndexNull;
|
||||
OpenRCT2::ObjectEntryIndex Railings = OpenRCT2::kObjectEntryIndexNull;
|
||||
bool IsQueueSelected{};
|
||||
OpenRCT2::ObjectEntryIndex legacyPath = OpenRCT2::kObjectEntryIndexNull;
|
||||
OpenRCT2::ObjectEntryIndex normalSurface = OpenRCT2::kObjectEntryIndexNull;
|
||||
OpenRCT2::ObjectEntryIndex queueSurface = OpenRCT2::kObjectEntryIndexNull;
|
||||
OpenRCT2::ObjectEntryIndex railings = OpenRCT2::kObjectEntryIndexNull;
|
||||
bool isQueueSelected{};
|
||||
|
||||
OpenRCT2::ObjectEntryIndex GetSelectedSurface() const
|
||||
OpenRCT2::ObjectEntryIndex getSelectedSurface() const
|
||||
{
|
||||
return IsQueueSelected ? QueueSurface : NormalSurface;
|
||||
return isQueueSelected ? queueSurface : normalSurface;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -299,7 +299,7 @@ namespace OpenRCT2
|
||||
bool PathElement::ShouldDrawPathOverSupports() const
|
||||
{
|
||||
// TODO: make this an actual decision of the tile element.
|
||||
return (GetRailingsDescriptor()->Flags & RAILING_ENTRY_FLAG_DRAW_PATH_OVER_SUPPORTS);
|
||||
return (GetRailingsDescriptor()->flags & RAILING_ENTRY_FLAG_DRAW_PATH_OVER_SUPPORTS);
|
||||
}
|
||||
|
||||
void PathElement::SetShouldDrawPathOverSupports(bool on)
|
||||
|
||||
Reference in new issue
Block a user