mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge a8b180936d
into 47d0996b4f
This commit is contained in:
commit
9a0b251035
|
@ -1,85 +0,0 @@
|
|||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Mac",
|
||||
"includePath": [
|
||||
"/usr/include",
|
||||
"/usr/local/include",
|
||||
"${workspaceRoot}",
|
||||
"${workspaceRoot}/src/**"
|
||||
],
|
||||
"defines": [],
|
||||
"intelliSenseMode": "clang-x64",
|
||||
"browse": {
|
||||
"path": [
|
||||
"/usr/include",
|
||||
"/usr/local/include",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ""
|
||||
},
|
||||
"macFrameworkPath": [
|
||||
"/System/Library/Frameworks",
|
||||
"/Library/Frameworks"
|
||||
],
|
||||
"cStandard": "c11",
|
||||
"cppStandard": "c++20"
|
||||
},
|
||||
{
|
||||
"name": "Linux",
|
||||
"includePath": [
|
||||
"/usr/include",
|
||||
"/usr/include/SDL2",
|
||||
"/usr/local/include",
|
||||
"${workspaceRoot}",
|
||||
"${workspaceRoot}/src"
|
||||
],
|
||||
"defines": [
|
||||
"ENABLE_SCRIPTING"
|
||||
],
|
||||
"intelliSenseMode": "clang-x64",
|
||||
"browse": {
|
||||
"path": [
|
||||
"/usr/include",
|
||||
"/usr/local/include",
|
||||
"${workspaceRoot}",
|
||||
"${workspaceRoot}/src"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ""
|
||||
},
|
||||
"compilerPath": "/usr/bin/clang",
|
||||
"cStandard": "c11",
|
||||
"cppStandard": "c++17"
|
||||
},
|
||||
{
|
||||
"name": "Win32",
|
||||
"includePath": [
|
||||
"${workspaceRoot}",
|
||||
"${workspaceRoot}/src",
|
||||
"${workspaceRoot}/src/thirdparty",
|
||||
"${workspaceRoot}/lib/Win32/include",
|
||||
"${workspaceRoot}/lib/x64/include",
|
||||
"${workspaceRoot}/lib/googletest/googletest/include"
|
||||
],
|
||||
"defines": [
|
||||
"_DEBUG",
|
||||
"UNICODE",
|
||||
"_UNICODE",
|
||||
"ENABLE_SCRIPTING"
|
||||
],
|
||||
"intelliSenseMode": "msvc-x64",
|
||||
"browse": {
|
||||
"path": [
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ""
|
||||
},
|
||||
"cStandard": "c11",
|
||||
"cppStandard": "c++17"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
|
@ -52,7 +52,7 @@ static Widget WindowAssetPacksWidgets[] = {
|
|||
class AssetPacksWindow final : public Window
|
||||
{
|
||||
private:
|
||||
static constexpr int32_t ItemHeight = SCROLLABLE_ROW_HEIGHT + 1;
|
||||
static constexpr int32_t ItemHeight = kScrollableRowHeight + 1;
|
||||
static constexpr int32_t ItemCheckBoxSize = ItemHeight - 3;
|
||||
std::optional<size_t> _highlightedIndex;
|
||||
std::optional<size_t> _selectedIndex;
|
||||
|
|
|
@ -230,11 +230,11 @@ static Widget _inventionListDragWidgets[] = {
|
|||
ScreenSize size{};
|
||||
if (scrollIndex == 0)
|
||||
{
|
||||
size.height = static_cast<int32_t>(gameState.ResearchItemsInvented.size()) * SCROLLABLE_ROW_HEIGHT;
|
||||
size.height = static_cast<int32_t>(gameState.ResearchItemsInvented.size()) * kScrollableRowHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
size.height = static_cast<int32_t>(gameState.ResearchItemsUninvented.size()) * SCROLLABLE_ROW_HEIGHT;
|
||||
size.height = static_cast<int32_t>(gameState.ResearchItemsUninvented.size()) * kScrollableRowHeight;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
@ -279,14 +279,14 @@ static Widget _inventionListDragWidgets[] = {
|
|||
GfxClear(dpi, paletteIndex);
|
||||
|
||||
int16_t boxWidth = widgets[WIDX_RESEARCH_ORDER_SCROLL].width();
|
||||
int32_t itemY = -SCROLLABLE_ROW_HEIGHT;
|
||||
int32_t itemY = -kScrollableRowHeight;
|
||||
auto* dragItem = WindowEditorInventionsListDragGetItem();
|
||||
|
||||
const auto& researchList = scrollIndex == 0 ? gameState.ResearchItemsInvented : gameState.ResearchItemsUninvented;
|
||||
for (const auto& researchItem : researchList)
|
||||
{
|
||||
itemY += SCROLLABLE_ROW_HEIGHT;
|
||||
if (itemY + SCROLLABLE_ROW_HEIGHT < dpi.y || itemY >= dpi.y + dpi.height)
|
||||
itemY += kScrollableRowHeight;
|
||||
if (itemY + kScrollableRowHeight < dpi.y || itemY >= dpi.y + dpi.height)
|
||||
continue;
|
||||
|
||||
if (_selectedResearchItem == &researchItem)
|
||||
|
@ -296,7 +296,7 @@ static Widget _inventionListDragWidgets[] = {
|
|||
{
|
||||
// Highlight
|
||||
top = itemY;
|
||||
bottom = itemY + SCROLLABLE_ROW_HEIGHT - 1;
|
||||
bottom = itemY + kScrollableRowHeight - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -559,7 +559,7 @@ static Widget _inventionListDragWidgets[] = {
|
|||
auto& researchList = isInvented ? gameState.ResearchItemsInvented : gameState.ResearchItemsUninvented;
|
||||
for (auto& researchItem : researchList)
|
||||
{
|
||||
y -= SCROLLABLE_ROW_HEIGHT;
|
||||
y -= kScrollableRowHeight;
|
||||
if (y < 0)
|
||||
{
|
||||
return &researchItem;
|
||||
|
@ -575,7 +575,7 @@ static Widget _inventionListDragWidgets[] = {
|
|||
auto& researchList = isInvented ? gameState.ResearchItemsInvented : gameState.ResearchItemsUninvented;
|
||||
for (auto& researchItem : researchList)
|
||||
{
|
||||
y -= SCROLLABLE_ROW_HEIGHT;
|
||||
y -= kScrollableRowHeight;
|
||||
if (y < 0)
|
||||
{
|
||||
return &researchItem;
|
||||
|
|
|
@ -584,7 +584,7 @@ static std::vector<Widget> _window_editor_object_selection_widgets = {
|
|||
*/
|
||||
ScreenSize OnScrollGetSize(int32_t scrollIndex) override
|
||||
{
|
||||
const auto newHeight = static_cast<int32_t>(_listItems.size() * SCROLLABLE_ROW_HEIGHT);
|
||||
const auto newHeight = static_cast<int32_t>(_listItems.size() * kScrollableRowHeight);
|
||||
return { 0, newHeight };
|
||||
}
|
||||
|
||||
|
@ -729,7 +729,7 @@ static std::vector<Widget> _window_editor_object_selection_widgets = {
|
|||
for (size_t i = 0; i < _listItems.size(); i++)
|
||||
{
|
||||
const auto& listItem = _listItems[i];
|
||||
if (screenCoords.y + SCROLLABLE_ROW_HEIGHT >= dpi.y && screenCoords.y <= dpi.y + dpi.height)
|
||||
if (screenCoords.y + kScrollableRowHeight >= dpi.y && screenCoords.y <= dpi.y + dpi.height)
|
||||
{
|
||||
// Draw checkbox
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) && !(*listItem.flags & 0x20))
|
||||
|
@ -741,7 +741,7 @@ static std::vector<Widget> _window_editor_object_selection_widgets = {
|
|||
&& !(*listItem.flags & ObjectSelectionFlags::Flag6);
|
||||
if (highlighted)
|
||||
{
|
||||
auto bottom = screenCoords.y + (SCROLLABLE_ROW_HEIGHT - 1);
|
||||
auto bottom = screenCoords.y + (kScrollableRowHeight - 1);
|
||||
GfxFilterRect(dpi, { 0, screenCoords.y, width, bottom }, FilterPaletteID::PaletteDarken1);
|
||||
}
|
||||
|
||||
|
@ -800,7 +800,7 @@ static std::vector<Widget> _window_editor_object_selection_widgets = {
|
|||
ft.Add<const char*>(gCommonStringFormatBuffer);
|
||||
DrawTextEllipsised(dpi, screenCoords, width_limit, STR_STRING, ft, { colour, FontStyle::Medium, darkness });
|
||||
}
|
||||
screenCoords.y += SCROLLABLE_ROW_HEIGHT;
|
||||
screenCoords.y += kScrollableRowHeight;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1538,7 +1538,7 @@ static std::vector<Widget> _window_editor_object_selection_widgets = {
|
|||
*/
|
||||
int32_t GetObjectFromObjectSelection(ObjectType object_type, int32_t y)
|
||||
{
|
||||
int32_t listItemIndex = y / SCROLLABLE_ROW_HEIGHT;
|
||||
int32_t listItemIndex = y / kScrollableRowHeight;
|
||||
if (listItemIndex < 0 || static_cast<size_t>(listItemIndex) >= _listItems.size())
|
||||
return -1;
|
||||
|
||||
|
|
|
@ -129,9 +129,9 @@ static Widget window_guest_list_widgets[] = {
|
|||
char Name[256];
|
||||
};
|
||||
|
||||
static constexpr uint8_t SUMMARISED_GUEST_ROW_HEIGHT = SCROLLABLE_ROW_HEIGHT + 11;
|
||||
static constexpr uint8_t SUMMARISED_GUEST_ROW_HEIGHT = kScrollableRowHeight + 11;
|
||||
static constexpr auto GUESTS_PER_PAGE = 2000;
|
||||
static constexpr const auto GUEST_PAGE_HEIGHT = GUESTS_PER_PAGE * SCROLLABLE_ROW_HEIGHT;
|
||||
static constexpr const auto GUEST_PAGE_HEIGHT = GUESTS_PER_PAGE * kScrollableRowHeight;
|
||||
static constexpr size_t MaxGroups = 240;
|
||||
|
||||
TabId _selectedTab{};
|
||||
|
@ -500,7 +500,7 @@ static Widget window_guest_list_widgets[] = {
|
|||
{
|
||||
case TabId::Individual:
|
||||
// Count the number of guests
|
||||
y = static_cast<int32_t>(_guestList.size()) * SCROLLABLE_ROW_HEIGHT;
|
||||
y = static_cast<int32_t>(_guestList.size()) * kScrollableRowHeight;
|
||||
_numPages = (_guestList.size() + GUESTS_PER_PAGE - 1) / GUESTS_PER_PAGE;
|
||||
if (_numPages == 0)
|
||||
_selectedPage = 0;
|
||||
|
@ -539,7 +539,7 @@ static Widget window_guest_list_widgets[] = {
|
|||
|
||||
void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
|
||||
{
|
||||
auto i = screenCoords.y / (_selectedTab == TabId::Individual ? SCROLLABLE_ROW_HEIGHT : SUMMARISED_GUEST_ROW_HEIGHT);
|
||||
auto i = screenCoords.y / (_selectedTab == TabId::Individual ? kScrollableRowHeight : SUMMARISED_GUEST_ROW_HEIGHT);
|
||||
i += static_cast<int32_t>(_selectedPage * GUESTS_PER_PAGE);
|
||||
if (static_cast<size_t>(i) != _highlightedIndex)
|
||||
{
|
||||
|
@ -554,7 +554,7 @@ static Widget window_guest_list_widgets[] = {
|
|||
{
|
||||
case TabId::Individual:
|
||||
{
|
||||
auto i = screenCoords.y / SCROLLABLE_ROW_HEIGHT;
|
||||
auto i = screenCoords.y / kScrollableRowHeight;
|
||||
i += static_cast<int32_t>(_selectedPage * GUESTS_PER_PAGE);
|
||||
for (const auto& guestItem : _guestList)
|
||||
{
|
||||
|
@ -667,14 +667,14 @@ static Widget window_guest_list_widgets[] = {
|
|||
for (const auto& guestItem : _guestList)
|
||||
{
|
||||
// Check if y is beyond the scroll control
|
||||
if (y + SCROLLABLE_ROW_HEIGHT + 1 >= -0x7FFF && y + SCROLLABLE_ROW_HEIGHT + 1 > dpi.y && y < 0x7FFF
|
||||
if (y + kScrollableRowHeight + 1 >= -0x7FFF && y + kScrollableRowHeight + 1 > dpi.y && y < 0x7FFF
|
||||
&& y < dpi.y + dpi.height)
|
||||
{
|
||||
// Highlight backcolour and text colour (format)
|
||||
StringId format = STR_BLACK_STRING;
|
||||
if (index == _highlightedIndex)
|
||||
{
|
||||
GfxFilterRect(dpi, { 0, y, 800, y + SCROLLABLE_ROW_HEIGHT - 1 }, FilterPaletteID::PaletteDarken1);
|
||||
GfxFilterRect(dpi, { 0, y, 800, y + kScrollableRowHeight - 1 }, FilterPaletteID::PaletteDarken1);
|
||||
format = STR_WINDOW_COLOUR_2_STRINGID;
|
||||
}
|
||||
|
||||
|
@ -722,7 +722,7 @@ static Widget window_guest_list_widgets[] = {
|
|||
break;
|
||||
}
|
||||
}
|
||||
y += SCROLLABLE_ROW_HEIGHT;
|
||||
y += kScrollableRowHeight;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -904,14 +904,14 @@ static Widget window_loadsave_widgets[] =
|
|||
|
||||
ScreenSize OnScrollGetSize(int32_t scrollIndex) override
|
||||
{
|
||||
return { 0, no_list_items * SCROLLABLE_ROW_HEIGHT };
|
||||
return { 0, no_list_items * kScrollableRowHeight };
|
||||
}
|
||||
|
||||
void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
|
||||
{
|
||||
int32_t selectedItem;
|
||||
|
||||
selectedItem = screenCoords.y / SCROLLABLE_ROW_HEIGHT;
|
||||
selectedItem = screenCoords.y / kScrollableRowHeight;
|
||||
if (selectedItem >= no_list_items)
|
||||
return;
|
||||
|
||||
|
@ -924,7 +924,7 @@ static Widget window_loadsave_widgets[] =
|
|||
{
|
||||
int32_t selectedItem;
|
||||
|
||||
selectedItem = screenCoords.y / SCROLLABLE_ROW_HEIGHT;
|
||||
selectedItem = screenCoords.y / kScrollableRowHeight;
|
||||
if (selectedItem >= no_list_items)
|
||||
return;
|
||||
|
||||
|
@ -965,11 +965,11 @@ static Widget window_loadsave_widgets[] =
|
|||
|
||||
for (int32_t i = 0; i < no_list_items; i++)
|
||||
{
|
||||
int32_t y = i * SCROLLABLE_ROW_HEIGHT;
|
||||
int32_t y = i * kScrollableRowHeight;
|
||||
if (y > dpi.y + dpi.height)
|
||||
break;
|
||||
|
||||
if (y + SCROLLABLE_ROW_HEIGHT < dpi.y)
|
||||
if (y + kScrollableRowHeight < dpi.y)
|
||||
continue;
|
||||
|
||||
StringId stringId = STR_BLACK_STRING;
|
||||
|
@ -978,7 +978,7 @@ static Widget window_loadsave_widgets[] =
|
|||
if (i == selected_list_item)
|
||||
{
|
||||
stringId = STR_WINDOW_COLOUR_2_STRINGID;
|
||||
GfxFilterRect(dpi, { 0, y, listWidth, y + SCROLLABLE_ROW_HEIGHT }, FilterPaletteID::PaletteDarken1);
|
||||
GfxFilterRect(dpi, { 0, y, listWidth, y + kScrollableRowHeight }, FilterPaletteID::PaletteDarken1);
|
||||
}
|
||||
// display a marker next to the currently loaded game file
|
||||
if (_listItems[i].loaded)
|
||||
|
|
|
@ -569,7 +569,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = {
|
|||
Invalidate();
|
||||
}
|
||||
|
||||
screenSize = { 0, NetworkGetNumPlayers() * SCROLLABLE_ROW_HEIGHT };
|
||||
screenSize = { 0, NetworkGetNumPlayers() * kScrollableRowHeight };
|
||||
int32_t i = screenSize.height - window_multiplayer_players_widgets[WIDX_LIST].bottom
|
||||
+ window_multiplayer_players_widgets[WIDX_LIST].top + 21;
|
||||
if (i < 0)
|
||||
|
@ -590,7 +590,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = {
|
|||
Invalidate();
|
||||
}
|
||||
|
||||
screenSize = { 0, NetworkGetNumActions() * SCROLLABLE_ROW_HEIGHT };
|
||||
screenSize = { 0, NetworkGetNumActions() * kScrollableRowHeight };
|
||||
int32_t i = screenSize.height - window_multiplayer_groups_widgets[WIDX_LIST].bottom
|
||||
+ window_multiplayer_groups_widgets[WIDX_LIST].top + 21;
|
||||
if (i < 0)
|
||||
|
@ -612,7 +612,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = {
|
|||
{
|
||||
case WINDOW_MULTIPLAYER_PAGE_PLAYERS:
|
||||
{
|
||||
int32_t index = screenCoords.y / SCROLLABLE_ROW_HEIGHT;
|
||||
int32_t index = screenCoords.y / kScrollableRowHeight;
|
||||
if (index >= no_list_items)
|
||||
return;
|
||||
|
||||
|
@ -626,7 +626,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = {
|
|||
|
||||
case WINDOW_MULTIPLAYER_PAGE_GROUPS:
|
||||
{
|
||||
int32_t index = screenCoords.y / SCROLLABLE_ROW_HEIGHT;
|
||||
int32_t index = screenCoords.y / kScrollableRowHeight;
|
||||
if (index >= no_list_items)
|
||||
return;
|
||||
|
||||
|
@ -648,7 +648,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = {
|
|||
case WINDOW_MULTIPLAYER_PAGE_PLAYERS:
|
||||
case WINDOW_MULTIPLAYER_PAGE_GROUPS:
|
||||
{
|
||||
int32_t index = screenCoords.y / SCROLLABLE_ROW_HEIGHT;
|
||||
int32_t index = screenCoords.y / kScrollableRowHeight;
|
||||
if (index >= no_list_items)
|
||||
return;
|
||||
|
||||
|
@ -751,7 +751,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = {
|
|||
break;
|
||||
}
|
||||
|
||||
if (screenCoords.y + SCROLLABLE_ROW_HEIGHT + 1 >= dpi.y)
|
||||
if (screenCoords.y + kScrollableRowHeight + 1 >= dpi.y)
|
||||
{
|
||||
thread_local std::string _buffer;
|
||||
_buffer.reserve(512);
|
||||
|
@ -762,7 +762,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = {
|
|||
if (listPosition == selected_list_item)
|
||||
{
|
||||
GfxFilterRect(
|
||||
dpi, { 0, screenCoords.y, 800, screenCoords.y + SCROLLABLE_ROW_HEIGHT - 1 },
|
||||
dpi, { 0, screenCoords.y, 800, screenCoords.y + kScrollableRowHeight - 1 },
|
||||
FilterPaletteID::PaletteDarken1);
|
||||
_buffer += NetworkGetPlayerName(player);
|
||||
colour = colours[2];
|
||||
|
@ -831,7 +831,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = {
|
|||
screenCoords.x = 356;
|
||||
GfxDrawString(dpi, screenCoords, _buffer.c_str(), { colour });
|
||||
}
|
||||
screenCoords.y += SCROLLABLE_ROW_HEIGHT;
|
||||
screenCoords.y += kScrollableRowHeight;
|
||||
listPosition++;
|
||||
}
|
||||
}
|
||||
|
@ -893,7 +893,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = {
|
|||
if (i == selected_list_item)
|
||||
{
|
||||
GfxFilterRect(
|
||||
dpi, { 0, screenCoords.y, 800, screenCoords.y + SCROLLABLE_ROW_HEIGHT - 1 },
|
||||
dpi, { 0, screenCoords.y, 800, screenCoords.y + kScrollableRowHeight - 1 },
|
||||
FilterPaletteID::PaletteDarken1);
|
||||
}
|
||||
if (screenCoords.y > dpi.y + dpi.height)
|
||||
|
@ -901,7 +901,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = {
|
|||
break;
|
||||
}
|
||||
|
||||
if (screenCoords.y + SCROLLABLE_ROW_HEIGHT + 1 >= dpi.y)
|
||||
if (screenCoords.y + kScrollableRowHeight + 1 >= dpi.y)
|
||||
{
|
||||
int32_t groupindex = NetworkGetGroupIndex(_selectedGroup);
|
||||
if (groupindex != -1)
|
||||
|
@ -918,7 +918,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = {
|
|||
ft.Add<uint16_t>(NetworkGetActionNameStringID(i));
|
||||
DrawTextBasic(dpi, { 10, screenCoords.y }, STR_WINDOW_COLOUR_2_STRINGID, ft);
|
||||
}
|
||||
screenCoords.y += SCROLLABLE_ROW_HEIGHT;
|
||||
screenCoords.y += kScrollableRowHeight;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -465,19 +465,19 @@ static Widget window_object_load_error_widgets[] = {
|
|||
|
||||
ScreenSize OnScrollGetSize(const int32_t scrollIndex) override
|
||||
{
|
||||
return ScreenSize(0, no_list_items * SCROLLABLE_ROW_HEIGHT);
|
||||
return ScreenSize(0, no_list_items * kScrollableRowHeight);
|
||||
}
|
||||
|
||||
void OnScrollMouseDown(const int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
|
||||
{
|
||||
const auto selectedItem = screenCoords.y / SCROLLABLE_ROW_HEIGHT;
|
||||
const auto selectedItem = screenCoords.y / kScrollableRowHeight;
|
||||
SelectObjectFromList(selectedItem);
|
||||
}
|
||||
|
||||
void OnScrollMouseOver(const int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
|
||||
{
|
||||
// Highlight item that the cursor is over, or remove highlighting if none
|
||||
const auto selectedItem = screenCoords.y / SCROLLABLE_ROW_HEIGHT;
|
||||
const auto selectedItem = screenCoords.y / kScrollableRowHeight;
|
||||
if (selectedItem < 0 || selectedItem >= no_list_items)
|
||||
_highlightedIndex = -1;
|
||||
else
|
||||
|
@ -513,15 +513,15 @@ static Widget window_object_load_error_widgets[] = {
|
|||
for (int32_t i = 0; i < no_list_items; i++)
|
||||
{
|
||||
ScreenCoordsXY screenCoords;
|
||||
screenCoords.y = i * SCROLLABLE_ROW_HEIGHT;
|
||||
screenCoords.y = i * kScrollableRowHeight;
|
||||
if (screenCoords.y > dpi.y + dpi.height)
|
||||
break;
|
||||
|
||||
if (screenCoords.y + SCROLLABLE_ROW_HEIGHT < dpi.y)
|
||||
if (screenCoords.y + kScrollableRowHeight < dpi.y)
|
||||
continue;
|
||||
|
||||
const auto screenRect = ScreenRect{ { 0, screenCoords.y },
|
||||
{ listWidth, screenCoords.y + SCROLLABLE_ROW_HEIGHT - 1 } };
|
||||
{ listWidth, screenCoords.y + kScrollableRowHeight - 1 } };
|
||||
// If hovering over item, change the color and fill the backdrop.
|
||||
if (i == selected_list_item)
|
||||
GfxFillRect(dpi, screenRect, ColourMapA[colours[1]].darker);
|
||||
|
|
|
@ -385,7 +385,7 @@ static Widget _rideListWidgets[] = {
|
|||
*/
|
||||
ScreenSize OnScrollGetSize(int32_t scrollIndex) override
|
||||
{
|
||||
const auto newHeight = static_cast<int32_t>(_rideList.size() * SCROLLABLE_ROW_HEIGHT);
|
||||
const auto newHeight = static_cast<int32_t>(_rideList.size() * kScrollableRowHeight);
|
||||
if (selected_list_item != -1)
|
||||
{
|
||||
selected_list_item = -1;
|
||||
|
@ -410,7 +410,7 @@ static Widget _rideListWidgets[] = {
|
|||
*/
|
||||
void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
|
||||
{
|
||||
const auto index = screenCoords.y / SCROLLABLE_ROW_HEIGHT;
|
||||
const auto index = screenCoords.y / kScrollableRowHeight;
|
||||
if (index < 0 || static_cast<size_t>(index) >= _rideList.size())
|
||||
return;
|
||||
|
||||
|
@ -436,7 +436,7 @@ static Widget _rideListWidgets[] = {
|
|||
*/
|
||||
void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
|
||||
{
|
||||
const auto index = screenCoords.y / SCROLLABLE_ROW_HEIGHT;
|
||||
const auto index = screenCoords.y / kScrollableRowHeight;
|
||||
if (index < 0 || static_cast<size_t>(index) >= _rideList.size())
|
||||
return;
|
||||
|
||||
|
@ -551,7 +551,7 @@ static Widget _rideListWidgets[] = {
|
|||
if (i == static_cast<size_t>(selected_list_item))
|
||||
{
|
||||
// Background highlight
|
||||
GfxFilterRect(dpi, { 0, y, 800, y + SCROLLABLE_ROW_HEIGHT - 1 }, FilterPaletteID::PaletteDarken1);
|
||||
GfxFilterRect(dpi, { 0, y, 800, y + kScrollableRowHeight - 1 }, FilterPaletteID::PaletteDarken1);
|
||||
format = (_quickDemolishMode ? STR_LIGHTPINK_STRINGID : STR_WINDOW_COLOUR_2_STRINGID);
|
||||
}
|
||||
|
||||
|
@ -741,7 +741,7 @@ static Widget _rideListWidgets[] = {
|
|||
ft.Add<StringId>(formatSecondary);
|
||||
}
|
||||
DrawTextEllipsised(dpi, { 160, y - 1 }, 157, format, ft);
|
||||
y += SCROLLABLE_ROW_HEIGHT;
|
||||
y += kScrollableRowHeight;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -263,7 +263,7 @@ static Widget window_shortcut_change_widgets[] = {
|
|||
|
||||
ScreenSize OnScrollGetSize(int32_t scrollIndex) override
|
||||
{
|
||||
auto h = static_cast<int32_t>(_list.size() * SCROLLABLE_ROW_HEIGHT);
|
||||
auto h = static_cast<int32_t>(_list.size() * kScrollableRowHeight);
|
||||
auto bottom = std::max(0, h - widgets[WIDX_SCROLL].bottom + widgets[WIDX_SCROLL].top + 21);
|
||||
if (bottom < scrolls[0].v_top)
|
||||
{
|
||||
|
@ -275,7 +275,7 @@ static Widget window_shortcut_change_widgets[] = {
|
|||
|
||||
void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
|
||||
{
|
||||
auto index = static_cast<int_fast16_t>((screenCoords.y - 1) / SCROLLABLE_ROW_HEIGHT);
|
||||
auto index = static_cast<int_fast16_t>((screenCoords.y - 1) / kScrollableRowHeight);
|
||||
if (static_cast<size_t>(index) < _list.size())
|
||||
{
|
||||
_highlightedItem = index;
|
||||
|
@ -289,7 +289,7 @@ static Widget window_shortcut_change_widgets[] = {
|
|||
|
||||
void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
|
||||
{
|
||||
auto selectedItem = static_cast<size_t>((screenCoords.y - 1) / SCROLLABLE_ROW_HEIGHT);
|
||||
auto selectedItem = static_cast<size_t>((screenCoords.y - 1) / kScrollableRowHeight);
|
||||
if (selectedItem < _list.size())
|
||||
{
|
||||
// Is this a separator?
|
||||
|
@ -314,13 +314,13 @@ static Widget window_shortcut_change_widgets[] = {
|
|||
|
||||
for (size_t i = 0; i < _list.size(); ++i)
|
||||
{
|
||||
auto y = static_cast<int32_t>(1 + i * SCROLLABLE_ROW_HEIGHT);
|
||||
auto y = static_cast<int32_t>(1 + i * kScrollableRowHeight);
|
||||
if (y > dpi.y + dpi.height)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (y + SCROLLABLE_ROW_HEIGHT < dpi.y)
|
||||
if (y + kScrollableRowHeight < dpi.y)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -504,7 +504,7 @@ static Widget window_shortcut_change_widgets[] = {
|
|||
|
||||
void DrawSeparator(DrawPixelInfo& dpi, int32_t y, int32_t scrollWidth)
|
||||
{
|
||||
const int32_t top = y + (SCROLLABLE_ROW_HEIGHT / 2) - 1;
|
||||
const int32_t top = y + (kScrollableRowHeight / 2) - 1;
|
||||
GfxFillRect(dpi, { { 0, top }, { scrollWidth, top } }, ColourMapA[colours[0]].mid_dark);
|
||||
GfxFillRect(dpi, { { 0, top + 1 }, { scrollWidth, top + 1 } }, ColourMapA[colours[0]].lightest);
|
||||
}
|
||||
|
@ -516,7 +516,7 @@ static Widget window_shortcut_change_widgets[] = {
|
|||
if (isHighlighted)
|
||||
{
|
||||
format = STR_WINDOW_COLOUR_2_STRINGID;
|
||||
GfxFilterRect(dpi, { 0, y - 1, scrollWidth, y + (SCROLLABLE_ROW_HEIGHT - 2) }, FilterPaletteID::PaletteDarken1);
|
||||
GfxFilterRect(dpi, { 0, y - 1, scrollWidth, y + (kScrollableRowHeight - 2) }, FilterPaletteID::PaletteDarken1);
|
||||
}
|
||||
|
||||
auto bindingOffset = (scrollWidth * 2) / 3;
|
||||
|
|
|
@ -323,7 +323,7 @@ static Widget _staffListWidgets[] = {
|
|||
Invalidate();
|
||||
}
|
||||
|
||||
auto scrollHeight = static_cast<int32_t>(_staffList.size()) * SCROLLABLE_ROW_HEIGHT;
|
||||
auto scrollHeight = static_cast<int32_t>(_staffList.size()) * kScrollableRowHeight;
|
||||
auto i = scrollHeight - widgets[WIDX_STAFF_LIST_LIST].bottom + widgets[WIDX_STAFF_LIST_LIST].top + 21;
|
||||
if (i < 0)
|
||||
i = 0;
|
||||
|
@ -339,7 +339,7 @@ static Widget _staffListWidgets[] = {
|
|||
|
||||
void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
|
||||
{
|
||||
auto i = static_cast<size_t>(screenCoords.y / SCROLLABLE_ROW_HEIGHT);
|
||||
auto i = static_cast<size_t>(screenCoords.y / kScrollableRowHeight);
|
||||
if (i != _highlightedIndex)
|
||||
{
|
||||
_highlightedIndex = static_cast<size_t>(i);
|
||||
|
@ -349,7 +349,7 @@ static Widget _staffListWidgets[] = {
|
|||
|
||||
void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
|
||||
{
|
||||
int32_t i = screenCoords.y / SCROLLABLE_ROW_HEIGHT;
|
||||
int32_t i = screenCoords.y / kScrollableRowHeight;
|
||||
for (const auto& entry : _staffList)
|
||||
{
|
||||
if (i == 0)
|
||||
|
@ -409,7 +409,7 @@ static Widget _staffListWidgets[] = {
|
|||
|
||||
if (i == _highlightedIndex)
|
||||
{
|
||||
GfxFilterRect(dpi, { 0, y, 800, y + (SCROLLABLE_ROW_HEIGHT - 1) }, FilterPaletteID::PaletteDarken1);
|
||||
GfxFilterRect(dpi, { 0, y, 800, y + (kScrollableRowHeight - 1) }, FilterPaletteID::PaletteDarken1);
|
||||
format = (_quickFireMode ? STR_LIGHTPINK_STRINGID : STR_WINDOW_COLOUR_2_STRINGID);
|
||||
}
|
||||
|
||||
|
@ -451,7 +451,7 @@ static Widget _staffListWidgets[] = {
|
|||
}
|
||||
}
|
||||
|
||||
y += SCROLLABLE_ROW_HEIGHT;
|
||||
y += kScrollableRowHeight;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -993,7 +993,7 @@ static uint64_t PageDisabledWidgets[] = {
|
|||
|
||||
ScreenSize OnScrollGetSize(int32_t scrollIndex) override
|
||||
{
|
||||
return ScreenSize(WW - 30, windowTileInspectorElementCount * SCROLLABLE_ROW_HEIGHT);
|
||||
return ScreenSize(WW - 30, windowTileInspectorElementCount * kScrollableRowHeight);
|
||||
}
|
||||
|
||||
void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
|
||||
|
@ -1003,7 +1003,7 @@ static uint64_t PageDisabledWidgets[] = {
|
|||
return;
|
||||
|
||||
// Because the list items are displayed in reverse order, subtract the calculated index from the amount of elements
|
||||
const int16_t index = windowTileInspectorElementCount - (screenCoords.y - 1) / SCROLLABLE_ROW_HEIGHT - 1;
|
||||
const int16_t index = windowTileInspectorElementCount - (screenCoords.y - 1) / kScrollableRowHeight - 1;
|
||||
const ScreenRect checkboxColumnRect{ { 2, 0 }, { 15, screenCoords.y } };
|
||||
if (index >= 0 && checkboxColumnRect.Contains(screenCoords))
|
||||
{ // Checkbox was clicked
|
||||
|
@ -1017,7 +1017,7 @@ static uint64_t PageDisabledWidgets[] = {
|
|||
|
||||
void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
|
||||
{
|
||||
int16_t index = windowTileInspectorElementCount - (screenCoords.y - 1) / SCROLLABLE_ROW_HEIGHT - 1;
|
||||
int16_t index = windowTileInspectorElementCount - (screenCoords.y - 1) / kScrollableRowHeight - 1;
|
||||
if (index < 0 || index >= windowTileInspectorElementCount)
|
||||
_highlightedIndex = -1;
|
||||
else
|
||||
|
@ -1584,7 +1584,7 @@ static uint64_t PageDisabledWidgets[] = {
|
|||
}
|
||||
|
||||
ScreenCoordsXY screenCoords{};
|
||||
screenCoords.y = SCROLLABLE_ROW_HEIGHT * (windowTileInspectorElementCount - 1);
|
||||
screenCoords.y = kScrollableRowHeight * (windowTileInspectorElementCount - 1);
|
||||
int32_t i = 0;
|
||||
char buffer[256];
|
||||
|
||||
|
@ -1601,7 +1601,7 @@ static uint64_t PageDisabledWidgets[] = {
|
|||
|
||||
// Draw row background colour
|
||||
auto fillRectangle = ScreenRect{ { 0, screenCoords.y },
|
||||
{ listWidth, screenCoords.y + SCROLLABLE_ROW_HEIGHT - 1 } };
|
||||
{ listWidth, screenCoords.y + kScrollableRowHeight - 1 } };
|
||||
if (selectedRow)
|
||||
GfxFillRect(dpi, fillRectangle, ColourMapA[colours[1]].mid_dark);
|
||||
else if (hoveredRow)
|
||||
|
@ -1718,7 +1718,7 @@ static uint64_t PageDisabledWidgets[] = {
|
|||
if (last)
|
||||
DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ LastFlagColumnXY.x, 0 }, stringFormat, checkboxFormatter);
|
||||
|
||||
screenCoords.y -= SCROLLABLE_ROW_HEIGHT;
|
||||
screenCoords.y -= kScrollableRowHeight;
|
||||
i++;
|
||||
} while (!(tileElement++)->IsLastForTile());
|
||||
}
|
||||
|
|
|
@ -172,7 +172,7 @@ static Widget _trackListWidgets[] = {
|
|||
maxItems++;
|
||||
}
|
||||
|
||||
int32_t index = screenCoords.y / SCROLLABLE_ROW_HEIGHT;
|
||||
int32_t index = screenCoords.y / kScrollableRowHeight;
|
||||
if (index < 0 || static_cast<uint32_t>(index) >= maxItems)
|
||||
{
|
||||
index = -1;
|
||||
|
@ -328,7 +328,7 @@ static Widget _trackListWidgets[] = {
|
|||
// Extra item: custom design
|
||||
numItems++;
|
||||
}
|
||||
int32_t scrollHeight = static_cast<int32_t>(numItems * SCROLLABLE_ROW_HEIGHT);
|
||||
int32_t scrollHeight = static_cast<int32_t>(numItems * kScrollableRowHeight);
|
||||
|
||||
return { width, scrollHeight };
|
||||
}
|
||||
|
@ -519,7 +519,7 @@ static Widget _trackListWidgets[] = {
|
|||
{
|
||||
// Vehicle design not available
|
||||
DrawTextEllipsised(dpi, screenPos, 368, STR_VEHICLE_DESIGN_UNAVAILABLE, {}, { TextAlignment::CENTRE });
|
||||
screenPos.y -= SCROLLABLE_ROW_HEIGHT;
|
||||
screenPos.y -= kScrollableRowHeight;
|
||||
}
|
||||
|
||||
if (_loadedTrackDesign->track_flags & TRACK_DESIGN_FLAG_SCENERY_UNAVAILABLE)
|
||||
|
@ -529,7 +529,7 @@ static Widget _trackListWidgets[] = {
|
|||
// Scenery not available
|
||||
DrawTextEllipsised(
|
||||
dpi, screenPos, 368, STR_DESIGN_INCLUDES_SCENERY_WHICH_IS_UNAVAILABLE, {}, { TextAlignment::CENTRE });
|
||||
screenPos.y -= SCROLLABLE_ROW_HEIGHT;
|
||||
screenPos.y -= kScrollableRowHeight;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -696,7 +696,7 @@ static Widget _trackListWidgets[] = {
|
|||
{
|
||||
// Highlight
|
||||
GfxFilterRect(
|
||||
dpi, { screenCoords, { width, screenCoords.y + SCROLLABLE_ROW_HEIGHT - 1 } },
|
||||
dpi, { screenCoords, { width, screenCoords.y + kScrollableRowHeight - 1 } },
|
||||
FilterPaletteID::PaletteDarken1);
|
||||
stringId = STR_WINDOW_COLOUR_2_STRINGID;
|
||||
}
|
||||
|
@ -708,20 +708,20 @@ static Widget _trackListWidgets[] = {
|
|||
auto ft = Formatter();
|
||||
ft.Add<StringId>(STR_BUILD_CUSTOM_DESIGN);
|
||||
DrawTextBasic(dpi, screenCoords - ScreenCoordsXY{ 0, 1 }, stringId, ft);
|
||||
screenCoords.y += SCROLLABLE_ROW_HEIGHT;
|
||||
screenCoords.y += kScrollableRowHeight;
|
||||
listIndex++;
|
||||
}
|
||||
|
||||
for (auto i : _filteredTrackIds)
|
||||
{
|
||||
if (screenCoords.y + SCROLLABLE_ROW_HEIGHT >= dpi.y && screenCoords.y < dpi.y + dpi.height)
|
||||
if (screenCoords.y + kScrollableRowHeight >= dpi.y && screenCoords.y < dpi.y + dpi.height)
|
||||
{
|
||||
StringId stringId;
|
||||
if (listIndex == static_cast<size_t>(selected_list_item))
|
||||
{
|
||||
// Highlight
|
||||
GfxFilterRect(
|
||||
dpi, { screenCoords, { width, screenCoords.y + SCROLLABLE_ROW_HEIGHT - 1 } },
|
||||
dpi, { screenCoords, { width, screenCoords.y + kScrollableRowHeight - 1 } },
|
||||
FilterPaletteID::PaletteDarken1);
|
||||
stringId = STR_WINDOW_COLOUR_2_STRINGID;
|
||||
}
|
||||
|
@ -737,7 +737,7 @@ static Widget _trackListWidgets[] = {
|
|||
DrawTextBasic(dpi, screenCoords - ScreenCoordsXY{ 0, 1 }, stringId, ft);
|
||||
}
|
||||
|
||||
screenCoords.y += SCROLLABLE_ROW_HEIGHT;
|
||||
screenCoords.y += kScrollableRowHeight;
|
||||
listIndex++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,4 +84,4 @@ struct NewVersionInfo
|
|||
std::string url;
|
||||
};
|
||||
|
||||
NewVersionInfo GetLatestVersion();
|
||||
NewVersionInfo GetLatestVersion();
|
|
@ -487,4 +487,4 @@ static void PrintLaunchInformation()
|
|||
Console::WriteLine();
|
||||
|
||||
// TODO Print other potential information (e.g. user, hardware)
|
||||
}
|
||||
}
|
|
@ -41,7 +41,7 @@ enum class CloseWindowModifier : uint8_t;
|
|||
|
||||
constexpr uint8_t CloseButtonWidth = 10;
|
||||
|
||||
#define SCROLLABLE_ROW_HEIGHT 12
|
||||
constexpr uint8_t kScrollableRowHeight = 12;
|
||||
constexpr uint8_t kListRowHeight = 12;
|
||||
constexpr uint8_t kTableCellHeight = 12;
|
||||
constexpr uint8_t kButtonFaceHeight = 12;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
/*****************************************************************************
|
||||
* Copyright (c) 2014-2024 OpenRCT2 developers
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue