mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-20 21:43:06 +01:00
Create ImageItem constructor, add tooltips to land styles
This commit is contained in:
@@ -155,6 +155,11 @@ namespace OpenRCT2::Dropdown
|
||||
{
|
||||
return Item{ kSeparatorString };
|
||||
}
|
||||
|
||||
constexpr Item ImageItem(ImageId image, StringId tooltip = kStringIdEmpty)
|
||||
{
|
||||
return Item{ .format = Dropdown::kFormatLandPicker, .args = { .image = image }, .tooltip = tooltip };
|
||||
}
|
||||
|
||||
struct DropdownState
|
||||
{
|
||||
|
||||
@@ -67,8 +67,7 @@ void LandTool::ShowSurfaceStyleDropdown(WindowBase* w, Widget* widget, ObjectEnt
|
||||
if (surfaceObj->Colour != TerrainSurfaceObject::kNoValue)
|
||||
imageId = imageId.WithPrimary(surfaceObj->Colour);
|
||||
|
||||
gDropdown.items[itemIndex].format = Dropdown::kFormatLandPicker;
|
||||
gDropdown.items[itemIndex].args.image = imageId;
|
||||
gDropdown.items[itemIndex] = Dropdown::ImageItem(imageId, surfaceObj->NameStringId);
|
||||
if (i == currentSurfaceType)
|
||||
{
|
||||
defaultIndex = itemIndex;
|
||||
@@ -82,6 +81,7 @@ void LandTool::ShowSurfaceStyleDropdown(WindowBase* w, Widget* widget, ObjectEnt
|
||||
w->windowPos.x + widget->left, w->windowPos.y + widget->top, widget->height(), w->colours[2], 0, surfaceCount, 47, 36,
|
||||
DropdownGetAppropriateImageDropdownItemsPerRow(surfaceCount));
|
||||
|
||||
gDropdown.hasTooltips = true;
|
||||
gDropdown.defaultIndex = defaultIndex;
|
||||
}
|
||||
|
||||
@@ -117,8 +117,7 @@ void LandTool::ShowEdgeStyleDropdown(WindowBase* w, Widget* widget, ObjectEntryI
|
||||
// If fallback images are loaded, the RCT1 styles will just look like copies of already existing styles, so hide them.
|
||||
if (edgeObj != nullptr && !edgeObj->UsesFallbackImages())
|
||||
{
|
||||
gDropdown.items[itemIndex].format = Dropdown::kFormatLandPicker;
|
||||
gDropdown.items[itemIndex].args.image = ImageId(edgeObj->IconImageId);
|
||||
gDropdown.items[itemIndex] = Dropdown::ImageItem(ImageId(edgeObj->IconImageId), edgeObj->NameStringId);
|
||||
if (i == currentEdgeType)
|
||||
{
|
||||
defaultIndex = itemIndex;
|
||||
@@ -133,6 +132,7 @@ void LandTool::ShowEdgeStyleDropdown(WindowBase* w, Widget* widget, ObjectEntryI
|
||||
w->windowPos.x + widget->left, w->windowPos.y + widget->top, widget->height(), w->colours[2], 0, edgeCount, 47, 36,
|
||||
itemsPerRow);
|
||||
|
||||
gDropdown.hasTooltips = true;
|
||||
gDropdown.defaultIndex = defaultIndex;
|
||||
}
|
||||
|
||||
|
||||
@@ -702,9 +702,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
defaultIndex = numPathTypes;
|
||||
}
|
||||
|
||||
gDropdown.items[numPathTypes].format = Dropdown::kFormatLandPicker;
|
||||
gDropdown.items[numPathTypes].tooltip = pathType->NameStringId;
|
||||
gDropdown.items[numPathTypes].args.image = ImageId(pathType->PreviewImageId);
|
||||
gDropdown.items[numPathTypes] = Dropdown::ImageItem(ImageId(pathType->PreviewImageId), pathType->NameStringId);
|
||||
_dropdownEntries.push_back({ ObjectType::footpathSurface, i });
|
||||
numPathTypes++;
|
||||
}
|
||||
@@ -728,10 +726,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
defaultIndex = numPathTypes;
|
||||
}
|
||||
|
||||
gDropdown.items[numPathTypes].format = Dropdown::kFormatLandPicker;
|
||||
gDropdown.items[numPathTypes].tooltip = pathEntry->string_idx;
|
||||
gDropdown.items[numPathTypes].args.image = ImageId(
|
||||
showQueues ? pathEntry->GetQueuePreviewImage() : pathEntry->GetPreviewImage());
|
||||
auto image = ImageId(showQueues ? pathEntry->GetQueuePreviewImage() : pathEntry->GetPreviewImage());
|
||||
gDropdown.items[numPathTypes] = Dropdown::ImageItem(image, pathEntry->string_idx);
|
||||
_dropdownEntries.push_back({ ObjectType::paths, i });
|
||||
numPathTypes++;
|
||||
}
|
||||
@@ -766,9 +762,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
defaultIndex = numRailingsTypes;
|
||||
}
|
||||
|
||||
gDropdown.items[numRailingsTypes].format = Dropdown::kFormatLandPicker;
|
||||
gDropdown.items[numRailingsTypes].tooltip = railingsEntry->NameStringId;
|
||||
gDropdown.items[numRailingsTypes].args.image = ImageId(railingsEntry->PreviewImageId);
|
||||
gDropdown.items[numRailingsTypes] = Dropdown::ImageItem(ImageId(railingsEntry->PreviewImageId), railingsEntry->NameStringId);
|
||||
_dropdownEntries.push_back({ ObjectType::footpathRailings, i });
|
||||
numRailingsTypes++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user