diff --git a/.gitignore b/.gitignore
index 4117e05150..401b329470 100644
--- a/.gitignore
+++ b/.gitignore
@@ -29,6 +29,8 @@ data/tracks.dat
data/sequence
data/object
data/assetpack
+test/tests/testdata/replays
+test/tests/testdata/sprites/result.dat
#################
## Eclipse
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9a8e0c8b53..b6edd7f277 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -82,9 +82,9 @@ set(OPENMSX_VERSION "1.6.1")
set(OPENMSX_URL "https://github.com/OpenRCT2/OpenMusic/releases/download/v${OPENMSX_VERSION}/openmusic.zip")
set(OPENMSX_SHA256 "994b350d3b180ee1cb9619fe27f7ebae3a1a5232840c4bd47a89f33fa89de1a1")
-set(REPLAYS_VERSION "0.0.90")
+set(REPLAYS_VERSION "0.0.91")
set(REPLAYS_URL "https://github.com/OpenRCT2/replays/releases/download/v${REPLAYS_VERSION}/replays.zip")
-set(REPLAYS_SHA256 "f8474a927e155056e5729b6fa9f05af2a85ae7e1435f5fa89ba496242f9f255e")
+set(REPLAYS_SHA256 "5b99edc3d8445fcd2cb22c204708247f575d0bdd3128561322e3abf01e977c79")
option(FORCE32 "Force 32-bit build. It will add `-m32` to compiler flags.")
option(WITH_TESTS "Build tests")
diff --git a/contributors.md b/contributors.md
index 53cd7ea965..e4149d51e3 100644
--- a/contributors.md
+++ b/contributors.md
@@ -7,7 +7,6 @@ Includes all git commit authors. Aliases are GitHub usernames or community nickn
* Michał Janiszewski (janisozaur) - Programming
* Hielke Morsink (Broxzier) - Programming
* Tulio Paschoalin Leao (tupaschoal) - Programming
-* Matthias Moninger (ZehMatt) - Programming
* Karst van Galen Last (AuraSpecs) - Lead OpenSoundEffects & OpenMusic
* Michael Bernardi (mrmbernardi) - Programming
* Michael Steenbeek (Gymnasiast) - Lead Localisation - Programming
@@ -25,6 +24,7 @@ Includes all git commit authors. Aliases are GitHub usernames or community nickn
* Richard Jenkins (rwjuk)
* Rik Smeets (rik-smeets)
* Olivier Wervers (Oli414)
+* Matthias Moninger (ZehMatt)
## Long term contributors
Appreciation for long term contributors to the project having provided substantial work.
diff --git a/data/language/ca-ES.txt b/data/language/ca-ES.txt
index aff7bbf8c5..ad23410ca7 100644
--- a/data/language/ca-ES.txt
+++ b/data/language/ca-ES.txt
@@ -3839,3 +3839,8 @@ STR_7004 :Força que es torni a dibuixar
STR_7005 :Dibuixa una àrea de camí
STR_7006 :Dibuixa una vora al voltant de les imatges dels botons
STR_7007 :Tipus d’atracció
+STR_7008 :Tipus d’atracció desconegut ({INT32})
+STR_7009 :Es reben scripts nous…
+STR_7010 :No s’ha pogut iniciar la repetició. El fitxer «{STRING}» no existeix o no és vàlid.
+STR_7011 :No s’ha pogut iniciar la repetició.
+STR_7012 :Złoty polonès (PLN)
diff --git a/data/language/de-DE.txt b/data/language/de-DE.txt
index 00a606a774..aae868b05b 100644
--- a/data/language/de-DE.txt
+++ b/data/language/de-DE.txt
@@ -3831,3 +3831,4 @@ STR_7004 :Erzwinge Neuzeichnung
STR_7005 :Baue eine Fläche aus Fußwegen
STR_7006 :Zeichne Ränder um Bildknöpfe
STR_7007 :Achterbahntyp
+STR_7008 :Unbekannter Fahrgeschäftstyp ({INT32})
diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt
index 0102bca7d7..b10b65b668 100644
--- a/data/language/en-GB.txt
+++ b/data/language/en-GB.txt
@@ -3838,3 +3838,11 @@ STR_7005 :Drag an area of footpath
STR_7006 :Draw border around image buttons
STR_7007 :Ride Type
STR_7008 :Unknown ride type ({INT32})
+STR_7009 :Receiving scripts…
+STR_7010 :Could not start replay, file ‘{STRING}’ doesn’t exist or isn’t valid
+STR_7011 :Could not start replay
+STR_7012 :Polish Złoty (PLN)
+STR_7013 :Drag areas of path
+STR_7014 :I own the game on Steam, but I haven’t installed it yet.
+STR_7015 :Please close Steam if it’s running, then click ‘OK’.
+STR_7016 :OpenRCT2 has tried to trigger a download in Steam. Please open Steam and let it download the game. When Steam is finished, click ‘OK’.
diff --git a/data/language/eo-ZZ.txt b/data/language/eo-ZZ.txt
index 71208c0141..662fde46ae 100644
--- a/data/language/eo-ZZ.txt
+++ b/data/language/eo-ZZ.txt
@@ -3834,3 +3834,8 @@ STR_7004 :Devigi redesegnon
STR_7005 :Treni areon de trotuaro
STR_7006 :Desegni borderon ĉirkaŭ bildo-butonoj
STR_7007 :Atrakciotipo
+STR_7008 :Nekonata atrakciotipo ({INT32})
+STR_7009 :Ricevas skriptojn…
+STR_7010 :Ne povas komenci reludigon, la dosiero ‘{STRING}’ ne ekzistas aŭ ne validas
+STR_7011 :Ne povas komenci reludigon
+STR_7012 :Pola zloto (PLN)
diff --git a/data/language/fr-FR.txt b/data/language/fr-FR.txt
index 88a01d4a58..c889b511c9 100644
--- a/data/language/fr-FR.txt
+++ b/data/language/fr-FR.txt
@@ -3839,3 +3839,9 @@ STR_7003 :Le fichier audio « {STRING} » est tronqué. L’échantillon {I
STR_7004 :Forcer le rendu
STR_7005 :Remplir de chemin une zone
STR_7006 :Dessiner une bordure autour des boutons-images
+STR_7007 :Type d’attraction
+STR_7008 :Type d’attraction inconnu ({INT32})
+STR_7012 :Złoty polonais (PLN)
+STR_7009 :Réception des scripts…
+STR_7010 :Impossible de jouer l’enregistrement, le fichier {SMALLFONT}{STRING}{MEDIUMFONT} n’existe pas ou est invalide
+STR_7011 :Impossible de jouer l’enregistrement
diff --git a/data/language/gl-ES.txt b/data/language/gl-ES.txt
index 144166c637..ff329b74d7 100644
--- a/data/language/gl-ES.txt
+++ b/data/language/gl-ES.txt
@@ -3834,3 +3834,4 @@ STR_7004 :Forzar redeseño
STR_7005 :Arrastra unha área de camiño
STR_7006 :Debuxa un bordo arredor dos botóns de imaxe
STR_7007 :Tipo de atracción
+STR_7008 :Tipo de atracción descoñecida ({INT32})
diff --git a/data/language/hu-HU.txt b/data/language/hu-HU.txt
index b6dfdef848..291399acfa 100644
--- a/data/language/hu-HU.txt
+++ b/data/language/hu-HU.txt
@@ -3835,3 +3835,7 @@ STR_7005 :Útterület építése húzással
STR_7006 :Keret rajzolása a képgombok köré
STR_7007 :Játéktípus
STR_7008 :Ismeretlen játéktípus ({INT32})
+STR_7009 :Szkriptek fogadása…
+STR_7010 :Nem sikerült elindítani a visszajátszást, „{STRING}” fájl nem létezik vagy érvénytelen
+STR_7011 :Nem sikerült elindítani a visszajátszást
+STR_7012 :Lengyel złoty (PLN)
diff --git a/data/language/ko-KR.txt b/data/language/ko-KR.txt
index b935769a7c..69dfc1368f 100644
--- a/data/language/ko-KR.txt
+++ b/data/language/ko-KR.txt
@@ -3838,3 +3838,7 @@ STR_7005 :드래그로 보도 건설
STR_7006 :버튼 주위에 경계선 표시
STR_7007 :놀이기구 종류
STR_7008 :알 수 없는 놀이기구 종류 ({INT32})
+STR_7009 :스크립트 받는 중…
+STR_7010 :리플레이를 시작할 수 없습니다, ‘{STRING}’ 파일이 존재하지 않거나 유효하지 않습니다
+STR_7011 :리플레이를 시작할 수 없습니다
+STR_7012 :폴란드 즐로티 (PLN)
diff --git a/data/language/nl-NL.txt b/data/language/nl-NL.txt
index 9643050f41..551b0ea45f 100644
--- a/data/language/nl-NL.txt
+++ b/data/language/nl-NL.txt
@@ -3426,7 +3426,7 @@ STR_6396 :Schermbeveiliging en -energiebesparing uitschakelen
STR_6397 :Als dit is ingeschakeld, zal (zolang OpenRCT2 loopt) de schermbeveiliging niet worden ingeschakeld en gaat het scherm ook niet na verloop van tijd op zwart.
STR_6398 :Bestand bevat niet-ondersteunde attractietypes. Update naar een nieuwere versie van OpenRCT2 om dit bestand te openen.
STR_6399 :OpenRCT2 heeft bestanden van een RollerCoaster Tycoon 2-installatie nodig. Voer het pad naar de map waar de bestanden van RollerCoaster Tycoon 2 zich bevinden in bij de variabele “game_path” in config.ini. Start daarna OpenRCT2 opnieuw op.
-STR_6400 :Ik heb offline GOG-installer voor RollerCoaster Tycoon 2 gedownload, maar nog niet geïnstalleerd
+STR_6400 :Ik heb de offline GOG-installer voor RollerCoaster Tycoon 2 gedownload, maar nog niet geïnstalleerd
STR_6401 :Ik heb RollerCoaster Tycoon 2 al geïnstalleerd
STR_6402 :OpenRCT2-data instellen
STR_6403 :Selecteer de optie die op je situatie van toepassing is:
@@ -3834,3 +3834,7 @@ STR_7005 :Voetpaden aanleggen door te slepen
STR_7006 :Rand tekenen om knoppen met alleen een plaatje
STR_7007 :Attractietype
STR_7008 :Onbekend attractietype ({INT32})
+STR_7009 :Scripts ophalen…
+STR_7010 :Kon de replay niet starten, bestand ‘{STRING}’ bestaat niet of is ongeldig.
+STR_7011 :Kon de replay niet starten.
+STR_7012 :Poolse Złoty (PLN)
diff --git a/data/language/pl-PL.txt b/data/language/pl-PL.txt
index 2c185a76eb..6477d7b413 100644
--- a/data/language/pl-PL.txt
+++ b/data/language/pl-PL.txt
@@ -1062,7 +1062,7 @@ STR_1676 :Ustaw limit prędkości hamowania
STR_1677 :{WINDOW_COLOUR_2}Popularność: {BLACK}Nieznana
STR_1678 :{WINDOW_COLOUR_2}Popularność: {BLACK}{COMMA16}%
STR_1679 :Spirala w górę (lewo)
-STR_1680 :Spirala w dół (prawo)
+STR_1680 :Spirala w górę (prawo)
STR_1681 :Spirala w dół (lewo)
STR_1682 :Spirala w dół (prawo)
STR_1683 :Wymiary bazowe 2 × 2
@@ -3081,7 +3081,7 @@ STR_5998 :Dodaj pieniądze
STR_5999 :Ustaw pieniądze
STR_6000 :Wprowadź nową wartość:
STR_6001 :Włącz efekty świetlne (eksperymentalne)
-STR_6002 :Lampy i atrakcje będą świeciły w nocy.{NEWLINE}Wymaga włączenia silnika sprzętowego.
+STR_6002 :Lampy i atrakcje będą świeciły w nocy.{NEWLINE}Wymaga włączenia renderowania sprzętowego.
STR_6003 :Widok przekroju
STR_6004 :Widok przekroju
STR_6005 :Włącz widok przekroju
@@ -3769,3 +3769,73 @@ STR_6739 :{WINDOW_COLOUR_2}Data: {BLACK}{STRINGID}
STR_6740 :{WINDOW_COLOUR_2}Gotówka: {BLACK}{CURRENCY2DP}
STR_6741 :{WINDOW_COLOUR_2}Liczba atrakcji: {BLACK}{UINT16}
STR_6742 :{WINDOW_COLOUR_2}Liczba gości: {BLACK}{UINT16}
+STR_6743 :Klimat
+STR_6744 :{WINDOW_COLOUR_2}{UINT16}%
+STR_6745 :{WINDOW_COLOUR_2}Preferencje intensywności gości:
+STR_6746 :Brak preferencji
+STR_6747 :Różne preferencje (domyślne)
+STR_6748 :Tylko mniej intensywne przejażdżki
+STR_6749 :Tylko bardziej intensywne przejażdżki
+STR_6750 :Wybierz preferencje nowych gości dot. intensywności przejażdżek.
+STR_6751 :Zakolejkowane ścieżki nie mogą być na przejeździe kolejowym!
+STR_6752 :Opcje scenariusza - Cele
+STR_6753 :Opcje scenariusza - Szczegóły scenariusza
+STR_6754 :Opcje scenariusza - Ograniczenia terenu
+STR_6755 :Pokaż opcje celów
+STR_6756 :Pokaż opcje szczegółów scenariusza
+STR_6757 :Pokaż opcje ograniczenia terenu
+STR_6758 :Opcje pożyczki
+STR_6759 :Model biznesowy
+STR_6760 :Zarobki:
+STR_6761 :Szczegóły scenariusza
+STR_6762 :Interfejs
+STR_6763 :RollerCoaster Tycoon 1
+STR_6764 :Zapisywanie i auto. zapisy
+STR_6765 :Zaawansowane
+STR_6766 :Wyczyść
+STR_6767 :Okno
+STR_6768 :Renderowanie
+STR_6769 :Zachowanie
+STR_6770 :Limit klatek/sek.:
+STR_6771 :Prędkość wewnętrzna (domyślne)
+STR_6772 :Synchronizacja pionowa
+STR_6773 :Nielimitowane
+STR_6774 :Czas od ostatniej inspekcji
+STR_6775 :{COMMA16} minuta
+STR_6776 :{COMMA16} minuty
+STR_6777 :więcej niż 4 godziny
+STR_6778 :Podgląd scenariuszy poprzez:
+STR_6779 :Wybierz rodzaj obrazka podglądowego, który będzie używany na ekranie wyboru scenariusza.
+STR_6780 :Miniatury map
+STR_6781 :Zrzuty ekranu
+STR_6782 :Powiadomienia parku
+STR_6783 :Powiadomienia przejażdżki
+STR_6784 :Powiadomienia gości
+STR_6785 :Kontroler
+STR_6786 :Martwa strefa:
+STR_6787 :Martwa strefa gałki analogowej (minimalny wymagany ruch gałką)
+STR_6788 :Czułość:
+STR_6789 :Mnożnik czułości gałki analogowej
+STR_6790 :Martwa strefa: {COMMA32}%
+STR_6791 :Czułość: {COMMA32}%
+STR_6792 :Budynki wejściowe
+STR_6793 :Goście i pracownicy
+STR_6794 :Scenerie i style
+STR_6795 :{MOVE_X}{10}{STRINGID}
+STR_6796 :•{MOVE_X}{10}{STRINGID}
+STR_6797 :Brak podglądu
+STR_6798 :Zrzut ekranu
+STR_6799 :Miniatura mapy
+STR_7000 :lub
+STR_7001 :Nazwa przejażdżki
+STR_7002 :{STRINGID} {STRINGID}
+STR_7003 :Plik audio ‘{STRING}’ jest wybrakowany. Oczekiwano próbki {INT32}, ale jedynie {INT32} jest dostępna. Rozważ przeinstalowanie RCT2.
+STR_7004 :Wymuś przerysowanie
+STR_7005 :Przeciągnij obszar chodnika
+STR_7006 :Rysuj ramkę wokół przycisków
+STR_7007 :Rodzaj przejażdżki
+STR_7008 :Nieznany rodzaj przejażdżki ({INT32})
+STR_7009 :Otrzymywanie skryptów…
+STR_7010 :Nie udało się uruchomić powtórki, plik ‘{STRING}’ nie istnieje lub jest nieprawidłowy
+STR_7011 :Nie udało się uruchomić powtórki
+STR_7012 :Polski Złoty (zł)
diff --git a/data/language/pt-BR.txt b/data/language/pt-BR.txt
index 14778594e4..9001150040 100644
--- a/data/language/pt-BR.txt
+++ b/data/language/pt-BR.txt
@@ -3835,3 +3835,7 @@ STR_7005 :Arrastar uma área de calçada
STR_7006 :Desenhar borda ao redor dos botões com imagens
STR_7007 :Tipo de Atração
STR_7008 :Tipo de atração desconhecido ({INT32})
+STR_7009 :Recebendo scripts…
+STR_7010 :Não foi possível iniciar o replay, o arquivo ‘{STRING}’ não existe ou é inválido
+STR_7011 :Não foi possível iniciar o replay
+STR_7012 :Złoty polonês (PLN)
diff --git a/data/language/ru-RU.txt b/data/language/ru-RU.txt
index b5ecffae10..f0fc80cf52 100644
--- a/data/language/ru-RU.txt
+++ b/data/language/ru-RU.txt
@@ -3822,3 +3822,7 @@ STR_7004 :Полная перерисовка
STR_7006 :Бордюр на кнопках с изображениями
STR_7007 :Тип аттр.
STR_7008 :Неизвестный аттракцион ({INT32})
+STR_7009 :Скачиваются скрипты…
+STR_7010 :Не могу запустить демо - файл «{STRING}» не существует или повреждён
+STR_7011 :Не могу запустить демо
+STR_7012 :Польские злотые (PLN)
diff --git a/distribution/changelog.txt b/distribution/changelog.txt
index c13f1560df..5c66141169 100644
--- a/distribution/changelog.txt
+++ b/distribution/changelog.txt
@@ -1,9 +1,48 @@
+0.4.30 (in development)
+------------------------------------------------------------------------
+- Improved: [#24912] Staff now use an appropriate standing animation while waiting at level crossings.
+- Improved: [#25515] Path dragging can now be disabled via multiplayer group permissions.
+- Improved: [#25529] The map selection grid no longer redraws every frame if it has not changed.
+- Improved: [#25530] Wall dragging can now be cancelled without closing the Scenery window.
+- Improved: [#25575] Updated the network protocol to a new format that supports larger packets, allowing clients to connect reliably to servers with many objects or large maps.
+- Improved: [#25621] Added the Polish Złoty (PLN) to the list of available currencies.
+- Improved: [#25625] Renewing and refurbishing rides now also resets the downtime.
+- Improved: [#25662] The sprite build command is faster when building sprites from the same image file.
+- Change: [#21912] Toilet income is now categorised as shop sales instead of ride tickets.
+- Change: [#25403] Guests will not slide down the Spiral Slide if it's broken, even if they have already entered the ride structure.
+- Change: [#25485] Make the enlarged pressed swatch sprite more pronounced.
+- Change: [#25544] The default game window size is now 1280×720px instead of 640×480px.
+- Fix: [#9895] Stand-up coaster gets wrong intensity boost from the synchronisation bonus.
+- Fix: [#11617] Path corner connections are broken when hovering track design ghosts with paths over them in zero clearances.
+- Fix: [#22484] Lingering ghost entrance after placing park entrance.
+- Fix: [#24952] Duplicate track designs when running via Steam without having RCT1 linked.
+- Fix: [#25187] On-ride photo platform does not render as ghost when placing track design.
+- Fix: [#25229] Excessive logging of game actions, reduced to top-level game actions and filters ghost related ones.
+- Fix: [#25469] Drawing in the ui.imageManager.draw callback causes an assertion.
+- Fix: [#25524] The track construction arrow does not immediately change position when deleting track pieces.
+- Fix: [#25552] Clear Scenery does not show an error message about insufficient money if cash is negative.
+- Fix: [#25565] Chairlift station ends are missing tunnels at certain rotations.
+- Fix: [#25569] Placing park entrances in multiplayer does not show for other players, causing desyncs.
+- Fix: [#25571] Potential crash due to drawing a Crooked House ride.
+- Fix: [#25588] When the master server becomes unreachable the server would not register again until a restart.
+- Fix: [#25592] Log flume, river rapids, & splash boats can get control failure breakdown instead of brakes failure.
+- Fix: [#25595] Invisible entrance is added to imported SV4 saves.
+- Fix: [#25601] Inspection interval of a ride gets reset when opening the construction window.
+- Fix: [#25628] Availability of AVX2 and SSE4.1 is not detected correctly.
+- Fix: [#25639] Scenery window crashes when a no longer present object is still selected.
+- Fix: [#25641] Desync because of mismatching inspection intervals.
+- Fix: [#25642] The selection marker for purchasing land rights is not drawn with the correct colours.
+- Fix: [#25646] It is possible to remove scenery and paths when setting staff patrol areas and purchasing land.
+- Fix: [#25660] After saving a track design with scenery, that ride’s entrances and exits are visible in ‘Highlight path issues’ mode.
+- Fix: [#25717] Umbrellas given to guests by means of cheats do not use the full (extended) range of colours.
+
0.4.29 (2025-11-22)
------------------------------------------------------------------------
- Feature: [#25459] Wall line dragging tool.
- Improved: [#25028] Stalls now support colour presets, just like regular rides.
- Improved: [#25426] Building the track designs index is now quicker.
- Improved: [#25490] The ‘New Ride’ window can now be resized.
+- Improved: [#25502] Track height markers on flat rides now more sensible.
- Fix: [#6228] The saved queue line path connections are not preserved when placing track designs (original bug).
- Fix: [#14365] Track designs with scenery below the lowest track piece do not preview correctly.
- Fix: [#25451] Dropdown item tooltips stay open if the mouse is moved over an empty space.
@@ -14,6 +53,7 @@
- Fix: [#25480] The mini track design preview and price are misaligned in Enlarged UI mode.
- Fix: [#25488] Crash in headless mode.
- Fix: [#25494] The Go-Karts steep to flat track does not draw correctly in the flat side tunnel.
+- Fix: [#25503] Height markers missing from some maze tiles.
- Fix: [#25518] The virtual floor does not draw correctly if expanded on the positive x and y axes.
- Fix: [#25519] Crackling audio when sampling frequencies do not match.
- Fix: [objects#401] Round tunnels on down slopes glitch.
diff --git a/openrct2.deps.targets b/openrct2.deps.targets
index 34aea9797e..55f7507cf1 100644
--- a/openrct2.deps.targets
+++ b/openrct2.deps.targets
@@ -224,8 +224,8 @@
06b90f3e19c216752df441d551b26a9e3e1ba7755bdd2102504b73bf993608be
https://github.com/OpenRCT2/OpenMusic/releases/download/v1.6.1/openmusic.zip
994b350d3b180ee1cb9619fe27f7ebae3a1a5232840c4bd47a89f33fa89de1a1
- https://github.com/OpenRCT2/replays/releases/download/v0.0.90/replays.zip
- f8474a927e155056e5729b6fa9f05af2a85ae7e1435f5fa89ba496242f9f255e
+ https://github.com/OpenRCT2/replays/releases/download/v0.0.91/replays.zip
+ 5b99edc3d8445fcd2cb22c204708247f575d0bdd3128561322e3abf01e977c79
diff --git a/readme.md b/readme.md
index 7405e0e39d..22d9802cab 100644
--- a/readme.md
+++ b/readme.md
@@ -19,7 +19,7 @@
### Download
| Latest release | Latest development build |
|----------------------------------------------------------------------------------------------------------------------|--------------------------|
-| [](https://openrct2.io/download/release/latest) | [](https://openrct2.io/download/develop/latest) |
+| [](https://openrct2.io/download/release/latest) | [](https://openrct2.io/download/develop/latest) |
---
@@ -85,7 +85,6 @@ Some Linux distributions offer native packages:
Some \*BSD operating systems offer native packages:
* FreeBSD: [games/openrct2](https://www.freshports.org/games/openrct2)
-* OpenBSD: [games/openrct2](https://openports.se/games/openrct2)
---
diff --git a/resources/g2/icons/colour_pressed_large.png b/resources/g2/icons/colour_pressed_large.png
index c73c31cb28..13227a67e1 100644
Binary files a/resources/g2/icons/colour_pressed_large.png and b/resources/g2/icons/colour_pressed_large.png differ
diff --git a/src/openrct2-android/app/src/main/CMakeLists.txt b/src/openrct2-android/app/src/main/CMakeLists.txt
index ef63285416..375481a0dd 100644
--- a/src/openrct2-android/app/src/main/CMakeLists.txt
+++ b/src/openrct2-android/app/src/main/CMakeLists.txt
@@ -272,6 +272,7 @@ target_include_directories(openrct2-ui PRIVATE "${ORCT2_ROOT}/src/thirdparty/duk
target_include_directories(openrct2-ui PRIVATE "${ORCT2_ROOT}/src")
target_include_directories(openrct2-ui SYSTEM PRIVATE "${ORCT2_ROOT}/src/thirdparty")
target_include_directories(openrct2-cli PRIVATE "${ORCT2_ROOT}/src")
+target_include_directories(openrct2-cli SYSTEM PRIVATE "${ORCT2_ROOT}/src/thirdparty")
target_include_directories(openrct2 PRIVATE "/opt/openrct2/include/nlohmann/../")
target_include_directories(openrct2-ui PRIVATE "/opt/openrct2/include/nlohmann/../")
diff --git a/src/openrct2-ui/UiContext.cpp b/src/openrct2-ui/UiContext.cpp
index 329845ae29..e187ae82ef 100644
--- a/src/openrct2-ui/UiContext.cpp
+++ b/src/openrct2-ui/UiContext.cpp
@@ -800,10 +800,12 @@ private:
int32_t width = Config::Get().general.windowWidth;
int32_t height = Config::Get().general.windowHeight;
#endif
+
+ // Set defaults if size is invalid
if (width <= 0)
- width = 640;
+ width = 1280;
if (height <= 0)
- height = 480;
+ height = 720;
// Create window in window first rather than fullscreen so we have the display the window is on first
uint32_t flags = SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI;
diff --git a/src/openrct2-ui/WindowManager.cpp b/src/openrct2-ui/WindowManager.cpp
index b71e0d78d5..cf0c19c967 100644
--- a/src/openrct2-ui/WindowManager.cpp
+++ b/src/openrct2-ui/WindowManager.cpp
@@ -862,7 +862,7 @@ public:
{
if (w->flags.has(WindowFlag::dead))
continue;
- if (!(w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront, WindowFlag::noAutoClose)))
+ if (!w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront, WindowFlag::noAutoClose))
{
Close(*w.get());
break;
@@ -884,7 +884,7 @@ public:
}
}
}
- else if (!(flags.has(WindowFlag::stickToFront)))
+ else if (!flags.has(WindowFlag::stickToFront))
{
for (auto it = gWindowList.rbegin(); it != gWindowList.rend(); it++)
{
@@ -903,7 +903,7 @@ public:
wp->flags = flags;
// Play sounds and flash the window
- if (!(flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront)))
+ if (!flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront))
{
wp->flash();
OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::windowOpen, 0, pos.x + (windowSize.width / 2));
@@ -964,7 +964,7 @@ public:
{
if (w->flags.has(WindowFlag::dead))
continue;
- if (!(w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront, WindowFlag::noAutoClose)))
+ if (!w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront, WindowFlag::noAutoClose))
{
foundW = w.get();
break;
@@ -1007,7 +1007,7 @@ public:
// Now close the collected windows
for (auto* wnd : windowsToClose)
{
- if (!(wnd->flags.has(WindowFlag::dead)))
+ if (!wnd->flags.has(WindowFlag::dead))
{
Close(*wnd);
}
@@ -1053,7 +1053,7 @@ public:
return;
}
- auto pred = [](WindowBase* w) -> bool { return !(w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront)); };
+ auto pred = [](WindowBase* w) -> bool { return !w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront); };
CloseByCondition(pred, WindowCloseFlags::CloseSingle);
}
@@ -1066,14 +1066,14 @@ public:
{
CloseByClass(WindowClass::dropdown);
CloseByCondition(
- [](WindowBase* w) -> bool { return !(w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront)); });
+ [](WindowBase* w) -> bool { return !w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront); });
}
void CloseAllExceptClass(WindowClass cls) override
{
CloseByClass(WindowClass::dropdown);
CloseByCondition([cls](WindowBase* w) -> bool {
- return w->classification != cls && !(w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront));
+ return w->classification != cls && !w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront);
});
}
@@ -1082,7 +1082,7 @@ public:
*/
void CloseAllExceptFlags(WindowFlags flags) override
{
- CloseByCondition([flags](WindowBase* w) -> bool { return !(w->flags.hasAny(flags)); });
+ CloseByCondition([flags](WindowBase* w) -> bool { return !w->flags.hasAny(flags); });
}
/**
@@ -1094,7 +1094,7 @@ public:
CloseByCondition([cls, number](WindowBase* w) -> bool {
return (
!(w->number == number && w->classification == cls)
- && !(w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront)));
+ && !w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront));
});
}
@@ -1327,7 +1327,7 @@ public:
*/
WindowBase* BringToFront(WindowBase& w) override
{
- if (!(w.flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront)))
+ if (!w.flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront))
{
auto itSourcePos = WindowGetIterator(&w);
if (itSourcePos != gWindowList.end())
@@ -1341,7 +1341,7 @@ public:
{
continue;
}
- if (!(w2->flags.has(WindowFlag::stickToFront)))
+ if (!w2->flags.has(WindowFlag::stickToFront))
{
// base() returns the next element in the list, so we need to decrement it.
itDestPos = std::prev(it.base());
diff --git a/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp b/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp
index d26f5b456c..bfb58b3d0f 100644
--- a/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp
+++ b/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp
@@ -878,7 +878,7 @@ void OpenGLDrawingContext::DrawSprite(RenderTarget& rt, const ImageId imageId, c
if (rt.zoom_level > ZoomLevel{ 0 })
{
- if (g1Element->flags & G1_FLAG_HAS_ZOOM_SPRITE)
+ if (g1Element->flags.has(G1Flag::hasZoomSprite))
{
RenderTarget zoomedRT;
zoomedRT.bits = rt.bits;
@@ -888,10 +888,10 @@ void OpenGLDrawingContext::DrawSprite(RenderTarget& rt, const ImageId imageId, c
zoomedRT.width = rt.width;
zoomedRT.pitch = rt.pitch;
zoomedRT.zoom_level = rt.zoom_level - 1;
- DrawSprite(zoomedRT, imageId.WithIndex(imageId.GetIndex() - g1Element->zoomed_offset), x >> 1, y >> 1);
+ DrawSprite(zoomedRT, imageId.WithIndex(imageId.GetIndex() - g1Element->zoomedOffset), x >> 1, y >> 1);
return;
}
- if (g1Element->flags & G1_FLAG_NO_ZOOM_DRAW)
+ if (g1Element->flags.has(G1Flag::noZoomDraw))
{
return;
}
@@ -899,8 +899,8 @@ void OpenGLDrawingContext::DrawSprite(RenderTarget& rt, const ImageId imageId, c
auto texture = _textureCache->GetOrLoadImageTexture(imageId);
- int32_t left = x + g1Element->x_offset;
- int32_t top = y + g1Element->y_offset;
+ int32_t left = x + g1Element->xOffset;
+ int32_t top = y + g1Element->yOffset;
int32_t xModifier = 0;
int32_t yModifier = 0;
@@ -1015,8 +1015,8 @@ void OpenGLDrawingContext::DrawSpriteRawMasked(
const auto textureMask = _textureCache->GetOrLoadImageTexture(maskImage);
const auto textureColour = _textureCache->GetOrLoadImageTexture(colourImage);
- int32_t drawOffsetX = g1ElementMask->x_offset;
- int32_t drawOffsetY = g1ElementMask->y_offset;
+ int32_t drawOffsetX = g1ElementMask->xOffset;
+ int32_t drawOffsetY = g1ElementMask->yOffset;
int32_t drawWidth = std::min(g1ElementMask->width, g1ElementColour->width);
int32_t drawHeight = std::min(g1ElementMask->height, g1ElementColour->height);
@@ -1075,8 +1075,8 @@ void OpenGLDrawingContext::DrawSpriteSolid(RenderTarget& rt, const ImageId image
const auto texture = _textureCache->GetOrLoadImageTexture(image);
- int32_t drawOffsetX = g1Element->x_offset;
- int32_t drawOffsetY = g1Element->y_offset;
+ int32_t drawOffsetX = g1Element->xOffset;
+ int32_t drawOffsetY = g1Element->yOffset;
int32_t drawWidth = static_cast(g1Element->width);
int32_t drawHeight = static_cast(g1Element->height);
@@ -1127,8 +1127,8 @@ void OpenGLDrawingContext::DrawGlyph(RenderTarget& rt, const ImageId image, int3
const auto texture = _textureCache->GetOrLoadGlyphTexture(image, palette);
- int32_t left = x + g1Element->x_offset;
- int32_t top = y + g1Element->y_offset;
+ int32_t left = x + g1Element->xOffset;
+ int32_t top = y + g1Element->yOffset;
int32_t right = left + static_cast(g1Element->width);
int32_t bottom = top + static_cast(g1Element->height);
@@ -1229,7 +1229,7 @@ void OpenGLDrawingContext::DrawTTFBitmap(
command.texMaskBounds = { 0.0f, 0.0f, 0.0f, 0.0f };
command.palettes = { 0, 0, 0 };
command.flags = DrawRectCommand::FLAG_TTF_TEXT;
- command.colour = info->palette[3];
+ command.colour = info->palette.shadowOutline;
command.bounds = b;
command.depth = _drawCount++;
command.zoom = 1.0f;
@@ -1245,7 +1245,7 @@ void OpenGLDrawingContext::DrawTTFBitmap(
command.texMaskBounds = { 0.0f, 0.0f, 0.0f, 0.0f };
command.palettes = { 0, 0, 0 };
command.flags = DrawRectCommand::FLAG_TTF_TEXT;
- command.colour = info->palette[3];
+ command.colour = info->palette.shadowOutline;
command.bounds = { left + 1, top + 1, right + 1, bottom + 1 };
command.depth = _drawCount++;
command.zoom = 1.0f;
@@ -1259,7 +1259,7 @@ void OpenGLDrawingContext::DrawTTFBitmap(
command.texMaskBounds = { 0.0f, 0.0f, 0.0f, 0.0f };
command.palettes = { 0, 0, 0 };
command.flags = DrawRectCommand::FLAG_TTF_TEXT | (hintingThreshold << 8);
- command.colour = info->palette[1];
+ command.colour = info->palette.fill;
command.bounds = { left, top, right, bottom };
command.depth = _drawCount++;
command.zoom = 1.0f;
diff --git a/src/openrct2-ui/drawing/engines/opengl/OpenGLFramebuffer.cpp b/src/openrct2-ui/drawing/engines/opengl/OpenGLFramebuffer.cpp
index 0c60599bbb..1b467792b3 100644
--- a/src/openrct2-ui/drawing/engines/opengl/OpenGLFramebuffer.cpp
+++ b/src/openrct2-ui/drawing/engines/opengl/OpenGLFramebuffer.cpp
@@ -180,7 +180,7 @@ GLuint OpenGLFramebuffer::CreateDepthTexture(int32_t width, int32_t height)
return depth;
}
-void OpenGLFramebuffer::GetPixels(RenderTarget& rt) const
+void OpenGLFramebuffer::GetPixels(Drawing::RenderTarget& rt) const
{
assert(rt.width == _width && rt.height == _height);
@@ -200,7 +200,7 @@ void OpenGLFramebuffer::GetPixels(RenderTarget& rt) const
}
}
-void OpenGLFramebuffer::SetPixels(const RenderTarget& rt)
+void OpenGLFramebuffer::SetPixels(const Drawing::RenderTarget& rt)
{
assert(rt.width == _width && rt.height == _height);
diff --git a/src/openrct2-ui/drawing/engines/opengl/OpenGLFramebuffer.h b/src/openrct2-ui/drawing/engines/opengl/OpenGLFramebuffer.h
index 0507a049fe..4b5d50ed7e 100644
--- a/src/openrct2-ui/drawing/engines/opengl/OpenGLFramebuffer.h
+++ b/src/openrct2-ui/drawing/engines/opengl/OpenGLFramebuffer.h
@@ -58,12 +58,12 @@ namespace OpenRCT2::Ui
void Bind() const;
void BindDraw() const;
void BindRead() const;
- void GetPixels(RenderTarget& rt) const;
+ void GetPixels(Drawing::RenderTarget& rt) const;
void SwapColourBuffer(OpenGLFramebuffer& other);
GLuint SwapDepthTexture(GLuint depth);
void Copy(OpenGLFramebuffer& src, GLenum filter);
- void SetPixels(const RenderTarget& rt);
+ void SetPixels(const Drawing::RenderTarget& rt);
static GLuint CreateDepthTexture(int32_t width, int32_t height);
};
diff --git a/src/openrct2-ui/drawing/engines/opengl/TextureCache.cpp b/src/openrct2-ui/drawing/engines/opengl/TextureCache.cpp
index 1f290cde6f..14e772e214 100644
--- a/src/openrct2-ui/drawing/engines/opengl/TextureCache.cpp
+++ b/src/openrct2-ui/drawing/engines/opengl/TextureCache.cpp
@@ -226,7 +226,7 @@ void TextureCache::GeneratePaletteTexture()
const auto* element = GfxGetG1Element(g1Index.value());
if (element != nullptr)
{
- GfxDrawSpriteSoftware(rt, ImageId(g1Index.value()), { -element->x_offset, y - element->y_offset });
+ GfxDrawSpriteSoftware(rt, ImageId(g1Index.value()), { -element->xOffset, y - element->yOffset });
}
}
}
@@ -361,7 +361,7 @@ RenderTarget TextureCache::GetImageAsDPI(const ImageId imageId)
int32_t height = g1Element->height;
RenderTarget rt = CreateDPI(width, height);
- GfxDrawSpriteSoftware(rt, imageId, { -g1Element->x_offset, -g1Element->y_offset });
+ GfxDrawSpriteSoftware(rt, imageId, { -g1Element->xOffset, -g1Element->yOffset });
return rt;
}
@@ -373,7 +373,7 @@ RenderTarget TextureCache::GetGlyphAsDPI(const ImageId imageId, const PaletteMap
RenderTarget rt = CreateDPI(width, height);
- const auto glyphCoords = ScreenCoordsXY{ -g1Element->x_offset, -g1Element->y_offset };
+ const auto glyphCoords = ScreenCoordsXY{ -g1Element->xOffset, -g1Element->yOffset };
GfxDrawSpritePaletteSetSoftware(rt, imageId, glyphCoords, palette);
return rt;
}
diff --git a/src/openrct2-ui/drawing/engines/opengl/TextureCache.h b/src/openrct2-ui/drawing/engines/opengl/TextureCache.h
index 513995b50f..aa580a16ac 100644
--- a/src/openrct2-ui/drawing/engines/opengl/TextureCache.h
+++ b/src/openrct2-ui/drawing/engines/opengl/TextureCache.h
@@ -20,9 +20,13 @@
#include
#include
-struct RenderTarget;
struct PaletteMap;
-enum class FilterPaletteID : int32_t;
+
+namespace OpenRCT2::Drawing
+{
+ enum class FilterPaletteID : int32_t;
+ struct RenderTarget;
+} // namespace OpenRCT2::Drawing
namespace OpenRCT2::Ui
{
@@ -211,7 +215,7 @@ namespace OpenRCT2::Ui
GLuint GetAtlasesTexture();
GLuint GetPaletteTexture();
GLuint GetBlendPaletteTexture();
- static GLint PaletteToY(FilterPaletteID palette);
+ static GLint PaletteToY(Drawing::FilterPaletteID palette);
private:
void CreateTextures();
@@ -221,11 +225,11 @@ namespace OpenRCT2::Ui
AtlasTextureInfo LoadGlyphTexture(const ImageId image, const PaletteMap& paletteMap);
AtlasTextureInfo AllocateImage(int32_t imageWidth, int32_t imageHeight);
AtlasTextureInfo LoadBitmapTexture(ImageIndex image, const void* pixels, size_t width, size_t height);
- static RenderTarget GetImageAsDPI(const ImageId imageId);
- static RenderTarget GetGlyphAsDPI(const ImageId imageId, const PaletteMap& paletteMap);
+ static Drawing::RenderTarget GetImageAsDPI(const ImageId imageId);
+ static Drawing::RenderTarget GetGlyphAsDPI(const ImageId imageId, const PaletteMap& paletteMap);
void FreeTextures();
- static RenderTarget CreateDPI(int32_t width, int32_t height);
- static void DeleteDPI(RenderTarget rt);
+ static Drawing::RenderTarget CreateDPI(int32_t width, int32_t height);
+ static void DeleteDPI(Drawing::RenderTarget rt);
};
} // namespace OpenRCT2::Ui
diff --git a/src/openrct2-ui/input/MouseInput.cpp b/src/openrct2-ui/input/MouseInput.cpp
index 712c66d1b0..125a9097ab 100644
--- a/src/openrct2-ui/input/MouseInput.cpp
+++ b/src/openrct2-ui/input/MouseInput.cpp
@@ -220,7 +220,7 @@ namespace OpenRCT2
if (scroll.flags & VSCROLLBAR_VISIBLE)
{
- int16_t size = widget.height() - 1;
+ int16_t size = widget.height() - 2;
if (scroll.flags & HSCROLLBAR_VISIBLE)
size -= 11;
size = std::max(0, scroll.contentHeight - size);
@@ -397,7 +397,7 @@ namespace OpenRCT2
break;
if (w->classification != _dragWidget.windowClassification || w->number != _dragWidget.windowNumber
- || !(gInputFlags.has(InputFlag::toolActive)))
+ || !gInputFlags.has(InputFlag::toolActive))
{
break;
}
@@ -490,9 +490,7 @@ namespace OpenRCT2
static void InputWindowPositionContinue(
WindowBase& w, const ScreenCoordsXY& lastScreenCoords, const ScreenCoordsXY& newScreenCoords)
{
- int32_t snapProximity;
-
- snapProximity = (w.flags.has(WindowFlag::noSnapping)) ? 0 : Config::Get().general.windowSnapProximity;
+ int32_t snapProximity = w.flags.has(WindowFlag::noSnapping) ? 0 : Config::Get().general.windowSnapProximity;
WindowMoveAndSnap(w, newScreenCoords - lastScreenCoords, snapProximity);
}
@@ -591,7 +589,7 @@ namespace OpenRCT2
}
else if (differentialCoords.x != 0 || differentialCoords.y != 0)
{
- if (!(w->flags.has(WindowFlag::noScrolling)))
+ if (!w->flags.has(WindowFlag::noScrolling))
{
// User dragged a scrollable viewport
@@ -834,7 +832,7 @@ namespace OpenRCT2
int32_t newTop;
newTop = scroll.contentHeight;
newTop *= y;
- y = widget.height() - 21;
+ y = widget.height() - 22;
if (scroll.flags & HSCROLLBAR_VISIBLE)
y -= kScrollBarWidth + 1;
newTop /= y;
@@ -844,7 +842,7 @@ namespace OpenRCT2
newTop += y;
if (newTop < 0)
newTop = 0;
- y = widget.height() - 1;
+ y = widget.height() - 2;
if (scroll.flags & HSCROLLBAR_VISIBLE)
y -= kScrollBarWidth + 1;
y *= -1;
@@ -937,7 +935,7 @@ namespace OpenRCT2
auto& scroll = w.scrolls[scroll_id];
scroll.flags |= VSCROLLBAR_DOWN_PRESSED;
scroll.contentOffsetY += 3;
- int32_t newTop = widget.height() - 1;
+ int32_t newTop = widget.height() - 2;
if (scroll.flags & HSCROLLBAR_VISIBLE)
newTop -= kScrollBarWidth + 1;
newTop *= -1;
@@ -1603,7 +1601,7 @@ namespace OpenRCT2
mainWindow = WindowGetMain();
if (mainWindow == nullptr)
return;
- if ((mainWindow->flags.has(WindowFlag::noScrolling))
+ if (mainWindow->flags.has(WindowFlag::noScrolling)
|| (gLegacyScene == LegacyScene::trackDesignsManager || gLegacyScene == LegacyScene::titleSequence))
return;
if (mainWindow->viewport == nullptr)
diff --git a/src/openrct2-ui/interface/Graph.h b/src/openrct2-ui/interface/Graph.h
index 9d0d637150..eb56c73806 100644
--- a/src/openrct2-ui/interface/Graph.h
+++ b/src/openrct2-ui/interface/Graph.h
@@ -68,7 +68,7 @@ namespace OpenRCT2::Graph
}
};
- void DrawFinanceGraph(RenderTarget& rt, const GraphProperties& p);
- void DrawRatingGraph(RenderTarget& rt, const GraphProperties& p);
- void DrawGuestGraph(RenderTarget& rt, const GraphProperties& p);
+ void DrawFinanceGraph(Drawing::RenderTarget& rt, const GraphProperties& p);
+ void DrawRatingGraph(Drawing::RenderTarget& rt, const GraphProperties& p);
+ void DrawGuestGraph(Drawing::RenderTarget& rt, const GraphProperties& p);
} // namespace OpenRCT2::Graph
diff --git a/src/openrct2-ui/interface/InGameConsole.h b/src/openrct2-ui/interface/InGameConsole.h
index fb83b6cd63..b1fc28e676 100644
--- a/src/openrct2-ui/interface/InGameConsole.h
+++ b/src/openrct2-ui/interface/InGameConsole.h
@@ -69,7 +69,7 @@ namespace OpenRCT2::Ui
void Scroll(int32_t linesToScroll);
void Update();
- void Draw(RenderTarget& rt) const;
+ void Draw(Drawing::RenderTarget& rt) const;
private:
void ClearInput();
diff --git a/src/openrct2-ui/interface/LandTool.cpp b/src/openrct2-ui/interface/LandTool.cpp
index 4727a58015..4168449551 100644
--- a/src/openrct2-ui/interface/LandTool.cpp
+++ b/src/openrct2-ui/interface/LandTool.cpp
@@ -78,8 +78,8 @@ void LandTool::ShowSurfaceStyleDropdown(WindowBase* w, Widget* widget, ObjectEnt
uint32_t surfaceCount = itemIndex;
WindowDropdownShowImage(
- w->windowPos.x + widget->left, w->windowPos.y + widget->top, widget->height(), w->colours[2], 0, surfaceCount, 47, 36,
- DropdownGetAppropriateImageDropdownItemsPerRow(surfaceCount));
+ w->windowPos.x + widget->left, w->windowPos.y + widget->top, widget->height() - 1, w->colours[2], 0, surfaceCount, 47,
+ 36, DropdownGetAppropriateImageDropdownItemsPerRow(surfaceCount));
gDropdown.hasTooltips = true;
gDropdown.defaultIndex = defaultIndex;
@@ -129,7 +129,7 @@ void LandTool::ShowEdgeStyleDropdown(WindowBase* w, Widget* widget, ObjectEntryI
auto itemsPerRow = DropdownGetAppropriateImageDropdownItemsPerRow(edgeCount);
WindowDropdownShowImage(
- w->windowPos.x + widget->left, w->windowPos.y + widget->top, widget->height(), w->colours[2], 0, edgeCount, 47, 36,
+ w->windowPos.x + widget->left, w->windowPos.y + widget->top, widget->height() - 1, w->colours[2], 0, edgeCount, 47, 36,
itemsPerRow);
gDropdown.hasTooltips = true;
diff --git a/src/openrct2-ui/interface/ViewportInteraction.cpp b/src/openrct2-ui/interface/ViewportInteraction.cpp
index 8a7d92cb94..a49ff97d73 100644
--- a/src/openrct2-ui/interface/ViewportInteraction.cpp
+++ b/src/openrct2-ui/interface/ViewportInteraction.cpp
@@ -467,7 +467,7 @@ namespace OpenRCT2::Ui
break;
}
- if (!gInputFlags.has(InputFlag::unk6) || !gInputFlags.has(InputFlag::toolActive))
+ if (!gInputFlags.has(InputFlag::allowRightMouseRemoval) || !gInputFlags.has(InputFlag::toolActive))
{
auto* windowMgr = GetWindowManager();
if (windowMgr->FindByClass(WindowClass::rideConstruction) == nullptr
diff --git a/src/openrct2-ui/interface/Widget.cpp b/src/openrct2-ui/interface/Widget.cpp
index b434001f4b..5cbc8249f9 100644
--- a/src/openrct2-ui/interface/Widget.cpp
+++ b/src/openrct2-ui/interface/Widget.cpp
@@ -622,12 +622,13 @@ namespace OpenRCT2::Ui
if (widget.string == nullptr)
return;
- topLeft = w.windowPos + ScreenCoordsXY{ widget.midX() - 1, std::max(widget.top, widget.midY() - 5) };
+ const auto closeButtonTextOffset = Config::Get().interface.enlargedUi ? 5 : 6;
+ auto crossMidPoint = w.windowPos + ScreenCoordsXY{ widget.midX() - 1, widget.midY() - closeButtonTextOffset };
if (widgetIsDisabled(w, widgetIndex))
colour.flags.set(ColourFlag::inset, true);
- DrawText(rt, topLeft, { colour, TextAlignment::centre }, widget.string);
+ DrawText(rt, crossMidPoint, { colour, TextAlignment::centre }, widget.string);
}
/**
@@ -709,7 +710,7 @@ namespace OpenRCT2::Ui
bottomRight.y--;
bool hScrollNeeded = scroll.contentWidth > (widget.width() - 1) && (scroll.flags & HSCROLLBAR_VISIBLE);
- bool vScrollNeeded = scroll.contentHeight > widget.height() && (scroll.flags & VSCROLLBAR_VISIBLE);
+ bool vScrollNeeded = scroll.contentHeight > widget.height() - 1 && (scroll.flags & VSCROLLBAR_VISIBLE);
// Horizontal scrollbar
if (hScrollNeeded)
@@ -856,7 +857,7 @@ namespace OpenRCT2::Ui
const auto& widget = w.widgets[widgetIndex];
// Get the image
- if (widget.image.GetIndex() == kSpriteIdNull)
+ if (widget.image.GetIndex() == kImageIndexUndefined)
return;
auto image = widget.image;
@@ -1020,7 +1021,7 @@ namespace OpenRCT2::Ui
}
}
else if (
- (scroll.flags & VSCROLLBAR_VISIBLE) && scroll.contentHeight > widget->height()
+ (scroll.flags & VSCROLLBAR_VISIBLE) && scroll.contentHeight > widget->height() - 1
&& (screenCoords.x >= w.windowPos.x + widget->right - (kScrollBarWidth + 1)))
{
// vertical scrollbar
@@ -1208,7 +1209,7 @@ namespace OpenRCT2::Ui
if (OpenRCT2::Ui::Windows::TextBoxCaretIsFlashed())
{
auto colour = ColourMapA[w.colours[1].colour].mid_light;
- auto y = topLeft.y + 1 + widget.height() - 4;
+ auto y = topLeft.y + 1 + widget.height() - 5;
Rectangle::fill(rt, { { curX, y }, { curX + width, y } }, colour + 5);
}
}
@@ -1241,7 +1242,7 @@ namespace OpenRCT2::Ui
if (fillSize > 0)
{
Rectangle::fillInset(
- rt, { topLeft + ScreenCoordsXY{ 1, 1 }, topLeft + ScreenCoordsXY{ fillSize + 1, widget.height() - 1 } },
+ rt, { topLeft + ScreenCoordsXY{ 1, 1 }, topLeft + ScreenCoordsXY{ fillSize + 1, widget.height() - 2 } },
{ widget.colour });
}
}
@@ -1312,7 +1313,7 @@ namespace OpenRCT2::Ui
if (scroll.flags & VSCROLLBAR_VISIBLE)
{
- int32_t view_size = widget.height() - 21;
+ int32_t view_size = widget.height() - 22;
if (scroll.flags & HSCROLLBAR_VISIBLE)
view_size -= 11;
int32_t y = scroll.contentOffsetY * view_size;
@@ -1320,7 +1321,7 @@ namespace OpenRCT2::Ui
y /= scroll.contentHeight;
scroll.vThumbTop = y + 11;
- y = widget.height() - 2;
+ y = widget.height() - 3;
if (scroll.flags & HSCROLLBAR_VISIBLE)
y -= 11;
y += scroll.contentOffsetY;
diff --git a/src/openrct2-ui/interface/Widget.h b/src/openrct2-ui/interface/Widget.h
index 8de17d6b22..da160cb0d7 100644
--- a/src/openrct2-ui/interface/Widget.h
+++ b/src/openrct2-ui/interface/Widget.h
@@ -78,7 +78,7 @@ namespace OpenRCT2::Ui
const ScreenCoordsXY& origin, const ScreenSize& size, WidgetType type, WindowColour colour, ImageIndex content,
StringId tooltip = kStringIdNone)
{
- return makeWidget(origin, size, type, colour, ImageId(content, FilterPaletteID::paletteNull), tooltip);
+ return makeWidget(origin, size, type, colour, ImageId(content, Drawing::FilterPaletteID::paletteNull), tooltip);
}
constexpr Widget makeTab(const ScreenCoordsXY& origin, StringId tooltip = kStringIdNone)
@@ -248,7 +248,7 @@ namespace OpenRCT2::Ui
makeDropdownButtonWidget(origin, size, type, colour, content, tooltip));
};
- void widgetDraw(RenderTarget& rt, WindowBase& w, WidgetIndex widgetIndex);
+ void widgetDraw(Drawing::RenderTarget& rt, WindowBase& w, WidgetIndex widgetIndex);
bool widgetIsDisabled(const WindowBase& w, WidgetIndex widgetIndex);
bool widgetIsHoldable(const WindowBase& w, WidgetIndex widgetIndex);
diff --git a/src/openrct2-ui/interface/Window.cpp b/src/openrct2-ui/interface/Window.cpp
index a7c1d77329..b8b68a8e66 100644
--- a/src/openrct2-ui/interface/Window.cpp
+++ b/src/openrct2-ui/interface/Window.cpp
@@ -94,7 +94,7 @@ namespace OpenRCT2::Ui
if (scroll.flags & VSCROLLBAR_VISIBLE)
{
- int32_t size = widget->height() - 1;
+ int32_t size = widget->height() - 2;
if (scroll.flags & HSCROLLBAR_VISIBLE)
size -= 11;
size = std::max(0, scroll.contentHeight - size);
@@ -1024,7 +1024,7 @@ namespace OpenRCT2::Ui::Windows
*/
void WindowDrawWidgets(WindowBase& w, RenderTarget& rt)
{
- if ((w.flags.has(WindowFlag::transparent)) && !(w.flags.has(WindowFlag::noBackground)))
+ if (w.flags.has(WindowFlag::transparent) && !w.flags.has(WindowFlag::noBackground))
Rectangle::filter(
rt, { w.windowPos, w.windowPos + ScreenCoordsXY{ w.width - 1, w.height - 1 } }, FilterPaletteID::palette51);
diff --git a/src/openrct2-ui/interface/Window.h b/src/openrct2-ui/interface/Window.h
index fbdb0b1c50..dca1d5d5df 100644
--- a/src/openrct2-ui/interface/Window.h
+++ b/src/openrct2-ui/interface/Window.h
@@ -23,8 +23,8 @@ namespace OpenRCT2::Ui
struct Window : WindowBase
{
- void onDraw(RenderTarget& rt) override;
- void onDrawWidget(WidgetIndex widgetIndex, RenderTarget& rt) override;
+ void onDraw(Drawing::RenderTarget& rt) override;
+ void onDrawWidget(WidgetIndex widgetIndex, Drawing::RenderTarget& rt) override;
void scrollToViewport();
void initScrollWidgets();
@@ -36,7 +36,7 @@ namespace OpenRCT2::Ui
void setWidgetDisabledAndInvalidate(WidgetIndex widgetIndex, bool value);
void setWidgetPressed(WidgetIndex widgetIndex, bool value);
void setCheckboxValue(WidgetIndex widgetIndex, bool value);
- void drawWidgets(RenderTarget& rt);
+ void drawWidgets(Drawing::RenderTarget& rt);
void close();
void closeOthers();
void closeOthersOfThisClass();
@@ -86,8 +86,8 @@ namespace OpenRCT2::Ui::Windows
void InvalidateAllWindowsAfterInput();
- void WindowDrawWidgets(WindowBase& w, RenderTarget& rt);
- void WindowDrawViewport(RenderTarget& rt, WindowBase& w);
+ void WindowDrawWidgets(WindowBase& w, Drawing::RenderTarget& rt);
+ void WindowDrawViewport(Drawing::RenderTarget& rt, WindowBase& w);
void WindowZoomIn(WindowBase& w, bool atCursor);
void WindowZoomOut(WindowBase& w, bool atCursor);
diff --git a/src/openrct2-ui/ride/Construction.cpp b/src/openrct2-ui/ride/Construction.cpp
index 3a7c89a464..b025036747 100644
--- a/src/openrct2-ui/ride/Construction.cpp
+++ b/src/openrct2-ui/ride/Construction.cpp
@@ -13,6 +13,7 @@
#include
#include
+#include
#include
#include
#include
@@ -25,200 +26,200 @@ using namespace OpenRCT2::TrackMetaData;
namespace OpenRCT2
{
- constexpr auto kSeparator = TrackElemType::None;
+ constexpr auto kSeparator = TrackElemType::none;
/**
* Order of special track elements dropdown. Elements with the same name string must be sequential or they show up twice.
*/
constexpr std::array kSpecialElementsDropdownOrder = {
- TrackElemType::EndStation,
+ TrackElemType::endStation,
// Brakes
- TrackElemType::Brakes,
- TrackElemType::DiagBrakes,
- TrackElemType::Down25Brakes,
- TrackElemType::DiagDown25Brakes,
- TrackElemType::BlockBrakes,
- TrackElemType::DiagBlockBrakes,
+ TrackElemType::brakes,
+ TrackElemType::diagBrakes,
+ TrackElemType::down25Brakes,
+ TrackElemType::diagDown25Brakes,
+ TrackElemType::blockBrakes,
+ TrackElemType::diagBlockBrakes,
// Boosters
- TrackElemType::Booster,
- TrackElemType::DiagBooster,
+ TrackElemType::booster,
+ TrackElemType::diagBooster,
// Photo sections
- TrackElemType::OnRidePhoto,
+ TrackElemType::onRidePhoto,
// Rotation control
- TrackElemType::RotationControlToggle,
+ TrackElemType::rotationControlToggle,
// (Curved) lift (hills) pieces
- TrackElemType::LeftCurvedLiftHill,
- TrackElemType::RightCurvedLiftHill,
- TrackElemType::CableLiftHill,
- TrackElemType::PoweredLift,
+ TrackElemType::leftCurvedLiftHill,
+ TrackElemType::rightCurvedLiftHill,
+ TrackElemType::cableLiftHill,
+ TrackElemType::poweredLift,
kSeparator,
// Heart Line pieces
- TrackElemType::HeartLineTransferUp,
- TrackElemType::HeartLineTransferDown,
- TrackElemType::LeftHeartLineRoll,
- TrackElemType::RightHeartLineRoll,
+ TrackElemType::heartLineTransferUp,
+ TrackElemType::heartLineTransferDown,
+ TrackElemType::leftHeartLineRoll,
+ TrackElemType::rightHeartLineRoll,
kSeparator,
// Brake for drop
- TrackElemType::BrakeForDrop,
+ TrackElemType::brakeForDrop,
kSeparator,
// Tower
- TrackElemType::TowerBase,
- TrackElemType::TowerSection,
+ TrackElemType::towerBase,
+ TrackElemType::towerSection,
kSeparator,
// Mini Golf pieces
- TrackElemType::MinigolfHoleA,
- TrackElemType::MinigolfHoleB,
- TrackElemType::MinigolfHoleC,
- TrackElemType::MinigolfHoleD,
- TrackElemType::MinigolfHoleE,
+ TrackElemType::minigolfHoleA,
+ TrackElemType::minigolfHoleB,
+ TrackElemType::minigolfHoleC,
+ TrackElemType::minigolfHoleD,
+ TrackElemType::minigolfHoleE,
kSeparator,
// S-Bends
- TrackElemType::SBendLeft,
- TrackElemType::SBendRight,
+ TrackElemType::sBendLeft,
+ TrackElemType::sBendRight,
kSeparator,
// Helixes
- TrackElemType::LeftHalfBankedHelixUpSmall,
- TrackElemType::RightHalfBankedHelixUpSmall,
- TrackElemType::LeftHalfBankedHelixDownSmall,
- TrackElemType::RightHalfBankedHelixDownSmall,
- TrackElemType::LeftHalfBankedHelixUpLarge,
- TrackElemType::RightHalfBankedHelixUpLarge,
- TrackElemType::LeftHalfBankedHelixDownLarge,
- TrackElemType::RightHalfBankedHelixDownLarge,
- TrackElemType::LeftQuarterBankedHelixLargeUp,
- TrackElemType::RightQuarterBankedHelixLargeUp,
- TrackElemType::LeftQuarterBankedHelixLargeDown,
- TrackElemType::RightQuarterBankedHelixLargeDown,
- TrackElemType::LeftQuarterHelixLargeUp,
- TrackElemType::RightQuarterHelixLargeUp,
- TrackElemType::LeftQuarterHelixLargeDown,
- TrackElemType::RightQuarterHelixLargeDown,
+ TrackElemType::leftHalfBankedHelixUpSmall,
+ TrackElemType::rightHalfBankedHelixUpSmall,
+ TrackElemType::leftHalfBankedHelixDownSmall,
+ TrackElemType::rightHalfBankedHelixDownSmall,
+ TrackElemType::leftHalfBankedHelixUpLarge,
+ TrackElemType::rightHalfBankedHelixUpLarge,
+ TrackElemType::leftHalfBankedHelixDownLarge,
+ TrackElemType::rightHalfBankedHelixDownLarge,
+ TrackElemType::leftQuarterBankedHelixLargeUp,
+ TrackElemType::rightQuarterBankedHelixLargeUp,
+ TrackElemType::leftQuarterBankedHelixLargeDown,
+ TrackElemType::rightQuarterBankedHelixLargeDown,
+ TrackElemType::leftQuarterHelixLargeUp,
+ TrackElemType::rightQuarterHelixLargeUp,
+ TrackElemType::leftQuarterHelixLargeDown,
+ TrackElemType::rightQuarterHelixLargeDown,
kSeparator,
// (Wooden) water splash
- TrackElemType::Watersplash,
+ TrackElemType::watersplash,
kSeparator,
// River Rapids
- TrackElemType::Waterfall,
- TrackElemType::Rapids, // Also used for Monster Trucks
- TrackElemType::Whirlpool,
+ TrackElemType::waterfall,
+ TrackElemType::rapids, // Also used for Monster Trucks
+ TrackElemType::whirlpool,
kSeparator,
// Spinning tunnel
- TrackElemType::SpinningTunnel,
+ TrackElemType::spinningTunnel,
kSeparator,
// Reverser pieces
- TrackElemType::LeftReverser,
- TrackElemType::RightReverser,
- TrackElemType::LogFlumeReverser,
+ TrackElemType::leftReverser,
+ TrackElemType::rightReverser,
+ TrackElemType::logFlumeReverser,
kSeparator,
// Reverse freefall pieces
- TrackElemType::ReverseFreefallSlope,
- TrackElemType::ReverseFreefallVertical,
+ TrackElemType::reverseFreefallSlope,
+ TrackElemType::reverseFreefallVertical,
// Air thrust pieces
- TrackElemType::AirThrustTopCap,
- TrackElemType::AirThrustVerticalDown,
- TrackElemType::AirThrustVerticalDownToLevel,
+ TrackElemType::airThrustTopCap,
+ TrackElemType::airThrustVerticalDown,
+ TrackElemType::airThrustVerticalDownToLevel,
kSeparator,
// Corkscrews
- TrackElemType::LeftCorkscrewUp,
- TrackElemType::LeftCorkscrewDown,
- TrackElemType::RightCorkscrewUp,
- TrackElemType::RightCorkscrewDown,
- TrackElemType::LeftFlyerCorkscrewUp,
- TrackElemType::LeftFlyerCorkscrewDown,
- TrackElemType::RightFlyerCorkscrewUp,
- TrackElemType::RightFlyerCorkscrewDown,
- TrackElemType::LeftLargeCorkscrewUp,
- TrackElemType::LeftLargeCorkscrewDown,
- TrackElemType::RightLargeCorkscrewUp,
- TrackElemType::RightLargeCorkscrewDown,
+ TrackElemType::leftCorkscrewUp,
+ TrackElemType::leftCorkscrewDown,
+ TrackElemType::rightCorkscrewUp,
+ TrackElemType::rightCorkscrewDown,
+ TrackElemType::leftFlyerCorkscrewUp,
+ TrackElemType::leftFlyerCorkscrewDown,
+ TrackElemType::rightFlyerCorkscrewUp,
+ TrackElemType::rightFlyerCorkscrewDown,
+ TrackElemType::leftLargeCorkscrewUp,
+ TrackElemType::leftLargeCorkscrewDown,
+ TrackElemType::rightLargeCorkscrewUp,
+ TrackElemType::rightLargeCorkscrewDown,
kSeparator,
// Loops
- TrackElemType::LeftVerticalLoop,
- TrackElemType::RightVerticalLoop,
- TrackElemType::HalfLoopUp,
- TrackElemType::HalfLoopDown,
- TrackElemType::FlyerHalfLoopUninvertedUp,
- TrackElemType::FlyerHalfLoopInvertedDown,
- TrackElemType::FlyerHalfLoopInvertedUp,
- TrackElemType::FlyerHalfLoopUninvertedDown,
- TrackElemType::LeftMediumHalfLoopUp,
- TrackElemType::LeftMediumHalfLoopDown,
- TrackElemType::RightMediumHalfLoopUp,
- TrackElemType::RightMediumHalfLoopDown,
- TrackElemType::LeftLargeHalfLoopUp,
- TrackElemType::LeftLargeHalfLoopDown,
- TrackElemType::RightLargeHalfLoopUp,
- TrackElemType::RightLargeHalfLoopDown,
- TrackElemType::LeftFlyerLargeHalfLoopUninvertedUp,
- TrackElemType::LeftFlyerLargeHalfLoopInvertedDown,
- TrackElemType::LeftFlyerLargeHalfLoopInvertedUp,
- TrackElemType::LeftFlyerLargeHalfLoopUninvertedDown,
- TrackElemType::RightFlyerLargeHalfLoopUninvertedUp,
- TrackElemType::RightFlyerLargeHalfLoopInvertedDown,
- TrackElemType::RightFlyerLargeHalfLoopInvertedUp,
- TrackElemType::RightFlyerLargeHalfLoopUninvertedDown,
- TrackElemType::MultiDimInvertedFlatToDown90QuarterLoop,
- TrackElemType::Up90ToInvertedFlatQuarterLoop,
- TrackElemType::InvertedFlatToDown90QuarterLoop,
- TrackElemType::MultiDimUp90ToInvertedFlatQuarterLoop,
- TrackElemType::MultiDimFlatToDown90QuarterLoop,
- TrackElemType::MultiDimInvertedUp90ToFlatQuarterLoop,
+ TrackElemType::leftVerticalLoop,
+ TrackElemType::rightVerticalLoop,
+ TrackElemType::halfLoopUp,
+ TrackElemType::halfLoopDown,
+ TrackElemType::flyerHalfLoopUninvertedUp,
+ TrackElemType::flyerHalfLoopInvertedDown,
+ TrackElemType::flyerHalfLoopInvertedUp,
+ TrackElemType::flyerHalfLoopUninvertedDown,
+ TrackElemType::leftMediumHalfLoopUp,
+ TrackElemType::leftMediumHalfLoopDown,
+ TrackElemType::rightMediumHalfLoopUp,
+ TrackElemType::rightMediumHalfLoopDown,
+ TrackElemType::leftLargeHalfLoopUp,
+ TrackElemType::leftLargeHalfLoopDown,
+ TrackElemType::rightLargeHalfLoopUp,
+ TrackElemType::rightLargeHalfLoopDown,
+ TrackElemType::leftFlyerLargeHalfLoopUninvertedUp,
+ TrackElemType::leftFlyerLargeHalfLoopInvertedDown,
+ TrackElemType::leftFlyerLargeHalfLoopInvertedUp,
+ TrackElemType::leftFlyerLargeHalfLoopUninvertedDown,
+ TrackElemType::rightFlyerLargeHalfLoopUninvertedUp,
+ TrackElemType::rightFlyerLargeHalfLoopInvertedDown,
+ TrackElemType::rightFlyerLargeHalfLoopInvertedUp,
+ TrackElemType::rightFlyerLargeHalfLoopUninvertedDown,
+ TrackElemType::multiDimInvertedFlatToDown90QuarterLoop,
+ TrackElemType::up90ToInvertedFlatQuarterLoop,
+ TrackElemType::invertedFlatToDown90QuarterLoop,
+ TrackElemType::multiDimUp90ToInvertedFlatQuarterLoop,
+ TrackElemType::multiDimFlatToDown90QuarterLoop,
+ TrackElemType::multiDimInvertedUp90ToFlatQuarterLoop,
kSeparator,
// Zero-G Rolls, Dive Loops
- TrackElemType::LeftZeroGRollUp,
- TrackElemType::LeftZeroGRollDown,
- TrackElemType::RightZeroGRollUp,
- TrackElemType::RightZeroGRollDown,
- TrackElemType::LeftLargeZeroGRollUp,
- TrackElemType::LeftLargeZeroGRollDown,
- TrackElemType::RightLargeZeroGRollUp,
- TrackElemType::RightLargeZeroGRollDown,
- TrackElemType::LeftEighthDiveLoopUpToOrthogonal,
- TrackElemType::LeftEighthDiveLoopDownToDiag,
- TrackElemType::RightEighthDiveLoopUpToOrthogonal,
- TrackElemType::RightEighthDiveLoopDownToDiag,
+ TrackElemType::leftZeroGRollUp,
+ TrackElemType::leftZeroGRollDown,
+ TrackElemType::rightZeroGRollUp,
+ TrackElemType::rightZeroGRollDown,
+ TrackElemType::leftLargeZeroGRollUp,
+ TrackElemType::leftLargeZeroGRollDown,
+ TrackElemType::rightLargeZeroGRollUp,
+ TrackElemType::rightLargeZeroGRollDown,
+ TrackElemType::leftEighthDiveLoopUpToOrthogonal,
+ TrackElemType::leftEighthDiveLoopDownToDiag,
+ TrackElemType::rightEighthDiveLoopUpToOrthogonal,
+ TrackElemType::rightEighthDiveLoopDownToDiag,
kSeparator,
// Barrel Rolls
- TrackElemType::LeftBarrelRollUpToDown,
- TrackElemType::LeftBarrelRollDownToUp,
- TrackElemType::RightBarrelRollUpToDown,
- TrackElemType::RightBarrelRollDownToUp,
+ TrackElemType::leftBarrelRollUpToDown,
+ TrackElemType::leftBarrelRollDownToUp,
+ TrackElemType::rightBarrelRollUpToDown,
+ TrackElemType::rightBarrelRollDownToUp,
kSeparator,
// Twists
- TrackElemType::LeftTwistDownToUp,
- TrackElemType::LeftTwistUpToDown,
- TrackElemType::RightTwistDownToUp,
- TrackElemType::RightTwistUpToDown,
- TrackElemType::LeftFlyerTwistUp,
- TrackElemType::LeftFlyerTwistDown,
- TrackElemType::RightFlyerTwistUp,
- TrackElemType::RightFlyerTwistDown,
+ TrackElemType::leftTwistDownToUp,
+ TrackElemType::leftTwistUpToDown,
+ TrackElemType::rightTwistDownToUp,
+ TrackElemType::rightTwistUpToDown,
+ TrackElemType::leftFlyerTwistUp,
+ TrackElemType::leftFlyerTwistDown,
+ TrackElemType::rightFlyerTwistUp,
+ TrackElemType::rightFlyerTwistDown,
};
// Update the magic number with the current number of track elements to silence
- static_assert(EnumValue(TrackElemType::Count) == 350, "Reminder to add new track element to special dropdown list");
+ static_assert(EnumValue(TrackElemType::count) == 350, "Reminder to add new track element to special dropdown list");
/**
*
@@ -231,12 +232,13 @@ namespace OpenRCT2
int32_t colour2 = RideGetUnusedPresetVehicleColour(rideEntryIndex);
auto gameAction = GameActions::RideCreateAction(
- listItem.Type, listItem.EntryIndex, colour1, colour2, getGameState().lastEntranceStyle);
+ listItem.Type, listItem.EntryIndex, colour1, colour2, getGameState().lastEntranceStyle,
+ Config::Get().general.defaultInspectionInterval);
gameAction.SetCallback([](const GameActions::GameAction* ga, const GameActions::Result* result) {
- if (result->Error != GameActions::Status::Ok)
+ if (result->error != GameActions::Status::ok)
return;
- const auto rideIndex = result->GetData();
+ const auto rideIndex = result->getData();
auto ride = GetRide(rideIndex);
RideConstructionStart(*ride);
});
@@ -278,7 +280,7 @@ namespace OpenRCT2
}
// Additional tower bases can only be built if the ride allows for it (elevator)
- if (trackType == TrackElemType::TowerBase
+ if (trackType == TrackElemType::towerBase
&& !currentRide.getRideTypeDescriptor().HasFlag(RtdFlag::allowExtraTowerBases))
entryIsDisabled = true;
@@ -341,7 +343,7 @@ namespace OpenRCT2
break;
auto trackPiece = elements[list.PreferredNumRows + i].TrackType;
- if (trackPiece == TrackElemType::None)
+ if (trackPiece == TrackElemType::none)
{
list.PreferredNumRows += i + 1;
break;
@@ -377,9 +379,9 @@ namespace OpenRCT2
if (trackElement->GetRideIndex() == gRideEntranceExitPlaceRideIndex)
{
const auto& ted = GetTrackElementDescriptor(trackElement->GetTrackType());
- if (ted.sequences[0].flags & TRACK_SEQUENCE_FLAG_ORIGIN)
+ if (ted.sequences[0].flags.has(SequenceFlag::trackOrigin))
{
- if (trackElement->GetTrackType() == TrackElemType::Maze)
+ if (trackElement->GetTrackType() == TrackElemType::maze)
{
gRideEntranceExitPlaceStationIndex = StationIndex::FromUnderlying(0);
}
@@ -457,7 +459,7 @@ namespace OpenRCT2
auto* trackElement = tileElement->AsTrack();
if (trackElement->GetRideIndex() != gRideEntranceExitPlaceRideIndex)
continue;
- if (trackElement->GetTrackType() == TrackElemType::Maze)
+ if (trackElement->GetTrackType() == TrackElemType::maze)
{
// if it's a maze, it can place the entrance and exit immediately
entranceExitCoords.direction = DirectionReverse(entranceExitCoords.direction);
@@ -472,7 +474,8 @@ namespace OpenRCT2
// get the ride entrance's side relative to the TrackElement
Direction direction = (DirectionReverse(entranceExitCoords.direction) - tileElement->GetDirection()) & 3;
const auto& ted = GetTrackElementDescriptor(trackElement->GetTrackType());
- if (ted.sequences[trackElement->GetSequenceIndex()].flags & (1 << direction))
+ auto connectionSides = ted.sequences[trackElement->GetSequenceIndex()].getEntranceConnectionSides();
+ if (connectionSides & (1 << direction))
{
// if that side of the TrackElement supports stations, the ride entrance is valid and faces away from
// the station
diff --git a/src/openrct2-ui/scripting/CustomImages.cpp b/src/openrct2-ui/scripting/CustomImages.cpp
index 71f039dcdb..ac2a1727e1 100644
--- a/src/openrct2-ui/scripting/CustomImages.cpp
+++ b/src/openrct2-ui/scripting/CustomImages.cpp
@@ -151,18 +151,18 @@ namespace OpenRCT2::Scripting
DukObject obj(ctx);
obj.Set("id", id);
- obj.Set("offset", ToDuk(ctx, { g1->x_offset, g1->y_offset }));
+ obj.Set("offset", ToDuk(ctx, { g1->xOffset, g1->yOffset }));
obj.Set("width", g1->width);
obj.Set("height", g1->height);
- obj.Set("hasTransparent", (g1->flags & G1_FLAG_HAS_TRANSPARENCY) != 0);
- obj.Set("isRLE", (g1->flags & G1_FLAG_RLE_COMPRESSION) != 0);
- obj.Set("isPalette", (g1->flags & G1_FLAG_PALETTE) != 0);
- obj.Set("noZoom", (g1->flags & G1_FLAG_NO_ZOOM_DRAW) != 0);
+ obj.Set("hasTransparent", g1->flags.has(G1Flag::hasTransparency));
+ obj.Set("isRLE", g1->flags.has(G1Flag::hasRLECompression));
+ obj.Set("isPalette", g1->flags.has(G1Flag::isPalette));
+ obj.Set("noZoom", g1->flags.has(G1Flag::noZoomDraw));
- if (g1->flags & G1_FLAG_HAS_ZOOM_SPRITE)
+ if (g1->flags.has(G1Flag::hasZoomSprite))
{
- obj.Set("nextZoomId", id - g1->zoomed_offset);
+ obj.Set("nextZoomId", id - g1->zoomedOffset);
}
else
{
@@ -173,9 +173,9 @@ namespace OpenRCT2::Scripting
static const char* GetPixelDataTypeForG1(const G1Element& g1)
{
- if (g1.flags & G1_FLAG_RLE_COMPRESSION)
+ if (g1.flags.has(G1Flag::hasRLECompression))
return "rle";
- else if (g1.flags & G1_FLAG_PALETTE)
+ else if (g1.flags.has(G1Flag::isPalette))
return "palette";
return "raw";
}
@@ -405,10 +405,10 @@ namespace OpenRCT2::Scripting
el.offset = newData;
el.width = pixelData.Width;
el.height = pixelData.Height;
- el.flags = 0;
+ el.flags = {};
if (pixelData.Type == PixelDataKind::Rle)
{
- el.flags |= G1_FLAG_RLE_COMPRESSION;
+ el.flags.set(G1Flag::hasRLECompression);
}
GfxSetG1Element(id, &el);
DrawingEngineInvalidateImage(id);
@@ -441,7 +441,7 @@ namespace OpenRCT2::Scripting
auto createNewImage = false;
auto g1 = GfxGetG1Element(id);
- if (g1 == nullptr || g1->width != size.width || g1->height != size.height || (g1->flags & G1_FLAG_RLE_COMPRESSION))
+ if (g1 == nullptr || g1->width != size.width || g1->height != size.height || g1->flags.has(G1Flag::hasRLECompression))
{
createNewImage = true;
}
@@ -465,7 +465,9 @@ namespace OpenRCT2::Scripting
}
auto dukG = GetObjectAsDukValue(ctx, std::make_shared(ctx, rt));
+ drawingEngine->BeginDraw();
scriptEngine.ExecutePluginCall(plugin, callback, { dukG }, false);
+ drawingEngine->EndDraw();
if (createNewImage)
{
@@ -478,7 +480,7 @@ namespace OpenRCT2::Scripting
newg1.offset = rt.bits;
newg1.width = size.width;
newg1.height = size.height;
- newg1.flags = 0;
+ newg1.flags = {};
GfxSetG1Element(id, &newg1);
}
diff --git a/src/openrct2-ui/scripting/CustomListView.h b/src/openrct2-ui/scripting/CustomListView.h
index ab00a4a21f..119ac4fa4f 100644
--- a/src/openrct2-ui/scripting/CustomListView.h
+++ b/src/openrct2-ui/scripting/CustomListView.h
@@ -138,15 +138,17 @@ namespace OpenRCT2::Ui::Windows
void MouseOver(const ScreenCoordsXY& pos, bool isMouseDown);
void MouseDown(const ScreenCoordsXY& pos);
void MouseUp(const ScreenCoordsXY& pos);
- void Paint(WindowBase* w, RenderTarget& rt, const ScrollArea* scroll) const;
+ void Paint(WindowBase* w, Drawing::RenderTarget& rt, const ScrollArea* scroll) const;
private:
void PaintHeading(
- WindowBase* w, RenderTarget& rt, const ScreenCoordsXY& pos, const ScreenSize& size, const std::string& text,
- ColumnSortOrder sortOrder, bool isPressed) const;
- void PaintSeparator(RenderTarget& rt, const ScreenCoordsXY& pos, const ScreenSize& size, const char* text) const;
+ WindowBase* w, Drawing::RenderTarget& rt, const ScreenCoordsXY& pos, const ScreenSize& size,
+ const std::string& text, ColumnSortOrder sortOrder, bool isPressed) const;
+ void PaintSeparator(
+ Drawing::RenderTarget& rt, const ScreenCoordsXY& pos, const ScreenSize& size, const char* text) const;
void PaintCell(
- RenderTarget& rt, const ScreenCoordsXY& pos, const ScreenSize& size, const char* text, bool isHighlighted) const;
+ Drawing::RenderTarget& rt, const ScreenCoordsXY& pos, const ScreenSize& size, const char* text,
+ bool isHighlighted) const;
std::optional GetItemIndexAt(const ScreenCoordsXY& pos);
Widget* GetWidget() const;
void Invalidate();
diff --git a/src/openrct2-ui/scripting/CustomWindow.cpp b/src/openrct2-ui/scripting/CustomWindow.cpp
index 7b48af5fc7..6b16a6f41a 100644
--- a/src/openrct2-ui/scripting/CustomWindow.cpp
+++ b/src/openrct2-ui/scripting/CustomWindow.cpp
@@ -520,7 +520,7 @@ namespace OpenRCT2::Ui::Windows
{
auto& listView = _info.ListViews[scrollIndex];
auto wwidth = widget.width() - 2;
- auto wheight = widget.height() + 1 - 2;
+ auto wheight = widget.height() - 2;
if (listView.GetScrollbars() == ScrollbarType::Horizontal
|| listView.GetScrollbars() == ScrollbarType::Both)
{
@@ -536,7 +536,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
WindowDrawWidgets(*this, rt);
DrawTabImages(rt);
@@ -562,7 +562,7 @@ namespace OpenRCT2::Ui::Windows
RenderTarget widgetDpi;
if (ClipDrawPixelInfo(
widgetDpi, rt, { windowPos.x + widget.left, windowPos.y + widget.top }, widget.width() - 1,
- widget.height()))
+ widget.height() - 1))
{
auto ctx = onDraw.context();
auto dukWidget = ScWidget::ToDukValue(ctx, this, widgetIndex);
@@ -653,8 +653,8 @@ namespace OpenRCT2::Ui::Windows
gDropdown.items[i] = Dropdown::MenuLabel(items[i].c_str());
}
WindowDropdownShowTextCustomWidth(
- { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1,
- colours[widget->colour], 0, Dropdown::Flag::StayOpen, numItems, widget->width() - 4);
+ { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height(), colours[widget->colour], 0,
+ Dropdown::Flag::StayOpen, numItems, widget->width() - 4);
if (selectedIndex >= 0 && selectedIndex < static_cast(numItems))
gDropdown.items[selectedIndex].setChecked(true);
@@ -810,7 +810,7 @@ namespace OpenRCT2::Ui::Windows
auto left = windowPos.x + viewportWidget->left + 1;
auto top = windowPos.y + viewportWidget->top + 1;
auto wwidth = viewportWidget->width() - 2;
- auto wheight = viewportWidget->height() - 1;
+ auto wheight = viewportWidget->height() - 2;
if (viewport == nullptr)
{
ViewportCreate(*this, { left, top }, wwidth, wheight, Focus(CoordsXYZ(0, 0, 0)));
diff --git a/src/openrct2-ui/scripting/ScTileSelection.hpp b/src/openrct2-ui/scripting/ScTileSelection.hpp
index bc9b058993..b3546dd975 100644
--- a/src/openrct2-ui/scripting/ScTileSelection.hpp
+++ b/src/openrct2-ui/scripting/ScTileSelection.hpp
@@ -51,7 +51,6 @@ namespace OpenRCT2::Scripting
void range_set(DukValue value)
{
- MapInvalidateSelectionRect();
if (value.type() == DukValue::Type::OBJECT)
{
auto range = GetMapRange(value);
@@ -69,7 +68,6 @@ namespace OpenRCT2::Scripting
{
gMapSelectFlags.unset(MapSelectFlag::enable);
}
- MapInvalidateSelectionRect();
}
DukValue tiles_get() const
@@ -78,7 +76,7 @@ namespace OpenRCT2::Scripting
if (gMapSelectFlags.has(MapSelectFlag::enableConstruct))
{
duk_uarridx_t index = 0;
- for (const auto& tile : gMapSelectionTiles)
+ for (const auto& tile : MapSelection::getSelectedTiles())
{
duk_push_object(_ctx);
duk_push_int(_ctx, tile.x);
@@ -94,8 +92,7 @@ namespace OpenRCT2::Scripting
void tiles_set(DukValue value)
{
- MapInvalidateMapSelectionTiles();
- gMapSelectionTiles.clear();
+ MapSelection::clearSelectedTiles();
if (value.is_array())
{
value.push();
@@ -108,14 +105,14 @@ namespace OpenRCT2::Scripting
auto coords = GetCoordsXY(dukElement);
if (coords)
{
- gMapSelectionTiles.push_back(*coords);
+ MapSelection::addSelectedTile(*coords);
}
}
}
duk_pop(_ctx);
}
- if (gMapSelectionTiles.empty())
+ if (MapSelection::getSelectedTiles().empty())
{
gMapSelectFlags.unset(MapSelectFlag::enableConstruct);
gMapSelectFlags.unset(MapSelectFlag::green);
@@ -124,7 +121,6 @@ namespace OpenRCT2::Scripting
{
gMapSelectFlags.set(MapSelectFlag::enableConstruct);
}
- MapInvalidateMapSelectionTiles();
}
static void Register(duk_context* ctx)
diff --git a/src/openrct2-ui/scripting/ScWidget.hpp b/src/openrct2-ui/scripting/ScWidget.hpp
index 7f3ce90aa5..936865ed3c 100644
--- a/src/openrct2-ui/scripting/ScWidget.hpp
+++ b/src/openrct2-ui/scripting/ScWidget.hpp
@@ -250,7 +250,7 @@ namespace OpenRCT2::Scripting
auto widget = GetWidget();
if (widget != nullptr)
{
- return widget->height() + 1;
+ return widget->height();
}
return 0;
}
@@ -371,7 +371,7 @@ namespace OpenRCT2::Scripting
if (IsCustomWindow())
{
auto widget = GetWidget();
- if (widget != nullptr && (widget->flags.has(WidgetFlag::textIsString)) && widget->string != nullptr)
+ if (widget != nullptr && widget->flags.has(WidgetFlag::textIsString) && widget->string != nullptr)
{
return widget->string;
}
diff --git a/src/openrct2-ui/scripting/ScWindow.hpp b/src/openrct2-ui/scripting/ScWindow.hpp
index 32d7e67dc0..9129c781d1 100644
--- a/src/openrct2-ui/scripting/ScWindow.hpp
+++ b/src/openrct2-ui/scripting/ScWindow.hpp
@@ -208,7 +208,7 @@ namespace OpenRCT2::Scripting
auto w = GetWindow();
if (w != nullptr)
{
- return (w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront));
+ return w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront);
}
return false;
}
diff --git a/src/openrct2-ui/windows/About.cpp b/src/openrct2-ui/windows/About.cpp
index 135660010f..f5188b0823 100644
--- a/src/openrct2-ui/windows/About.cpp
+++ b/src/openrct2-ui/windows/About.cpp
@@ -147,7 +147,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
@@ -219,7 +219,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- int32_t DrawOpenRCT2Info(RenderTarget& rt)
+ int32_t DrawOpenRCT2Info(Drawing::RenderTarget& rt)
{
// Draw logo on placeholder widget
const auto& logoWidget = widgets[WIDX_OPENRCT2_LOGO];
@@ -252,7 +252,7 @@ namespace OpenRCT2::Ui::Windows
return textCoords.y - windowPos.y;
}
- int32_t DrawRCT2Info(RenderTarget& rt)
+ int32_t DrawRCT2Info(Drawing::RenderTarget& rt)
{
auto& backgroundWidget = widgets[WIDX_PAGE_BACKGROUND];
auto textCoords = windowPos + ScreenCoordsXY{ backgroundWidget.midX(), backgroundWidget.top + kPadding };
diff --git a/src/openrct2-ui/windows/AssetPacks.cpp b/src/openrct2-ui/windows/AssetPacks.cpp
index a56f342c5a..6705cb6f6d 100644
--- a/src/openrct2-ui/windows/AssetPacks.cpp
+++ b/src/openrct2-ui/windows/AssetPacks.cpp
@@ -155,7 +155,7 @@ namespace OpenRCT2::Ui::Windows
{
auto& list = widgets[WIDX_LIST];
list.left = 6;
- list.top = widgets[WIDX_TITLE].height() + 8 + 11 + 3;
+ list.top = widgets[WIDX_TITLE].height() - 1 + 8 + 11 + 3;
list.right = width - 2 - 24 - 1;
list.bottom = height - 6 - 11 - 3;
@@ -168,7 +168,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_LOW_LABEL].left = list.left;
widgets[WIDX_LOW_LABEL].right = list.right;
- auto toolstripY = widgets[WIDX_TITLE].height() + 8;
+ auto toolstripY = widgets[WIDX_TITLE].height() - 1 + 8;
auto toolstripRight = width - 2;
auto toolstripLeft = toolstripRight - 24;
for (WidgetIndex i = WIDX_MOVE_UP; i <= WIDX_APPLY; i++)
@@ -187,12 +187,12 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_APPLY].top = widgets[WIDX_APPLY].bottom - 24;
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
}
- void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
+ void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
auto rtCoords = ScreenCoordsXY{ rt.x, rt.y };
Rectangle::fill(
@@ -237,7 +237,7 @@ namespace OpenRCT2::Ui::Windows
}
private:
- void PaintItem(RenderTarget& rt, int32_t y, Formatter& ft, bool isChecked, bool isSelected, bool isHighlighted)
+ void PaintItem(Drawing::RenderTarget& rt, int32_t y, Formatter& ft, bool isChecked, bool isSelected, bool isHighlighted)
{
auto listWidth = widgets[WIDX_LIST].right - widgets[WIDX_LIST].left;
auto stringId = STR_BLACK_STRING;
@@ -258,7 +258,7 @@ namespace OpenRCT2::Ui::Windows
PaintCheckbox(rt, { { 2, y + 1 }, { 2 + checkboxSize + 1, y + 1 + checkboxSize } }, isChecked);
}
- void PaintCheckbox(RenderTarget& rt, const ScreenRect& rect, bool checked)
+ void PaintCheckbox(Drawing::RenderTarget& rt, const ScreenRect& rect, bool checked)
{
Rectangle::fillInset(
rt, rect, colours[1], Rectangle::BorderStyle::inset, Rectangle::FillBrightness::dark,
diff --git a/src/openrct2-ui/windows/Banner.cpp b/src/openrct2-ui/windows/Banner.cpp
index 649a7e8647..127c39d33a 100644
--- a/src/openrct2-ui/windows/Banner.cpp
+++ b/src/openrct2-ui/windows/Banner.cpp
@@ -88,7 +88,7 @@ namespace OpenRCT2::Ui::Windows
const auto& viewportWidget = widgets[WIDX_VIEWPORT];
ViewportCreate(
*this, windowPos + ScreenCoordsXY{ viewportWidget.left + 1, viewportWidget.top + 1 },
- viewportWidget.width() - 2, (viewportWidget.height()) - 1, Focus(_bannerViewPos));
+ viewportWidget.width() - 2, viewportWidget.height() - 2, Focus(_bannerViewPos));
if (viewport != nullptr)
viewport->flags = Config::Get().general.alwaysShowGridlines ? VIEWPORT_FLAG_GRIDLINES : VIEWPORT_FLAG_NONE;
@@ -176,7 +176,7 @@ namespace OpenRCT2::Ui::Windows
widget--;
WindowDropdownShowTextCustomWidth(
- { widget->left + windowPos.x, widget->top + windowPos.y }, widget->height() + 1, colours[1], 0,
+ { widget->left + windowPos.x, widget->top + windowPos.y }, widget->height(), colours[1], 0,
Dropdown::Flag::StayOpen, numItems, widget->width() - 1 + 3);
gDropdown.items[EnumValue(banner->textColour) - 1].setChecked(true);
@@ -269,7 +269,7 @@ namespace OpenRCT2::Ui::Windows
createViewport();
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
diff --git a/src/openrct2-ui/windows/Changelog.cpp b/src/openrct2-ui/windows/Changelog.cpp
index cc61d724df..59d335f5f6 100644
--- a/src/openrct2-ui/windows/Changelog.cpp
+++ b/src/openrct2-ui/windows/Changelog.cpp
@@ -175,7 +175,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
+ void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
const int32_t lineHeight = FontGetLineHeight(FontStyle::medium);
diff --git a/src/openrct2-ui/windows/Cheats.cpp b/src/openrct2-ui/windows/Cheats.cpp
index 8f954e9dfd..941eacb6b4 100644
--- a/src/openrct2-ui/windows/Cheats.cpp
+++ b/src/openrct2-ui/windows/Cheats.cpp
@@ -593,7 +593,7 @@ static StringId window_cheats_page_titles[] = {
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -775,7 +775,7 @@ static StringId window_cheats_page_titles[] = {
}
}
- void DrawTabImages(RenderTarget& rt)
+ void DrawTabImages(Drawing::RenderTarget& rt)
{
// Money tab
if (!isWidgetDisabled(WIDX_TAB_1))
@@ -848,12 +848,12 @@ static StringId window_cheats_page_titles[] = {
switch (widgetIndex)
{
case WIDX_MONEY_SPINNER_INCREMENT:
- _moneySpinnerValue = AddClamp(
+ _moneySpinnerValue = AddClamp(
kCheatsMoneyIncrement * (_moneySpinnerValue / kCheatsMoneyIncrement), kCheatsMoneyIncrement);
invalidateWidget(WIDX_MONEY_SPINNER);
break;
case WIDX_MONEY_SPINNER_DECREMENT:
- _moneySpinnerValue = AddClamp(
+ _moneySpinnerValue = AddClamp(
kCheatsMoneyIncrement * (_moneySpinnerValue / kCheatsMoneyIncrement), -kCheatsMoneyIncrement);
invalidateWidget(WIDX_MONEY_SPINNER);
break;
@@ -994,7 +994,7 @@ static StringId window_cheats_page_titles[] = {
}
WindowDropdownShowTextCustomWidth(
- { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
+ { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(),
colours[1], 0, Dropdown::Flag::StayOpen, 3, dropdownWidget->width() - 4);
gDropdown.items[EnumValue(gameState.cheats.selectedStaffSpeed)].setChecked(true);
}
@@ -1016,7 +1016,7 @@ static StringId window_cheats_page_titles[] = {
gDropdown.items[i] = Dropdown::MenuLabel(WeatherTypes[i]);
}
WindowDropdownShowTextCustomWidth(
- { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
+ { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(),
colours[1], 0, Dropdown::Flag::StayOpen, std::size(WeatherTypes), dropdownWidget->width() - 4);
auto currentWeather = gameState.weatherCurrent.weatherType;
diff --git a/src/openrct2-ui/windows/ClearScenery.cpp b/src/openrct2-ui/windows/ClearScenery.cpp
index 6cddde3b3f..71f1dda8d8 100644
--- a/src/openrct2-ui/windows/ClearScenery.cpp
+++ b/src/openrct2-ui/windows/ClearScenery.cpp
@@ -171,7 +171,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gLandToolSize));
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
@@ -218,7 +218,6 @@ namespace OpenRCT2::Ui::Windows
{
uint8_t state_changed = 0;
- MapInvalidateSelectionRect();
gMapSelectFlags.unset(MapSelectFlag::enable);
auto mapTile = ScreenGetMapXY(screenPos, nullptr);
@@ -228,7 +227,7 @@ namespace OpenRCT2::Ui::Windows
return state_changed;
}
- if (!(gMapSelectFlags.has(MapSelectFlag::enable)))
+ if (!gMapSelectFlags.has(MapSelectFlag::enable))
{
gMapSelectFlags.set(MapSelectFlag::enable);
state_changed++;
@@ -275,7 +274,6 @@ namespace OpenRCT2::Ui::Windows
state_changed++;
}
- MapInvalidateSelectionRect();
return state_changed;
}
@@ -290,7 +288,7 @@ namespace OpenRCT2::Ui::Windows
auto action = GetClearAction();
auto result = GameActions::Query(&action, getGameState());
- auto cost = (result.Error == GameActions::Status::Ok ? result.Cost : kMoney64Undefined);
+ auto cost = (result.error == GameActions::Status::ok ? result.cost : kMoney64Undefined);
if (_clearSceneryCost != cost)
{
_clearSceneryCost = cost;
@@ -331,7 +329,7 @@ namespace OpenRCT2::Ui::Windows
case WIDX_BACKGROUND:
{
auto* windowMgr = GetWindowManager();
- if (windowMgr->FindByClass(WindowClass::error) == nullptr && (gMapSelectFlags.has(MapSelectFlag::enable)))
+ if (windowMgr->FindByClass(WindowClass::error) == nullptr && gMapSelectFlags.has(MapSelectFlag::enable))
{
auto action = GetClearAction();
GameActions::Execute(&action, getGameState());
@@ -347,7 +345,6 @@ namespace OpenRCT2::Ui::Windows
switch (widgetIndex)
{
case WIDX_BACKGROUND:
- MapInvalidateSelectionRect();
gMapSelectFlags.unset(MapSelectFlag::enable);
gCurrentToolId = Tool::bulldozer;
break;
@@ -387,7 +384,7 @@ namespace OpenRCT2::Ui::Windows
ShowGridlines();
auto* toolWindow = ContextOpenWindow(WindowClass::clearScenery);
ToolSet(*toolWindow, WIDX_BACKGROUND, Tool::bulldozer);
- gInputFlags.set(InputFlag::unk6);
+ gInputFlags.set(InputFlag::allowRightMouseRemoval);
}
}
} // namespace OpenRCT2::Ui::Windows
diff --git a/src/openrct2-ui/windows/CustomCurrency.cpp b/src/openrct2-ui/windows/CustomCurrency.cpp
index e4e5e397b5..4d8d6e83eb 100644
--- a/src/openrct2-ui/windows/CustomCurrency.cpp
+++ b/src/openrct2-ui/windows/CustomCurrency.cpp
@@ -91,7 +91,7 @@ namespace OpenRCT2::Ui::Windows
gDropdown.items[1] = Dropdown::MenuLabel(STR_SUFFIX);
WindowDropdownShowTextCustomWidth(
- { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0,
+ { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height(), colours[1], 0,
Dropdown::Flag::StayOpen, 2, widget->width() - 4);
if (CurrencyDescriptors[EnumValue(CurrencyType::custom)].affix_unicode == CurrencyAffix::prefix)
@@ -187,14 +187,14 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
auto ft = Formatter::Common();
ft.Add(10.00_GBP);
drawWidgets(rt);
- auto screenCoords = windowPos + ScreenCoordsXY{ 10, 18 + widgets[WIDX_TITLE].height() };
+ auto screenCoords = windowPos + ScreenCoordsXY{ 10, 18 + widgets[WIDX_TITLE].height() - 1 };
DrawTextBasic(rt, screenCoords, STR_RATE, {}, { colours[1] });
diff --git a/src/openrct2-ui/windows/DebugPaint.cpp b/src/openrct2-ui/windows/DebugPaint.cpp
index c15f9caae3..d556c8668d 100644
--- a/src/openrct2-ui/windows/DebugPaint.cpp
+++ b/src/openrct2-ui/windows/DebugPaint.cpp
@@ -154,7 +154,7 @@ namespace OpenRCT2::Ui::Windows
setCheckboxValue(WIDX_TOGGLE_FORCE_REDRAW, gPaintForceRedraw);
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
}
diff --git a/src/openrct2-ui/windows/DemolishRidePrompt.cpp b/src/openrct2-ui/windows/DemolishRidePrompt.cpp
index 8d8bfafcef..2cfb809dc4 100644
--- a/src/openrct2-ui/windows/DemolishRidePrompt.cpp
+++ b/src/openrct2-ui/windows/DemolishRidePrompt.cpp
@@ -73,7 +73,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
WindowDrawWidgets(*this, rt);
diff --git a/src/openrct2-ui/windows/Dropdown.cpp b/src/openrct2-ui/windows/Dropdown.cpp
index 2227a1d818..c6b9cd1328 100644
--- a/src/openrct2-ui/windows/Dropdown.cpp
+++ b/src/openrct2-ui/windows/Dropdown.cpp
@@ -104,7 +104,7 @@ namespace OpenRCT2::Ui::Windows
DrawTextEllipsised(rt, { screenCoords.x + 2, screenCoords.y + yOffset }, width - 7, format, ft, { colour });
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
@@ -640,7 +640,7 @@ namespace OpenRCT2::Ui::Windows
// Show dropdown
auto squareSize = DropdownWindow::GetDefaultRowHeight();
WindowDropdownShowImage(
- w->windowPos.x + widget->left, w->windowPos.y + widget->top, widget->height() + 1, dropdownColour,
+ w->windowPos.x + widget->left, w->windowPos.y + widget->top, widget->height(), dropdownColour,
Dropdown::Flag::StayOpen, numColours, squareSize, squareSize,
DropdownGetAppropriateImageDropdownItemsPerRow(static_cast(numColours)));
diff --git a/src/openrct2-ui/windows/EditorBottomToolbar.cpp b/src/openrct2-ui/windows/EditorBottomToolbar.cpp
index 5f281d28e2..d528c24fa7 100644
--- a/src/openrct2-ui/windows/EditorBottomToolbar.cpp
+++ b/src/openrct2-ui/windows/EditorBottomToolbar.cpp
@@ -125,7 +125,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
auto drawPreviousButton = widgets[WIDX_PREVIOUS_STEP_BUTTON].type != WidgetType::empty;
auto drawNextButton = widgets[WIDX_NEXT_STEP_BUTTON].type != WidgetType::empty;
@@ -334,7 +334,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_NEXT_IMAGE].type = WidgetType::empty;
}
- void DrawLeftButtonBack(RenderTarget& rt)
+ void DrawLeftButtonBack(Drawing::RenderTarget& rt)
{
const auto& previousWidget = widgets[WIDX_PREVIOUS_IMAGE];
auto leftTop = windowPos + ScreenCoordsXY{ previousWidget.left, previousWidget.top };
@@ -342,7 +342,7 @@ namespace OpenRCT2::Ui::Windows
Rectangle::filter(rt, { leftTop, rightBottom }, FilterPaletteID::palette51);
}
- void DrawLeftButton(RenderTarget& rt)
+ void DrawLeftButton(Drawing::RenderTarget& rt)
{
const auto topLeft = windowPos
+ ScreenCoordsXY{ widgets[WIDX_PREVIOUS_IMAGE].left + 1, widgets[WIDX_PREVIOUS_IMAGE].top + 1 };
@@ -374,7 +374,7 @@ namespace OpenRCT2::Ui::Windows
DrawTextBasic(rt, { textX, textY + 10 }, stringId, {}, { textColour, TextAlignment::centre });
}
- void DrawRightButtonBack(RenderTarget& rt)
+ void DrawRightButtonBack(Drawing::RenderTarget& rt)
{
auto nextWidget = widgets[WIDX_NEXT_IMAGE];
auto leftTop = windowPos + ScreenCoordsXY{ nextWidget.left, nextWidget.top };
@@ -382,7 +382,7 @@ namespace OpenRCT2::Ui::Windows
Rectangle::filter(rt, { leftTop, rightBottom }, FilterPaletteID::palette51);
}
- void DrawRightButton(RenderTarget& rt)
+ void DrawRightButton(Drawing::RenderTarget& rt)
{
const auto topLeft = windowPos
+ ScreenCoordsXY{ widgets[WIDX_NEXT_IMAGE].left + 1, widgets[WIDX_NEXT_IMAGE].top + 1 };
@@ -415,7 +415,7 @@ namespace OpenRCT2::Ui::Windows
DrawTextBasic(rt, { textX, textY + 10 }, stringId, {}, { textColour, TextAlignment::centre });
}
- void DrawStepText(RenderTarget& rt)
+ void DrawStepText(Drawing::RenderTarget& rt)
{
int16_t stateX = (widgets[WIDX_PREVIOUS_IMAGE].right + widgets[WIDX_NEXT_IMAGE].left) / 2 + windowPos.x;
int16_t stateY = height - 0x0C + windowPos.y;
diff --git a/src/openrct2-ui/windows/EditorInventionsList.cpp b/src/openrct2-ui/windows/EditorInventionsList.cpp
index 4d7f8615bd..dc46740127 100644
--- a/src/openrct2-ui/windows/EditorInventionsList.cpp
+++ b/src/openrct2-ui/windows/EditorInventionsList.cpp
@@ -269,7 +269,7 @@ namespace OpenRCT2::Ui::Windows
WindowEditorInventionsListDragOpen(researchItem, windowPos, widgets[WIDX_PRE_RESEARCHED_SCROLL].right);
}
- void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
+ void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
const auto& gameState = getGameState();
@@ -354,7 +354,7 @@ namespace OpenRCT2::Ui::Windows
return fallback;
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
@@ -403,7 +403,7 @@ namespace OpenRCT2::Ui::Windows
RenderTarget clipDPI;
screenPos = windowPos + ScreenCoordsXY{ bkWidget.left + 1, bkWidget.top + 1 };
const auto clipWidth = bkWidget.width() - 2;
- const auto clipHeight = bkWidget.height() - 1;
+ const auto clipHeight = bkWidget.height() - 2;
if (ClipDrawPixelInfo(clipDPI, rt, screenPos, clipWidth, clipHeight))
{
object->DrawPreview(clipDPI, clipWidth, clipHeight);
@@ -655,7 +655,7 @@ namespace OpenRCT2::Ui::Windows
close();
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
auto screenCoords = windowPos + ScreenCoordsXY{ 0, 2 };
diff --git a/src/openrct2-ui/windows/EditorObjectSelection.cpp b/src/openrct2-ui/windows/EditorObjectSelection.cpp
index 0a41de0b54..8c7d89e42b 100644
--- a/src/openrct2-ui/windows/EditorObjectSelection.cpp
+++ b/src/openrct2-ui/windows/EditorObjectSelection.cpp
@@ -533,7 +533,7 @@ namespace OpenRCT2::Ui::Windows
auto& ddWidget = widgets[WIDX_FILTER_DROPDOWN];
WindowDropdownShowText(
- { windowPos.x + ddWidget.left, windowPos.y + ddWidget.top }, ddWidget.height() + 1,
+ { windowPos.x + ddWidget.left, windowPos.y + ddWidget.top }, ddWidget.height(),
colours[ddWidget.colour], Dropdown::Flag::StayOpen, _numSourceGameItems + numSelectionItems);
for (int32_t i = 0; i < _numSourceGameItems; i++)
@@ -655,8 +655,8 @@ namespace OpenRCT2::Ui::Windows
const auto objectSelectResult = WindowEditorObjectSelectionSelectObject(0, inputFlags, listItem->repositoryItem);
if (!objectSelectResult.Successful)
{
- StringId error_title = (inputFlags.has(EditorInputFlag::select)) ? STR_UNABLE_TO_SELECT_THIS_OBJECT
- : STR_UNABLE_TO_DE_SELECT_THIS_OBJECT;
+ StringId error_title = inputFlags.has(EditorInputFlag::select) ? STR_UNABLE_TO_SELECT_THIS_OBJECT
+ : STR_UNABLE_TO_DE_SELECT_THIS_OBJECT;
ContextShowError(error_title, objectSelectResult.Message, {});
return;
@@ -725,7 +725,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
+ void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
// ScrollPaint
ScreenCoordsXY screenCoords;
@@ -917,7 +917,7 @@ namespace OpenRCT2::Ui::Windows
for (size_t i = 0; i < std::size(ObjectSelectionPages); i++)
{
auto& widget = widgets[WIDX_TAB_1 + i];
- if (ObjectSelectionPages[i].Image != kSpriteIdNull)
+ if (ObjectSelectionPages[i].Image != kImageIndexUndefined)
{
widget.type = WidgetType::tab;
widget.left = x;
@@ -1008,7 +1008,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_PREVIEW].right = widgets[WIDX_PREVIEW].left + kPreviewSize;
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
@@ -1112,7 +1112,7 @@ namespace OpenRCT2::Ui::Windows
RenderTarget clipDPI;
auto screenPos = windowPos + ScreenCoordsXY{ previewWidget.left + 1, previewWidget.top + 1 };
int32_t previewWidth = previewWidget.width() - 2;
- int32_t previewHeight = previewWidget.height() - 1;
+ int32_t previewHeight = previewWidget.height() - 2;
if (ClipDrawPixelInfo(clipDPI, rt, screenPos, previewWidth, previewHeight))
{
_loadedObject->DrawPreview(clipDPI, previewWidth, previewHeight);
@@ -1248,7 +1248,7 @@ namespace OpenRCT2::Ui::Windows
_listItems.shrink_to_fit();
}
- void DrawDescriptions(RenderTarget& rt)
+ void DrawDescriptions(Drawing::RenderTarget& rt)
{
auto screenPos = windowPos + ScreenCoordsXY{ widgets[WIDX_PREVIEW].midX(), widgets[WIDX_PREVIEW].bottom + 3 };
auto descriptionWidth = width - widgets[WIDX_LIST].right - 12;
@@ -1356,7 +1356,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void DrawDebugData(RenderTarget& rt)
+ void DrawDebugData(Drawing::RenderTarget& rt)
{
ObjectListItem* listItem = &_listItems[selectedListItem];
auto screenPos = windowPos + ScreenCoordsXY{ width - 5, height - (kListRowHeight * 6) };
diff --git a/src/openrct2-ui/windows/EditorParkEntrance.cpp b/src/openrct2-ui/windows/EditorParkEntrance.cpp
index 18d9c01020..cb14f3fa56 100644
--- a/src/openrct2-ui/windows/EditorParkEntrance.cpp
+++ b/src/openrct2-ui/windows/EditorParkEntrance.cpp
@@ -30,6 +30,7 @@
#include
using namespace OpenRCT2::Drawing;
+using OpenRCT2::GameActions::CommandFlag;
namespace OpenRCT2::Ui::Windows
{
@@ -41,12 +42,13 @@ namespace OpenRCT2::Ui::Windows
static constexpr int32_t kScrollWidth = (kImageSize * kNumColumns) + kScrollBarWidth + 4;
static constexpr int32_t kScrollHeight = (kImageSize * kNumRows);
static constexpr ScreenSize kWindowSize = { kScrollWidth + 28, kScrollHeight + 51 };
+ static bool _placingEntrance = false;
struct EntranceSelection
{
ObjectEntryIndex entryIndex = kObjectEntryIndexNull;
StringId stringId = kStringIdNone;
- ImageIndex imageId = kSpriteIdNull;
+ ImageIndex imageId = kImageIndexUndefined;
};
enum WindowEditorParkEntranceListWidgetIdx
@@ -103,7 +105,7 @@ namespace OpenRCT2::Ui::Windows
return numRows;
}
- void PaintPreview(RenderTarget& rt, ImageIndex imageStart, ScreenCoordsXY screenCoords, Direction direction)
+ void PaintPreview(Drawing::RenderTarget& rt, ImageIndex imageStart, ScreenCoordsXY screenCoords, Direction direction)
{
imageStart += (direction * 3);
@@ -166,8 +168,11 @@ namespace OpenRCT2::Ui::Windows
void PlaceParkEntranceToolUpdate(const ScreenCoordsXY& screenCoords)
{
- MapInvalidateSelectionRect();
- MapInvalidateMapSelectionTiles();
+ if (_placingEntrance)
+ {
+ return;
+ }
+
gMapSelectFlags.unset(MapSelectFlag::enable, MapSelectFlag::enableArrow, MapSelectFlag::enableConstruct);
CoordsXYZD parkEntrancePosition = PlaceParkEntranceGetMapPosition(screenCoords);
if (parkEntrancePosition.IsNull())
@@ -177,12 +182,12 @@ namespace OpenRCT2::Ui::Windows
}
int32_t sideDirection = (parkEntrancePosition.direction + 1) & 3;
- gMapSelectionTiles.clear();
- gMapSelectionTiles.push_back({ parkEntrancePosition.x, parkEntrancePosition.y });
- gMapSelectionTiles.push_back(
+ MapSelection::clearSelectedTiles();
+ MapSelection::addSelectedTile({ parkEntrancePosition.x, parkEntrancePosition.y });
+ MapSelection::addSelectedTile(
{ parkEntrancePosition.x + CoordsDirectionDelta[sideDirection].x,
parkEntrancePosition.y + CoordsDirectionDelta[sideDirection].y });
- gMapSelectionTiles.push_back(
+ MapSelection::addSelectedTile(
{ parkEntrancePosition.x - CoordsDirectionDelta[sideDirection].x,
parkEntrancePosition.y - CoordsDirectionDelta[sideDirection].y });
@@ -190,7 +195,6 @@ namespace OpenRCT2::Ui::Windows
gMapSelectArrowDirection = parkEntrancePosition.direction;
gMapSelectFlags.set(MapSelectFlag::enableConstruct, MapSelectFlag::enableArrow);
- MapInvalidateMapSelectionTiles();
if (gParkEntranceGhostExists && parkEntrancePosition == gParkEntranceGhostPosition)
{
return;
@@ -202,10 +206,10 @@ namespace OpenRCT2::Ui::Windows
auto pathIndex = isLegacyPath ? gFootpathSelection.LegacyPath : gFootpathSelection.NormalSurface;
auto gameAction = GameActions::ParkEntrancePlaceAction(
parkEntrancePosition, pathIndex, _selectedEntranceType, isLegacyPath);
- gameAction.SetFlags(GAME_COMMAND_FLAG_GHOST);
+ gameAction.SetFlags({ CommandFlag::ghost });
auto result = GameActions::Execute(&gameAction, getGameState());
- if (result.Error == GameActions::Status::Ok)
+ if (result.error == GameActions::Status::ok)
{
gParkEntranceGhostPosition = parkEntrancePosition;
gParkEntranceGhostExists = true;
@@ -214,6 +218,8 @@ namespace OpenRCT2::Ui::Windows
void PlaceParkEntranceToolDown(const ScreenCoordsXY& screenCoords)
{
+ _placingEntrance = true;
+ gMapSelectFlags.unset(MapSelectFlag::enable, MapSelectFlag::enableArrow, MapSelectFlag::enableConstruct);
ParkEntranceRemoveGhost();
CoordsXYZD parkEntrancePosition = PlaceParkEntranceGetMapPosition(screenCoords);
@@ -223,10 +229,12 @@ namespace OpenRCT2::Ui::Windows
auto pathIndex = isLegacyPath ? gFootpathSelection.LegacyPath : gFootpathSelection.NormalSurface;
auto gameAction = GameActions::ParkEntrancePlaceAction(
parkEntrancePosition, pathIndex, _selectedEntranceType, isLegacyPath);
+ gameAction.SetCallback(
+ [&](const GameActions::GameAction*, const GameActions::Result* result) { _placingEntrance = false; });
auto result = GameActions::Execute(&gameAction, getGameState());
- if (result.Error == GameActions::Status::Ok)
+ if (result.error == GameActions::Status::ok)
{
- Audio::Play3D(Audio::SoundId::placeItem, result.Position);
+ Audio::Play3D(Audio::SoundId::placeItem, result.position);
}
}
}
@@ -264,7 +272,7 @@ namespace OpenRCT2::Ui::Windows
pressedWidgets |= 1LL << WIDX_TAB;
ToolSet(*this, WIDX_LIST, Tool::entranceDown);
- gInputFlags.set(InputFlag::unk6);
+ gInputFlags.set(InputFlag::allowRightMouseRemoval);
}
void onMouseUp(WidgetIndex widgetIndex) override
@@ -299,7 +307,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_LIST].bottom = height - 5;
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
GfxDrawSprite(
@@ -307,7 +315,7 @@ namespace OpenRCT2::Ui::Windows
windowPos + ScreenCoordsXY{ widgets[WIDX_TAB].left, widgets[WIDX_TAB].top });
}
- void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
+ void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
GfxClear(rt, ColourMapA[colours[1].colour].mid_light);
@@ -415,6 +423,7 @@ namespace OpenRCT2::Ui::Windows
window = windowMgr->Create(
WindowClass::editorParkEntrance, kWindowSize, { WindowFlag::higherContrastOnPress, WindowFlag::resizable });
+ _placingEntrance = false;
return window;
}
} // namespace OpenRCT2::Ui::Windows
diff --git a/src/openrct2-ui/windows/EditorScenarioOptions.cpp b/src/openrct2-ui/windows/EditorScenarioOptions.cpp
index d4ef6a34a2..68fa1e61b3 100644
--- a/src/openrct2-ui/windows/EditorScenarioOptions.cpp
+++ b/src/openrct2-ui/windows/EditorScenarioOptions.cpp
@@ -457,7 +457,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
switch (page)
{
@@ -515,7 +515,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
+ void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
if (page == WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_RIDES)
{
@@ -590,7 +590,7 @@ namespace OpenRCT2::Ui::Windows
setWidgetPressed(WIDX_TAB_1 + page, true);
}
- void DrawTabImages(RenderTarget& rt)
+ void DrawTabImages(Drawing::RenderTarget& rt)
{
Widget* widget;
int32_t spriteIndex;
@@ -766,8 +766,8 @@ namespace OpenRCT2::Ui::Windows
Widget* dropdownWidget = &widgets[WIDX_OBJECTIVE];
WindowDropdownShowTextCustomWidth(
- { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
- colours[1], 0, Dropdown::Flag::StayOpen, numItems, dropdownWidget->width() - 4);
+ { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(), colours[1],
+ 0, Dropdown::Flag::StayOpen, numItems, dropdownWidget->width() - 4);
}
void ShowCategoryDropdown()
@@ -779,8 +779,8 @@ namespace OpenRCT2::Ui::Windows
Widget* dropdownWidget = &widgets[WIDX_CATEGORY];
WindowDropdownShowTextCustomWidth(
- { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
- colours[1], 0, Dropdown::Flag::StayOpen, 5, dropdownWidget->width() - 4);
+ { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(), colours[1],
+ 0, Dropdown::Flag::StayOpen, 5, dropdownWidget->width() - 4);
gDropdown.items[EnumValue(getGameState().scenarioOptions.category)].setChecked(true);
}
@@ -1141,7 +1141,7 @@ namespace OpenRCT2::Ui::Windows
*
* rct2: 0x0067161C
*/
- void ObjectiveOnDraw(RenderTarget& rt)
+ void ObjectiveOnDraw(Drawing::RenderTarget& rt)
{
const auto& gameState = getGameState();
const auto& scenarioOptions = gameState.scenarioOptions;
@@ -1272,7 +1272,7 @@ namespace OpenRCT2::Ui::Windows
SetPressedTab();
}
- void ScenarioDetailsOnDraw(RenderTarget& rt)
+ void ScenarioDetailsOnDraw(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -1561,7 +1561,7 @@ namespace OpenRCT2::Ui::Windows
gDropdown.items[2] = Dropdown::MenuLabel(STR_PAID_ENTRY_PAID_RIDES);
WindowDropdownShowTextCustomWidth(
- { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() - 1,
+ { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() - 2,
colours[1], 0, Dropdown::Flag::StayOpen, 3, dropdownWidget->width() - 4);
if (gameState.park.flags & PARK_FLAGS_UNLOCK_ALL_PRICES)
@@ -1684,7 +1684,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_CLOSE].type = gLegacyScene == LegacyScene::scenarioEditor ? WidgetType::empty : WidgetType::closeBox;
}
- void FinancialDraw(RenderTarget& rt)
+ void FinancialDraw(Drawing::RenderTarget& rt)
{
ScreenCoordsXY screenCoords{};
@@ -1899,7 +1899,7 @@ namespace OpenRCT2::Ui::Windows
gDropdown.items[3] = Dropdown::MenuLabel(STR_GUESTS_PREFER_INTENSITY_MORE_INTENSE_RIDES);
WindowDropdownShowTextCustomWidth(
- { windowPos.x + dropdownWidget.left, windowPos.y + dropdownWidget.top }, dropdownWidget.height() - 1,
+ { windowPos.x + dropdownWidget.left, windowPos.y + dropdownWidget.top }, dropdownWidget.height() - 2,
colours[1], 0, Dropdown::Flag::StayOpen, 4, dropdownWidget.width() - 4);
const auto preferLess = gameState.park.flags & PARK_FLAGS_PREF_LESS_INTENSE_RIDES;
@@ -1970,7 +1970,7 @@ namespace OpenRCT2::Ui::Windows
setWidgetPressed(WIDX_HARD_GUEST_GENERATION, gameState.park.flags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION);
}
- void GuestsDraw(RenderTarget& rt)
+ void GuestsDraw(Drawing::RenderTarget& rt)
{
ScreenCoordsXY screenCoords{};
@@ -2173,7 +2173,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_CLOSE].type = gLegacyScene == LegacyScene::scenarioEditor ? WidgetType::empty : WidgetType::closeBox;
}
- void LandDraw(RenderTarget& rt)
+ void LandDraw(Drawing::RenderTarget& rt)
{
ScreenCoordsXY screenCoords{};
@@ -2327,7 +2327,7 @@ namespace OpenRCT2::Ui::Windows
*
* rct2: 0x00672340
*/
- void RidesOnDraw(RenderTarget& rt)
+ void RidesOnDraw(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -2337,7 +2337,7 @@ namespace OpenRCT2::Ui::Windows
*
* rct2: 0x0067236F
*/
- void RidesOnScrollDraw(RenderTarget& rt, int32_t scrollIndex)
+ void RidesOnScrollDraw(Drawing::RenderTarget& rt, int32_t scrollIndex)
{
int32_t colour = ColourMapA[colours[1].colour].mid_light;
Rectangle::fill(rt, { { rt.x, rt.y }, { rt.x + rt.width - 1, rt.y + rt.height - 1 } }, colour);
diff --git a/src/openrct2-ui/windows/Error.cpp b/src/openrct2-ui/windows/Error.cpp
index dc9762175f..f7c932a9c9 100644
--- a/src/openrct2-ui/windows/Error.cpp
+++ b/src/openrct2-ui/windows/Error.cpp
@@ -67,7 +67,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
WindowDrawWidgets(*this, rt);
diff --git a/src/openrct2-ui/windows/Finances.cpp b/src/openrct2-ui/windows/Finances.cpp
index 7d0bd1dd35..0789f03470 100644
--- a/src/openrct2-ui/windows/Finances.cpp
+++ b/src/openrct2-ui/windows/Finances.cpp
@@ -346,7 +346,7 @@ namespace OpenRCT2::Ui::Windows
onPrepareDrawGraph(graphPageWidget, centredGraph);
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -395,7 +395,7 @@ namespace OpenRCT2::Ui::Windows
return {};
}
- void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
+ void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
if (page != WINDOW_FINANCES_PAGE_SUMMARY)
return;
@@ -588,7 +588,7 @@ namespace OpenRCT2::Ui::Windows
initialiseScrollPosition(WIDX_SUMMARY_SCROLL, 0);
}
- void onDrawSummary(RenderTarget& rt)
+ void onDrawSummary(Drawing::RenderTarget& rt)
{
auto titleBarBottom = widgets[WIDX_TITLE].bottom;
auto screenCoords = windowPos + ScreenCoordsXY{ 8, titleBarBottom + 37 };
@@ -706,7 +706,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDrawMarketing(RenderTarget& rt)
+ void onDrawMarketing(Drawing::RenderTarget& rt)
{
auto screenCoords = windowPos + ScreenCoordsXY{ 8, widgets[WIDX_TAB_1].top + 45 };
int32_t noCampaignsActive = 1;
@@ -785,7 +785,7 @@ namespace OpenRCT2::Ui::Windows
#pragma region Graph Events
- void onDrawGraph(RenderTarget& rt, const money64 currentValue, const StringId fmt) const
+ void onDrawGraph(Drawing::RenderTarget& rt, const money64 currentValue, const StringId fmt) const
{
Formatter ft;
ft.Add(currentValue);
@@ -852,7 +852,7 @@ namespace OpenRCT2::Ui::Windows
widgetScrollUpdateThumbs(*this, widgetIndex);
}
- void DrawTabImage(RenderTarget& rt, int32_t tabPage, int32_t spriteIndex)
+ void DrawTabImage(Drawing::RenderTarget& rt, int32_t tabPage, int32_t spriteIndex)
{
WidgetIndex widgetIndex = WIDX_TAB_1 + tabPage;
@@ -870,7 +870,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void DrawTabImages(RenderTarget& rt)
+ void DrawTabImages(Drawing::RenderTarget& rt)
{
DrawTabImage(rt, WINDOW_FINANCES_PAGE_SUMMARY, SPR_TAB_FINANCES_SUMMARY_0);
DrawTabImage(rt, WINDOW_FINANCES_PAGE_FINANCIAL_GRAPH, SPR_TAB_FINANCES_FINANCIAL_GRAPH_0);
diff --git a/src/openrct2-ui/windows/Footpath.cpp b/src/openrct2-ui/windows/Footpath.cpp
index fad523809c..4da27dc435 100644
--- a/src/openrct2-ui/windows/Footpath.cpp
+++ b/src/openrct2-ui/windows/Footpath.cpp
@@ -29,6 +29,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -47,6 +48,7 @@
#include
using namespace OpenRCT2::Numerics;
+using OpenRCT2::GameActions::CommandFlag;
namespace OpenRCT2::Ui::Windows
{
@@ -240,7 +242,7 @@ namespace OpenRCT2::Ui::Windows
ToolCancel();
_footpathConstructionMode = PathConstructionMode::onLand;
ToolSet(*this, WIDX_CONSTRUCT_ON_LAND, Tool::pathDown);
- gInputFlags.set(InputFlag::unk6);
+ gInputFlags.set(InputFlag::allowRightMouseRemoval);
_footpathErrorOccured = false;
WindowFootpathSetEnabledAndPressedWidgets();
@@ -254,7 +256,6 @@ namespace OpenRCT2::Ui::Windows
{
FootpathUpdateProvisional();
ViewportSetVisibility(ViewportVisibility::standard);
- MapInvalidateMapSelectionTiles();
gMapSelectFlags.unset(MapSelectFlag::enableConstruct);
auto* windowMgr = Ui::GetWindowManager();
@@ -345,11 +346,10 @@ namespace OpenRCT2::Ui::Windows
_windowFootpathCost = kMoney64Undefined;
ToolCancel();
FootpathUpdateProvisional();
- MapInvalidateMapSelectionTiles();
gMapSelectFlags.unset(MapSelectFlag::enableConstruct);
_footpathConstructionMode = PathConstructionMode::dragArea;
ToolSet(*this, WIDX_CONSTRUCT_DRAG_AREA, Tool::pathDown);
- gInputFlags.set(InputFlag::unk6);
+ gInputFlags.set(InputFlag::allowRightMouseRemoval);
_footpathErrorOccured = false;
WindowFootpathSetEnabledAndPressedWidgets();
}
@@ -370,11 +370,10 @@ namespace OpenRCT2::Ui::Windows
_windowFootpathCost = kMoney64Undefined;
ToolCancel();
FootpathUpdateProvisional();
- MapInvalidateMapSelectionTiles();
gMapSelectFlags.unset(MapSelectFlag::enableConstruct);
_footpathConstructionMode = PathConstructionMode::onLand;
ToolSet(*this, WIDX_CONSTRUCT_ON_LAND, Tool::pathDown);
- gInputFlags.set(InputFlag::unk6);
+ gInputFlags.set(InputFlag::allowRightMouseRemoval);
_footpathErrorOccured = false;
WindowFootpathSetEnabledAndPressedWidgets();
break;
@@ -395,11 +394,10 @@ namespace OpenRCT2::Ui::Windows
_windowFootpathCost = kMoney64Undefined;
ToolCancel();
FootpathUpdateProvisional();
- MapInvalidateMapSelectionTiles();
gMapSelectFlags.unset(MapSelectFlag::enableConstruct);
_footpathConstructionMode = PathConstructionMode::bridgeOrTunnelPick;
ToolSet(*this, WIDX_CONSTRUCT_BRIDGE_OR_TUNNEL, Tool::crosshair);
- gInputFlags.set(InputFlag::unk6);
+ gInputFlags.set(InputFlag::allowRightMouseRemoval);
_footpathErrorOccured = false;
WindowFootpathSetEnabledAndPressedWidgets();
break;
@@ -535,6 +533,18 @@ namespace OpenRCT2::Ui::Windows
? WidgetType::imgBtn
: WidgetType::empty;
+#ifndef DISABLE_NETWORK
+ bool canDrag = true;
+ if (Network::GetMode() == Network::Mode::client)
+ {
+ canDrag = Network::CanPerformAction(Network::GetCurrentPlayerGroupIndex(), Network::Permission::dragPathArea);
+ }
+ if (canDrag)
+ disabledWidgets &= ~(1uLL << WIDX_CONSTRUCT_DRAG_AREA);
+ else
+ disabledWidgets |= (1uLL << WIDX_CONSTRUCT_DRAG_AREA);
+#endif
+
if (gFootpathSelection.LegacyPath == kObjectEntryIndexNull)
{
widgets[WIDX_RAILINGS_TYPE].type = WidgetType::flatBtn;
@@ -545,7 +555,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
ScreenCoordsXY screenCoords;
WindowDrawWidgets(*this, rt);
@@ -633,7 +643,7 @@ namespace OpenRCT2::Ui::Windows
}
// Update provisional bridge mode path
- if (!(_provisionalFootpath.flags.has(ProvisionalPathFlag::placed)))
+ if (!_provisionalFootpath.flags.has(ProvisionalPathFlag::placed))
{
ObjectEntryIndex type;
ObjectEntryIndex railings = gFootpathSelection.Railings;
@@ -670,17 +680,16 @@ namespace OpenRCT2::Ui::Windows
{
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
}
- MapInvalidateTileFull(footpathLoc);
}
}
- void WindowFootpathDrawDropdownButtons(RenderTarget& rt)
+ void WindowFootpathDrawDropdownButtons(Drawing::RenderTarget& rt)
{
if (gFootpathSelection.LegacyPath == kObjectEntryIndexNull)
{
// Set footpath and queue type button images
- auto pathImage = kSpriteIdNull;
- auto queueImage = kSpriteIdNull;
+ auto pathImage = kImageIndexUndefined;
+ auto queueImage = kImageIndexUndefined;
auto pathEntry = GetPathSurfaceEntry(gFootpathSelection.NormalSurface);
if (pathEntry != nullptr)
{
@@ -697,7 +706,7 @@ namespace OpenRCT2::Ui::Windows
WindowFootpathDrawDropdownButton(rt, WIDX_QUEUELINE_TYPE, queueImage);
// Set railing
- auto railingsImage = kSpriteIdNull;
+ auto railingsImage = kImageIndexUndefined;
auto railingsEntry = GetPathRailingsEntry(gFootpathSelection.Railings);
if (railingsEntry != nullptr)
{
@@ -710,8 +719,8 @@ namespace OpenRCT2::Ui::Windows
auto& objManager = OpenRCT2::GetContext()->GetObjectManager();
// Set footpath and queue type button images
- auto pathImage = kSpriteIdNull;
- auto queueImage = kSpriteIdNull;
+ auto pathImage = kImageIndexUndefined;
+ auto queueImage = kImageIndexUndefined;
const auto* pathObj = objManager.GetLoadedObject(gFootpathSelection.LegacyPath);
if (pathObj != nullptr)
{
@@ -725,7 +734,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void WindowFootpathDrawDropdownButton(RenderTarget& rt, WidgetIndex widgetIndex, ImageIndex image)
+ void WindowFootpathDrawDropdownButton(Drawing::RenderTarget& rt, WidgetIndex widgetIndex, ImageIndex image)
{
const auto& widget = widgets[widgetIndex];
GfxDrawSprite(rt, ImageId(image), { windowPos.x + widget.left, windowPos.y + widget.top });
@@ -809,8 +818,8 @@ namespace OpenRCT2::Ui::Windows
auto itemsPerRow = DropdownGetAppropriateImageDropdownItemsPerRow(numPathTypes);
WindowDropdownShowImage(
- windowPos.x + widget->left, windowPos.y + widget->top, widget->height() + 1, colours[1], 0, numPathTypes, 47,
- 36, itemsPerRow);
+ windowPos.x + widget->left, windowPos.y + widget->top, widget->height(), colours[1], 0, numPathTypes, 47, 36,
+ itemsPerRow);
gDropdown.hasTooltips = true;
@@ -845,8 +854,8 @@ namespace OpenRCT2::Ui::Windows
auto itemsPerRow = DropdownGetAppropriateImageDropdownItemsPerRow(numRailingsTypes);
WindowDropdownShowImage(
- windowPos.x + widget->left, windowPos.y + widget->top, widget->height() + 1, colours[1], 0, numRailingsTypes,
- 47, 36, itemsPerRow);
+ windowPos.x + widget->left, windowPos.y + widget->top, widget->height(), colours[1], 0, numRailingsTypes, 47,
+ 36, itemsPerRow);
gDropdown.hasTooltips = true;
@@ -1040,7 +1049,6 @@ namespace OpenRCT2::Ui::Windows
*/
void WindowFootpathSetProvisionalPathAtPoint(const ScreenCoordsXY& screenCoords)
{
- MapInvalidateSelectionRect();
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
// Get current map pos and handle key modifier state
@@ -1049,7 +1057,7 @@ namespace OpenRCT2::Ui::Windows
return;
// Check for change
- if ((_provisionalFootpath.flags.has(ProvisionalPathFlag::placed)) && _provisionalFootpath.positionA == mapPos
+ if (_provisionalFootpath.flags.has(ProvisionalPathFlag::placed) && _provisionalFootpath.positionA == mapPos
&& _provisionalFootpath.startZ == _footpathPlaceZ)
{
return;
@@ -1107,11 +1115,10 @@ namespace OpenRCT2::Ui::Windows
void WindowFootpathSetProvisionalPathDragArea(MapRange range, int32_t baseZ)
{
- MapInvalidateSelectionRect();
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
// Check for change
- if ((_provisionalFootpath.flags.has(ProvisionalPathFlag::placed)) && range.Point1 == _provisionalFootpath.positionA
+ if (_provisionalFootpath.flags.has(ProvisionalPathFlag::placed) && range.Point1 == _provisionalFootpath.positionA
&& range.Point2 == _provisionalFootpath.positionB && baseZ == _provisionalFootpath.startZ)
{
return;
@@ -1146,7 +1153,6 @@ namespace OpenRCT2::Ui::Windows
int32_t direction;
TileElement* tileElement;
- MapInvalidateSelectionRect();
gMapSelectFlags.unset(MapSelectFlag::enable, MapSelectFlag::enableArrow);
auto mapCoords = FootpathBridgeGetInfoFromPos(screenCoords, &direction, &tileElement);
@@ -1174,8 +1180,6 @@ namespace OpenRCT2::Ui::Windows
gMapSelectArrowPosition = CoordsXYZ{ mapCoords, z };
gMapSelectArrowDirection = direction;
-
- MapInvalidateSelectionRect();
}
FootpathPlacementResult WindowFootpathGetPlacementFromScreenCoords(const ScreenCoordsXY& screenCoords)
@@ -1285,10 +1289,10 @@ namespace OpenRCT2::Ui::Windows
auto footpathPlaceAction = GameActions::FootpathPlaceAction(
tile.position, tile.slope, selectedType, gFootpathSelection.Railings, kInvalidDirection, constructFlags);
auto result = GameActions::Execute(&footpathPlaceAction, getGameState());
- if (result.Error == GameActions::Status::Ok)
+ if (result.error == GameActions::Status::ok)
{
anySuccess = true;
- cost += result.Cost;
+ cost += result.cost;
}
lastLocation = tile.position;
}
@@ -1335,12 +1339,12 @@ namespace OpenRCT2::Ui::Windows
{ *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)
+ if (result->error == GameActions::Status::ok)
{
// Don't play sound if it is no cost to prevent multiple sounds. TODO: make this work in no money scenarios
- if (result->Cost != 0)
+ if (result->cost != 0)
{
- OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::placeItem, result->Position);
+ OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::placeItem, result->position);
}
}
else
@@ -1429,9 +1433,9 @@ namespace OpenRCT2::Ui::Windows
footpathPlaceAction.SetCallback(
[footpathLoc](const GameActions::GameAction* ga, const GameActions::Result* result) {
- if (result->Error == GameActions::Status::Ok)
+ if (result->error == GameActions::Status::ok)
{
- Audio::Play3D(OpenRCT2::Audio::SoundId::placeItem, result->Position);
+ Audio::Play3D(OpenRCT2::Audio::SoundId::placeItem, result->position);
}
auto* windowMgr = GetWindowManager();
@@ -1441,7 +1445,7 @@ namespace OpenRCT2::Ui::Windows
return;
}
- if (result->Error == GameActions::Status::Ok)
+ if (result->error == GameActions::Status::ok)
{
if (_footpathConstructSlope == SlopePitch::flat)
{
@@ -1602,15 +1606,13 @@ namespace OpenRCT2::Ui::Windows
{
if (_footpathConstructionMode == PathConstructionMode::bridgeOrTunnel)
{
- MapInvalidateMapSelectionTiles();
gMapSelectFlags.set(MapSelectFlag::enableConstruct, MapSelectFlag::green);
int32_t direction = _footpathConstructDirection;
- gMapSelectionTiles.clear();
- gMapSelectionTiles.push_back(
+ MapSelection::clearSelectedTiles();
+ MapSelection::addSelectedTile(
{ _footpathConstructFromPosition.x + CoordsDirectionDelta[direction].x,
_footpathConstructFromPosition.y + CoordsDirectionDelta[direction].y });
- MapInvalidateMapSelectionTiles();
}
uint64_t newPressedWidgets = pressedWidgets
@@ -1949,14 +1951,14 @@ namespace OpenRCT2::Ui::Windows
{
auto footpathPlaceAction = GameActions::FootpathPlaceAction(
tile.position, tile.slope, type, railingsType, kInvalidDirection, constructFlags);
- footpathPlaceAction.SetFlags(GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED);
+ footpathPlaceAction.SetFlags({ CommandFlag::ghost, CommandFlag::allowDuringPaused });
res = GameActions::Execute(&footpathPlaceAction, getGameState());
// The latter status will be returned if there is already path at the tile in question, to prevent a ghost
// from glitching through the existing path.
- if (res.Error == GameActions::Status::Ok || res.Error == GameActions::Status::ItemAlreadyPlaced)
+ if (res.error == GameActions::Status::ok || res.error == GameActions::Status::itemAlreadyPlaced)
{
succesfulTiles.emplace_back(tile);
- cost += res.Cost;
+ cost += res.cost;
}
}
@@ -2020,7 +2022,7 @@ namespace OpenRCT2::Ui::Windows
for (const auto& tile : _provisionalFootpath.tiles)
{
auto action = GameActions::FootpathRemoveAction(tile.position);
- action.SetFlags(GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST);
+ action.SetFlags({ CommandFlag::allowDuringPaused, CommandFlag::noSpend, CommandFlag::ghost });
GameActions::Execute(&action, getGameState());
}
}
@@ -2036,7 +2038,6 @@ namespace OpenRCT2::Ui::Windows
_provisionalFootpath.flags.unset(ProvisionalPathFlag::showArrow);
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
- MapInvalidateTileFull(_footpathConstructFromPosition);
}
FootpathRemoveProvisional();
}
diff --git a/src/openrct2-ui/windows/GameBottomToolbar.cpp b/src/openrct2-ui/windows/GameBottomToolbar.cpp
index f4cb9623c3..09373cda63 100644
--- a/src/openrct2-ui/windows/GameBottomToolbar.cpp
+++ b/src/openrct2-ui/windows/GameBottomToolbar.cpp
@@ -89,7 +89,7 @@ namespace OpenRCT2::Ui::Windows
: colours[0].colour);
}
- void DrawLeftPanel(RenderTarget& rt)
+ void DrawLeftPanel(Drawing::RenderTarget& rt)
{
const auto& leftPanelWidget = widgets[WIDX_LEFT_OUTSET];
@@ -154,7 +154,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void DrawParkRating(RenderTarget& rt, int32_t colour, const ScreenCoordsXY& coords, uint8_t factor)
+ void DrawParkRating(Drawing::RenderTarget& rt, int32_t colour, const ScreenCoordsXY& coords, uint8_t factor)
{
int16_t bar_width = (factor * 114) / 255;
Rectangle::fillInset(
@@ -175,7 +175,7 @@ namespace OpenRCT2::Ui::Windows
GfxDrawSprite(rt, ImageId(SPR_RATING_HIGH), coords + ScreenCoordsXY{ 114, 0 });
}
- void DrawRightPanel(RenderTarget& rt)
+ void DrawRightPanel(Drawing::RenderTarget& rt)
{
const auto& rightPanelWidget = widgets[WIDX_RIGHT_OUTSET];
@@ -237,7 +237,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void DrawNewsItem(RenderTarget& rt)
+ void DrawNewsItem(Drawing::RenderTarget& rt)
{
const auto& middleOutsetWidget = widgets[WIDX_MIDDLE_OUTSET];
auto* newsItem = News::GetItem(0);
@@ -353,7 +353,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void DrawMiddlePanel(RenderTarget& rt)
+ void DrawMiddlePanel(Drawing::RenderTarget& rt)
{
Widget* middleOutsetWidget = &widgets[WIDX_MIDDLE_OUTSET];
@@ -620,7 +620,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
const auto& leftWidget = widgets[WIDX_LEFT_OUTSET];
const auto& rightWidget = widgets[WIDX_RIGHT_OUTSET];
diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp
index 90af298993..9bf88fa08e 100644
--- a/src/openrct2-ui/windows/Guest.cpp
+++ b/src/openrct2-ui/windows/Guest.cpp
@@ -356,7 +356,7 @@ namespace OpenRCT2::Ui::Windows
onViewportRotateOverview();
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
switch (page)
{
@@ -419,7 +419,7 @@ namespace OpenRCT2::Ui::Windows
onScrollMouseDownRides(scrollIndex, screenCoords);
}
}
- void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
+ void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
if (page == WINDOW_GUEST_RIDES)
{
@@ -543,14 +543,14 @@ namespace OpenRCT2::Ui::Windows
#pragma region Overview
- void OverviewTabDraw(RenderTarget& rt)
+ void OverviewTabDraw(Drawing::RenderTarget& rt)
{
if (widgetIsDisabled(*this, WIDX_TAB_1))
return;
const auto& widget = widgets[WIDX_TAB_1];
int32_t widgWidth = widget.width() - 2;
- int32_t widgHeight = widget.height() - 1;
+ int32_t widgHeight = widget.height() - 2;
auto screenCoords = windowPos + ScreenCoordsXY{ widget.left + 1, widget.top + 1 };
if (page == WINDOW_GUEST_OVERVIEW)
widgHeight++;
@@ -625,7 +625,7 @@ namespace OpenRCT2::Ui::Windows
{
const auto& widget = widgets[WIDX_VIEWPORT];
const auto reqViewportWidth = widget.width() - 2;
- const auto reqViewportHeight = widget.height() - 1;
+ const auto reqViewportHeight = widget.height() - 2;
viewport->pos = windowPos + ScreenCoordsXY{ widget.left + 1, widget.top + 1 };
if (viewport->width != reqViewportWidth || viewport->height != reqViewportHeight)
{
@@ -661,7 +661,7 @@ namespace OpenRCT2::Ui::Windows
Network::GetCurrentPlayerId() };
pickupAction.SetCallback(
[peepnum = number](const GameActions::GameAction* ga, const GameActions::Result* result) {
- if (result->Error != GameActions::Status::Ok)
+ if (result->error != GameActions::Status::ok)
return;
auto* windowMgr = GetWindowManager();
WindowBase* wind = windowMgr->FindByNumber(WindowClass::peep, peepnum);
@@ -728,7 +728,7 @@ namespace OpenRCT2::Ui::Windows
};
WindowDropdownShowText(
- { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, colours[1], 0, dropdownItems);
+ { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height(), colours[1], 0, dropdownItems);
gDropdown.defaultIndex = 0;
}
@@ -767,7 +767,7 @@ namespace OpenRCT2::Ui::Windows
const auto& viewWidget = widgets[WIDX_VIEWPORT];
auto screenPos = ScreenCoordsXY{ viewWidget.left + 1 + windowPos.x, viewWidget.top + 1 + windowPos.y };
int32_t widgWidth = viewWidget.width() - 2;
- int32_t widgHeight = viewWidget.height() - 1;
+ int32_t widgHeight = viewWidget.height() - 2;
ViewportCreate(*this, screenPos, widgWidth, widgHeight, focus.value());
if (viewport != nullptr && reCreateViewport)
@@ -780,7 +780,7 @@ namespace OpenRCT2::Ui::Windows
invalidate();
}
- void onDrawOverview(RenderTarget& rt)
+ void onDrawOverview(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
OverviewTabDraw(rt);
@@ -823,7 +823,7 @@ namespace OpenRCT2::Ui::Windows
auto marqWidth = marqueeWidget.width() - 4;
int32_t left = marqueeWidget.left + 2 + windowPos.x;
int32_t top = marqueeWidget.top + windowPos.y;
- int32_t marqHeight = marqueeWidget.height();
+ int32_t marqHeight = marqueeWidget.height() - 1;
RenderTarget rtMarquee;
if (!ClipDrawPixelInfo(rtMarquee, rt, { left, top }, marqWidth, marqHeight))
{
@@ -977,8 +977,6 @@ namespace OpenRCT2::Ui::Windows
if (widgetIndex != WIDX_PICKUP)
return;
- MapInvalidateSelectionRect();
-
gMapSelectFlags.unset(MapSelectFlag::enable);
auto mapCoords = FootpathGetCoordinatesFromPos({ screenCoords.x, screenCoords.y + 16 }, nullptr, nullptr);
@@ -988,7 +986,6 @@ namespace OpenRCT2::Ui::Windows
gMapSelectType = MapSelectType::full;
gMapSelectPositionA = mapCoords;
gMapSelectPositionB = mapCoords;
- MapInvalidateSelectionRect();
}
gPickupPeepImage = ImageId();
@@ -1030,7 +1027,7 @@ namespace OpenRCT2::Ui::Windows
{ destCoords, tileElement->GetBaseZ() },
Network::GetCurrentPlayerId() };
pickupAction.SetCallback([](const GameActions::GameAction* ga, const GameActions::Result* result) {
- if (result->Error != GameActions::Status::Ok)
+ if (result->error != GameActions::Status::ok)
return;
ToolCancel();
gPickupPeepImage = ImageId();
@@ -1053,7 +1050,7 @@ namespace OpenRCT2::Ui::Windows
#pragma endregion
#pragma region Stats
- void StatsTabDraw(RenderTarget& rt)
+ void StatsTabDraw(Drawing::RenderTarget& rt)
{
if (widgetIsDisabled(*this, WIDX_TAB_2))
return;
@@ -1110,7 +1107,7 @@ namespace OpenRCT2::Ui::Windows
return std::clamp(newValue, newMin, 100);
}
- void onDrawStats(RenderTarget& rt)
+ void onDrawStats(Drawing::RenderTarget& rt)
{
// ebx
const auto peep = GetGuest();
@@ -1209,7 +1206,7 @@ namespace OpenRCT2::Ui::Windows
#pragma endregion
#pragma region Rides
- void RidesTabDraw(RenderTarget& rt)
+ void RidesTabDraw(Drawing::RenderTarget& rt)
{
if (widgetIsDisabled(*this, WIDX_TAB_3))
return;
@@ -1318,7 +1315,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_RIDE_SCROLL].bottom = height - 15;
}
- void onDrawRides(RenderTarget& rt)
+ void onDrawRides(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
OverviewTabDraw(rt);
@@ -1355,7 +1352,7 @@ namespace OpenRCT2::Ui::Windows
DrawTextEllipsised(rt, screenCoords, width - 14, STR_FAVOURITE_RIDE, ft);
}
- void onScrollDrawRides(int32_t scrollIndex, RenderTarget& rt)
+ void onScrollDrawRides(int32_t scrollIndex, Drawing::RenderTarget& rt)
{
auto colour = ColourMapA[colours[1].colour].mid_light;
Rectangle::fill(rt, { { rt.x, rt.y }, { rt.x + rt.width - 1, rt.y + rt.height - 1 } }, colour);
@@ -1382,7 +1379,7 @@ namespace OpenRCT2::Ui::Windows
#pragma endregion
#pragma region Finance
- void FinanceTabDraw(RenderTarget& rt)
+ void FinanceTabDraw(Drawing::RenderTarget& rt)
{
if (widgetIsDisabled(*this, WIDX_TAB_4))
return;
@@ -1408,7 +1405,7 @@ namespace OpenRCT2::Ui::Windows
invalidateWidget(WIDX_TAB_4);
}
- void onDrawFinance(RenderTarget& rt)
+ void onDrawFinance(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
OverviewTabDraw(rt);
@@ -1520,7 +1517,7 @@ namespace OpenRCT2::Ui::Windows
#pragma endregion
#pragma region Thoughts
- void ThoughtsTabDraw(RenderTarget& rt)
+ void ThoughtsTabDraw(Drawing::RenderTarget& rt)
{
if (widgetIsDisabled(*this, WIDX_TAB_5))
return;
@@ -1557,7 +1554,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDrawThoughts(RenderTarget& rt)
+ void onDrawThoughts(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
OverviewTabDraw(rt);
@@ -1598,7 +1595,7 @@ namespace OpenRCT2::Ui::Windows
#pragma endregion
#pragma region Inventory
- void InventoryTabDraw(RenderTarget& rt)
+ void InventoryTabDraw(Drawing::RenderTarget& rt)
{
if (widgetIsDisabled(*this, WIDX_TAB_6))
return;
@@ -1738,7 +1735,7 @@ namespace OpenRCT2::Ui::Windows
return std::make_pair(itemImage, ft);
}
- void onDrawInventory(RenderTarget& rt)
+ void onDrawInventory(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
OverviewTabDraw(rt);
@@ -1788,7 +1785,7 @@ namespace OpenRCT2::Ui::Windows
#pragma endregion
#pragma region Debug
- void DebugTabDraw(RenderTarget& rt)
+ void DebugTabDraw(Drawing::RenderTarget& rt)
{
if (widgetIsDisabled(*this, WIDX_TAB_7))
return;
@@ -1811,7 +1808,7 @@ namespace OpenRCT2::Ui::Windows
invalidate();
}
- void onDrawDebug(RenderTarget& rt)
+ void onDrawDebug(Drawing::RenderTarget& rt)
{
char buffer[512]{};
char buffer2[512]{};
diff --git a/src/openrct2-ui/windows/GuestList.cpp b/src/openrct2-ui/windows/GuestList.cpp
index 46879a4e35..0c5a4222b5 100644
--- a/src/openrct2-ui/windows/GuestList.cpp
+++ b/src/openrct2-ui/windows/GuestList.cpp
@@ -335,7 +335,7 @@ namespace OpenRCT2::Ui::Windows
auto* widget = &widgets[widgetIndex - 1];
WindowDropdownShowTextCustomWidth(
- { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0,
+ { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height(), colours[1], 0,
Dropdown::Flag::StayOpen, _numPages, widget->width() - 4);
for (size_t i = 0; i < _numPages; i++)
@@ -354,7 +354,7 @@ namespace OpenRCT2::Ui::Windows
auto* widget = &widgets[widgetIndex - 1];
WindowDropdownShowTextCustomWidth(
- { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0,
+ { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height(), colours[1], 0,
Dropdown::Flag::StayOpen, 2, widget->width() - 4);
gDropdown.items[static_cast(_selectedView)].setChecked(true);
@@ -427,7 +427,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -573,7 +573,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
+ void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
Rectangle::fill(
rt, { { rt.x, rt.y }, { rt.x + rt.width - 1, rt.y + rt.height - 1 } }, ColourMapA[colours[1].colour].mid_light);
@@ -626,7 +626,7 @@ namespace OpenRCT2::Ui::Windows
}
private:
- void DrawTabImages(RenderTarget& rt)
+ void DrawTabImages(Drawing::RenderTarget& rt)
{
// Tab 1 image
auto i = (_selectedTab == TabId::Individual ? _tabAnimationIndex & ~3 : 0);
@@ -643,7 +643,7 @@ namespace OpenRCT2::Ui::Windows
windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_2].left, widgets[WIDX_TAB_2].top });
}
- void DrawScrollIndividual(RenderTarget& rt)
+ void DrawScrollIndividual(Drawing::RenderTarget& rt)
{
size_t index = 0;
auto y = static_cast(_selectedPage) * -kGuestPageHeight;
@@ -710,7 +710,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void DrawScrollSummarised(RenderTarget& rt)
+ void DrawScrollSummarised(Drawing::RenderTarget& rt)
{
size_t index = 0;
auto y = 0;
diff --git a/src/openrct2-ui/windows/InstallTrack.cpp b/src/openrct2-ui/windows/InstallTrack.cpp
index 8ee75bf41a..57d43db79b 100644
--- a/src/openrct2-ui/windows/InstallTrack.cpp
+++ b/src/openrct2-ui/windows/InstallTrack.cpp
@@ -149,7 +149,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
@@ -163,7 +163,7 @@ namespace OpenRCT2::Ui::Windows
g1temp.offset = _trackDesignPreviewPixels.data() + (_currentTrackPieceDirection * kTrackPreviewImageSize);
g1temp.width = 370;
g1temp.height = 217;
- g1temp.flags = G1_FLAG_HAS_TRANSPARENCY;
+ g1temp.flags = { G1Flag::hasTransparency };
GfxSetG1Element(SPR_TEMP, &g1temp);
DrawingEngineInvalidateImage(SPR_TEMP);
GfxDrawSprite(rt, ImageId(SPR_TEMP), screenPos);
diff --git a/src/openrct2-ui/windows/Land.cpp b/src/openrct2-ui/windows/Land.cpp
index 0e2de599f5..27208711dc 100644
--- a/src/openrct2-ui/windows/Land.cpp
+++ b/src/openrct2-ui/windows/Land.cpp
@@ -32,6 +32,8 @@
#include
#include
+using OpenRCT2::GameActions::CommandFlag;
+
namespace OpenRCT2::Ui::Windows
{
static constexpr StringId kWindowTitle = STR_LAND;
@@ -51,6 +53,12 @@ namespace OpenRCT2::Ui::Windows
WIDX_WALL,
};
+ enum class SelectionMode
+ {
+ query,
+ apply,
+ };
+
// clang-format off
static constexpr auto window_land_widgets = makeWidgets(
makeWindowShim(kWindowTitle, kWindowSize),
@@ -251,7 +259,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gLandToolSize));
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
ScreenCoordsXY screenCoords;
int32_t numTiles;
@@ -331,7 +339,7 @@ namespace OpenRCT2::Ui::Windows
*
* rct2: 0x006644DD
*/
- money64 SelectionRaiseLand(uint8_t flag)
+ money64 SelectionRaiseLand(const SelectionMode mode)
{
int32_t centreX = (gMapSelectPositionA.x + gMapSelectPositionB.x) / 2;
int32_t centreY = (gMapSelectPositionA.y + gMapSelectPositionB.y) / 2;
@@ -346,25 +354,25 @@ namespace OpenRCT2::Ui::Windows
{ centreX, centreY },
{ gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y },
gMapSelectType, false);
- auto res = (flag & GAME_COMMAND_FLAG_APPLY) ? GameActions::Execute(&landSmoothAction, gameState)
- : GameActions::Query(&landSmoothAction, gameState);
- return res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined;
+ auto res = (mode == SelectionMode::apply) ? GameActions::Execute(&landSmoothAction, gameState)
+ : GameActions::Query(&landSmoothAction, gameState);
+ return res.error == GameActions::Status::ok ? res.cost : kMoney64Undefined;
}
auto landRaiseAction = GameActions::LandRaiseAction(
{ centreX, centreY },
{ gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, gMapSelectType);
- auto res = (flag & GAME_COMMAND_FLAG_APPLY) ? GameActions::Execute(&landRaiseAction, gameState)
- : GameActions::Query(&landRaiseAction, gameState);
+ auto res = (mode == SelectionMode::apply) ? GameActions::Execute(&landRaiseAction, gameState)
+ : GameActions::Query(&landRaiseAction, gameState);
- return res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined;
+ return res.error == GameActions::Status::ok ? res.cost : kMoney64Undefined;
}
/**
*
* rct2: 0x006645B3
*/
- money64 SelectionLowerLand(uint8_t flag)
+ money64 SelectionLowerLand(const SelectionMode mode)
{
int32_t centreX = (gMapSelectPositionA.x + gMapSelectPositionB.x) / 2;
int32_t centreY = (gMapSelectPositionA.y + gMapSelectPositionB.y) / 2;
@@ -379,18 +387,18 @@ namespace OpenRCT2::Ui::Windows
{ centreX, centreY },
{ gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y },
gMapSelectType, true);
- auto res = (flag & GAME_COMMAND_FLAG_APPLY) ? GameActions::Execute(&landSmoothAction, gameState)
- : GameActions::Query(&landSmoothAction, gameState);
- return res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined;
+ auto res = (mode == SelectionMode::apply) ? GameActions::Execute(&landSmoothAction, gameState)
+ : GameActions::Query(&landSmoothAction, gameState);
+ return res.error == GameActions::Status::ok ? res.cost : kMoney64Undefined;
}
auto landLowerAction = GameActions::LandLowerAction(
{ centreX, centreY },
{ gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, gMapSelectType);
- auto res = (flag & GAME_COMMAND_FLAG_APPLY) ? GameActions::Execute(&landLowerAction, gameState)
- : GameActions::Query(&landLowerAction, gameState);
+ auto res = (mode == SelectionMode::apply) ? GameActions::Execute(&landLowerAction, gameState)
+ : GameActions::Query(&landLowerAction, gameState);
- return res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined;
+ return res.error == GameActions::Status::ok ? res.cost : kMoney64Undefined;
}
/**
@@ -424,7 +432,7 @@ namespace OpenRCT2::Ui::Windows
{
gInputDragLast.y += tile_height;
- SelectionRaiseLand(GAME_COMMAND_FLAG_APPLY);
+ SelectionRaiseLand(SelectionMode::apply);
_landToolRaiseCost = kMoney64Undefined;
_landToolLowerCost = kMoney64Undefined;
@@ -433,7 +441,7 @@ namespace OpenRCT2::Ui::Windows
{
gInputDragLast.y -= tile_height;
- SelectionLowerLand(GAME_COMMAND_FLAG_APPLY);
+ SelectionLowerLand(SelectionMode::apply);
_landToolRaiseCost = kMoney64Undefined;
_landToolLowerCost = kMoney64Undefined;
@@ -444,7 +452,6 @@ namespace OpenRCT2::Ui::Windows
{
uint8_t state_changed = 0;
- MapInvalidateSelectionRect();
gMapSelectFlags.unset(MapSelectFlag::enable);
auto mapTile = ScreenGetMapXY(screenPos, nullptr);
@@ -454,7 +461,7 @@ namespace OpenRCT2::Ui::Windows
return state_changed;
}
- if (!(gMapSelectFlags.has(MapSelectFlag::enable)))
+ if (!gMapSelectFlags.has(MapSelectFlag::enable))
{
gMapSelectFlags.set(MapSelectFlag::enable);
state_changed++;
@@ -501,7 +508,6 @@ namespace OpenRCT2::Ui::Windows
state_changed++;
}
- MapInvalidateSelectionRect();
return state_changed;
}
@@ -582,7 +588,6 @@ namespace OpenRCT2::Ui::Windows
switch (widgetIndex)
{
case WIDX_BACKGROUND:
- MapInvalidateSelectionRect();
gMapSelectFlags.unset(MapSelectFlag::enable);
gCurrentToolId = Tool::digDown;
break;
@@ -609,15 +614,13 @@ namespace OpenRCT2::Ui::Windows
const bool mapCtrlPressed = GetInputManager().isModifierKeyPressed(ModifierKey::ctrl);
auto* windowMgr = Ui::GetWindowManager();
- MapInvalidateSelectionRect();
-
if (gCurrentToolId == Tool::upDownArrow)
{
- if (!(gMapSelectFlags.has(MapSelectFlag::enable)))
+ if (!gMapSelectFlags.has(MapSelectFlag::enable))
return;
- money64 lower_cost = SelectionLowerLand(0);
- money64 raise_cost = SelectionRaiseLand(0);
+ money64 lower_cost = SelectionLowerLand(SelectionMode::query);
+ money64 raise_cost = SelectionRaiseLand(SelectionMode::query);
if (_landToolRaiseCost != raise_cost || _landToolLowerCost != lower_cost)
{
@@ -657,7 +660,7 @@ namespace OpenRCT2::Ui::Windows
uint8_t state_changed = 0;
- if (!(gMapSelectFlags.has(MapSelectFlag::enable)))
+ if (!gMapSelectFlags.has(MapSelectFlag::enable))
{
gMapSelectFlags.set(MapSelectFlag::enable);
state_changed++;
@@ -700,12 +703,11 @@ namespace OpenRCT2::Ui::Windows
state_changed++;
}
- MapInvalidateSelectionRect();
if (!state_changed)
return;
- money64 lower_cost = SelectionLowerLand(0);
- money64 raise_cost = SelectionRaiseLand(0);
+ money64 lower_cost = SelectionLowerLand(SelectionMode::query);
+ money64 raise_cost = SelectionRaiseLand(SelectionMode::query);
if (_landToolRaiseCost != raise_cost || _landToolLowerCost != lower_cost)
{
@@ -735,7 +737,7 @@ namespace OpenRCT2::Ui::Windows
uint8_t state_changed = 0;
- if (!(gMapSelectFlags.has(MapSelectFlag::enable)))
+ if (!gMapSelectFlags.has(MapSelectFlag::enable))
{
gMapSelectFlags.set(MapSelectFlag::enable);
state_changed++;
@@ -827,12 +829,11 @@ namespace OpenRCT2::Ui::Windows
state_changed++;
}
- MapInvalidateSelectionRect();
if (!state_changed)
return;
- money64 lower_cost = SelectionLowerLand(0);
- money64 raise_cost = SelectionRaiseLand(0);
+ money64 lower_cost = SelectionLowerLand(SelectionMode::query);
+ money64 raise_cost = SelectionRaiseLand(SelectionMode::query);
if (_landToolRaiseCost != raise_cost || _landToolLowerCost != lower_cost)
{
@@ -842,7 +843,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void DrawDropdownButtons(RenderTarget& rt)
+ void DrawDropdownButtons(Drawing::RenderTarget& rt)
{
auto& objManager = GetContext()->GetObjectManager();
const auto* surfaceObj = objManager.GetLoadedObject(_selectedFloorTexture);
@@ -865,7 +866,7 @@ namespace OpenRCT2::Ui::Windows
DrawDropdownButton(rt, WIDX_WALL, edgeImage);
}
- void DrawDropdownButton(RenderTarget& rt, WidgetIndex widgetIndex, ImageId image)
+ void DrawDropdownButton(Drawing::RenderTarget& rt, WidgetIndex widgetIndex, ImageId image)
{
const auto& widget = widgets[widgetIndex];
GfxDrawSprite(rt, image, { windowPos.x + widget.left, windowPos.y + widget.top });
@@ -894,7 +895,7 @@ namespace OpenRCT2::Ui::Windows
ShowGridlines();
auto* toolWindow = ContextOpenWindow(WindowClass::land);
ToolSet(*toolWindow, WIDX_BACKGROUND, Tool::digDown);
- gInputFlags.set(InputFlag::unk6);
+ gInputFlags.set(InputFlag::allowRightMouseRemoval);
}
}
} // namespace OpenRCT2::Ui::Windows
diff --git a/src/openrct2-ui/windows/LandRights.cpp b/src/openrct2-ui/windows/LandRights.cpp
index cfbf37b184..871289e04b 100644
--- a/src/openrct2-ui/windows/LandRights.cpp
+++ b/src/openrct2-ui/windows/LandRights.cpp
@@ -109,7 +109,6 @@ namespace OpenRCT2::Ui::Windows
_landRightsMode = mode;
ToolSet(*this, widgetIndex, Tool::upArrow);
- gInputFlags.set(InputFlag::unk6);
if (kLandRightsVisibleByMode[EnumValue(mode)])
ShowLandRights();
@@ -393,7 +392,7 @@ namespace OpenRCT2::Ui::Windows
invalidate();
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
auto screenCoords = ScreenCoordsXY{ windowPos.x + widgets[WIDX_PREVIEW].midX(),
windowPos.y + widgets[WIDX_PREVIEW].midY() };
@@ -459,7 +458,6 @@ namespace OpenRCT2::Ui::Windows
void onToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override
{
- MapInvalidateSelectionRect();
gMapSelectFlags.unset(MapSelectFlag::enable);
auto info = GetMapCoordinatesFromPos(
@@ -479,7 +477,7 @@ namespace OpenRCT2::Ui::Windows
uint8_t state_changed = 0;
- if (!(gMapSelectFlags.has(MapSelectFlag::enable)))
+ if (!gMapSelectFlags.has(MapSelectFlag::enable))
{
gMapSelectFlags.set(MapSelectFlag::enable);
state_changed++;
@@ -529,7 +527,6 @@ namespace OpenRCT2::Ui::Windows
state_changed++;
}
- MapInvalidateSelectionRect();
if (!state_changed)
return;
@@ -538,13 +535,13 @@ namespace OpenRCT2::Ui::Windows
{
auto landSetRightsAction = GetLandSetAction();
auto res = GameActions::Query(&landSetRightsAction, gameState);
- _landRightsCost = res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined;
+ _landRightsCost = res.error == GameActions::Status::ok ? res.cost : kMoney64Undefined;
}
else
{
auto landBuyRightsAction = GetLandBuyAction();
auto res = GameActions::Query(&landBuyRightsAction, gameState);
- _landRightsCost = res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined;
+ _landRightsCost = res.error == GameActions::Status::ok ? res.cost : kMoney64Undefined;
}
}
diff --git a/src/openrct2-ui/windows/LoadSave.cpp b/src/openrct2-ui/windows/LoadSave.cpp
index 2e977c15d9..602fb40792 100644
--- a/src/openrct2-ui/windows/LoadSave.cpp
+++ b/src/openrct2-ui/windows/LoadSave.cpp
@@ -404,7 +404,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void DrawPreview(RenderTarget& rt)
+ void DrawPreview(Drawing::RenderTarget& rt)
{
// Find preview image to draw
PreviewImage* image = nullptr;
@@ -731,7 +731,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
@@ -919,7 +919,7 @@ namespace OpenRCT2::Ui::Windows
Widget* widget = &widgets[WIDX_SORT_CUSTOMISE];
WindowDropdownShowTextCustomWidth(
- { windowPos.x + widget->left - 70, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0,
+ { windowPos.x + widget->left - 70, windowPos.y + widget->top }, widget->height(), colours[1], 0,
Dropdown::Flag::StayOpen, 7, 90);
auto& config = Config::Get().general;
@@ -1077,7 +1077,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
+ void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
Rectangle::fill(
rt, { { rt.x, rt.y }, { rt.x + rt.width - 1, rt.y + rt.height - 1 } }, ColourMapA[colours[1].colour].mid_light);
diff --git a/src/openrct2-ui/windows/Main.cpp b/src/openrct2-ui/windows/Main.cpp
index a336ac81c0..420b7f4cd6 100644
--- a/src/openrct2-ui/windows/Main.cpp
+++ b/src/openrct2-ui/windows/Main.cpp
@@ -46,7 +46,7 @@ namespace OpenRCT2::Ui::Windows
WindowFootpathResetSelectedPath();
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
ViewportRender(rt, viewport);
}
diff --git a/src/openrct2-ui/windows/Map.cpp b/src/openrct2-ui/windows/Map.cpp
index 880f37b405..18e1fa87ae 100644
--- a/src/openrct2-ui/windows/Map.cpp
+++ b/src/openrct2-ui/windows/Map.cpp
@@ -449,7 +449,6 @@ namespace OpenRCT2::Ui::Windows
{
int32_t direction;
TileElement* tileElement;
- MapInvalidateSelectionRect();
gMapSelectFlags.unset(MapSelectFlag::enable, MapSelectFlag::enableArrow);
auto mapCoords = FootpathBridgeGetInfoFromPos(screenCoords, &direction, &tileElement);
if (mapCoords.IsNull())
@@ -470,7 +469,6 @@ namespace OpenRCT2::Ui::Windows
gMapSelectPositionB = mapCoords;
gMapSelectArrowPosition = CoordsXYZ{ mapCoords, mapZ };
gMapSelectArrowDirection = DirectionReverse(direction);
- MapInvalidateSelectionRect();
}
void SetPeepSpawnToolDown(const ScreenCoordsXY& screenCoords)
@@ -486,9 +484,9 @@ namespace OpenRCT2::Ui::Windows
auto gameAction = GameActions::PeepSpawnPlaceAction({ mapCoords, mapZ, static_cast(direction) });
auto result = GameActions::Execute(&gameAction, getGameState());
- if (result.Error == GameActions::Status::Ok)
+ if (result.error == GameActions::Status::ok)
{
- Audio::Play3D(Audio::SoundId::placeItem, result.Position);
+ Audio::Play3D(Audio::SoundId::placeItem, result.position);
}
}
@@ -535,7 +533,7 @@ namespace OpenRCT2::Ui::Windows
auto& mapArea = widgets[WIDX_MAP];
if (size.width >= mapArea.width() - 1)
size.width -= kScrollBarWidth;
- if (size.height >= mapArea.height())
+ if (size.height >= mapArea.height() - 1)
size.height -= kScrollBarWidth;
return size;
@@ -568,7 +566,7 @@ namespace OpenRCT2::Ui::Windows
onScrollMouseDown(scrollIndex, screenCoords);
}
- void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
+ void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
GfxClear(rt, PaletteIndex::pi10);
@@ -663,7 +661,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -739,7 +737,7 @@ namespace OpenRCT2::Ui::Windows
// calculate width and height of minimap
auto& widget = widgets[WIDX_MAP];
auto mapWidth = widget.width() - 1 - kScrollBarWidth - 1;
- auto mapHeight = widget.height() - kScrollBarWidth - 1;
+ auto mapHeight = widget.height() - 1 - kScrollBarWidth - 1;
centreX = std::max(centreX - (mapWidth >> 1), 0);
centreY = std::max(centreY - (mapHeight >> 1), 0);
@@ -949,7 +947,7 @@ namespace OpenRCT2::Ui::Windows
return colourB;
}
- void PaintPeepOverlay(RenderTarget& rt, const ScreenCoordsXY& offset)
+ void PaintPeepOverlay(Drawing::RenderTarget& rt, const ScreenCoordsXY& offset)
{
auto flashColour = GetGuestFlashColour();
for (auto guest : EntityList())
@@ -963,7 +961,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void DrawMapPeepPixel(Peep* peep, const uint8_t flashColour, RenderTarget& rt, const ScreenCoordsXY& offset)
+ void DrawMapPeepPixel(Peep* peep, const uint8_t flashColour, Drawing::RenderTarget& rt, const ScreenCoordsXY& offset)
{
if (peep->x == kLocationNull)
return;
@@ -1009,7 +1007,7 @@ namespace OpenRCT2::Ui::Windows
return colour;
}
- void PaintTrainOverlay(RenderTarget& rt, const ScreenCoordsXY& offset)
+ void PaintTrainOverlay(Drawing::RenderTarget& rt, const ScreenCoordsXY& offset)
{
for (auto train : TrainManager::View())
{
@@ -1031,7 +1029,7 @@ namespace OpenRCT2::Ui::Windows
* The call to Rectangle::fill was originally wrapped in Sub68DABD which made sure that arguments were ordered
* correctly, but it doesn't look like it's ever necessary here so the call was removed.
*/
- void PaintHudRectangle(RenderTarget& rt, const ScreenCoordsXY& widgetOffset)
+ void PaintHudRectangle(Drawing::RenderTarget& rt, const ScreenCoordsXY& widgetOffset)
{
WindowBase* mainWindow = WindowGetMain();
if (mainWindow == nullptr)
@@ -1069,7 +1067,7 @@ namespace OpenRCT2::Ui::Windows
Rectangle::fill(rt, { rightBottom - ScreenCoordsXY{ 0, 3 }, rightBottom }, PaletteIndex::pi56);
}
- void DrawTabImages(RenderTarget& rt)
+ void DrawTabImages(Drawing::RenderTarget& rt)
{
// Guest tab image (animated)
uint32_t guestTabImage = SPR_TAB_GUESTS_0;
diff --git a/src/openrct2-ui/windows/MapGen.cpp b/src/openrct2-ui/windows/MapGen.cpp
index 0b7e191817..38c448c01e 100644
--- a/src/openrct2-ui/windows/MapGen.cpp
+++ b/src/openrct2-ui/windows/MapGen.cpp
@@ -299,7 +299,7 @@ namespace OpenRCT2::Ui::Windows
pressedWidgets |= 1LL << (WIDX_TAB_1 + page);
}
- void DrawTabImage(RenderTarget& rt, int32_t newPage, int32_t spriteIndex)
+ void DrawTabImage(Drawing::RenderTarget& rt, int32_t newPage, int32_t spriteIndex)
{
WidgetIndex widgetIndex = WIDX_TAB_1 + newPage;
@@ -317,7 +317,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void DrawTabImages(RenderTarget& rt)
+ void DrawTabImages(Drawing::RenderTarget& rt)
{
DrawTabImage(rt, WINDOW_MAPGEN_PAGE_BASE, SPR_TAB_GEARS_0);
DrawTabImage(rt, WINDOW_MAPGEN_PAGE_TERRAIN, SPR_G2_MAP_GEN_TERRAIN_TAB);
@@ -461,7 +461,7 @@ namespace OpenRCT2::Ui::Windows
Widget* ddWidget = &widgets[widgetIndex - 1];
WindowDropdownShowTextCustomWidth(
- { windowPos.x + ddWidget->left, windowPos.y + ddWidget->top }, ddWidget->height() + 1, colours[1], 0,
+ { windowPos.x + ddWidget->left, windowPos.y + ddWidget->top }, ddWidget->height(), colours[1], 0,
Dropdown::Flag::StayOpen, std::size(items), ddWidget->width() - 3);
gDropdown.items[EnumValue(_settings.algorithm)].setChecked(true);
@@ -597,7 +597,7 @@ namespace OpenRCT2::Ui::Windows
// clang-format on
}
- void BaseDraw(RenderTarget& rt)
+ void BaseDraw(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -759,7 +759,7 @@ namespace OpenRCT2::Ui::Windows
setWidgetDisabled(WIDX_TREE_ALTITUDE_MAX_DOWN, !_settings.trees || isFlatland);
}
- void ForestsDraw(RenderTarget& rt)
+ void ForestsDraw(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -863,7 +863,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void SimplexDraw(RenderTarget& rt)
+ void SimplexDraw(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -973,7 +973,7 @@ namespace OpenRCT2::Ui::Windows
setCheckboxValue(WIDX_HEIGHTMAP_NORMALIZE, _settings.normalize_height);
}
- void HeightmapDraw(RenderTarget& rt)
+ void HeightmapDraw(Drawing::RenderTarget& rt)
{
const auto enabledColour = colours[1];
const auto disabledColour = enabledColour.withFlag(ColourFlag::inset, true);
@@ -1159,7 +1159,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void DrawDropdownButton(RenderTarget& rt, WidgetIndex widgetIndex, ImageId image)
+ void DrawDropdownButton(Drawing::RenderTarget& rt, WidgetIndex widgetIndex, ImageId image)
{
const auto& widget = widgets[widgetIndex];
ScreenCoordsXY pos = { windowPos.x + widget.left, windowPos.y + widget.top };
@@ -1181,7 +1181,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void DrawDropdownButtons(RenderTarget& rt, WidgetIndex floorWidgetIndex, WidgetIndex edgeWidgetIndex)
+ void DrawDropdownButtons(Drawing::RenderTarget& rt, WidgetIndex floorWidgetIndex, WidgetIndex edgeWidgetIndex)
{
auto& objManager = GetContext()->GetObjectManager();
const auto* surfaceObj = objManager.GetLoadedObject(_settings.landTexture);
@@ -1223,7 +1223,7 @@ namespace OpenRCT2::Ui::Windows
SetPressedTab();
}
- void TerrainDraw(RenderTarget& rt)
+ void TerrainDraw(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -1334,7 +1334,7 @@ namespace OpenRCT2::Ui::Windows
SetPressedTab();
}
- void WaterDraw(RenderTarget& rt)
+ void WaterDraw(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -1446,7 +1446,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
switch (page)
{
diff --git a/src/openrct2-ui/windows/MapTooltip.cpp b/src/openrct2-ui/windows/MapTooltip.cpp
index 2d43802b0c..e09dd26163 100644
--- a/src/openrct2-ui/windows/MapTooltip.cpp
+++ b/src/openrct2-ui/windows/MapTooltip.cpp
@@ -46,7 +46,7 @@ namespace OpenRCT2::Ui::Windows
invalidate();
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
StringId stringId;
std::memcpy(&stringId, _mapTooltipArgs.Data(), sizeof(StringId));
@@ -86,7 +86,7 @@ namespace OpenRCT2::Ui::Windows
// Check for cursor movement
_cursorHoldDuration++;
- if (abs(cursorChange.x) > 5 || abs(cursorChange.y) > 5 || (gInputFlags.has(InputFlag::rightMousePressed))
+ if (abs(cursorChange.x) > 5 || abs(cursorChange.y) > 5 || gInputFlags.has(InputFlag::rightMousePressed)
|| InputGetState() == InputState::ViewportRight)
_cursorHoldDuration = 0;
diff --git a/src/openrct2-ui/windows/MazeConstruction.cpp b/src/openrct2-ui/windows/MazeConstruction.cpp
index 4113495335..7ed86827a5 100644
--- a/src/openrct2-ui/windows/MazeConstruction.cpp
+++ b/src/openrct2-ui/windows/MazeConstruction.cpp
@@ -32,6 +32,10 @@
#include
#include
+using OpenRCT2::GameActions::CommandFlag;
+using OpenRCT2::GameActions::CommandFlags;
+using OpenRCT2::GameActions::MazeBuildMode;
+
namespace OpenRCT2::Ui::Windows
{
#pragma region Widgets
@@ -118,7 +122,6 @@ namespace OpenRCT2::Ui::Windows
RideConstructionInvalidateCurrentTrack();
ViewportSetVisibility(ViewportVisibility::standard);
- MapInvalidateMapSelectionTiles();
gMapSelectFlags.unset(MapSelectFlag::enableConstruct);
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
@@ -134,7 +137,7 @@ namespace OpenRCT2::Ui::Windows
if (currentRide->overallView.IsNull())
{
auto gameAction = GameActions::RideDemolishAction(currentRide->id, GameActions::RideModifyType::demolish);
- gameAction.SetFlags(GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED);
+ gameAction.SetFlags({ CommandFlag::allowDuringPaused });
GameActions::Execute(&gameAction, getGameState());
}
else
@@ -302,7 +305,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
}
@@ -317,7 +320,7 @@ namespace OpenRCT2::Ui::Windows
: ENTRANCE_TYPE_RIDE_EXIT;
gRideEntranceExitPlaceRideIndex = rideId;
gRideEntranceExitPlaceStationIndex = StationIndex::FromUnderlying(0);
- gInputFlags.set(InputFlag::unk6);
+ gInputFlags.set(InputFlag::allowRightMouseRemoval);
RideConstructionInvalidateCurrentTrack();
@@ -344,8 +347,6 @@ namespace OpenRCT2::Ui::Windows
{
RideConstructionInvalidateCurrentTrack();
- MapInvalidateSelectionRect();
-
gMapSelectFlags.unset(MapSelectFlag::enable);
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
@@ -364,10 +365,10 @@ namespace OpenRCT2::Ui::Windows
rideEntranceExitPlaceAction.SetCallback([=, this](
const GameActions::GameAction* ga, const GameActions::Result* result) {
- if (result->Error != GameActions::Status::Ok)
+ if (result->error != GameActions::Status::ok)
return;
- OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::placeItem, result->Position);
+ OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::placeItem, result->position);
auto* windowMgr = Ui::GetWindowManager();
@@ -399,7 +400,9 @@ namespace OpenRCT2::Ui::Windows
void WindowMazeConstructionConstruct(int32_t direction)
{
- int32_t x, y, z, actionFlags = 0, mode;
+ int32_t x, y, z;
+ MazeBuildMode mode;
+ CommandFlags actionFlags = {};
_currentTrackSelectionFlags.clearAll();
_rideConstructionNextArrowPulse = 0;
@@ -412,15 +415,15 @@ namespace OpenRCT2::Ui::Windows
switch (_rideConstructionState)
{
case RideConstructionState::MazeBuild:
- mode = GC_SET_MAZE_TRACK_BUILD;
+ mode = MazeBuildMode::build;
break;
case RideConstructionState::MazeMove:
- mode = GC_SET_MAZE_TRACK_MOVE;
- actionFlags = GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED;
+ mode = MazeBuildMode::move;
+ actionFlags = { CommandFlag::allowDuringPaused };
break;
default:
case RideConstructionState::MazeFill:
- mode = GC_SET_MAZE_TRACK_FILL;
+ mode = MazeBuildMode::fill;
break;
}
@@ -428,7 +431,7 @@ namespace OpenRCT2::Ui::Windows
auto action = GameActions::MazeSetTrackAction(loc, false, _currentRideIndex, mode);
action.SetFlags(actionFlags);
const auto res = GameActions::Execute(&action, getGameState());
- if (res.Error != GameActions::Status::Ok)
+ if (res.error != GameActions::Status::ok)
{
return;
}
diff --git a/src/openrct2-ui/windows/Multiplayer.cpp b/src/openrct2-ui/windows/Multiplayer.cpp
index 3e849012b2..e295792c09 100644
--- a/src/openrct2-ui/windows/Multiplayer.cpp
+++ b/src/openrct2-ui/windows/Multiplayer.cpp
@@ -166,8 +166,8 @@ namespace OpenRCT2::Ui::Windows
auto numItems = Network::GetNumGroups();
WindowDropdownShowTextCustomWidth(
- windowPos + ScreenCoordsXY{ dropdownWidget->left, dropdownWidget->top }, dropdownWidget->height() + 1,
- colours[1], 0, 0, numItems, widget->right - dropdownWidget->left);
+ windowPos + ScreenCoordsXY{ dropdownWidget->left, dropdownWidget->top }, dropdownWidget->height(), colours[1],
+ 0, 0, numItems, widget->right - dropdownWidget->left);
for (auto i = 0; i < Network::GetNumGroups(); i++)
{
@@ -183,7 +183,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void informationPaint(RenderTarget& rt)
+ void informationPaint(Drawing::RenderTarget& rt)
{
RenderTarget clippedDPI;
if (ClipDrawPixelInfo(clippedDPI, rt, windowPos, width, height))
@@ -236,7 +236,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void playersPaint(RenderTarget& rt)
+ void playersPaint(Drawing::RenderTarget& rt)
{
// Number of players
StringId stringId = numListItems == 1 ? STR_MULTIPLAYER_PLAYER_COUNT : STR_MULTIPLAYER_PLAYER_COUNT_PLURAL;
@@ -246,7 +246,7 @@ namespace OpenRCT2::Ui::Windows
DrawTextBasic(rt, screenCoords, stringId, ft, { colours[2] });
}
- void playersScrollPaint(int32_t scrollIndex, RenderTarget& rt) const
+ void playersScrollPaint(int32_t scrollIndex, Drawing::RenderTarget& rt) const
{
ScreenCoordsXY screenCoords;
screenCoords.y = 0;
@@ -346,7 +346,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void groupsPaint(RenderTarget& rt)
+ void groupsPaint(Drawing::RenderTarget& rt)
{
thread_local std::string _buffer;
@@ -389,7 +389,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void groupsScrollPaint(int32_t scrollIndex, RenderTarget& rt) const
+ void groupsScrollPaint(int32_t scrollIndex, Drawing::RenderTarget& rt) const
{
auto screenCoords = ScreenCoordsXY{ 0, 0 };
@@ -432,7 +432,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void drawTabImage(RenderTarget& rt, int32_t page_number, int32_t spriteIndex)
+ void drawTabImage(Drawing::RenderTarget& rt, int32_t page_number, int32_t spriteIndex)
{
WidgetIndex widgetIndex = WIDX_TAB1 + page_number;
@@ -454,7 +454,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void drawTabImages(RenderTarget& rt)
+ void drawTabImages(Drawing::RenderTarget& rt)
{
drawTabImage(rt, WINDOW_MULTIPLAYER_PAGE_INFORMATION, SPR_TAB_KIOSKS_AND_FACILITIES_0);
drawTabImage(rt, WINDOW_MULTIPLAYER_PAGE_PLAYERS, SPR_TAB_GUESTS_0);
@@ -704,7 +704,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
drawTabImages(rt);
@@ -900,7 +900,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
+ void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
switch (page)
{
diff --git a/src/openrct2-ui/windows/NetworkStatus.cpp b/src/openrct2-ui/windows/NetworkStatus.cpp
index 8201902086..f506bf78b1 100644
--- a/src/openrct2-ui/windows/NetworkStatus.cpp
+++ b/src/openrct2-ui/windows/NetworkStatus.cpp
@@ -86,7 +86,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
WindowDrawWidgets(*this, rt);
thread_local std::string _buffer;
diff --git a/src/openrct2-ui/windows/NewCampaign.cpp b/src/openrct2-ui/windows/NewCampaign.cpp
index 8d2c640487..418a966351 100644
--- a/src/openrct2-ui/windows/NewCampaign.cpp
+++ b/src/openrct2-ui/windows/NewCampaign.cpp
@@ -220,7 +220,7 @@ namespace OpenRCT2::Ui::Windows
WindowDropdownShowTextCustomWidth(
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top },
- dropdownWidget->height() + 1, colours[1], 0, Dropdown::Flag::StayOpen, numItems,
+ dropdownWidget->height(), colours[1], 0, Dropdown::Flag::StayOpen, numItems,
dropdownWidget->width() - 4);
}
}
@@ -240,9 +240,8 @@ namespace OpenRCT2::Ui::Windows
}
WindowDropdownShowTextCustomWidth(
- { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top },
- dropdownWidget->height() + 1, colours[1], 0, Dropdown::Flag::StayOpen, numItems,
- dropdownWidget->width() - 4);
+ { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(),
+ colours[1], 0, Dropdown::Flag::StayOpen, numItems, dropdownWidget->width() - 4);
}
break;
// In RCT2, the maximum was 6 weeks
@@ -269,7 +268,7 @@ namespace OpenRCT2::Ui::Windows
auto gameAction = GameActions::ParkMarketingAction(
Campaign.campaign_type, Campaign.RideId.ToUnderlying(), Campaign.no_weeks);
gameAction.SetCallback([](const GameActions::GameAction* ga, const GameActions::Result* result) {
- if (result->Error == GameActions::Status::Ok)
+ if (result->error == GameActions::Status::ok)
{
auto* windowMgr = Ui::GetWindowManager();
windowMgr->CloseByClass(WindowClass::newCampaign);
@@ -354,7 +353,7 @@ namespace OpenRCT2::Ui::Windows
widgetSetDisabled(*this, WIDX_START_BUTTON, true);
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
ScreenCoordsXY screenCoords{};
diff --git a/src/openrct2-ui/windows/NewRide.cpp b/src/openrct2-ui/windows/NewRide.cpp
index 60497bb4fa..0eb1ec678b 100644
--- a/src/openrct2-ui/windows/NewRide.cpp
+++ b/src/openrct2-ui/windows/NewRide.cpp
@@ -430,7 +430,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_GROUP_BY_TRACK_TYPE].left = width - 8 - localizedGroupByTrackTypeWidth;
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -488,7 +488,7 @@ namespace OpenRCT2::Ui::Windows
invalidate();
}
- void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
+ void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
if (_currentTab == RESEARCH_TAB)
{
@@ -941,7 +941,8 @@ namespace OpenRCT2::Ui::Windows
widgetScrollUpdateThumbs(*this, WIDX_RIDE_LIST);
}
- void DrawRideInformation(RenderTarget& rt, RideSelection item, const ScreenCoordsXY& screenPos, int32_t textWidth)
+ void DrawRideInformation(
+ Drawing::RenderTarget& rt, RideSelection item, const ScreenCoordsXY& screenPos, int32_t textWidth)
{
auto& objMgr = OpenRCT2::GetContext()->GetObjectManager();
const auto* rideObj = objMgr.GetLoadedObject(item.EntryIndex);
@@ -1027,7 +1028,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void DrawTabImage(RenderTarget& rt, NewRideTabId tab, int32_t spriteIndex)
+ void DrawTabImage(Drawing::RenderTarget& rt, NewRideTabId tab, int32_t spriteIndex)
{
WidgetIndex widgetIndex = WIDX_TAB_1 + static_cast(tab);
@@ -1045,7 +1046,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void DrawTabImages(RenderTarget& rt)
+ void DrawTabImages(Drawing::RenderTarget& rt)
{
DrawTabImage(rt, TRANSPORT_TAB, SPR_TAB_RIDES_TRANSPORT_0);
DrawTabImage(rt, GENTLE_TAB, SPR_TAB_RIDES_GENTLE_0);
diff --git a/src/openrct2-ui/windows/News.cpp b/src/openrct2-ui/windows/News.cpp
index 5bf08ec29c..30583cc988 100644
--- a/src/openrct2-ui/windows/News.cpp
+++ b/src/openrct2-ui/windows/News.cpp
@@ -128,7 +128,7 @@ namespace OpenRCT2::Ui::Windows
auto& widget = widgets[WIDX_SCROLL];
ScreenSize scrollSize = onScrollGetSize(0);
- scrolls[0].contentOffsetY = std::max(0, scrollSize.height - (widget.height() - 1));
+ scrolls[0].contentOffsetY = std::max(0, scrollSize.height - (widget.height() - 2));
widgetScrollUpdateThumbs(*this, WIDX_SCROLL);
}
@@ -178,7 +178,7 @@ namespace OpenRCT2::Ui::Windows
groupWidgetsToInsert.emplace_back(groupWidget);
lastGroup = def.group;
- y += groupWidget.height();
+ y += groupWidget.height() - 1;
}
// Create checkbox widgets
@@ -260,7 +260,7 @@ namespace OpenRCT2::Ui::Windows
setWidgetPressed(WIDX_TAB_OPTIONS, page == optionsTab);
}
- void DrawTabImages(RenderTarget& rt)
+ void DrawTabImages(Drawing::RenderTarget& rt)
{
if (!isWidgetDisabled(WIDX_TAB_NEWS))
{
@@ -308,7 +308,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -441,7 +441,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
+ void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
int32_t lineHeight = FontGetLineHeight(FontStyle::small);
int32_t itemHeight = CalculateNewsItemHeight();
@@ -450,7 +450,7 @@ namespace OpenRCT2::Ui::Windows
const auto backgroundPaletteIndex = ColourMapA[colours[3].colour].light;
// Fill the scrollbar gap if no scrollbar is visible
- const bool scrollbarVisible = scrolls[0].contentHeight > widgets[WIDX_SCROLL].height();
+ const bool scrollbarVisible = scrolls[0].contentHeight > widgets[WIDX_SCROLL].height() - 1;
const auto scrollbarFill = scrollbarVisible ? 0 : kScrollBarWidth;
for (const auto& newsItem : getGameState().newsItems.GetArchived())
diff --git a/src/openrct2-ui/windows/ObjectLoadError.cpp b/src/openrct2-ui/windows/ObjectLoadError.cpp
index dd6372b294..f533d8058c 100644
--- a/src/openrct2-ui/windows/ObjectLoadError.cpp
+++ b/src/openrct2-ui/windows/ObjectLoadError.cpp
@@ -492,7 +492,7 @@ namespace OpenRCT2::Ui::Windows
invalidateWidget(WIDX_SCROLL);
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
WindowDrawWidgets(*this, rt);
@@ -510,7 +510,7 @@ namespace OpenRCT2::Ui::Windows
DrawTextEllipsised(rt, screenPos + ScreenCoordsXY{ 0, 29 }, kWindowSize.width - 5, STR_BLACK_STRING, ft);
}
- void onScrollDraw(const int32_t scrollIndex, RenderTarget& rt) override
+ void onScrollDraw(const int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
auto rtCoords = ScreenCoordsXY{ rt.x, rt.y };
Rectangle::fill(
diff --git a/src/openrct2-ui/windows/Options.cpp b/src/openrct2-ui/windows/Options.cpp
index 607a5b0c99..e493b2dd17 100644
--- a/src/openrct2-ui/windows/Options.cpp
+++ b/src/openrct2-ui/windows/Options.cpp
@@ -31,6 +31,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -627,7 +628,7 @@ namespace OpenRCT2::Ui::Windows
CommonPrepareDrawAfter();
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -1018,7 +1019,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_FRAME_RATE_LIMIT].text = kFrameRateLimitStringIds[activeItem];
}
- void DisplayDraw(RenderTarget& rt)
+ void DisplayDraw(Drawing::RenderTarget& rt)
{
auto ft = Formatter();
ft.Add(static_cast(Config::Get().general.windowScale * 100));
@@ -1072,7 +1073,7 @@ namespace OpenRCT2::Ui::Windows
Config::Get().general.upperCaseBanners ^= 1;
Config::Save();
invalidate();
- ScrollingTextInvalidate();
+ Drawing::ScrollingText::invalidate();
break;
case WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX:
Config::Get().general.disableLightningEffect ^= 1;
@@ -1802,7 +1803,7 @@ namespace OpenRCT2::Ui::Windows
}
WindowDropdownShowTextCustomWidth(
- { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0,
+ { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height(), colours[1], 0,
Dropdown::Flag::StayOpen, numItems, widget->width() - 4);
gDropdown.items[static_cast(ThemeManagerGetAvailableThemeIndex())].setChecked(true);
@@ -1916,7 +1917,7 @@ namespace OpenRCT2::Ui::Windows
numItems++;
WindowDropdownShowText(
- { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1],
+ { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height(), colours[1],
Dropdown::Flag::StayOpen, numItems);
auto selectedIndex = Config::Get().interface.randomTitleSequence
@@ -1933,7 +1934,7 @@ namespace OpenRCT2::Ui::Windows
gDropdown.items[1] = Dropdown::MenuLabel(STR_SCENARIO_PREVIEWS_SCREENSHOTS);
WindowDropdownShowTextCustomWidth(
- { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0,
+ { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height(), colours[1], 0,
Dropdown::Flag::StayOpen, numItems, widget->width() - 4);
gDropdown.items[Config::Get().interface.scenarioPreviewScreenshots].setChecked(true);
@@ -1946,7 +1947,8 @@ namespace OpenRCT2::Ui::Windows
}
ShowDropdown(widget, 7);
- gDropdown.items[Config::Get().general.defaultInspectionInterval].setChecked(true);
+ auto selectedIndex = EnumValue(Config::Get().general.defaultInspectionInterval);
+ gDropdown.items[selectedIndex].setChecked(true);
break;
}
}
@@ -1974,9 +1976,9 @@ namespace OpenRCT2::Ui::Windows
break;
}
case WIDX_DEFAULT_INSPECTION_INTERVAL_DROPDOWN:
- if (dropdownIndex != Config::Get().general.defaultInspectionInterval)
+ if (dropdownIndex != EnumValue(Config::Get().general.defaultInspectionInterval))
{
- Config::Get().general.defaultInspectionInterval = static_cast(dropdownIndex);
+ Config::Get().general.defaultInspectionInterval = static_cast(dropdownIndex);
Config::Save();
invalidate();
}
@@ -2039,8 +2041,8 @@ namespace OpenRCT2::Ui::Windows
setCheckboxValue(WIDX_SCENARIO_UNLOCKING, Config::Get().general.scenarioUnlockingEnabled);
- widgets[WIDX_DEFAULT_INSPECTION_INTERVAL].text = kRideInspectionIntervalNames
- [Config::Get().general.defaultInspectionInterval];
+ auto selectedIndex = EnumValue(Config::Get().general.defaultInspectionInterval);
+ widgets[WIDX_DEFAULT_INSPECTION_INTERVAL].text = kRideInspectionIntervalNames[selectedIndex];
}
#pragma endregion
@@ -2223,7 +2225,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_ASSET_PACKS].bottom = widgets[WIDX_GROUP_ADVANCED].bottom - 6;
}
- void AdvancedDraw(RenderTarget& rt)
+ void AdvancedDraw(Drawing::RenderTarget& rt)
{
auto ft = Formatter();
ft.Add(static_cast(Config::Get().general.autosaveAmount));
@@ -2296,11 +2298,11 @@ namespace OpenRCT2::Ui::Windows
{
// helper function, all dropdown boxes have similar properties
WindowDropdownShowTextCustomWidth(
- { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0,
+ { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height(), colours[1], 0,
Dropdown::Flag::StayOpen, num_items, widget->width() - 4);
}
- void DrawTabImages(RenderTarget& rt)
+ void DrawTabImages(Drawing::RenderTarget& rt)
{
DrawTabImage(rt, WINDOW_OPTIONS_PAGE_DISPLAY, SPR_G2_MONITOR_TAB_START);
DrawTabImage(rt, WINDOW_OPTIONS_PAGE_RENDERING, SPR_G2_TAB_TREE);
@@ -2312,7 +2314,7 @@ namespace OpenRCT2::Ui::Windows
DrawTabImage(rt, WINDOW_OPTIONS_PAGE_ADVANCED, SPR_TAB_WRENCH_0);
}
- void DrawTabImage(RenderTarget& rt, int32_t p, int32_t spriteIndex)
+ void DrawTabImage(Drawing::RenderTarget& rt, int32_t p, int32_t spriteIndex)
{
WidgetIndex widgetIndex = WIDX_FIRST_TAB + p;
Widget* widget = &widgets[widgetIndex];
diff --git a/src/openrct2-ui/windows/OverwritePrompt.cpp b/src/openrct2-ui/windows/OverwritePrompt.cpp
index 30f41c9cec..28e1cde802 100644
--- a/src/openrct2-ui/windows/OverwritePrompt.cpp
+++ b/src/openrct2-ui/windows/OverwritePrompt.cpp
@@ -85,7 +85,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
diff --git a/src/openrct2-ui/windows/Park.cpp b/src/openrct2-ui/windows/Park.cpp
index eecb8c5e38..8de02560e0 100644
--- a/src/openrct2-ui/windows/Park.cpp
+++ b/src/openrct2-ui/windows/Park.cpp
@@ -357,7 +357,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
switch (page)
{
@@ -451,7 +451,7 @@ namespace OpenRCT2::Ui::Windows
gDropdown.items[0] = Dropdown::MenuLabel(STR_CLOSE_PARK);
gDropdown.items[1] = Dropdown::MenuLabel(STR_OPEN_PARK);
WindowDropdownShowText(
- { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, colours[1], 0, 2);
+ { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height(), colours[1], 0, 2);
if (Park::IsOpen(getGameState().park))
{
@@ -585,7 +585,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDrawEntrance(RenderTarget& rt)
+ void onDrawEntrance(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -646,7 +646,7 @@ namespace OpenRCT2::Ui::Windows
Widget* viewportWidget = &widgets[WIDX_VIEWPORT];
ViewportCreate(
*this, windowPos + ScreenCoordsXY{ viewportWidget->left + 1, viewportWidget->top + 1 },
- viewportWidget->width() - 2, viewportWidget->height() - 1, focus.value());
+ viewportWidget->width() - 2, viewportWidget->height() - 2, focus.value());
flags |= WindowFlag::noScrolling;
invalidate();
}
@@ -700,7 +700,7 @@ namespace OpenRCT2::Ui::Windows
kGraphNumYLabels, kParkRatingHistorySize);
}
- void onDrawRating(RenderTarget& rt)
+ void onDrawRating(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -781,7 +781,7 @@ namespace OpenRCT2::Ui::Windows
kGraphNumYLabels, kGuestsInParkHistorySize);
}
- void onDrawGuests(RenderTarget& rt)
+ void onDrawGuests(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -882,7 +882,7 @@ namespace OpenRCT2::Ui::Windows
WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_7);
}
- void onDrawPrice(RenderTarget& rt)
+ void onDrawPrice(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -942,7 +942,7 @@ namespace OpenRCT2::Ui::Windows
WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_7);
}
- void onDrawStats(RenderTarget& rt)
+ void onDrawStats(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -1068,7 +1068,7 @@ namespace OpenRCT2::Ui::Windows
WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_7);
}
- void onDrawObjective(RenderTarget& rt)
+ void onDrawObjective(Drawing::RenderTarget& rt)
{
auto& gameState = getGameState();
drawWidgets(rt);
@@ -1134,7 +1134,7 @@ namespace OpenRCT2::Ui::Windows
WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_7);
}
- void onDrawAwards(RenderTarget& rt)
+ void onDrawAwards(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -1208,7 +1208,7 @@ namespace OpenRCT2::Ui::Windows
pressedWidgets |= 1LL << (WIDX_TAB_1 + page);
}
- void DrawTabImages(RenderTarget& rt)
+ void DrawTabImages(Drawing::RenderTarget& rt)
{
// Entrance tab
if (!widgetIsDisabled(*this, WIDX_TAB_1))
diff --git a/src/openrct2-ui/windows/PatrolArea.cpp b/src/openrct2-ui/windows/PatrolArea.cpp
index dab5a095d4..231a032a0f 100644
--- a/src/openrct2-ui/windows/PatrolArea.cpp
+++ b/src/openrct2-ui/windows/PatrolArea.cpp
@@ -136,7 +136,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gLandToolSize));
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
@@ -159,7 +159,7 @@ namespace OpenRCT2::Ui::Windows
return;
auto stateChanged = false;
- if (!(gMapSelectFlags.has(MapSelectFlag::enable)))
+ if (!gMapSelectFlags.has(MapSelectFlag::enable))
stateChanged = true;
if (gMapSelectType != MapSelectType::full)
@@ -181,15 +181,10 @@ namespace OpenRCT2::Ui::Windows
if (stateChanged)
{
- // Invalidate previous area
- MapInvalidateSelectionRect();
-
- // Update and invalidate new area
gMapSelectFlags.set(MapSelectFlag::enable);
gMapSelectType = MapSelectType::full;
gMapSelectPositionA = posA;
gMapSelectPositionB = posB;
- MapInvalidateSelectionRect();
}
}
@@ -254,7 +249,6 @@ namespace OpenRCT2::Ui::Windows
if (!ToolSet(*this, 0, Tool::walkDown))
{
ShowGridlines();
- gInputFlags.set(InputFlag::unk6);
SetPatrolAreaToRender(_staffId);
GfxInvalidateScreen();
}
diff --git a/src/openrct2-ui/windows/Player.cpp b/src/openrct2-ui/windows/Player.cpp
index f450d6e0da..7bad97d828 100644
--- a/src/openrct2-ui/windows/Player.cpp
+++ b/src/openrct2-ui/windows/Player.cpp
@@ -151,7 +151,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
switch (page)
{
@@ -251,7 +251,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void DrawTabImages(RenderTarget& rt)
+ void DrawTabImages(Drawing::RenderTarget& rt)
{
Widget* widget;
@@ -404,7 +404,7 @@ namespace OpenRCT2::Ui::Windows
viewport->pos = windowPos + ScreenCoordsXY{ viewportWidget->left, viewportWidget->top };
viewport->width = viewportWidget->width() - 1;
- viewport->height = viewportWidget->height();
+ viewport->height = viewportWidget->height() - 1;
}
// only enable kick button for other players
@@ -415,7 +415,7 @@ namespace OpenRCT2::Ui::Windows
widgetSetEnabled(*this, WIDX_KICK, canKick && !isOwnWindow && !isServer);
}
- void onDrawOverview(RenderTarget& rt)
+ void onDrawOverview(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -533,7 +533,7 @@ namespace OpenRCT2::Ui::Windows
auto playerSetGroupAction = GameActions::PlayerSetGroupAction(playerId, groupId);
playerSetGroupAction.SetCallback(
[windowHandle](const GameActions::GameAction* ga, const GameActions::Result* result) {
- if (result->Error == GameActions::Status::Ok)
+ if (result->error == GameActions::Status::ok)
{
auto* windowMgr = Ui::GetWindowManager();
windowMgr->InvalidateByNumber(windowHandle.first, windowHandle.second);
@@ -557,8 +557,8 @@ namespace OpenRCT2::Ui::Windows
numItems = Network::GetNumGroups();
WindowDropdownShowTextCustomWidth(
- { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
- colours[1], 0, 0, numItems, widget->right - dropdownWidget->left);
+ { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(), colours[1],
+ 0, 0, numItems, widget->right - dropdownWidget->left);
for (i = 0; i < Network::GetNumGroups(); i++)
{
@@ -599,7 +599,7 @@ namespace OpenRCT2::Ui::Windows
WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_2);
}
- void onDrawStatistics(RenderTarget& rt)
+ void onDrawStatistics(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
DrawTabImages(rt);
diff --git a/src/openrct2-ui/windows/ProgressWindow.cpp b/src/openrct2-ui/windows/ProgressWindow.cpp
index 2dfbca8cd9..89a900ea0f 100644
--- a/src/openrct2-ui/windows/ProgressWindow.cpp
+++ b/src/openrct2-ui/windows/ProgressWindow.cpp
@@ -171,14 +171,14 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
WindowDrawWidgets(*this, rt);
auto& widget = widgets[WIDX_TITLE];
auto screenCoords = windowPos + ScreenCoordsXY{ widget.left, widget.bottom + 1 };
- RenderTarget clipDPI;
+ Drawing::RenderTarget clipDPI;
if (!ClipDrawPixelInfo(clipDPI, rt, screenCoords, width - 3, height - widget.bottom - 3))
return;
@@ -198,9 +198,14 @@ namespace OpenRCT2::Ui::Windows
int16_t vehicleWidth = (vehicle != nullptr) ? vehicle->width : 0;
int32_t position;
if (_totalCount > 0)
- position = (-vehicleWidth + 2) + width * _currentProgress / _totalCount;
+ {
+ const auto progress = static_cast(_currentProgress) / _totalCount;
+ position = static_cast((-vehicleWidth + 2) + width * progress);
+ }
else
+ {
position = (vehicleWidth + width) / 2;
+ }
GfxDrawSprite(clipDPI, variant.vehicle, ScreenCoordsXY(position, widget.bottom + 1));
}
@@ -208,9 +213,6 @@ namespace OpenRCT2::Ui::Windows
void setCaption(const std::string& text)
{
_progressTitle = text;
- _currentProgress = 0;
- _totalCount = 0;
-
invalidate();
}
diff --git a/src/openrct2-ui/windows/RefurbishRidePrompt.cpp b/src/openrct2-ui/windows/RefurbishRidePrompt.cpp
index 56f9eb7540..bbc269530e 100644
--- a/src/openrct2-ui/windows/RefurbishRidePrompt.cpp
+++ b/src/openrct2-ui/windows/RefurbishRidePrompt.cpp
@@ -72,7 +72,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
WindowDrawWidgets(*this, rt);
diff --git a/src/openrct2-ui/windows/Research.cpp b/src/openrct2-ui/windows/Research.cpp
index 8f7a8e8605..a9c1310e7d 100644
--- a/src/openrct2-ui/windows/Research.cpp
+++ b/src/openrct2-ui/windows/Research.cpp
@@ -246,7 +246,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -266,7 +266,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void DrawTabImage(RenderTarget& rt, int32_t tabPage, int32_t spriteIndex)
+ void DrawTabImage(Drawing::RenderTarget& rt, int32_t tabPage, int32_t spriteIndex)
{
WidgetIndex widgetIndex = WIDX_TAB_1 + tabPage;
@@ -286,7 +286,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void DrawTabImages(RenderTarget& rt)
+ void DrawTabImages(Drawing::RenderTarget& rt)
{
DrawTabImage(rt, WINDOW_RESEARCH_PAGE_DEVELOPMENT, SPR_TAB_FINANCES_RESEARCH_0);
DrawTabImage(rt, WINDOW_RESEARCH_PAGE_FUNDING, SPR_TAB_FINANCES_SUMMARY_0);
@@ -340,7 +340,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void WindowResearchDevelopmentDraw(WindowBase* w, RenderTarget& rt, WidgetIndex baseWidgetIndex)
+ void WindowResearchDevelopmentDraw(WindowBase* w, Drawing::RenderTarget& rt, WidgetIndex baseWidgetIndex)
{
const auto& gameState = getGameState();
@@ -482,7 +482,7 @@ namespace OpenRCT2::Ui::Windows
gDropdown.items[i] = Dropdown::MenuLabel(kResearchFundingLevelNames[i]);
}
WindowDropdownShowTextCustomWidth(
- { w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
+ { w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height(),
w->colours[1], 0, Dropdown::Flag::StayOpen, 4, dropdownWidget->width() - 4);
int32_t currentResearchLevel = gameState.researchFundingLevel;
@@ -573,7 +573,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void WindowResearchFundingDraw(WindowBase* w, RenderTarget& rt)
+ void WindowResearchFundingDraw(WindowBase* w, Drawing::RenderTarget& rt)
{
const auto& gameState = getGameState();
if (gameState.park.flags & PARK_FLAGS_NO_MONEY)
diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp
index 3794ef7865..e4fbfac15b 100644
--- a/src/openrct2-ui/windows/Ride.cpp
+++ b/src/openrct2-ui/windows/Ride.cpp
@@ -542,48 +542,48 @@ namespace OpenRCT2::Ui::Windows
static_assert(std::size(VehicleColourSchemeNames) == kNumVehicleColourSettings);
static constexpr std::array VehicleStatusNames = {
- STR_MOVING_TO_END_OF, // Vehicle::Status::MovingToEndOfStation
- STR_WAITING_FOR_PASSENGERS_AT, // Vehicle::Status::WaitingForPassengers
- STR_WAITING_TO_DEPART, // Vehicle::Status::WaitingToDepart
- STR_DEPARTING, // Vehicle::Status::Departing
- STR_TRAVELLING_AT_0, // Vehicle::Status::Travelling
- STR_ARRIVING_AT, // Vehicle::Status::Arriving
- STR_UNLOADING_PASSENGERS_AT, // Vehicle::Status::UnloadingPassengers
- STR_TRAVELLING_AT_1, // Vehicle::Status::TravellingBoat
- STR_CRASHING, // Vehicle::Status::Crashing
- STR_CRASHED_0, // Vehicle::Status::Crashed
- STR_TRAVELLING_AT_2, // Vehicle::Status::TravellingDodgems
- STR_SWINGING, // Vehicle::Status::Swinging
- STR_ROTATING_0, // Vehicle::Status::Rotating
- STR_ROTATING_1, // Vehicle::Status::FerrisWheelRotating
- STR_OPERATING_0, // Vehicle::Status::SimulatorOperating
- STR_SHOWING_FILM, // Vehicle::Status::ShowingFilm
- STR_ROTATING_2, // Vehicle::Status::SpaceRingsOperating
- STR_OPERATING_1, // Vehicle::Status::TopSpinOperating
- STR_OPERATING_2, // Vehicle::Status::HauntedHouseOperating
- STR_DOING_CIRCUS_SHOW, // Vehicle::Status::DoingCircusShow
- STR_OPERATING_3, // Vehicle::Status::CrookedHouseOperating
- STR_WAITING_FOR_CABLE_LIFT, // Vehicle::Status::WaitingForCableLift
- STR_TRAVELLING_AT_3, // Vehicle::Status::TravellingCableLift
- STR_STOPPING_0, // Vehicle::Status::Stopping
- STR_WAITING_FOR_PASSENGERS, // Vehicle::Status::WaitingForPassengers17
- STR_WAITING_TO_START, // Vehicle::Status::WaitingToStart
- STR_STARTING, // Vehicle::Status::Starting
- STR_OPERATING, // Vehicle::Status::Operating1A
- STR_STOPPING_1, // Vehicle::Status::Stopping1B
- STR_UNLOADING_PASSENGERS, // Vehicle::Status::UnloadingPassengers1C
- STR_STOPPED_BY_BLOCK_BRAKES, // Vehicle::Status::StoppedByBlockBrakes
+ STR_MOVING_TO_END_OF, // Vehicle::Status::movingToEndOfStation
+ STR_WAITING_FOR_PASSENGERS_AT, // Vehicle::Status::waitingForPassengers
+ STR_WAITING_TO_DEPART, // Vehicle::Status::waitingToDepart
+ STR_DEPARTING, // Vehicle::Status::departing
+ STR_TRAVELLING_AT_0, // Vehicle::Status::travelling
+ STR_ARRIVING_AT, // Vehicle::Status::arriving
+ STR_UNLOADING_PASSENGERS_AT, // Vehicle::Status::unloadingPassengers
+ STR_TRAVELLING_AT_1, // Vehicle::Status::travellingBoat
+ STR_CRASHING, // Vehicle::Status::crashing
+ STR_CRASHED_0, // Vehicle::Status::crashed
+ STR_TRAVELLING_AT_2, // Vehicle::Status::travellingDodgems
+ STR_SWINGING, // Vehicle::Status::swinging
+ STR_ROTATING_0, // Vehicle::Status::rotating
+ STR_ROTATING_1, // Vehicle::Status::ferrisWheelRotating
+ STR_OPERATING_0, // Vehicle::Status::simulatorOperating
+ STR_SHOWING_FILM, // Vehicle::Status::showingFilm
+ STR_ROTATING_2, // Vehicle::Status::spaceRingsOperating
+ STR_OPERATING_1, // Vehicle::Status::topSpinOperating
+ STR_OPERATING_2, // Vehicle::Status::hauntedHouseOperating
+ STR_DOING_CIRCUS_SHOW, // Vehicle::Status::doingCircusShow
+ STR_OPERATING_3, // Vehicle::Status::crookedHouseOperating
+ STR_WAITING_FOR_CABLE_LIFT, // Vehicle::Status::waitingForCableLift
+ STR_TRAVELLING_AT_3, // Vehicle::Status::travellingCableLift
+ STR_STOPPING_0, // Vehicle::Status::stopping
+ STR_WAITING_FOR_PASSENGERS, // Vehicle::Status::waitingForPassengers17
+ STR_WAITING_TO_START, // Vehicle::Status::waitingToStart
+ STR_STARTING, // Vehicle::Status::starting
+ STR_OPERATING, // Vehicle::Status::operating1A
+ STR_STOPPING_1, // Vehicle::Status::stopping1B
+ STR_UNLOADING_PASSENGERS, // Vehicle::Status::unloadingPassengers1C
+ STR_STOPPED_BY_BLOCK_BRAKES, // Vehicle::Status::stoppedByBlockBrakes
};
static_assert(std::size(VehicleStatusNames) == 31);
static constexpr std::array SingleSessionVehicleStatusNames = {
- STR_STOPPING_0, // Vehicle::Status::MovingToEndOfStation
- STR_WAITING_FOR_PASSENGERS, // Vehicle::Status::WaitingForPassengers
- STR_WAITING_TO_START, // Vehicle::Status::WaitingToDepart
- STR_STARTING, // Vehicle::Status::Departing
- STR_OPERATING, // Vehicle::Status::Travelling
- STR_STOPPING_1, // Vehicle::Status::Arriving
- STR_UNLOADING_PASSENGERS, // Vehicle::Status::UnloadingPassengers
+ STR_STOPPING_0, // Vehicle::Status::movingToEndOfStation
+ STR_WAITING_FOR_PASSENGERS, // Vehicle::Status::waitingForPassengers
+ STR_WAITING_TO_START, // Vehicle::Status::waitingToDepart
+ STR_STARTING, // Vehicle::Status::departing
+ STR_OPERATING, // Vehicle::Status::travelling
+ STR_STOPPING_1, // Vehicle::Status::arriving
+ STR_UNLOADING_PASSENGERS, // Vehicle::Status::unloadingPassengers
};
static_assert(std::size(SingleSessionVehicleStatusNames) == 7);
@@ -893,7 +893,7 @@ namespace OpenRCT2::Ui::Windows
break;
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
switch (page)
{
@@ -1072,7 +1072,7 @@ namespace OpenRCT2::Ui::Windows
break;
}
}
- void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
+ void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
switch (page)
{
@@ -1204,7 +1204,7 @@ namespace OpenRCT2::Ui::Windows
}
private:
- void drawTabImage(RenderTarget& rt, int32_t tab, int32_t spriteIndex)
+ void drawTabImage(Drawing::RenderTarget& rt, int32_t tab, int32_t spriteIndex)
{
WidgetIndex widgetIndex = WIDX_TAB_1 + tab;
@@ -1221,7 +1221,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void DrawTabMain(RenderTarget& rt)
+ void DrawTabMain(Drawing::RenderTarget& rt)
{
WidgetIndex widgetIndex = WIDX_TAB_1 + static_cast(WINDOW_RIDE_PAGE_MAIN);
if (!widgetIsDisabled(*this, widgetIndex))
@@ -1255,7 +1255,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void DrawTabVehicle(RenderTarget& rt)
+ void DrawTabVehicle(Drawing::RenderTarget& rt)
{
WidgetIndex widgetIndex = WIDX_TAB_1 + static_cast(WINDOW_RIDE_PAGE_VEHICLE);
const auto& widget = widgets[widgetIndex];
@@ -1318,7 +1318,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void DrawTabCustomer(RenderTarget& rt)
+ void DrawTabCustomer(Drawing::RenderTarget& rt)
{
WidgetIndex widgetIndex = WIDX_TAB_1 + static_cast(WINDOW_RIDE_PAGE_CUSTOMER);
@@ -1338,7 +1338,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void drawTabImages(RenderTarget& rt)
+ void drawTabImages(Drawing::RenderTarget& rt)
{
DrawTabVehicle(rt);
drawTabImage(rt, WINDOW_RIDE_PAGE_OPERATING, SPR_TAB_GEARS_0);
@@ -1584,7 +1584,7 @@ namespace OpenRCT2::Ui::Windows
auto screenPos = windowPos + ScreenCoordsXY{ viewWidget.left + 1, viewWidget.top + 1 };
int32_t viewWidth = viewWidget.width() - 2;
- int32_t viewHeight = viewWidget.height() - 1;
+ int32_t viewHeight = viewWidget.height() - 2;
ViewportCreate(*this, screenPos, viewWidth, viewHeight, focus.value());
@@ -1761,8 +1761,8 @@ namespace OpenRCT2::Ui::Windows
}
WindowDropdownShowTextCustomWidth(
- { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
- colours[1], 0, 0, numItems, widget->right - dropdownWidget->left);
+ { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(), colours[1],
+ 0, 0, numItems, widget->right - dropdownWidget->left);
// First item
gDropdown.items[0] = Dropdown::MenuLabel(STR_OVERALL_VIEW);
@@ -1868,7 +1868,7 @@ namespace OpenRCT2::Ui::Windows
SetDropdown(info, RideStatus::testing, STR_TEST_RIDE);
SetDropdown(info, RideStatus::open, STR_OPEN_RIDE);
WindowDropdownShowText(
- { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, info.NumItems);
+ { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height(), colours[1], 0, info.NumItems);
if (info.CheckedIndex != -1)
{
gDropdown.items[info.CheckedIndex].setChecked(true);
@@ -1927,8 +1927,8 @@ namespace OpenRCT2::Ui::Windows
Widget* dropdownWidget = widget - 1;
WindowDropdownShowText(
- { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
- colours[1], Dropdown::Flag::StayOpen, RIDE_TYPE_COUNT);
+ { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(), colours[1],
+ Dropdown::Flag::StayOpen, RIDE_TYPE_COUNT);
// Find the current ride type in the ordered list.
int32_t pos = 0;
@@ -1956,7 +1956,7 @@ namespace OpenRCT2::Ui::Windows
gDropdown.items[1] = Dropdown::PlainMenuLabel(STR_FOLLOW_SUBJECT_TIP);
WindowDropdownShowText(
- { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, 2);
+ { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height(), colours[1], 0, 2);
gDropdown.defaultIndex = 0;
if (!ride->getRideTypeDescriptor().HasFlag(RtdFlag::hasTrack) || _viewIndex == 0 || _viewIndex > ride->numTrains)
{
@@ -2074,8 +2074,8 @@ namespace OpenRCT2::Ui::Windows
Widget* dropdownWidget = widget - 1;
WindowDropdownShowTextCustomWidth(
- { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
- colours[1], 0, Dropdown::Flag::StayOpen, numItems, dropdownWidget->width() - 1);
+ { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(), colours[1],
+ 0, Dropdown::Flag::StayOpen, numItems, dropdownWidget->width() - 1);
// Find the current vehicle type in the ordered list.
int32_t pos = 0;
@@ -2135,8 +2135,8 @@ namespace OpenRCT2::Ui::Windows
}
WindowDropdownShowTextCustomWidth(
- { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
- colours[1], 0, Dropdown::Flag::StayOpen, _entranceDropdownData.size(),
+ { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(), colours[1],
+ 0, Dropdown::Flag::StayOpen, _entranceDropdownData.size(),
widgets[WIDX_ENTRANCE_STYLE_DROPDOWN].right - dropdownWidget->left);
}
@@ -2262,10 +2262,10 @@ namespace OpenRCT2::Ui::Windows
{
Vehicle* vehicle = getGameState().entities.GetEntity(ride->vehicles[_viewIndex - 1]);
if (vehicle == nullptr
- || (vehicle->status != Vehicle::Status::Travelling
- && vehicle->status != Vehicle::Status::TravellingCableLift
- && vehicle->status != Vehicle::Status::TravellingDodgems
- && vehicle->status != Vehicle::Status::TravellingBoat))
+ || (vehicle->status != Vehicle::Status::travelling
+ && vehicle->status != Vehicle::Status::travellingCableLift
+ && vehicle->status != Vehicle::Status::travellingDodgems
+ && vehicle->status != Vehicle::Status::travellingBoat))
{
return;
}
@@ -2459,13 +2459,13 @@ namespace OpenRCT2::Ui::Windows
return kStringIdEmpty;
auto& rtd = ride->getRideTypeDescriptor();
- if (vehicle->status != Vehicle::Status::Crashing && vehicle->status != Vehicle::Status::Crashed)
+ if (vehicle->status != Vehicle::Status::crashing && vehicle->status != Vehicle::Status::crashed)
{
auto trackType = vehicle->GetTrackType();
- if (trackType == TrackElemType::BlockBrakes || trackType == TrackElemType::CableLiftHill
- || trackType == TrackElemType::Up25ToFlat || trackType == TrackElemType::Up60ToFlat
- || trackType == TrackElemType::DiagUp25ToFlat || trackType == TrackElemType::DiagUp60ToFlat
- || trackType == TrackElemType::DiagBlockBrakes)
+ if (trackType == TrackElemType::blockBrakes || trackType == TrackElemType::cableLiftHill
+ || trackType == TrackElemType::up25ToFlat || trackType == TrackElemType::up60ToFlat
+ || trackType == TrackElemType::diagUp25ToFlat || trackType == TrackElemType::diagUp60ToFlat
+ || trackType == TrackElemType::diagBlockBrakes)
{
if (rtd.SupportsTrackGroup(TrackGroup::blockBrakes) && vehicle->velocity == 0)
{
@@ -2480,7 +2480,7 @@ namespace OpenRCT2::Ui::Windows
auto stringId = VehicleStatusNames[EnumValue(vehicle->status)];
if (ride->getRideTypeDescriptor().HasFlag(RtdFlag::singleSession)
- && vehicle->status <= Vehicle::Status::UnloadingPassengers)
+ && vehicle->status <= Vehicle::Status::unloadingPassengers)
{
stringId = SingleSessionVehicleStatusNames[EnumValue(vehicle->status)];
}
@@ -2558,7 +2558,7 @@ namespace OpenRCT2::Ui::Windows
return GetStatusStation(ft);
}
- void MainOnDraw(RenderTarget& rt)
+ void MainOnDraw(Drawing::RenderTarget& rt)
{
WindowDrawWidgets(*this, rt);
drawTabImages(rt);
@@ -2847,7 +2847,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void VehicleOnDraw(RenderTarget& rt)
+ void VehicleOnDraw(Drawing::RenderTarget& rt)
{
WindowDrawWidgets(*this, rt);
drawTabImages(rt);
@@ -2934,7 +2934,7 @@ namespace OpenRCT2::Ui::Windows
ImageId imageId;
};
- void VehicleOnScrollDraw(RenderTarget& rt, int32_t scrollIndex)
+ void VehicleOnScrollDraw(Drawing::RenderTarget& rt, int32_t scrollIndex)
{
auto ride = GetRide(rideId);
if (ride == nullptr)
@@ -2947,7 +2947,7 @@ namespace OpenRCT2::Ui::Windows
Widget* widget = &widgets[WIDX_VEHICLE_TRAINS_PREVIEW];
int32_t startX = std::max(2, (widget->width() - 1 - ((ride->numTrains - 1) * 36)) / 2 - 25);
- int32_t startY = widget->height() - 4;
+ int32_t startY = widget->height() - 5;
bool isReversed = ride->hasLifecycleFlag(RIDE_LIFECYCLE_REVERSED_TRAINS);
int32_t carIndex = (isReversed) ? ride->numCarsPerTrain - 1 : 0;
@@ -3107,8 +3107,8 @@ namespace OpenRCT2::Ui::Windows
}
WindowDropdownShowTextCustomWidth(
- { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
- colours[1], 0, Dropdown::Flag::StayOpen, numAvailableModes, widget->right - dropdownWidget->left);
+ { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(), colours[1],
+ 0, Dropdown::Flag::StayOpen, numAvailableModes, widget->right - dropdownWidget->left);
if (checkedIndex != -1)
{
@@ -3128,8 +3128,8 @@ namespace OpenRCT2::Ui::Windows
gDropdown.items[i] = Dropdown::MenuLabel(VehicleLoadNames[i]);
}
WindowDropdownShowTextCustomWidth(
- { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
- colours[1], 0, Dropdown::Flag::StayOpen, 5, widget->right - dropdownWidget->left);
+ { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(), colours[1],
+ 0, Dropdown::Flag::StayOpen, 5, widget->right - dropdownWidget->left);
gDropdown.items[ride->departFlags & RIDE_DEPART_WAIT_FOR_LOAD_MASK].setChecked(true);
}
@@ -3670,7 +3670,7 @@ namespace OpenRCT2::Ui::Windows
WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10);
}
- void OperatingOnDraw(RenderTarget& rt)
+ void OperatingOnDraw(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
drawTabImages(rt);
@@ -3782,10 +3782,10 @@ namespace OpenRCT2::Ui::Windows
gDropdown.items[i] = Dropdown::MenuLabel(kRideInspectionIntervalNames[i]);
}
WindowDropdownShowTextCustomWidth(
- { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
+ { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(),
colours[1], 0, Dropdown::Flag::StayOpen, 7, widgets[widgetIndex].right - dropdownWidget->left);
- gDropdown.items[ride->inspectionInterval].setChecked(true);
+ gDropdown.items[EnumValue(ride->inspectionInterval)].setChecked(true);
break;
case WIDX_FORCE_BREAKDOWN:
@@ -3817,8 +3817,8 @@ namespace OpenRCT2::Ui::Windows
else
{
WindowDropdownShowText(
- { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top },
- dropdownWidget->height() + 1, colours[1], Dropdown::Flag::StayOpen, numItems);
+ { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(),
+ colours[1], Dropdown::Flag::StayOpen, numItems);
numItems = 1;
int32_t breakdownReason = ride->breakdownReasonPending;
@@ -3889,7 +3889,7 @@ namespace OpenRCT2::Ui::Windows
vehicle = getGameState().entities.GetEntity(vehicle->next_vehicle_on_train))
{
vehicle->ClearFlag(
- VehicleFlags::CarIsBroken | VehicleFlags::StoppedOnLift
+ VehicleFlags::CarIsBroken | VehicleFlags::StoppedBySafetyCutOut
| VehicleFlags::TrainIsBroken);
}
}
@@ -3984,7 +3984,7 @@ namespace OpenRCT2::Ui::Windows
auto ft = Formatter::Common();
ride->formatNameTo(ft);
- widgets[WIDX_INSPECTION_INTERVAL].text = kRideInspectionIntervalNames[ride->inspectionInterval];
+ widgets[WIDX_INSPECTION_INTERVAL].text = kRideInspectionIntervalNames[EnumValue(ride->inspectionInterval)];
WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10);
@@ -4010,7 +4010,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void MaintenanceOnDraw(RenderTarget& rt)
+ void MaintenanceOnDraw(Drawing::RenderTarget& rt)
{
auto ride = GetRide(rideId);
if (ride == nullptr)
@@ -4079,7 +4079,7 @@ namespace OpenRCT2::Ui::Windows
{
switch (ride->mechanicStatus)
{
- case RIDE_MECHANIC_STATUS_CALLING:
+ case MechanicStatus::calling:
{
stringId = STR_NO_MECHANICS_ARE_HIRED_MESSAGE;
@@ -4093,11 +4093,11 @@ namespace OpenRCT2::Ui::Windows
}
break;
}
- case RIDE_MECHANIC_STATUS_HEADING:
+ case MechanicStatus::heading:
stringId = STR_MECHANIC_IS_HEADING_FOR_THE_RIDE;
break;
- case RIDE_MECHANIC_STATUS_FIXING:
- case RIDE_MECHANIC_STATUS_HAS_FIXED_STATION_BRAKES:
+ case MechanicStatus::fixing:
+ case MechanicStatus::hasFixedStationBrakes:
stringId = STR_MECHANIC_IS_FIXING_THE_RIDE;
break;
default:
@@ -4315,7 +4315,7 @@ namespace OpenRCT2::Ui::Windows
}
WindowDropdownShowTextCustomWidth(
- { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
+ { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(),
colours[1], 0, Dropdown::Flag::StayOpen, 4, widgets[widgetIndex].right - dropdownWidget->left);
gDropdown.items[colourSchemeIndex].setChecked(true);
@@ -4341,7 +4341,7 @@ namespace OpenRCT2::Ui::Windows
}
WindowDropdownShowTextCustomWidth(
- { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
+ { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(),
colours[1], 0, Dropdown::Flag::StayOpen, 4, widgets[widgetIndex].right - dropdownWidget->left);
gDropdown.items[ride->trackColours[colourSchemeIndex].supports].setChecked(true);
@@ -4368,7 +4368,7 @@ namespace OpenRCT2::Ui::Windows
}
WindowDropdownShowTextCustomWidth(
- { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
+ { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(),
colours[1], 0, Dropdown::Flag::StayOpen, numDropdownItems,
widgets[widgetIndex].right - dropdownWidget->left);
@@ -4407,7 +4407,7 @@ namespace OpenRCT2::Ui::Windows
}
WindowDropdownShowTextCustomWidth(
- { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
+ { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(),
colours[1], 0, Dropdown::Flag::StayOpen, dropdownIndex,
widgets[widgetIndex].right - dropdownWidget->left);
@@ -4483,7 +4483,7 @@ namespace OpenRCT2::Ui::Windows
rideId, GameActions::RideSetAppearanceType::EntranceStyle, objIndex, 0);
rideSetAppearanceAction.SetCallback(
[objIndex](const GameActions::GameAction*, const GameActions::Result* res) {
- if (res->Error != GameActions::Status::Ok)
+ if (res->error != GameActions::Status::ok)
return;
getGameState().lastEntranceStyle = objIndex;
});
@@ -4496,7 +4496,7 @@ namespace OpenRCT2::Ui::Windows
rideId, GameActions::RideSetAppearanceType::VehicleColourScheme, dropdownIndex, 0);
rideSetAppearanceAction.SetCallback(
[this](const GameActions::GameAction* ga, const GameActions::Result* result) {
- if (result->Error == GameActions::Status::Ok)
+ if (result->error == GameActions::Status::ok)
{
resetVehicleIndex();
}
@@ -4799,7 +4799,7 @@ namespace OpenRCT2::Ui::Windows
WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10);
}
- void ColourOnDraw(RenderTarget& rt)
+ void ColourOnDraw(Drawing::RenderTarget& rt)
{
// TODO: This should use lists and identified sprites
RenderTarget clippedDpi;
@@ -4879,7 +4879,7 @@ namespace OpenRCT2::Ui::Windows
if (ClipDrawPixelInfo(
clippedDpi, rt,
windowPos + ScreenCoordsXY{ entrancePreviewWidget.left + 1, entrancePreviewWidget.top + 1 },
- entrancePreviewWidget.width() - 1, entrancePreviewWidget.height()))
+ entrancePreviewWidget.width() - 1, entrancePreviewWidget.height() - 1))
{
GfxClear(clippedDpi, PaletteIndex::pi12);
@@ -4908,7 +4908,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void ColourOnScrollDraw(RenderTarget& rt, int32_t scrollIndex) const
+ void ColourOnScrollDraw(Drawing::RenderTarget& rt, int32_t scrollIndex) const
{
auto ride = GetRide(rideId);
if (ride == nullptr)
@@ -4925,7 +4925,7 @@ namespace OpenRCT2::Ui::Windows
Rectangle::fill(rt, { { rt.x, rt.y }, { rt.x + rt.width - 1, rt.y + rt.height - 1 } }, PaletteIndex::pi12);
// ?
- auto screenCoords = ScreenCoordsXY{ vehiclePreviewWidget->width() / 2, vehiclePreviewWidget->height() - 15 };
+ auto screenCoords = ScreenCoordsXY{ vehiclePreviewWidget->width() / 2, vehiclePreviewWidget->height() - 16 };
// ?
auto trainCarIndex = ride->vehicleColourSettings == VehicleColourSettings::perCar ? _vehicleIndex
@@ -5077,8 +5077,8 @@ namespace OpenRCT2::Ui::Windows
}
WindowDropdownShowTextCustomWidth(
- { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
- colours[1], 0, Dropdown::Flag::StayOpen, numItems, widgets[widgetIndex].right - dropdownWidget->left);
+ { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(), colours[1],
+ 0, Dropdown::Flag::StayOpen, numItems, widgets[widgetIndex].right - dropdownWidget->left);
// Set currently checked item
for (size_t i = 0; i < numItems; i++)
@@ -5125,7 +5125,7 @@ namespace OpenRCT2::Ui::Windows
// Figure out minimum size
ScreenSize size{};
- size.height = widgets[WIDX_MUSIC_DATA].height() - 2;
+ size.height = widgets[WIDX_MUSIC_DATA].height() - 3;
size.width = widgets[WIDX_MUSIC_DATA].width() - 3;
auto ride = GetRide(rideId);
@@ -5215,7 +5215,7 @@ namespace OpenRCT2::Ui::Windows
WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10);
}
- void MusicOnDraw(RenderTarget& rt)
+ void MusicOnDraw(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
drawTabImages(rt);
@@ -5241,7 +5241,7 @@ namespace OpenRCT2::Ui::Windows
// Figure out where the image should go
const auto& previewWidget = widgets[WIDX_MUSIC_IMAGE];
int32_t clipWidth = previewWidget.width() - 2;
- int32_t clipHeight = previewWidget.height() - 1;
+ int32_t clipHeight = previewWidget.height() - 2;
// Draw the preview image
RenderTarget clipDPI;
@@ -5252,7 +5252,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void MusicOnScrollDraw(RenderTarget& rt, int32_t scrollIndex)
+ void MusicOnScrollDraw(Drawing::RenderTarget& rt, int32_t scrollIndex)
{
auto ride = GetRide(rideId);
if (ride == nullptr)
@@ -5459,7 +5459,7 @@ namespace OpenRCT2::Ui::Windows
WindowDropdownShowText(
{ windowPos.x + widgets[widgetIndex].left, windowPos.y + widgets[widgetIndex].top },
- widgets[widgetIndex].height() + 1, colours[1], Dropdown::Flag::StayOpen, 2);
+ widgets[widgetIndex].height(), colours[1], Dropdown::Flag::StayOpen, 2);
gDropdown.defaultIndex = 0;
if (!ride->getRideTypeDescriptor().HasFlag(RtdFlag::hasTrack))
{
@@ -5594,7 +5594,7 @@ namespace OpenRCT2::Ui::Windows
WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10);
}
- void MeasurementsOnDraw(RenderTarget& rt)
+ void MeasurementsOnDraw(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
drawTabImages(rt);
@@ -6038,13 +6038,13 @@ namespace OpenRCT2::Ui::Windows
WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10);
}
- void GraphsOnDraw(RenderTarget& rt)
+ void GraphsOnDraw(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
drawTabImages(rt);
}
- void GraphsOnScrollDraw(RenderTarget& rt, int32_t scrollIndex)
+ void GraphsOnScrollDraw(Drawing::RenderTarget& rt, int32_t scrollIndex)
{
GfxClear(rt, ColourMapA[COLOUR_SATURATED_GREEN].darker);
@@ -6060,7 +6060,7 @@ namespace OpenRCT2::Ui::Windows
if (measurement == nullptr)
{
// No measurement message
- ScreenCoordsXY stringCoords(widget->width() / 2, widget->height() / 2 - 5);
+ ScreenCoordsXY stringCoords(widget->width() / 2, widget->height() - 1 / 2 - 5);
int32_t txtWidth = widget->width() - 3;
DrawTextWrapped(rt, stringCoords, txtWidth, message.str, message.args, { TextAlignment::centre });
return;
@@ -6099,7 +6099,7 @@ namespace OpenRCT2::Ui::Windows
yUnit -= kMapBaseZ * 3;
}
- for (int32_t y = widget->height() - 13; y >= 8; y -= yInterval, yUnit += yUnitInterval)
+ for (int32_t y = widget->height() - 14; y >= 8; y -= yInterval, yUnit += yUnitInterval)
{
// Minor / major line
int32_t colour = yUnit == 0 ? lightColour : darkColour;
@@ -6170,8 +6170,8 @@ namespace OpenRCT2::Ui::Windows
}
// Adjust line to match graph widget position.
- firstPoint = widget->height() - firstPoint - 13;
- secondPoint = widget->height() - secondPoint - 13;
+ firstPoint = widget->height() - firstPoint - 14;
+ secondPoint = widget->height() - secondPoint - 14;
if (firstPoint > secondPoint)
{
std::swap(firstPoint, secondPoint);
@@ -6180,8 +6180,8 @@ namespace OpenRCT2::Ui::Windows
// Adjust threshold line position as well
if (listType == GRAPH_VERTICAL || listType == GRAPH_LATERAL)
{
- intensityThresholdPositive = widget->height() - intensityThresholdPositive - 13;
- intensityThresholdNegative = widget->height() - intensityThresholdNegative - 13;
+ intensityThresholdPositive = widget->height() - intensityThresholdPositive - 14;
+ intensityThresholdNegative = widget->height() - intensityThresholdNegative - 14;
}
const bool previousMeasurement = x > measurement->current_item;
@@ -6599,7 +6599,7 @@ namespace OpenRCT2::Ui::Windows
WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10);
}
- void IncomeOnDraw(RenderTarget& rt)
+ void IncomeOnDraw(Drawing::RenderTarget& rt)
{
StringId stringId;
money64 profit;
@@ -6798,7 +6798,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void CustomerOnDraw(RenderTarget& rt)
+ void CustomerOnDraw(Drawing::RenderTarget& rt)
{
ShopItem shopItem;
int16_t popularity, satisfaction, queueTime;
@@ -7033,7 +7033,7 @@ namespace OpenRCT2::Ui::Windows
auto trackElement = tileElement->AsTrack();
auto trackType = trackElement->GetTrackType();
const auto& ted = GetTrackElementDescriptor(trackType);
- if (ted.sequences[0].flags & TRACK_SEQUENCE_FLAG_ORIGIN)
+ if (ted.sequences[0].flags.has(SequenceFlag::trackOrigin))
{
auto stationIndex = trackElement->GetStationIndex();
return WindowRideOpenStation(*ride, stationIndex);
diff --git a/src/openrct2-ui/windows/RideConstruction.cpp b/src/openrct2-ui/windows/RideConstruction.cpp
index 99bf94f422..5fcdae1048 100644
--- a/src/openrct2-ui/windows/RideConstruction.cpp
+++ b/src/openrct2-ui/windows/RideConstruction.cpp
@@ -65,6 +65,9 @@ constexpr uint8_t kVerticalDropButtonStart = 6;
using namespace OpenRCT2::Numerics;
using namespace OpenRCT2::TrackMetaData;
+using OpenRCT2::GameActions::CommandFlag;
+using OpenRCT2::GameActions::CommandFlags;
+using OpenRCT2::GameActions::MazeBuildMode;
namespace OpenRCT2::Ui::Windows
{
@@ -259,16 +262,16 @@ namespace OpenRCT2::Ui::Windows
_currentSeatRotationAngle = 4;
_currentlySelectedTrack = currentRide->getRideTypeDescriptor().StartTrackPiece;
- _currentTrackPitchEnd = TrackPitch::None;
- _currentTrackRollEnd = TrackRoll::None;
+ _currentTrackPitchEnd = TrackPitch::none;
+ _currentTrackRollEnd = TrackRoll::none;
_currentTrackHasLiftHill = false;
_currentTrackAlternative.clearAll();
if (currentRide->getRideTypeDescriptor().HasFlag(RtdFlag::startConstructionInverted))
_currentTrackAlternative.set(AlternativeTrackFlag::inverted);
- _previousTrackRollEnd = TrackRoll::None;
- _previousTrackPitchEnd = TrackPitch::None;
+ _previousTrackRollEnd = TrackRoll::none;
+ _previousTrackPitchEnd = TrackPitch::none;
_currentTrackPieceDirection = 0;
_rideConstructionState = RideConstructionState::Place;
@@ -286,7 +289,6 @@ namespace OpenRCT2::Ui::Windows
RideConstructionInvalidateCurrentTrack();
ViewportSetVisibility(ViewportVisibility::standard);
- MapInvalidateMapSelectionTiles();
gMapSelectFlags.unset(MapSelectFlag::enableConstruct);
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
@@ -324,7 +326,6 @@ namespace OpenRCT2::Ui::Windows
}
}
- currentRide->setToDefaultInspectionInterval();
auto intent = Intent(WindowClass::ride);
intent.PutExtra(INTENT_EXTRA_RIDE_ID, currentRide->id.ToUnderlying());
ContextOpenIntent(&intent);
@@ -332,7 +333,7 @@ namespace OpenRCT2::Ui::Windows
else
{
auto gameAction = GameActions::RideDemolishAction(currentRide->id, GameActions::RideModifyType::demolish);
- gameAction.SetFlags(GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED);
+ gameAction.SetFlags({ CommandFlag::allowDuringPaused });
GameActions::Execute(&gameAction, gameState);
}
}
@@ -365,11 +366,11 @@ namespace OpenRCT2::Ui::Windows
}
// Disable large curves if the start or end of the track is sloped and large sloped curves are not available
- if ((_previousTrackPitchEnd != TrackPitch::None || _currentTrackPitchEnd != TrackPitch::None))
+ if ((_previousTrackPitchEnd != TrackPitch::none || _currentTrackPitchEnd != TrackPitch::none))
{
if (!IsTrackEnabled(TrackGroup::slopeCurveLarge)
- || !(_previousTrackPitchEnd == TrackPitch::Up25 || _previousTrackPitchEnd == TrackPitch::Down25)
- || !(_currentTrackPitchEnd == TrackPitch::Up25 || _currentTrackPitchEnd == TrackPitch::Down25))
+ || !(_previousTrackPitchEnd == TrackPitch::up25 || _previousTrackPitchEnd == TrackPitch::down25)
+ || !(_currentTrackPitchEnd == TrackPitch::up25 || _currentTrackPitchEnd == TrackPitch::down25))
{
newDisabledWidgets |= (1uLL << WIDX_LEFT_CURVE_LARGE) | (1uLL << WIDX_RIGHT_CURVE_LARGE);
}
@@ -377,7 +378,7 @@ namespace OpenRCT2::Ui::Windows
if (IsTrackEnabled(TrackGroup::slopeCurve) && IsTrackEnabled(TrackGroup::curveVerySmall))
{
// Disable small curves if the start or end of the track is sloped.
- if (_previousTrackPitchEnd != TrackPitch::None || _currentTrackPitchEnd != TrackPitch::None)
+ if (_previousTrackPitchEnd != TrackPitch::none || _currentTrackPitchEnd != TrackPitch::none)
{
newDisabledWidgets |= (1uLL << WIDX_LEFT_CURVE_VERY_SMALL) | (1uLL << WIDX_RIGHT_CURVE_VERY_SMALL);
}
@@ -387,9 +388,9 @@ namespace OpenRCT2::Ui::Windows
if (IsTrackEnabled(TrackGroup::curveVertical))
{
// Disable all curves only on vertical track
- if (_previousTrackPitchEnd != TrackPitch::Up90 || _currentTrackPitchEnd != TrackPitch::Up90)
+ if (_previousTrackPitchEnd != TrackPitch::up90 || _currentTrackPitchEnd != TrackPitch::up90)
{
- if (_previousTrackPitchEnd != TrackPitch::Down90 || _currentTrackPitchEnd != TrackPitch::Down90)
+ if (_previousTrackPitchEnd != TrackPitch::down90 || _currentTrackPitchEnd != TrackPitch::down90)
{
newDisabledWidgets |= (1uLL << WIDX_LEFT_CURVE_VERY_SMALL) | (1uLL << WIDX_LEFT_CURVE_SMALL)
| (1uLL << WIDX_LEFT_CURVE) | (1uLL << WIDX_RIGHT_CURVE) | (1uLL << WIDX_RIGHT_CURVE_SMALL)
@@ -400,7 +401,7 @@ namespace OpenRCT2::Ui::Windows
else
{
// Disable all curves on sloped track
- if (_previousTrackPitchEnd != TrackPitch::None || _currentTrackPitchEnd != TrackPitch::None)
+ if (_previousTrackPitchEnd != TrackPitch::none || _currentTrackPitchEnd != TrackPitch::none)
{
newDisabledWidgets |= (1uLL << WIDX_LEFT_CURVE_VERY_SMALL) | (1uLL << WIDX_LEFT_CURVE_SMALL)
| (1uLL << WIDX_LEFT_CURVE) | (1uLL << WIDX_RIGHT_CURVE) | (1uLL << WIDX_RIGHT_CURVE_SMALL)
@@ -415,8 +416,8 @@ namespace OpenRCT2::Ui::Windows
| (1uLL << WIDX_BANK_RIGHT);
}
// Disable banking if the start track is steep and the end of the track becomes flat.
- if ((_previousTrackPitchEnd == TrackPitch::Down60 || _previousTrackPitchEnd == TrackPitch::Up60)
- && _currentTrackPitchEnd == TrackPitch::None)
+ if ((_previousTrackPitchEnd == TrackPitch::down60 || _previousTrackPitchEnd == TrackPitch::up60)
+ && _currentTrackPitchEnd == TrackPitch::none)
{
newDisabledWidgets |= (1uLL << WIDX_BANK_LEFT) | (1uLL << WIDX_BANK_RIGHT);
}
@@ -435,11 +436,11 @@ namespace OpenRCT2::Ui::Windows
// diagonals
if (!IsTrackEnabled(TrackGroup::slopeCurveLarge) && TrackPieceDirectionIsDiagonal(_currentTrackPieceDirection))
{
- if (_currentTrackPitchEnd != TrackPitch::None)
+ if (_currentTrackPitchEnd != TrackPitch::none)
{
newDisabledWidgets |= (1uLL << WIDX_BANK_LEFT) | (1uLL << WIDX_BANK_RIGHT);
}
- else if (_currentTrackRollEnd != TrackRoll::None)
+ else if (_currentTrackRollEnd != TrackRoll::none)
{
newDisabledWidgets |= (1uLL << WIDX_SLOPE_DOWN) | (1uLL << WIDX_SLOPE_UP);
}
@@ -448,11 +449,11 @@ namespace OpenRCT2::Ui::Windows
&& !getGameState().cheats.enableAllDrawableTrackPieces)
{
// Disable lift hill toggle and banking if current track piece is uphill
- if (_previousTrackPitchEnd == TrackPitch::Up25 || _previousTrackPitchEnd == TrackPitch::Up60
- || _currentTrackPitchEnd == TrackPitch::Up25 || _currentTrackPitchEnd == TrackPitch::Up60)
+ if (_previousTrackPitchEnd == TrackPitch::up25 || _previousTrackPitchEnd == TrackPitch::up60
+ || _currentTrackPitchEnd == TrackPitch::up25 || _currentTrackPitchEnd == TrackPitch::up60)
newDisabledWidgets |= 1uLL << WIDX_CHAIN_LIFT | (1uLL << WIDX_BANK_LEFT) | (1uLL << WIDX_BANK_RIGHT);
// Disable upward slope if current track piece is not flat
- if ((_previousTrackPitchEnd != TrackPitch::None || _previousTrackRollEnd != TrackRoll::None)
+ if ((_previousTrackPitchEnd != TrackPitch::none || _previousTrackRollEnd != TrackRoll::none)
&& !(_currentTrackHasLiftHill))
newDisabledWidgets |= (1uLL << WIDX_SLOPE_UP);
}
@@ -465,12 +466,12 @@ namespace OpenRCT2::Ui::Windows
{
switch (_currentlySelectedTrack.curve)
{
- case TrackCurve::LeftVerySmall:
- case TrackCurve::LeftSmall:
- case TrackCurve::Left:
- case TrackCurve::LeftLarge:
+ case TrackCurve::leftVerySmall:
+ case TrackCurve::leftSmall:
+ case TrackCurve::left:
+ case TrackCurve::leftLarge:
newDisabledWidgets |= (1uLL << WIDX_BANK_RIGHT);
- if (_previousTrackRollEnd == TrackRoll::None)
+ if (_previousTrackRollEnd == TrackRoll::none)
{
newDisabledWidgets |= (1uLL << WIDX_BANK_LEFT);
}
@@ -479,12 +480,12 @@ namespace OpenRCT2::Ui::Windows
newDisabledWidgets |= (1uLL << WIDX_BANK_STRAIGHT);
}
break;
- case TrackCurve::RightLarge:
- case TrackCurve::Right:
- case TrackCurve::RightSmall:
- case TrackCurve::RightVerySmall:
+ case TrackCurve::rightLarge:
+ case TrackCurve::right:
+ case TrackCurve::rightSmall:
+ case TrackCurve::rightVerySmall:
newDisabledWidgets |= (1uLL << WIDX_BANK_LEFT);
- if (_previousTrackRollEnd == TrackRoll::None)
+ if (_previousTrackRollEnd == TrackRoll::none)
{
newDisabledWidgets |= (1uLL << WIDX_BANK_RIGHT);
}
@@ -499,7 +500,7 @@ namespace OpenRCT2::Ui::Windows
}
if (!IsTrackEnabled(TrackGroup::slopeRollBanking))
{
- if (_currentTrackRollEnd != TrackRoll::None)
+ if (_currentTrackRollEnd != TrackRoll::none)
{
newDisabledWidgets |= (1uLL << WIDX_SLOPE_DOWN) | (1uLL << WIDX_SLOPE_UP);
}
@@ -508,8 +509,8 @@ namespace OpenRCT2::Ui::Windows
{
switch (_currentTrackPitchEnd)
{
- case TrackPitch::Up60:
- case TrackPitch::Down60:
+ case TrackPitch::up60:
+ case TrackPitch::down60:
newDisabledWidgets |= (1uLL << WIDX_LEFT_CURVE_VERY_SMALL) | (1uLL << WIDX_LEFT_CURVE)
| (1uLL << WIDX_RIGHT_CURVE) | (1uLL << WIDX_RIGHT_CURVE_VERY_SMALL);
if (!IsTrackEnabled(TrackGroup::slopeCurveSteep))
@@ -517,8 +518,8 @@ namespace OpenRCT2::Ui::Windows
newDisabledWidgets |= (1uLL << WIDX_LEFT_CURVE_SMALL) | (1uLL << WIDX_RIGHT_CURVE_SMALL);
}
break;
- case TrackPitch::Up90:
- case TrackPitch::Down90:
+ case TrackPitch::up90:
+ case TrackPitch::down90:
newDisabledWidgets |= (1uLL << WIDX_LEFT_CURVE_VERY_SMALL) | (1uLL << WIDX_LEFT_CURVE)
| (1uLL << WIDX_RIGHT_CURVE) | (1uLL << WIDX_RIGHT_CURVE_VERY_SMALL);
if (!IsTrackEnabled(TrackGroup::curveVertical))
@@ -542,48 +543,48 @@ namespace OpenRCT2::Ui::Windows
{
switch (_previousTrackPitchEnd)
{
- case TrackPitch::None:
+ case TrackPitch::none:
if (!IsTrackEnabled(TrackGroup::diagSlope))
{
newDisabledWidgets |= (1uLL << WIDX_SLOPE_UP) | (1uLL << WIDX_SLOPE_DOWN);
}
- if (_currentlySelectedTrack != TrackCurve::None
+ if (_currentlySelectedTrack != TrackCurve::none
|| (!IsTrackEnabled(TrackGroup::flatToSteepSlope)
&& !IsTrackEnabled(TrackGroup::diagSlopeSteepLong)))
{
newDisabledWidgets |= (1uLL << WIDX_SLOPE_DOWN_STEEP) | (1uLL << WIDX_SLOPE_UP_STEEP);
}
break;
- case TrackPitch::Down25:
+ case TrackPitch::down25:
newDisabledWidgets |= (1uLL << WIDX_SLOPE_UP) | (1uLL << WIDX_SLOPE_UP_STEEP);
if (!IsTrackEnabled(TrackGroup::diagSlopeSteepDown))
{
newDisabledWidgets |= (1uLL << WIDX_SLOPE_DOWN_STEEP);
}
break;
- case TrackPitch::Down60:
+ case TrackPitch::down60:
newDisabledWidgets |= (1uLL << WIDX_SLOPE_UP) | (1uLL << WIDX_SLOPE_UP_STEEP);
if (!IsTrackEnabled(TrackGroup::flatToSteepSlope) && !IsTrackEnabled(TrackGroup::diagSlopeSteepLong))
{
newDisabledWidgets |= (1uLL << WIDX_LEVEL);
}
break;
- case TrackPitch::Up25:
+ case TrackPitch::up25:
newDisabledWidgets |= (1uLL << WIDX_SLOPE_DOWN_STEEP) | (1uLL << WIDX_SLOPE_DOWN);
if (!IsTrackEnabled(TrackGroup::diagSlopeSteepUp))
{
newDisabledWidgets |= (1uLL << WIDX_SLOPE_UP_STEEP);
}
break;
- case TrackPitch::Up60:
+ case TrackPitch::up60:
newDisabledWidgets |= (1uLL << WIDX_SLOPE_DOWN_STEEP) | (1uLL << WIDX_SLOPE_DOWN);
if (!IsTrackEnabled(TrackGroup::flatToSteepSlope) && !IsTrackEnabled(TrackGroup::diagSlopeSteepLong))
{
newDisabledWidgets |= (1uLL << WIDX_LEVEL);
}
break;
- case TrackPitch::Down90:
- case TrackPitch::Up90:
+ case TrackPitch::down90:
+ case TrackPitch::up90:
newDisabledWidgets |= (1uLL << WIDX_SLOPE_DOWN) | (1uLL << WIDX_LEVEL) | (1uLL << WIDX_SLOPE_UP);
break;
}
@@ -592,61 +593,61 @@ namespace OpenRCT2::Ui::Windows
{
switch (_previousTrackPitchEnd)
{
- case TrackPitch::None:
- if (_currentlySelectedTrack != TrackCurve::None
+ case TrackPitch::none:
+ if (_currentlySelectedTrack != TrackCurve::none
|| (!IsTrackEnabled(TrackGroup::flatToSteepSlope) && !IsTrackEnabled(TrackGroup::slopeSteepLong)))
{
newDisabledWidgets |= (1uLL << WIDX_SLOPE_DOWN_STEEP) | (1uLL << WIDX_SLOPE_UP_STEEP);
}
break;
- case TrackPitch::Down25:
+ case TrackPitch::down25:
newDisabledWidgets |= (1uLL << WIDX_SLOPE_UP) | (1uLL << WIDX_SLOPE_UP_STEEP);
if (!IsTrackEnabled(TrackGroup::slopeSteepDown))
{
newDisabledWidgets |= 1uLL << WIDX_SLOPE_DOWN_STEEP;
}
break;
- case TrackPitch::Down60:
+ case TrackPitch::down60:
newDisabledWidgets |= (1uLL << WIDX_SLOPE_UP) | (1uLL << WIDX_SLOPE_UP_STEEP);
if (!IsTrackEnabled(TrackGroup::flatToSteepSlope) && !IsTrackEnabled(TrackGroup::slopeSteepLong))
{
newDisabledWidgets |= (1uLL << WIDX_LEVEL);
}
break;
- case TrackPitch::Up25:
+ case TrackPitch::up25:
newDisabledWidgets |= (1uLL << WIDX_SLOPE_DOWN_STEEP) | (1uLL << WIDX_SLOPE_DOWN);
if (!IsTrackEnabled(TrackGroup::slopeSteepUp))
{
newDisabledWidgets |= 1uLL << WIDX_SLOPE_UP_STEEP;
}
break;
- case TrackPitch::Up60:
+ case TrackPitch::up60:
newDisabledWidgets |= (1uLL << WIDX_SLOPE_DOWN_STEEP) | (1uLL << WIDX_SLOPE_DOWN);
if (!IsTrackEnabled(TrackGroup::flatToSteepSlope) && !IsTrackEnabled(TrackGroup::slopeSteepLong))
{
newDisabledWidgets |= (1uLL << WIDX_LEVEL);
}
break;
- case TrackPitch::Down90:
+ case TrackPitch::down90:
newDisabledWidgets |= (1uLL << WIDX_SLOPE_DOWN) | (1uLL << WIDX_LEVEL) | (1uLL << WIDX_SLOPE_UP)
| (1uLL << WIDX_SLOPE_UP_STEEP);
break;
- case TrackPitch::Up90:
+ case TrackPitch::up90:
newDisabledWidgets |= (1uLL << WIDX_SLOPE_DOWN_STEEP) | (1uLL << WIDX_SLOPE_DOWN) | (1uLL << WIDX_LEVEL)
| (1uLL << WIDX_SLOPE_UP);
break;
}
if (IsTrackEnabled(TrackGroup::slopeVertical))
{
- if (_previousTrackPitchEnd == TrackPitch::Up60 && _currentTrackPieceDirection < 4)
+ if (_previousTrackPitchEnd == TrackPitch::up60 && _currentTrackPieceDirection < 4)
{
newDisabledWidgets &= ~(1uLL << WIDX_SLOPE_UP_VERTICAL);
}
- if (_previousTrackPitchEnd == TrackPitch::Up90)
+ if (_previousTrackPitchEnd == TrackPitch::up90)
{
newDisabledWidgets &= ~(1uLL << WIDX_SLOPE_UP_VERTICAL);
}
- if (_previousTrackPitchEnd == TrackPitch::Down60 && _currentTrackPieceDirection < 4)
+ if (_previousTrackPitchEnd == TrackPitch::down60 && _currentTrackPieceDirection < 4)
{
newDisabledWidgets &= ~(1uLL << WIDX_SLOPE_DOWN_VERTICAL);
}
@@ -654,19 +655,19 @@ namespace OpenRCT2::Ui::Windows
}
if (TrackPieceDirectionIsDiagonal(_currentTrackPieceDirection)
- && (_currentlySelectedTrack == TrackCurve::LeftLarge || _currentlySelectedTrack == TrackCurve::RightLarge)
- && (_previousTrackPitchEnd == TrackPitch::Up25 || _previousTrackPitchEnd == TrackPitch::Down25)
+ && (_currentlySelectedTrack == TrackCurve::leftLarge || _currentlySelectedTrack == TrackCurve::rightLarge)
+ && (_previousTrackPitchEnd == TrackPitch::up25 || _previousTrackPitchEnd == TrackPitch::down25)
&& !IsTrackEnabled(TrackGroup::diagSlope))
{
newDisabledWidgets |= 1uLL << WIDX_STRAIGHT;
}
- if (_previousTrackRollEnd == TrackRoll::Left)
+ if (_previousTrackRollEnd == TrackRoll::left)
{
newDisabledWidgets |= (1uLL << WIDX_RIGHT_CURVE_SMALL) | (1uLL << WIDX_RIGHT_CURVE)
| (1uLL << WIDX_RIGHT_CURVE_LARGE) | (1uLL << WIDX_BANK_RIGHT);
}
- if (_previousTrackRollEnd == TrackRoll::Right)
+ if (_previousTrackRollEnd == TrackRoll::right)
{
newDisabledWidgets |= (1uLL << WIDX_LEFT_CURVE_SMALL) | (1uLL << WIDX_LEFT_CURVE)
| (1uLL << WIDX_LEFT_CURVE_LARGE) | (1uLL << WIDX_BANK_LEFT);
@@ -677,13 +678,13 @@ namespace OpenRCT2::Ui::Windows
| (1uLL << WIDX_RIGHT_CURVE_LARGE) | (1uLL << WIDX_LEFT_CURVE_SMALL) | (1uLL << WIDX_LEFT_CURVE)
| (1uLL << WIDX_LEFT_CURVE_LARGE);
}
- if (_currentTrackPitchEnd != TrackPitch::None)
+ if (_currentTrackPitchEnd != TrackPitch::none)
{
if (IsTrackEnabled(TrackGroup::slopeRollBanking))
{
- if (_previousTrackPitchEnd == TrackPitch::None)
+ if (_previousTrackPitchEnd == TrackPitch::none)
{
- if (_currentTrackPitchEnd != TrackPitch::Up25 && _currentTrackPitchEnd != TrackPitch::Down25)
+ if (_currentTrackPitchEnd != TrackPitch::up25 && _currentTrackPitchEnd != TrackPitch::down25)
{
newDisabledWidgets |= (1uLL << WIDX_BANK_LEFT) | (1uLL << WIDX_BANK_RIGHT);
}
@@ -696,7 +697,7 @@ namespace OpenRCT2::Ui::Windows
}
else
{
- if (_currentTrackPitchEnd != TrackPitch::Up25 && _currentTrackPitchEnd != TrackPitch::Down25)
+ if (_currentTrackPitchEnd != TrackPitch::up25 && _currentTrackPitchEnd != TrackPitch::down25)
{
newDisabledWidgets |= (1uLL << WIDX_BANK_LEFT) | (1uLL << WIDX_BANK_RIGHT);
}
@@ -708,75 +709,75 @@ namespace OpenRCT2::Ui::Windows
newDisabledWidgets |= (1uLL << WIDX_BANK_LEFT) | (1uLL << WIDX_BANK_RIGHT);
}
}
- if (_currentTrackRollEnd != TrackRoll::None || _previousTrackRollEnd != TrackRoll::None)
+ if (_currentTrackRollEnd != TrackRoll::none || _previousTrackRollEnd != TrackRoll::none)
{
newDisabledWidgets |= (1uLL << WIDX_SLOPE_DOWN_STEEP) | (1uLL << WIDX_SLOPE_UP_STEEP)
| (1uLL << WIDX_CHAIN_LIFT);
}
- if (_currentlySelectedTrack != TrackCurve::None)
+ if (_currentlySelectedTrack != TrackCurve::none)
{
if (!IsTrackEnabled(TrackGroup::liftHillCurve))
{
newDisabledWidgets |= (1uLL << WIDX_CHAIN_LIFT);
}
- if (_currentTrackPitchEnd == TrackPitch::None)
+ if (_currentTrackPitchEnd == TrackPitch::none)
{
newDisabledWidgets |= (1uLL << WIDX_CHAIN_LIFT);
}
- if (_currentTrackPitchEnd == TrackPitch::Up60)
+ if (_currentTrackPitchEnd == TrackPitch::up60)
{
newDisabledWidgets |= (1uLL << WIDX_CHAIN_LIFT);
}
- if (_currentTrackPitchEnd == TrackPitch::Down60)
+ if (_currentTrackPitchEnd == TrackPitch::down60)
{
newDisabledWidgets |= (1uLL << WIDX_CHAIN_LIFT);
}
// Ensures that you can build an "unbanking turn", but not select a turn that start banked and
// turns to level (as that does not exist).
- if (_currentTrackRollEnd != TrackRoll::None && _currentTrackPitchEnd != TrackPitch::None)
+ if (_currentTrackRollEnd != TrackRoll::none && _currentTrackPitchEnd != TrackPitch::none)
{
newDisabledWidgets |= (1uLL << WIDX_LEVEL);
}
}
- if (_currentTrackPitchEnd == TrackPitch::Up90 || _previousTrackPitchEnd == TrackPitch::Up90)
+ if (_currentTrackPitchEnd == TrackPitch::up90 || _previousTrackPitchEnd == TrackPitch::up90)
{
newDisabledWidgets |= (1uLL << WIDX_CHAIN_LIFT);
}
if (!IsTrackEnabled(TrackGroup::liftHillSteep))
{
- if (_previousTrackPitchEnd == TrackPitch::Up60 || _currentTrackPitchEnd == TrackPitch::Up60)
+ if (_previousTrackPitchEnd == TrackPitch::up60 || _currentTrackPitchEnd == TrackPitch::up60)
{
newDisabledWidgets |= (1uLL << WIDX_CHAIN_LIFT);
}
}
- if (_previousTrackRollEnd == TrackRoll::UpsideDown)
+ if (_previousTrackRollEnd == TrackRoll::upsideDown)
{
newDisabledWidgets |= (1uLL << WIDX_LEFT_CURVE_SMALL) | (1uLL << WIDX_LEFT_CURVE)
| (1uLL << WIDX_LEFT_CURVE_LARGE) | (1uLL << WIDX_STRAIGHT) | (1uLL << WIDX_RIGHT_CURVE_SMALL)
| (1uLL << WIDX_RIGHT_CURVE) | (1uLL << WIDX_RIGHT_CURVE_LARGE);
}
- if (_currentlySelectedTrack != TrackCurve::None)
+ if (_currentlySelectedTrack != TrackCurve::none)
{
- if (_currentTrackPitchEnd == TrackPitch::None)
+ if (_currentTrackPitchEnd == TrackPitch::none)
{
newDisabledWidgets |= (1uLL << WIDX_SLOPE_DOWN) | (1uLL << WIDX_SLOPE_UP);
}
if (_currentTrackPitchEnd == _previousTrackPitchEnd)
{
- if (_currentTrackPitchEnd == TrackPitch::Up25)
+ if (_currentTrackPitchEnd == TrackPitch::up25)
{
newDisabledWidgets |= (1uLL << WIDX_SLOPE_UP_STEEP);
- if (_currentlySelectedTrack == TrackCurve::Left || _currentlySelectedTrack == TrackCurve::Right
+ if (_currentlySelectedTrack == TrackCurve::left || _currentlySelectedTrack == TrackCurve::right
|| _rideConstructionState != RideConstructionState::Back
|| !IsTrackEnabled(TrackGroup::slopeCurveBanked))
{
newDisabledWidgets |= (1uLL << WIDX_LEVEL);
}
}
- if (_currentTrackPitchEnd == TrackPitch::Down25)
+ if (_currentTrackPitchEnd == TrackPitch::down25)
{
newDisabledWidgets |= (1uLL << WIDX_SLOPE_DOWN_STEEP);
- if (_currentlySelectedTrack == TrackCurve::Left || _currentlySelectedTrack == TrackCurve::Right
+ if (_currentlySelectedTrack == TrackCurve::left || _currentlySelectedTrack == TrackCurve::right
|| _rideConstructionState != RideConstructionState::Front
|| !IsTrackEnabled(TrackGroup::slopeCurveBanked))
{
@@ -787,57 +788,57 @@ namespace OpenRCT2::Ui::Windows
else if (IsTrackEnabled(TrackGroup::slopeCurveBanked))
{
newDisabledWidgets |= (1uLL << WIDX_SLOPE_DOWN_STEEP) | (1uLL << WIDX_SLOPE_UP_STEEP);
- if (_currentTrackRollEnd == TrackRoll::Left)
+ if (_currentTrackRollEnd == TrackRoll::left)
{
newDisabledWidgets |= (1uLL << WIDX_BANK_STRAIGHT) | (1uLL << WIDX_BANK_RIGHT);
newDisabledWidgets &= ~(1uLL << WIDX_BANK_LEFT);
}
- if (_currentTrackRollEnd == TrackRoll::Right)
+ if (_currentTrackRollEnd == TrackRoll::right)
{
newDisabledWidgets |= (1uLL << WIDX_BANK_LEFT) | (1uLL << WIDX_BANK_STRAIGHT);
newDisabledWidgets &= ~(1uLL << WIDX_BANK_RIGHT);
}
- if (_currentTrackRollEnd == TrackRoll::None)
+ if (_currentTrackRollEnd == TrackRoll::none)
{
newDisabledWidgets |= (1uLL << WIDX_BANK_LEFT) | (1uLL << WIDX_BANK_RIGHT);
newDisabledWidgets &= ~(1uLL << WIDX_BANK_STRAIGHT);
}
- if (_currentTrackPitchEnd == TrackPitch::None)
+ if (_currentTrackPitchEnd == TrackPitch::none)
{
newDisabledWidgets |= (1uLL << WIDX_SLOPE_DOWN) | (1uLL << WIDX_SLOPE_UP);
newDisabledWidgets &= ~(1uLL << WIDX_LEVEL);
}
- if (_currentTrackPitchEnd == TrackPitch::Up25)
+ if (_currentTrackPitchEnd == TrackPitch::up25)
{
newDisabledWidgets |= (1uLL << WIDX_SLOPE_DOWN) | (1uLL << WIDX_LEVEL);
newDisabledWidgets &= ~(1uLL << WIDX_SLOPE_UP);
}
- if (_currentTrackPitchEnd == TrackPitch::Down25)
+ if (_currentTrackPitchEnd == TrackPitch::down25)
{
newDisabledWidgets |= (1uLL << WIDX_LEVEL) | (1uLL << WIDX_SLOPE_UP);
newDisabledWidgets &= ~(1uLL << WIDX_SLOPE_DOWN);
}
- if (_currentlySelectedTrack == TrackCurve::LeftSmall)
+ if (_currentlySelectedTrack == TrackCurve::leftSmall)
{
newDisabledWidgets &= ~(1uLL << WIDX_LEFT_CURVE_SMALL);
}
- if (_currentlySelectedTrack == TrackCurve::RightSmall)
+ if (_currentlySelectedTrack == TrackCurve::rightSmall)
{
newDisabledWidgets &= ~(1uLL << WIDX_RIGHT_CURVE_SMALL);
}
}
}
- if (_currentlySelectedTrack != TrackCurve::None && _currentTrackPitchEnd == TrackPitch::Up60)
+ if (_currentlySelectedTrack != TrackCurve::none && _currentTrackPitchEnd == TrackPitch::up60)
{
newDisabledWidgets |= (1uLL << WIDX_SLOPE_UP);
}
- if (_currentlySelectedTrack != TrackCurve::None && _currentTrackPitchEnd == TrackPitch::Down60)
+ if (_currentlySelectedTrack != TrackCurve::none && _currentTrackPitchEnd == TrackPitch::down60)
{
newDisabledWidgets |= (1uLL << WIDX_SLOPE_DOWN);
}
if ((_currentTrackHasLiftHill) && !getGameState().cheats.enableChainLiftOnAllTrack)
{
- if (_currentTrackPitchEnd != TrackPitch::None && !IsTrackEnabled(TrackGroup::liftHillCurve))
+ if (_currentTrackPitchEnd != TrackPitch::none && !IsTrackEnabled(TrackGroup::liftHillCurve))
{
newDisabledWidgets |= (1uLL << WIDX_LEFT_CURVE_SMALL) | (1uLL << WIDX_LEFT_CURVE)
| (1uLL << WIDX_LEFT_CURVE_LARGE) | (1uLL << WIDX_RIGHT_CURVE_SMALL) | (1uLL << WIDX_RIGHT_CURVE)
@@ -851,17 +852,17 @@ namespace OpenRCT2::Ui::Windows
}
}
}
- if (_previousTrackPitchEnd == TrackPitch::Up60 && _currentlySelectedTrack != TrackCurve::None)
+ if (_previousTrackPitchEnd == TrackPitch::up60 && _currentlySelectedTrack != TrackCurve::none)
{
newDisabledWidgets |= (1uLL << WIDX_SLOPE_DOWN_STEEP) | (1uLL << WIDX_LEVEL);
}
- if (_previousTrackPitchEnd == TrackPitch::Down60 && _currentlySelectedTrack != TrackCurve::None)
+ if (_previousTrackPitchEnd == TrackPitch::down60 && _currentlySelectedTrack != TrackCurve::none)
{
newDisabledWidgets |= (1uLL << WIDX_LEVEL) | (1uLL << WIDX_SLOPE_UP_STEEP);
}
- if (_currentTrackPitchEnd == TrackPitch::Up90 || _previousTrackPitchEnd == TrackPitch::Up90)
+ if (_currentTrackPitchEnd == TrackPitch::up90 || _previousTrackPitchEnd == TrackPitch::up90)
{
- if (_currentlySelectedTrack != TrackCurve::None)
+ if (_currentlySelectedTrack != TrackCurve::none)
{
newDisabledWidgets |= (1uLL << WIDX_SLOPE_UP_STEEP);
}
@@ -873,9 +874,9 @@ namespace OpenRCT2::Ui::Windows
| (1uLL << WIDX_RIGHT_CURVE_SMALL) | (1uLL << WIDX_LEFT_CURVE_SMALL) | (1uLL << WIDX_LEFT_CURVE);
}
}
- else if (_currentTrackPitchEnd == TrackPitch::Down90 || _previousTrackPitchEnd == TrackPitch::Down90)
+ else if (_currentTrackPitchEnd == TrackPitch::down90 || _previousTrackPitchEnd == TrackPitch::down90)
{
- if (_currentlySelectedTrack != TrackCurve::None)
+ if (_currentlySelectedTrack != TrackCurve::none)
{
newDisabledWidgets |= (1uLL << WIDX_SLOPE_DOWN_STEEP);
}
@@ -888,11 +889,11 @@ namespace OpenRCT2::Ui::Windows
}
}
// If the previous track is flat and the next track is flat, attempt to show buttons for helixes
- if (_currentTrackPitchEnd == TrackPitch::None && _currentTrackPitchEnd == _previousTrackPitchEnd)
+ if (_currentTrackPitchEnd == TrackPitch::none && _currentTrackPitchEnd == _previousTrackPitchEnd)
{
// If the bank is none, attempt to show unbanked quarter helixes
- if (_currentTrackRollEnd == TrackRoll::None
- && (_currentlySelectedTrack == TrackCurve::Left || _currentlySelectedTrack == TrackCurve::Right))
+ if (_currentTrackRollEnd == TrackRoll::none
+ && (_currentlySelectedTrack == TrackCurve::left || _currentlySelectedTrack == TrackCurve::right))
{
if (IsTrackEnabled(TrackGroup::helixDownUnbankedQuarter))
newDisabledWidgets &= ~(1uLL << WIDX_SLOPE_DOWN_STEEP);
@@ -902,8 +903,8 @@ namespace OpenRCT2::Ui::Windows
// If the track is banked left or right and curvature is standard size (2.5 tile radius), attempt to show
// buttons for half or quarter helixes
else if (
- (_currentTrackRollEnd == TrackRoll::Left || _currentTrackRollEnd == TrackRoll::Right)
- && (_currentlySelectedTrack == TrackCurve::Left || _currentlySelectedTrack == TrackCurve::Right))
+ (_currentTrackRollEnd == TrackRoll::left || _currentTrackRollEnd == TrackRoll::right)
+ && (_currentlySelectedTrack == TrackCurve::left || _currentlySelectedTrack == TrackCurve::right))
{
if (IsTrackEnabled(TrackGroup::helixDownBankedHalf) || IsTrackEnabled(TrackGroup::helixDownBankedQuarter))
newDisabledWidgets &= ~(1uLL << WIDX_SLOPE_DOWN_STEEP);
@@ -913,8 +914,8 @@ namespace OpenRCT2::Ui::Windows
// If the track is banked left or right and curvature is small size (1.5 tile radius), attempt to show buttons
// for half helixes
else if (
- (_currentTrackRollEnd == TrackRoll::Left || _currentTrackRollEnd == TrackRoll::Right)
- && (_currentlySelectedTrack == TrackCurve::LeftSmall || _currentlySelectedTrack == TrackCurve::RightSmall))
+ (_currentTrackRollEnd == TrackRoll::left || _currentTrackRollEnd == TrackRoll::right)
+ && (_currentlySelectedTrack == TrackCurve::leftSmall || _currentlySelectedTrack == TrackCurve::rightSmall))
{
if (IsTrackEnabled(TrackGroup::helixDownBankedHalf))
newDisabledWidgets &= ~(1uLL << WIDX_SLOPE_DOWN_STEEP);
@@ -926,9 +927,9 @@ namespace OpenRCT2::Ui::Windows
{
if (_rideConstructionState == RideConstructionState::Front)
{
- if (_currentlySelectedTrack == TrackCurve::LeftSmall || _currentlySelectedTrack == TrackCurve::RightSmall)
+ if (_currentlySelectedTrack == TrackCurve::leftSmall || _currentlySelectedTrack == TrackCurve::rightSmall)
{
- if (_currentTrackPitchEnd == TrackPitch::None && _previousTrackRollEnd != TrackRoll::None
+ if (_currentTrackPitchEnd == TrackPitch::none && _previousTrackRollEnd != TrackRoll::none
&& (!currentRide->getRideTypeDescriptor().HasFlag(RtdFlag::upInclineRequiresLift)
|| getGameState().cheats.enableAllDrawableTrackPieces))
{
@@ -938,9 +939,9 @@ namespace OpenRCT2::Ui::Windows
}
else if (_rideConstructionState == RideConstructionState::Back)
{
- if (_currentlySelectedTrack == TrackCurve::LeftSmall || _currentlySelectedTrack == TrackCurve::RightSmall)
+ if (_currentlySelectedTrack == TrackCurve::leftSmall || _currentlySelectedTrack == TrackCurve::rightSmall)
{
- if (_currentTrackPitchEnd == TrackPitch::None && _previousTrackRollEnd != TrackRoll::None)
+ if (_currentTrackPitchEnd == TrackPitch::none && _previousTrackRollEnd != TrackRoll::none)
{
newDisabledWidgets &= ~(1uLL << WIDX_SLOPE_DOWN);
}
@@ -1034,10 +1035,10 @@ namespace OpenRCT2::Ui::Windows
{
switch (_currentlySelectedTrack.trackType)
{
- case TrackElemType::SpinningTunnel:
- case TrackElemType::Whirlpool:
- case TrackElemType::Rapids:
- case TrackElemType::Waterfall:
+ case TrackElemType::spinningTunnel:
+ case TrackElemType::whirlpool:
+ case TrackElemType::rapids:
+ case TrackElemType::waterfall:
invalidateWidget(WIDX_CONSTRUCT);
break;
default:
@@ -1137,102 +1138,102 @@ namespace OpenRCT2::Ui::Windows
break;
case WIDX_NEXT_SECTION:
RideSelectNextSection();
- if (!(gMapSelectFlags.has(MapSelectFlag::enable)))
+ if (!gMapSelectFlags.has(MapSelectFlag::enable))
VirtualFloorSetHeight(_currentTrackBegin.z);
break;
case WIDX_PREVIOUS_SECTION:
RideSelectPreviousSection();
- if (!(gMapSelectFlags.has(MapSelectFlag::enable)))
+ if (!gMapSelectFlags.has(MapSelectFlag::enable))
VirtualFloorSetHeight(_currentTrackBegin.z);
break;
case WIDX_LEFT_CURVE:
RideConstructionInvalidateCurrentTrack();
- _currentlySelectedTrack = TrackCurve::Left;
+ _currentlySelectedTrack = TrackCurve::left;
_currentTrackPrice = kMoney64Undefined;
WindowRideConstructionUpdateActiveElements();
break;
case WIDX_RIGHT_CURVE:
RideConstructionInvalidateCurrentTrack();
- _currentlySelectedTrack = TrackCurve::Right;
+ _currentlySelectedTrack = TrackCurve::right;
_currentTrackPrice = kMoney64Undefined;
WindowRideConstructionUpdateActiveElements();
break;
case WIDX_LEFT_CURVE_SMALL:
RideConstructionInvalidateCurrentTrack();
- _currentlySelectedTrack = TrackCurve::LeftSmall;
+ _currentlySelectedTrack = TrackCurve::leftSmall;
_currentTrackPrice = kMoney64Undefined;
WindowRideConstructionUpdateActiveElements();
break;
case WIDX_RIGHT_CURVE_SMALL:
RideConstructionInvalidateCurrentTrack();
- _currentlySelectedTrack = TrackCurve::RightSmall;
+ _currentlySelectedTrack = TrackCurve::rightSmall;
_currentTrackPrice = kMoney64Undefined;
WindowRideConstructionUpdateActiveElements();
break;
case WIDX_LEFT_CURVE_VERY_SMALL:
RideConstructionInvalidateCurrentTrack();
- _currentlySelectedTrack = TrackCurve::LeftVerySmall;
+ _currentlySelectedTrack = TrackCurve::leftVerySmall;
_currentTrackPrice = kMoney64Undefined;
WindowRideConstructionUpdateActiveElements();
break;
case WIDX_RIGHT_CURVE_VERY_SMALL:
RideConstructionInvalidateCurrentTrack();
- _currentlySelectedTrack = TrackCurve::RightVerySmall;
+ _currentlySelectedTrack = TrackCurve::rightVerySmall;
_currentTrackPrice = kMoney64Undefined;
WindowRideConstructionUpdateActiveElements();
break;
case WIDX_LEFT_CURVE_LARGE:
RideConstructionInvalidateCurrentTrack();
- _currentlySelectedTrack = TrackCurve::LeftLarge;
+ _currentlySelectedTrack = TrackCurve::leftLarge;
_currentTrackPrice = kMoney64Undefined;
WindowRideConstructionUpdateActiveElements();
break;
case WIDX_RIGHT_CURVE_LARGE:
RideConstructionInvalidateCurrentTrack();
- _currentlySelectedTrack = TrackCurve::RightLarge;
+ _currentlySelectedTrack = TrackCurve::rightLarge;
_currentTrackPrice = kMoney64Undefined;
WindowRideConstructionUpdateActiveElements();
break;
case WIDX_STRAIGHT:
RideConstructionInvalidateCurrentTrack();
- if (_currentlySelectedTrack != TrackCurve::None)
- _currentTrackRollEnd = TrackRoll::None;
- _currentlySelectedTrack = TrackCurve::None;
+ if (_currentlySelectedTrack != TrackCurve::none)
+ _currentTrackRollEnd = TrackRoll::none;
+ _currentlySelectedTrack = TrackCurve::none;
_currentTrackPrice = kMoney64Undefined;
WindowRideConstructionUpdateActiveElements();
break;
case WIDX_SLOPE_DOWN_VERTICAL:
RideConstructionInvalidateCurrentTrack();
- UpdateLiftHillSelected(TrackPitch::Down90);
+ UpdateLiftHillSelected(TrackPitch::down90);
break;
case WIDX_SLOPE_DOWN_STEEP:
RideConstructionInvalidateCurrentTrack();
if (IsTrackEnabled(TrackGroup::helixDownBankedHalf) || IsTrackEnabled(TrackGroup::helixUpBankedHalf))
{
- if (_currentlySelectedTrack == TrackCurve::Left && _currentTrackRollEnd == TrackRoll::Left)
+ if (_currentlySelectedTrack == TrackCurve::left && _currentTrackRollEnd == TrackRoll::left)
{
- _currentlySelectedTrack = TrackElemType::LeftHalfBankedHelixDownLarge;
+ _currentlySelectedTrack = TrackElemType::leftHalfBankedHelixDownLarge;
_currentTrackPrice = kMoney64Undefined;
WindowRideConstructionUpdateActiveElements();
break;
}
- if (_currentlySelectedTrack == TrackCurve::Right && _currentTrackRollEnd == TrackRoll::Right)
+ if (_currentlySelectedTrack == TrackCurve::right && _currentTrackRollEnd == TrackRoll::right)
{
- _currentlySelectedTrack = TrackElemType::RightHalfBankedHelixDownLarge;
+ _currentlySelectedTrack = TrackElemType::rightHalfBankedHelixDownLarge;
_currentTrackPrice = kMoney64Undefined;
WindowRideConstructionUpdateActiveElements();
break;
}
- if (_currentlySelectedTrack == TrackCurve::LeftSmall && _currentTrackRollEnd == TrackRoll::Left)
+ if (_currentlySelectedTrack == TrackCurve::leftSmall && _currentTrackRollEnd == TrackRoll::left)
{
- _currentlySelectedTrack = TrackElemType::LeftHalfBankedHelixDownSmall;
+ _currentlySelectedTrack = TrackElemType::leftHalfBankedHelixDownSmall;
_currentTrackPrice = kMoney64Undefined;
WindowRideConstructionUpdateActiveElements();
break;
}
- if (_currentlySelectedTrack == TrackCurve::RightSmall && _currentTrackRollEnd == TrackRoll::Right)
+ if (_currentlySelectedTrack == TrackCurve::rightSmall && _currentTrackRollEnd == TrackRoll::right)
{
- _currentlySelectedTrack = TrackElemType::RightHalfBankedHelixDownSmall;
+ _currentlySelectedTrack = TrackElemType::rightHalfBankedHelixDownSmall;
_currentTrackPrice = kMoney64Undefined;
WindowRideConstructionUpdateActiveElements();
break;
@@ -1240,16 +1241,16 @@ namespace OpenRCT2::Ui::Windows
}
if (IsTrackEnabled(TrackGroup::helixDownBankedQuarter) || IsTrackEnabled(TrackGroup::helixUpBankedQuarter))
{
- if (_currentlySelectedTrack == TrackCurve::Left && _currentTrackRollEnd == TrackRoll::Left)
+ if (_currentlySelectedTrack == TrackCurve::left && _currentTrackRollEnd == TrackRoll::left)
{
- _currentlySelectedTrack = TrackElemType::LeftQuarterBankedHelixLargeDown;
+ _currentlySelectedTrack = TrackElemType::leftQuarterBankedHelixLargeDown;
_currentTrackPrice = kMoney64Undefined;
WindowRideConstructionUpdateActiveElements();
break;
}
- if (_currentlySelectedTrack == TrackCurve::Right && _currentTrackRollEnd == TrackRoll::Right)
+ if (_currentlySelectedTrack == TrackCurve::right && _currentTrackRollEnd == TrackRoll::right)
{
- _currentlySelectedTrack = TrackElemType::RightQuarterBankedHelixLargeDown;
+ _currentlySelectedTrack = TrackElemType::rightQuarterBankedHelixLargeDown;
_currentTrackPrice = kMoney64Undefined;
WindowRideConstructionUpdateActiveElements();
break;
@@ -1258,18 +1259,18 @@ namespace OpenRCT2::Ui::Windows
if (IsTrackEnabled(TrackGroup::helixDownUnbankedQuarter)
|| IsTrackEnabled(TrackGroup::helixUpUnbankedQuarter))
{
- if (_currentTrackRollEnd == TrackRoll::None)
+ if (_currentTrackRollEnd == TrackRoll::none)
{
- if (_currentlySelectedTrack == TrackCurve::Left)
+ if (_currentlySelectedTrack == TrackCurve::left)
{
- _currentlySelectedTrack = TrackElemType::LeftQuarterHelixLargeDown;
+ _currentlySelectedTrack = TrackElemType::leftQuarterHelixLargeDown;
_currentTrackPrice = kMoney64Undefined;
WindowRideConstructionUpdateActiveElements();
break;
}
- if (_currentlySelectedTrack == TrackCurve::Right)
+ if (_currentlySelectedTrack == TrackCurve::right)
{
- _currentlySelectedTrack = TrackElemType::RightQuarterHelixLargeDown;
+ _currentlySelectedTrack = TrackElemType::rightQuarterHelixLargeDown;
_currentTrackPrice = kMoney64Undefined;
WindowRideConstructionUpdateActiveElements();
break;
@@ -1277,91 +1278,91 @@ namespace OpenRCT2::Ui::Windows
}
}
- UpdateLiftHillSelected(TrackPitch::Down60);
+ UpdateLiftHillSelected(TrackPitch::down60);
break;
case WIDX_SLOPE_DOWN:
RideConstructionInvalidateCurrentTrack();
- if (_rideConstructionState == RideConstructionState::Back && _currentTrackRollEnd != TrackRoll::None)
+ if (_rideConstructionState == RideConstructionState::Back && _currentTrackRollEnd != TrackRoll::none)
{
- _currentTrackRollEnd = TrackRoll::None;
+ _currentTrackRollEnd = TrackRoll::none;
}
- UpdateLiftHillSelected(TrackPitch::Down25);
+ UpdateLiftHillSelected(TrackPitch::down25);
break;
case WIDX_LEVEL:
RideConstructionInvalidateCurrentTrack();
- if (_rideConstructionState == RideConstructionState::Front && _previousTrackPitchEnd == TrackPitch::Down25)
+ if (_rideConstructionState == RideConstructionState::Front && _previousTrackPitchEnd == TrackPitch::down25)
{
- if (_currentlySelectedTrack == TrackCurve::LeftSmall)
+ if (_currentlySelectedTrack == TrackCurve::leftSmall)
{
- _currentTrackRollEnd = TrackRoll::Left;
+ _currentTrackRollEnd = TrackRoll::left;
}
- else if (_currentlySelectedTrack == TrackCurve::RightSmall)
+ else if (_currentlySelectedTrack == TrackCurve::rightSmall)
{
- _currentTrackRollEnd = TrackRoll::Right;
+ _currentTrackRollEnd = TrackRoll::right;
}
}
else if (
- _rideConstructionState == RideConstructionState::Back && _previousTrackPitchEnd == TrackPitch::Up25)
+ _rideConstructionState == RideConstructionState::Back && _previousTrackPitchEnd == TrackPitch::up25)
{
- if (_currentlySelectedTrack == TrackCurve::LeftSmall)
+ if (_currentlySelectedTrack == TrackCurve::leftSmall)
{
- _currentTrackRollEnd = TrackRoll::Left;
+ _currentTrackRollEnd = TrackRoll::left;
}
- else if (_currentlySelectedTrack == TrackCurve::RightSmall)
+ else if (_currentlySelectedTrack == TrackCurve::rightSmall)
{
- _currentTrackRollEnd = TrackRoll::Right;
+ _currentTrackRollEnd = TrackRoll::right;
}
}
- UpdateLiftHillSelected(TrackPitch::None);
+ UpdateLiftHillSelected(TrackPitch::none);
break;
case WIDX_SLOPE_UP:
RideConstructionInvalidateCurrentTrack();
- if (_rideConstructionState == RideConstructionState::Front && _currentTrackRollEnd != TrackRoll::None)
+ if (_rideConstructionState == RideConstructionState::Front && _currentTrackRollEnd != TrackRoll::none)
{
- _currentTrackRollEnd = TrackRoll::None;
+ _currentTrackRollEnd = TrackRoll::none;
}
if (currentRide->getRideTypeDescriptor().SupportsTrackGroup(TrackGroup::reverseFreefall))
{
if (_rideConstructionState == RideConstructionState::Front
- && _currentlySelectedTrack == TrackCurve::None)
+ && _currentlySelectedTrack == TrackCurve::none)
{
- _currentlySelectedTrack = TrackElemType::ReverseFreefallSlope;
+ _currentlySelectedTrack = TrackElemType::reverseFreefallSlope;
WindowRideConstructionUpdateActiveElements();
}
}
else
{
- UpdateLiftHillSelected(TrackPitch::Up25);
+ UpdateLiftHillSelected(TrackPitch::up25);
}
break;
case WIDX_SLOPE_UP_STEEP:
RideConstructionInvalidateCurrentTrack();
if (IsTrackEnabled(TrackGroup::helixDownBankedHalf) || IsTrackEnabled(TrackGroup::helixUpBankedHalf))
{
- if (_currentlySelectedTrack == TrackCurve::Left && _currentTrackRollEnd == TrackRoll::Left)
+ if (_currentlySelectedTrack == TrackCurve::left && _currentTrackRollEnd == TrackRoll::left)
{
- _currentlySelectedTrack = TrackElemType::LeftHalfBankedHelixUpLarge;
+ _currentlySelectedTrack = TrackElemType::leftHalfBankedHelixUpLarge;
_currentTrackPrice = kMoney64Undefined;
WindowRideConstructionUpdateActiveElements();
break;
}
- if (_currentlySelectedTrack == TrackCurve::Right && _currentTrackRollEnd == TrackRoll::Right)
+ if (_currentlySelectedTrack == TrackCurve::right && _currentTrackRollEnd == TrackRoll::right)
{
- _currentlySelectedTrack = TrackElemType::RightHalfBankedHelixUpLarge;
+ _currentlySelectedTrack = TrackElemType::rightHalfBankedHelixUpLarge;
_currentTrackPrice = kMoney64Undefined;
WindowRideConstructionUpdateActiveElements();
break;
}
- if (_currentlySelectedTrack == TrackCurve::LeftSmall && _currentTrackRollEnd == TrackRoll::Left)
+ if (_currentlySelectedTrack == TrackCurve::leftSmall && _currentTrackRollEnd == TrackRoll::left)
{
- _currentlySelectedTrack = TrackElemType::LeftHalfBankedHelixUpSmall;
+ _currentlySelectedTrack = TrackElemType::leftHalfBankedHelixUpSmall;
_currentTrackPrice = kMoney64Undefined;
WindowRideConstructionUpdateActiveElements();
break;
}
- if (_currentlySelectedTrack == TrackCurve::RightSmall && _currentTrackRollEnd == TrackRoll::Right)
+ if (_currentlySelectedTrack == TrackCurve::rightSmall && _currentTrackRollEnd == TrackRoll::right)
{
- _currentlySelectedTrack = TrackElemType::RightHalfBankedHelixUpSmall;
+ _currentlySelectedTrack = TrackElemType::rightHalfBankedHelixUpSmall;
_currentTrackPrice = kMoney64Undefined;
WindowRideConstructionUpdateActiveElements();
break;
@@ -1369,16 +1370,16 @@ namespace OpenRCT2::Ui::Windows
}
if (IsTrackEnabled(TrackGroup::helixDownBankedQuarter) || IsTrackEnabled(TrackGroup::helixUpBankedQuarter))
{
- if (_currentlySelectedTrack == TrackCurve::Left && _currentTrackRollEnd == TrackRoll::Left)
+ if (_currentlySelectedTrack == TrackCurve::left && _currentTrackRollEnd == TrackRoll::left)
{
- _currentlySelectedTrack = TrackElemType::LeftQuarterBankedHelixLargeUp;
+ _currentlySelectedTrack = TrackElemType::leftQuarterBankedHelixLargeUp;
_currentTrackPrice = kMoney64Undefined;
WindowRideConstructionUpdateActiveElements();
break;
}
- if (_currentlySelectedTrack == TrackCurve::Right && _currentTrackRollEnd == TrackRoll::Right)
+ if (_currentlySelectedTrack == TrackCurve::right && _currentTrackRollEnd == TrackRoll::right)
{
- _currentlySelectedTrack = TrackElemType::RightQuarterBankedHelixLargeUp;
+ _currentlySelectedTrack = TrackElemType::rightQuarterBankedHelixLargeUp;
_currentTrackPrice = kMoney64Undefined;
WindowRideConstructionUpdateActiveElements();
break;
@@ -1387,18 +1388,18 @@ namespace OpenRCT2::Ui::Windows
if (IsTrackEnabled(TrackGroup::helixDownUnbankedQuarter)
|| IsTrackEnabled(TrackGroup::helixUpUnbankedQuarter))
{
- if (_currentTrackRollEnd == TrackRoll::None)
+ if (_currentTrackRollEnd == TrackRoll::none)
{
- if (_currentlySelectedTrack == TrackCurve::Left)
+ if (_currentlySelectedTrack == TrackCurve::left)
{
- _currentlySelectedTrack = TrackElemType::LeftQuarterHelixLargeUp;
+ _currentlySelectedTrack = TrackElemType::leftQuarterHelixLargeUp;
_currentTrackPrice = kMoney64Undefined;
WindowRideConstructionUpdateActiveElements();
break;
}
- if (_currentlySelectedTrack == TrackCurve::Right)
+ if (_currentlySelectedTrack == TrackCurve::right)
{
- _currentlySelectedTrack = TrackElemType::RightQuarterHelixLargeUp;
+ _currentlySelectedTrack = TrackElemType::rightQuarterHelixLargeUp;
_currentTrackPrice = kMoney64Undefined;
WindowRideConstructionUpdateActiveElements();
break;
@@ -1406,11 +1407,11 @@ namespace OpenRCT2::Ui::Windows
}
}
- UpdateLiftHillSelected(TrackPitch::Up60);
+ UpdateLiftHillSelected(TrackPitch::up60);
break;
case WIDX_SLOPE_UP_VERTICAL:
RideConstructionInvalidateCurrentTrack();
- UpdateLiftHillSelected(TrackPitch::Up90);
+ UpdateLiftHillSelected(TrackPitch::up90);
break;
case WIDX_CHAIN_LIFT:
RideConstructionInvalidateCurrentTrack();
@@ -1424,7 +1425,7 @@ namespace OpenRCT2::Ui::Windows
RideConstructionInvalidateCurrentTrack();
if (!_currentlyShowingBrakeOrBoosterSpeed)
{
- _currentTrackRollEnd = TrackRoll::Left;
+ _currentTrackRollEnd = TrackRoll::left;
_currentTrackPrice = kMoney64Undefined;
WindowRideConstructionUpdateActiveElements();
}
@@ -1433,7 +1434,7 @@ namespace OpenRCT2::Ui::Windows
RideConstructionInvalidateCurrentTrack();
if (!_currentlyShowingBrakeOrBoosterSpeed)
{
- _currentTrackRollEnd = TrackRoll::None;
+ _currentTrackRollEnd = TrackRoll::none;
_currentTrackPrice = kMoney64Undefined;
WindowRideConstructionUpdateActiveElements();
}
@@ -1460,7 +1461,7 @@ namespace OpenRCT2::Ui::Windows
RideConstructionInvalidateCurrentTrack();
if (!_currentlyShowingBrakeOrBoosterSpeed)
{
- _currentTrackRollEnd = TrackRoll::Right;
+ _currentTrackRollEnd = TrackRoll::right;
_currentTrackPrice = kMoney64Undefined;
WindowRideConstructionUpdateActiveElements();
}
@@ -1547,18 +1548,18 @@ namespace OpenRCT2::Ui::Windows
OpenRCT2::TrackElemType trackPiece = _specialElementDropdownState.Elements[selectedIndex].TrackType;
switch (trackPiece)
{
- case TrackElemType::EndStation:
- case TrackElemType::SBendLeft:
- case TrackElemType::SBendRight:
- _currentTrackPitchEnd = TrackPitch::None;
+ case TrackElemType::endStation:
+ case TrackElemType::sBendLeft:
+ case TrackElemType::sBendRight:
+ _currentTrackPitchEnd = TrackPitch::none;
break;
- case TrackElemType::LeftVerticalLoop:
- case TrackElemType::RightVerticalLoop:
- _currentTrackRollEnd = TrackRoll::None;
+ case TrackElemType::leftVerticalLoop:
+ case TrackElemType::rightVerticalLoop:
+ _currentTrackRollEnd = TrackRoll::none;
_currentTrackHasLiftHill = false;
break;
- case TrackElemType::BlockBrakes:
- case TrackElemType::DiagBlockBrakes:
+ case TrackElemType::blockBrakes:
+ case TrackElemType::diagBlockBrakes:
_currentBrakeSpeed = kRCT2DefaultBlockBrakeSpeed;
break;
default:
@@ -1683,9 +1684,9 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_O_TRACK].tooltip = trackDrawerDescriptor.Covered.tooltip;
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
- RenderTarget clippedRT;
+ Drawing::RenderTarget clippedRT;
Widget* widget;
int32_t widgetWidth, widgetHeight;
@@ -1706,7 +1707,7 @@ namespace OpenRCT2::Ui::Windows
// Draw track piece
auto screenCoords = ScreenCoordsXY{ windowPos.x + widget->left + 1, windowPos.y + widget->top + 1 };
widgetWidth = widget->width() - 2;
- widgetHeight = widget->height() - 1;
+ widgetHeight = widget->height() - 2;
if (ClipDrawPixelInfo(clippedRT, rt, screenCoords, widgetWidth, widgetHeight))
{
DrawTrackPiece(
@@ -1834,11 +1835,11 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_SLOPE_UP].type = WidgetType::flatBtn;
}
if ((IsTrackEnabled(TrackGroup::helixDownBankedHalf) || IsTrackEnabled(TrackGroup::helixUpBankedHalf))
- && _currentTrackRollEnd != TrackRoll::None && _currentTrackPitchEnd == TrackPitch::None)
+ && _currentTrackRollEnd != TrackRoll::none && _currentTrackPitchEnd == TrackPitch::none)
{
- const bool hasHelixEquivalent = _currentlySelectedTrack == TrackCurve::Left
- || _currentlySelectedTrack == TrackCurve::Right || _currentlySelectedTrack == TrackCurve::LeftSmall
- || _currentlySelectedTrack == TrackCurve::RightSmall;
+ const bool hasHelixEquivalent = _currentlySelectedTrack == TrackCurve::left
+ || _currentlySelectedTrack == TrackCurve::right || _currentlySelectedTrack == TrackCurve::leftSmall
+ || _currentlySelectedTrack == TrackCurve::rightSmall;
if (hasHelixEquivalent)
{
// Enable helix
@@ -1859,7 +1860,7 @@ namespace OpenRCT2::Ui::Windows
const auto& gameState = getGameState();
if (currentRide->getRideTypeDescriptor().HasFlag(RtdFlag::upInclineRequiresLift)
- && (_currentTrackPitchEnd == TrackPitch::Up25 || _currentTrackPitchEnd == TrackPitch::Up60)
+ && (_currentTrackPitchEnd == TrackPitch::up25 || _currentTrackPitchEnd == TrackPitch::up60)
&& !gameState.cheats.enableAllDrawableTrackPieces)
{
_currentTrackHasLiftHill = true;
@@ -1888,19 +1889,19 @@ namespace OpenRCT2::Ui::Windows
if (IsTrackEnabled(TrackGroup::slopeVertical) && !TrackPieceDirectionIsDiagonal(_currentTrackPieceDirection))
{
- if (_previousTrackPitchEnd == TrackPitch::Up60 || _previousTrackPitchEnd == TrackPitch::Up90)
+ if (_previousTrackPitchEnd == TrackPitch::up60 || _previousTrackPitchEnd == TrackPitch::up90)
{
widgets[WIDX_SLOPE_UP_VERTICAL].type = WidgetType::flatBtn;
}
- else if (_previousTrackPitchEnd == TrackPitch::Down60 || _previousTrackPitchEnd == TrackPitch::Down90)
+ else if (_previousTrackPitchEnd == TrackPitch::down60 || _previousTrackPitchEnd == TrackPitch::down90)
{
widgets[WIDX_SLOPE_DOWN_VERTICAL].type = WidgetType::flatBtn;
}
}
if ((IsTrackEnabled(TrackGroup::helixDownUnbankedQuarter) || IsTrackEnabled(TrackGroup::helixUpUnbankedQuarter))
- && _currentTrackPitchEnd == TrackPitch::None && _currentTrackRollEnd == TrackRoll::None
- && (_currentlySelectedTrack == TrackCurve::Left || _currentlySelectedTrack == TrackCurve::Right))
+ && _currentTrackPitchEnd == TrackPitch::none && _currentTrackRollEnd == TrackRoll::none
+ && (_currentlySelectedTrack == TrackCurve::left || _currentlySelectedTrack == TrackCurve::right))
{
widgets[WIDX_SLOPE_DOWN_STEEP].image = ImageId(SPR_RIDE_CONSTRUCTION_HELIX_DOWN);
widgets[WIDX_SLOPE_DOWN_STEEP].tooltip = STR_RIDE_CONSTRUCTION_HELIX_DOWN_TIP;
@@ -1927,11 +1928,11 @@ namespace OpenRCT2::Ui::Windows
if (IsTrackEnabled(TrackGroup::helixDownBankedQuarter) || IsTrackEnabled(TrackGroup::helixUpBankedQuarter)
|| IsTrackEnabled(TrackGroup::helixDownBankedHalf) || IsTrackEnabled(TrackGroup::helixUpBankedHalf))
{
- const bool hasHelixEquivalent = _currentlySelectedTrack == TrackCurve::Left
- || _currentlySelectedTrack == TrackCurve::Right || _currentlySelectedTrack == TrackCurve::LeftSmall
- || _currentlySelectedTrack == TrackCurve::RightSmall;
+ const bool hasHelixEquivalent = _currentlySelectedTrack == TrackCurve::left
+ || _currentlySelectedTrack == TrackCurve::right || _currentlySelectedTrack == TrackCurve::leftSmall
+ || _currentlySelectedTrack == TrackCurve::rightSmall;
- if (hasHelixEquivalent && _currentTrackPitchEnd == TrackPitch::None && _currentTrackRollEnd != TrackRoll::None)
+ if (hasHelixEquivalent && _currentTrackPitchEnd == TrackPitch::none && _currentTrackRollEnd != TrackRoll::none)
{
widgets[WIDX_SLOPE_DOWN_STEEP].image = ImageId(SPR_RIDE_CONSTRUCTION_HELIX_DOWN);
widgets[WIDX_SLOPE_DOWN_STEEP].tooltip = STR_RIDE_CONSTRUCTION_HELIX_DOWN_TIP;
@@ -1989,9 +1990,9 @@ namespace OpenRCT2::Ui::Windows
|| TrackTypeIsBooster(_currentlySelectedTrack.trackType);
// only necessary because TD6 writes speed and seat rotation to the same bits. Remove for new track design format.
- bool trackHasSpeedAndSeatRotation = _selectedTrackType == TrackElemType::BlockBrakes
- || _currentlySelectedTrack == TrackElemType::BlockBrakes || _selectedTrackType > TrackElemType::HighestAlias
- || _currentlySelectedTrack.trackType > TrackElemType::HighestAlias;
+ bool trackHasSpeedAndSeatRotation = _selectedTrackType == TrackElemType::blockBrakes
+ || _currentlySelectedTrack == TrackElemType::blockBrakes || _selectedTrackType > TrackElemType::highestAlias
+ || _currentlySelectedTrack.trackType > TrackElemType::highestAlias;
bool rideHasSeatRotation = rtd.HasFlag(RtdFlag::hasSeatRotation);
@@ -2130,31 +2131,31 @@ namespace OpenRCT2::Ui::Windows
{
switch (_currentlySelectedTrack.curve)
{
- case TrackCurve::None:
+ case TrackCurve::none:
widgetIndex = WIDX_STRAIGHT;
break;
- case TrackCurve::Left:
+ case TrackCurve::left:
widgetIndex = WIDX_LEFT_CURVE;
break;
- case TrackCurve::Right:
+ case TrackCurve::right:
widgetIndex = WIDX_RIGHT_CURVE;
break;
- case TrackCurve::LeftSmall:
+ case TrackCurve::leftSmall:
widgetIndex = WIDX_LEFT_CURVE_SMALL;
break;
- case TrackCurve::RightSmall:
+ case TrackCurve::rightSmall:
widgetIndex = WIDX_RIGHT_CURVE_SMALL;
break;
- case TrackCurve::LeftVerySmall:
+ case TrackCurve::leftVerySmall:
widgetIndex = WIDX_LEFT_CURVE_VERY_SMALL;
break;
- case TrackCurve::RightVerySmall:
+ case TrackCurve::rightVerySmall:
widgetIndex = WIDX_RIGHT_CURVE_VERY_SMALL;
break;
- case TrackCurve::LeftLarge:
+ case TrackCurve::leftLarge:
widgetIndex = WIDX_LEFT_CURVE_LARGE;
break;
- case TrackCurve::RightLarge:
+ case TrackCurve::rightLarge:
widgetIndex = WIDX_RIGHT_CURVE_LARGE;
break;
}
@@ -2164,22 +2165,22 @@ namespace OpenRCT2::Ui::Windows
switch (_currentTrackPitchEnd)
{
- case TrackPitch::Down90:
+ case TrackPitch::down90:
widgetIndex = WIDX_SLOPE_DOWN_VERTICAL;
break;
- case TrackPitch::Down60:
+ case TrackPitch::down60:
widgetIndex = WIDX_SLOPE_DOWN_STEEP;
break;
- case TrackPitch::Down25:
+ case TrackPitch::down25:
widgetIndex = WIDX_SLOPE_DOWN;
break;
- case TrackPitch::Up25:
+ case TrackPitch::up25:
widgetIndex = WIDX_SLOPE_UP;
break;
- case TrackPitch::Up60:
+ case TrackPitch::up60:
widgetIndex = WIDX_SLOPE_UP_STEEP;
break;
- case TrackPitch::Up90:
+ case TrackPitch::up90:
widgetIndex = WIDX_SLOPE_UP_VERTICAL;
break;
default:
@@ -2203,10 +2204,10 @@ namespace OpenRCT2::Ui::Windows
}
switch (_currentTrackRollEnd)
{
- case TrackRoll::Left:
+ case TrackRoll::left:
widgetIndex = WIDX_BANK_LEFT;
break;
- case TrackRoll::None:
+ case TrackRoll::none:
widgetIndex = WIDX_BANK_STRAIGHT;
break;
default:
@@ -2242,7 +2243,6 @@ namespace OpenRCT2::Ui::Windows
int32_t trackDirection;
CoordsXYZ trackPos{};
- MapInvalidateMapSelectionTiles();
gMapSelectFlags.set(MapSelectFlag::enableConstruct);
gMapSelectFlags.set(MapSelectFlag::green);
@@ -2250,7 +2250,7 @@ namespace OpenRCT2::Ui::Windows
{
case RideConstructionState::State0:
trackDirection = _currentTrackPieceDirection;
- trackType = TrackElemType::Flat;
+ trackType = TrackElemType::flat;
trackPos = _currentTrackBegin;
break;
case RideConstructionState::Selected:
@@ -2259,13 +2259,13 @@ namespace OpenRCT2::Ui::Windows
trackPos = _currentTrackBegin;
break;
case RideConstructionState::EntranceExit:
- gMapSelectionTiles.clear();
+ MapSelection::clearSelectedTiles();
return;
default:
if (WindowRideConstructionUpdateState(&trackType, &trackDirection, nullptr, nullptr, &trackPos, nullptr))
{
trackDirection = _currentTrackPieceDirection;
- trackType = OpenRCT2::TrackElemType::Flat;
+ trackType = OpenRCT2::TrackElemType::flat;
trackPos = _currentTrackBegin;
}
break;
@@ -2274,7 +2274,6 @@ namespace OpenRCT2::Ui::Windows
if (GetRide(_currentRideIndex))
{
selectMapTiles(trackType, trackDirection, trackPos);
- MapInvalidateMapSelectionTiles();
}
}
@@ -2289,13 +2288,13 @@ namespace OpenRCT2::Ui::Windows
const auto& ted = GetTrackElementDescriptor(trackType);
trackDirection &= 3;
- gMapSelectionTiles.clear();
+ MapSelection::clearSelectedTiles();
for (uint8_t i = 0; i < ted.numSequences; i++)
{
CoordsXY offsets = { ted.sequences[i].clearance.x, ted.sequences[i].clearance.y };
CoordsXY currentTileCoords = tileCoords + offsets.Rotate(trackDirection);
- gMapSelectionTiles.push_back(currentTileCoords);
+ MapSelection::addSelectedTile(currentTileCoords);
}
}
@@ -2338,18 +2337,18 @@ namespace OpenRCT2::Ui::Windows
}
auto res = GameActions::Execute(&trackPlaceAction, getGameState());
- if (res.Error != GameActions::Status::Ok)
+ if (res.error != GameActions::Status::ok)
{
_trackPlaceCost = kMoney64Undefined;
- _trackPlaceErrorMessage = std::get(res.ErrorMessage);
+ _trackPlaceErrorMessage = std::get(res.errorMessage);
}
else
{
- _trackPlaceCost = res.Cost;
+ _trackPlaceCost = res.cost;
_trackPlaceErrorMessage = kStringIdNone;
}
- if (res.Error != GameActions::Status::Ok)
+ if (res.error != GameActions::Status::ok)
{
return;
}
@@ -2361,7 +2360,7 @@ namespace OpenRCT2::Ui::Windows
_currentTrackSelectionFlags.set(TrackSelectionFlag::trackPlaceActionQueued);
}
- const auto resultData = res.GetData();
+ const auto resultData = res.getData();
if (resultData.GroundFlags & ELEMENT_IS_UNDERGROUND)
{
ViewportSetVisibility(ViewportVisibility::undergroundViewOn);
@@ -2369,7 +2368,7 @@ namespace OpenRCT2::Ui::Windows
const bool helixSelected = (_currentlySelectedTrack.isTrackType)
&& TrackTypeIsHelix(_currentlySelectedTrack.trackType);
- if (helixSelected || (_currentTrackPitchEnd != TrackPitch::None))
+ if (helixSelected || (_currentTrackPitchEnd != TrackPitch::none))
{
ViewportSetVisibility(ViewportVisibility::trackHeights);
}
@@ -2461,7 +2460,7 @@ namespace OpenRCT2::Ui::Windows
{ _currentTrackBegin.x, _currentTrackBegin.y, _currentTrackBegin.z, currentDirection });
trackRemoveAction.SetCallback([=](const GameActions::GameAction* ga, const GameActions::Result* result) {
- if (result->Error != GameActions::Status::Ok)
+ if (result->error != GameActions::Status::ok)
{
WindowRideConstructionUpdateActiveElements();
}
@@ -2509,7 +2508,7 @@ namespace OpenRCT2::Ui::Windows
gRideEntranceExitPlaceType = ENTRANCE_TYPE_RIDE_ENTRANCE;
gRideEntranceExitPlaceRideIndex = _currentRideIndex;
gRideEntranceExitPlaceStationIndex = StationIndex::FromUnderlying(0);
- gInputFlags.set(InputFlag::unk6);
+ gInputFlags.set(InputFlag::allowRightMouseRemoval);
RideConstructionInvalidateCurrentTrack();
if (_rideConstructionState != RideConstructionState::EntranceExit)
{
@@ -2535,7 +2534,7 @@ namespace OpenRCT2::Ui::Windows
gRideEntranceExitPlaceType = ENTRANCE_TYPE_RIDE_EXIT;
gRideEntranceExitPlaceRideIndex = _currentRideIndex;
gRideEntranceExitPlaceStationIndex = StationIndex::FromUnderlying(0);
- gInputFlags.set(InputFlag::unk6);
+ gInputFlags.set(InputFlag::allowRightMouseRemoval);
RideConstructionInvalidateCurrentTrack();
if (_rideConstructionState != RideConstructionState::EntranceExit)
{
@@ -2554,9 +2553,9 @@ namespace OpenRCT2::Ui::Windows
{
switch (slope)
{
- case TrackPitch::None:
- case TrackPitch::Up25:
- case TrackPitch::Up60:
+ case TrackPitch::none:
+ case TrackPitch::up25:
+ case TrackPitch::up60:
break;
default:
_currentTrackHasLiftHill = false;
@@ -2597,7 +2596,7 @@ namespace OpenRCT2::Ui::Windows
TrackElemType trackPiece = element.TrackType;
// Separate elements logically
- if (trackPiece == TrackElemType::None)
+ if (trackPiece == TrackElemType::none)
{
gDropdown.items[i++] = Dropdown::Separator();
continue;
@@ -2632,8 +2631,8 @@ namespace OpenRCT2::Ui::Windows
ddWidth -= 30;
WindowDropdownShowTextCustomWidth(
- { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, 0,
- elements.size(), ddWidth, targetColumnSize);
+ { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height(), colours[1], 0, 0, elements.size(),
+ ddWidth, targetColumnSize);
for (size_t j = 0; j < elements.size(); j++)
{
@@ -2653,7 +2652,6 @@ namespace OpenRCT2::Ui::Windows
void ToolDownEntranceExit(const ScreenCoordsXY& screenCoords)
{
RideConstructionInvalidateCurrentTrack();
- MapInvalidateSelectionRect();
gMapSelectFlags.unset(MapSelectFlag::enable);
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
@@ -2667,10 +2665,10 @@ namespace OpenRCT2::Ui::Windows
rideEntranceExitPlaceAction.SetCallback(
[=, this](const GameActions::GameAction* ga, const GameActions::Result* result) {
- if (result->Error != GameActions::Status::Ok)
+ if (result->error != GameActions::Status::ok)
return;
- OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::placeItem, result->Position);
+ OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::placeItem, result->position);
auto* windowMgr = GetWindowManager();
@@ -2700,7 +2698,7 @@ namespace OpenRCT2::Ui::Windows
}
void DrawTrackPiece(
- RenderTarget& rt, RideId rideIndex, OpenRCT2::TrackElemType trackType, int32_t trackDirection,
+ Drawing::RenderTarget& rt, RideId rideIndex, OpenRCT2::TrackElemType trackType, int32_t trackDirection,
SelectedLiftAndInverted liftHillAndInvertedState, int32_t widgetWidth, int32_t widgetHeight)
{
auto currentRide = GetRide(rideIndex);
@@ -2741,7 +2739,7 @@ namespace OpenRCT2::Ui::Windows
}
void DrawTrackPieceHelper(
- RenderTarget& rt, RideId rideIndex, OpenRCT2::TrackElemType trackType, int32_t trackDirection,
+ Drawing::RenderTarget& rt, RideId rideIndex, OpenRCT2::TrackElemType trackType, int32_t trackDirection,
SelectedLiftAndInverted liftHillAndInvertedState, const CoordsXY& originCoords, int32_t originZ)
{
TileElement tempSideTrackTileElement{ 0x80, 0x8F, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
@@ -2953,7 +2951,7 @@ namespace OpenRCT2::Ui::Windows
static void RideConstructPlacedForwardGameActionCallback(
const GameActions::GameAction* ga, const GameActions::Result* result)
{
- if (result->Error != GameActions::Status::Ok)
+ if (result->error != GameActions::Status::ok)
{
WindowRideConstructionUpdateActiveElements();
return;
@@ -3000,7 +2998,7 @@ namespace OpenRCT2::Ui::Windows
static void RideConstructPlacedBackwardGameActionCallback(
const GameActions::GameAction* ga, const GameActions::Result* result)
{
- if (result->Error != GameActions::Status::Ok)
+ if (result->error != GameActions::Status::ok)
{
WindowRideConstructionUpdateActiveElements();
return;
@@ -3178,7 +3176,7 @@ namespace OpenRCT2::Ui::Windows
window->updateMapSelection();
- _selectedTrackType = TrackElemType::None;
+ _selectedTrackType = TrackElemType::none;
if (_rideConstructionState == RideConstructionState::Selected)
{
TileElement* tileElement;
@@ -3261,7 +3259,16 @@ namespace OpenRCT2::Ui::Windows
rideIndex, type, direction, liftHillAndAlternativeState, trackPos);
WindowRideConstructionUpdateActiveElements();
- if (!(gMapSelectFlags.has(MapSelectFlag::enable)))
+ gMapSelectArrowPosition = _currentTrackBegin;
+ Direction arrowDirection = _currentTrackPieceDirection;
+ // diagonal pieces trigger this
+ if (arrowDirection >= 4)
+ arrowDirection += 4;
+ if (_rideConstructionState == RideConstructionState::Back)
+ arrowDirection = DirectionReverse(arrowDirection);
+ gMapSelectArrowDirection = arrowDirection;
+
+ if (!gMapSelectFlags.has(MapSelectFlag::enable))
{
// Set height to where the next track piece would begin
VirtualFloorSetHeight(_currentTrackBegin.z);
@@ -3275,20 +3282,10 @@ namespace OpenRCT2::Ui::Windows
_rideConstructionNextArrowPulse = curTime + kArrowPulseDuration;
_currentTrackSelectionFlags.flip(TrackSelectionFlag::arrow);
- trackPos = _currentTrackBegin;
- direction = _currentTrackPieceDirection;
- type = _currentTrackPieceType;
- // diagonal pieces trigger this
- if (direction >= 4)
- direction += 4;
- if (_rideConstructionState == RideConstructionState::Back)
- direction = DirectionReverse(direction);
- gMapSelectArrowPosition = trackPos;
- gMapSelectArrowDirection = direction;
+
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
if (_currentTrackSelectionFlags.has(TrackSelectionFlag::arrow))
gMapSelectFlags.set(MapSelectFlag::enableArrow);
- MapInvalidateTileFull(trackPos);
break;
}
case RideConstructionState::Selected:
@@ -3338,7 +3335,6 @@ namespace OpenRCT2::Ui::Windows
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
if (_currentTrackSelectionFlags.has(TrackSelectionFlag::arrow))
gMapSelectFlags.set(MapSelectFlag::enableArrow);
- MapInvalidateTileFull(trackPos);
break;
}
default:
@@ -3354,7 +3350,6 @@ namespace OpenRCT2::Ui::Windows
{
int32_t z;
- MapInvalidateMapSelectionTiles();
gMapSelectFlags.unset(MapSelectFlag::enable);
gMapSelectFlags.unset(MapSelectFlag::enableConstruct);
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
@@ -3362,7 +3357,6 @@ namespace OpenRCT2::Ui::Windows
if (!mapCoords)
{
RideConstructionInvalidateCurrentTrack();
- MapInvalidateMapSelectionTiles();
return;
}
@@ -3375,8 +3369,8 @@ namespace OpenRCT2::Ui::Windows
gMapSelectFlags.unset(MapSelectFlag::green);
gMapSelectArrowPosition = CoordsXYZ{ *mapCoords, z };
gMapSelectArrowDirection = _currentTrackPieceDirection;
- gMapSelectionTiles.clear();
- gMapSelectionTiles.push_back(*mapCoords);
+ MapSelection::clearSelectedTiles();
+ MapSelection::addSelectedTile(*mapCoords);
RideId rideIndex;
OpenRCT2::TrackElemType trackType;
@@ -3386,7 +3380,6 @@ namespace OpenRCT2::Ui::Windows
&trackType, &trackDirection, &rideIndex, &liftHillAndAlternativeState, nullptr, nullptr))
{
RideConstructionInvalidateCurrentTrack();
- MapInvalidateMapSelectionTiles();
return;
}
_currentTrackPieceType = trackType;
@@ -3418,7 +3411,7 @@ namespace OpenRCT2::Ui::Windows
if (gMapSelectFlags.has(MapSelectFlag::enableConstruct))
{
int32_t highestZ = 0;
- for (const auto& selectedTile : gMapSelectionTiles)
+ for (const auto& selectedTile : MapSelection::getSelectedTiles())
{
if (MapIsLocationValid(selectedTile))
{
@@ -3446,13 +3439,12 @@ namespace OpenRCT2::Ui::Windows
_currentTrackBegin.z = z;
if (_currentTrackSelectionFlags.has(TrackSelectionFlag::track) && _currentTrackBegin == _previousTrackPiece)
{
- MapInvalidateMapSelectionTiles();
return;
}
_previousTrackPiece = _currentTrackBegin;
// search for appropriate z value for ghost, up to max ride height
- int numAttempts = (z <= MAX_TRACK_HEIGHT ? ((MAX_TRACK_HEIGHT - z) / kCoordsZStep + 1) : 2);
+ int numAttempts = (z <= kMaximumTrackHeight ? ((kMaximumTrackHeight - z) / kCoordsZStep + 1) : 2);
if (rtd.specialType == RtdSpecialType::maze)
{
@@ -3475,7 +3467,6 @@ namespace OpenRCT2::Ui::Windows
auto intent = Intent(INTENT_ACTION_UPDATE_MAZE_CONSTRUCTION);
ContextBroadcastIntent(&intent);
- MapInvalidateMapSelectionTiles();
return;
}
@@ -3564,7 +3555,6 @@ namespace OpenRCT2::Ui::Windows
}
WindowRideConstructionUpdateActiveElements();
- MapInvalidateMapSelectionTiles();
}
/**
@@ -3573,8 +3563,6 @@ namespace OpenRCT2::Ui::Windows
*/
void RideConstructionToolupdateEntranceExit(const ScreenCoordsXY& screenCoords)
{
- MapInvalidateSelectionRect();
- MapInvalidateMapSelectionTiles();
gMapSelectFlags.unset(MapSelectFlag::enable);
gMapSelectFlags.unset(MapSelectFlag::enableConstruct);
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
@@ -3591,7 +3579,6 @@ namespace OpenRCT2::Ui::Windows
gMapSelectPositionB = entranceOrExitCoords;
gMapSelectArrowPosition = entranceOrExitCoords;
gMapSelectArrowDirection = DirectionReverse(entranceOrExitCoords.direction);
- MapInvalidateSelectionRect();
entranceOrExitCoords.direction = DirectionReverse(gRideEntranceExitPlaceDirection);
StationIndex stationNum = gRideEntranceExitPlaceStationIndex;
@@ -3619,7 +3606,6 @@ namespace OpenRCT2::Ui::Windows
WindowBase* w;
- MapInvalidateMapSelectionTiles();
RideConstructionInvalidateCurrentTrack();
CoordsXYZ mapCoords{};
@@ -3636,7 +3622,7 @@ namespace OpenRCT2::Ui::Windows
highestZ = 0;
if (gMapSelectFlags.has(MapSelectFlag::enableConstruct))
{
- for (const auto& selectedTile : gMapSelectionTiles)
+ for (const auto& selectedTile : MapSelection::getSelectedTiles())
{
if (!MapIsLocationValid(selectedTile))
continue;
@@ -3689,7 +3675,7 @@ namespace OpenRCT2::Ui::Windows
}
// search for z value to build at, up to max ride height
- int numAttempts = (z <= MAX_TRACK_HEIGHT ? ((MAX_TRACK_HEIGHT - z) / kCoordsZStep + 1) : 2);
+ int numAttempts = (z <= kMaximumTrackHeight ? ((kMaximumTrackHeight - z) / kCoordsZStep + 1) : 2);
const auto& rtd = ride->getRideTypeDescriptor();
if (rtd.specialType == RtdSpecialType::maze)
@@ -3712,25 +3698,25 @@ namespace OpenRCT2::Ui::Windows
gDisableErrorWindowSound = true;
auto gameAction = GameActions::MazeSetTrackAction(
- CoordsXYZD{ _currentTrackBegin, 0 }, true, _currentRideIndex, GC_SET_MAZE_TRACK_BUILD);
+ CoordsXYZD{ _currentTrackBegin, 0 }, true, _currentRideIndex, MazeBuildMode::build);
auto mazeSetTrackResult = GameActions::Execute(&gameAction, getGameState());
- if (mazeSetTrackResult.Error == GameActions::Status::Ok)
+ if (mazeSetTrackResult.error == GameActions::Status::ok)
{
- _trackPlaceCost = mazeSetTrackResult.Cost;
+ _trackPlaceCost = mazeSetTrackResult.cost;
_trackPlaceErrorMessage = kStringIdNone;
}
else
{
_trackPlaceCost = kMoney64Undefined;
- _trackPlaceErrorMessage = std::get(mazeSetTrackResult.ErrorMessage);
+ _trackPlaceErrorMessage = std::get(mazeSetTrackResult.errorMessage);
}
gDisableErrorWindowSound = false;
- if (mazeSetTrackResult.Error != GameActions::Status::Ok)
+ if (mazeSetTrackResult.error != GameActions::Status::ok)
{
_rideConstructionState = RideConstructionState::Place;
- StringId errorText = std::get(mazeSetTrackResult.ErrorMessage);
+ StringId errorText = std::get(mazeSetTrackResult.errorMessage);
z -= 8;
if (errorText == STR_NOT_ENOUGH_CASH_REQUIRES || errorText == STR_CAN_ONLY_BUILD_THIS_UNDERWATER
|| errorText == STR_CAN_ONLY_BUILD_THIS_ON_WATER || errorText == STR_RIDE_CANT_BUILD_THIS_UNDERWATER
@@ -3742,7 +3728,7 @@ namespace OpenRCT2::Ui::Windows
if (w != nullptr)
{
ToolSet(*w, WIDX_CONSTRUCT, Tool::crosshair);
- gInputFlags.set(InputFlag::unk6);
+ gInputFlags.set(InputFlag::allowRightMouseRemoval);
_trackPlaceCtrlState = false;
_trackPlaceShiftState = false;
}
@@ -3837,14 +3823,14 @@ namespace OpenRCT2::Ui::Windows
switch (_currentlySelectedTrack.curve)
{
- case TrackCurve::LeftSmall:
+ case TrackCurve::leftSmall:
if (!widgetIsDisabled(*w, WIDX_LEFT_CURVE_VERY_SMALL)
&& w->widgets[WIDX_LEFT_CURVE_VERY_SMALL].type != WidgetType::empty)
{
w->onMouseDown(WIDX_LEFT_CURVE_VERY_SMALL);
}
break;
- case TrackCurve::Left:
+ case TrackCurve::left:
if (!widgetIsDisabled(*w, WIDX_LEFT_CURVE_SMALL) && w->widgets[WIDX_LEFT_CURVE_SMALL].type != WidgetType::empty)
{
w->onMouseDown(WIDX_LEFT_CURVE_SMALL);
@@ -3860,7 +3846,7 @@ namespace OpenRCT2::Ui::Windows
return;
}
break;
- case TrackCurve::LeftLarge:
+ case TrackCurve::leftLarge:
if (!widgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_LEFT_CURVE].type != WidgetType::empty)
{
w->onMouseDown(WIDX_LEFT_CURVE);
@@ -3881,7 +3867,7 @@ namespace OpenRCT2::Ui::Windows
return;
}
break;
- case TrackCurve::None:
+ case TrackCurve::none:
if (!widgetIsDisabled(*w, WIDX_LEFT_CURVE_LARGE) && w->widgets[WIDX_LEFT_CURVE_LARGE].type != WidgetType::empty)
{
w->onMouseDown(WIDX_LEFT_CURVE_LARGE);
@@ -3906,7 +3892,7 @@ namespace OpenRCT2::Ui::Windows
return;
}
break;
- case TrackCurve::RightLarge:
+ case TrackCurve::rightLarge:
if (!widgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WidgetType::empty)
{
w->onMouseDown(WIDX_STRAIGHT);
@@ -3936,7 +3922,7 @@ namespace OpenRCT2::Ui::Windows
return;
}
break;
- case TrackCurve::Right:
+ case TrackCurve::right:
if (!widgetIsDisabled(*w, WIDX_RIGHT_CURVE_LARGE)
&& w->widgets[WIDX_RIGHT_CURVE_LARGE].type != WidgetType::empty)
{
@@ -3971,7 +3957,7 @@ namespace OpenRCT2::Ui::Windows
return;
}
break;
- case TrackCurve::RightSmall:
+ case TrackCurve::rightSmall:
if (!widgetIsDisabled(*w, WIDX_RIGHT_CURVE) && w->widgets[WIDX_RIGHT_CURVE].type != WidgetType::empty)
{
w->onMouseDown(WIDX_RIGHT_CURVE);
@@ -4011,7 +3997,7 @@ namespace OpenRCT2::Ui::Windows
return;
}
break;
- case TrackCurve::RightVerySmall:
+ case TrackCurve::rightVerySmall:
if (!widgetIsDisabled(*w, WIDX_RIGHT_CURVE_SMALL)
&& w->widgets[WIDX_RIGHT_CURVE_SMALL].type != WidgetType::empty)
{
@@ -4056,7 +4042,7 @@ namespace OpenRCT2::Ui::Windows
return;
}
break;
- case TrackCurve::LeftVerySmall:
+ case TrackCurve::leftVerySmall:
break;
}
}
@@ -4075,14 +4061,14 @@ namespace OpenRCT2::Ui::Windows
switch (_currentlySelectedTrack.curve)
{
- case TrackCurve::RightSmall:
+ case TrackCurve::rightSmall:
if (!widgetIsDisabled(*w, WIDX_RIGHT_CURVE_VERY_SMALL)
&& w->widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type != WidgetType::empty)
{
w->onMouseDown(WIDX_RIGHT_CURVE_VERY_SMALL);
}
break;
- case TrackCurve::Right:
+ case TrackCurve::right:
if (!widgetIsDisabled(*w, WIDX_RIGHT_CURVE_SMALL)
&& w->widgets[WIDX_RIGHT_CURVE_SMALL].type != WidgetType::empty)
{
@@ -4099,7 +4085,7 @@ namespace OpenRCT2::Ui::Windows
return;
}
break;
- case TrackCurve::RightLarge:
+ case TrackCurve::rightLarge:
if (!widgetIsDisabled(*w, WIDX_RIGHT_CURVE) && w->widgets[WIDX_RIGHT_CURVE].type != WidgetType::empty)
{
w->onMouseDown(WIDX_RIGHT_CURVE);
@@ -4121,7 +4107,7 @@ namespace OpenRCT2::Ui::Windows
return;
}
break;
- case TrackCurve::None:
+ case TrackCurve::none:
if (!widgetIsDisabled(*w, WIDX_RIGHT_CURVE_LARGE)
&& w->widgets[WIDX_RIGHT_CURVE_LARGE].type != WidgetType::empty)
{
@@ -4148,7 +4134,7 @@ namespace OpenRCT2::Ui::Windows
return;
}
break;
- case TrackCurve::LeftLarge:
+ case TrackCurve::leftLarge:
if (!widgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WidgetType::empty)
{
w->onMouseDown(WIDX_STRAIGHT);
@@ -4180,7 +4166,7 @@ namespace OpenRCT2::Ui::Windows
return;
}
break;
- case TrackCurve::Left:
+ case TrackCurve::left:
if (!widgetIsDisabled(*w, WIDX_LEFT_CURVE_LARGE) && w->widgets[WIDX_LEFT_CURVE_LARGE].type != WidgetType::empty)
{
w->onMouseDown(WIDX_LEFT_CURVE_LARGE);
@@ -4216,7 +4202,7 @@ namespace OpenRCT2::Ui::Windows
return;
}
break;
- case TrackCurve::LeftSmall:
+ case TrackCurve::leftSmall:
if (!widgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_LEFT_CURVE].type != WidgetType::empty)
{
w->onMouseDown(WIDX_LEFT_CURVE);
@@ -4257,7 +4243,7 @@ namespace OpenRCT2::Ui::Windows
return;
}
break;
- case TrackCurve::LeftVerySmall:
+ case TrackCurve::leftVerySmall:
if (!widgetIsDisabled(*w, WIDX_LEFT_CURVE_SMALL) && w->widgets[WIDX_LEFT_CURVE_SMALL].type != WidgetType::empty)
{
w->onMouseDown(WIDX_LEFT_CURVE_SMALL);
@@ -4302,7 +4288,7 @@ namespace OpenRCT2::Ui::Windows
return;
}
break;
- case TrackCurve::RightVerySmall:
+ case TrackCurve::rightVerySmall:
break;
}
}
@@ -4349,20 +4335,20 @@ namespace OpenRCT2::Ui::Windows
switch (_currentTrackPitchEnd)
{
- case TrackPitch::Down60:
+ case TrackPitch::down60:
if (IsTrackEnabled(TrackGroup::slopeVertical) && !widgetIsDisabled(*w, WIDX_SLOPE_DOWN_VERTICAL)
&& w->widgets[WIDX_SLOPE_DOWN_VERTICAL].type != WidgetType::empty)
{
w->onMouseDown(WIDX_SLOPE_DOWN_VERTICAL);
}
break;
- case TrackPitch::Down25:
+ case TrackPitch::down25:
if (!widgetIsDisabled(*w, WIDX_SLOPE_DOWN_STEEP) && w->widgets[WIDX_SLOPE_DOWN_STEEP].type != WidgetType::empty)
{
w->onMouseDown(WIDX_SLOPE_DOWN_STEEP);
}
break;
- case TrackPitch::None:
+ case TrackPitch::none:
if (!widgetIsDisabled(*w, WIDX_SLOPE_DOWN) && w->widgets[WIDX_SLOPE_DOWN].type != WidgetType::empty)
{
w->onMouseDown(WIDX_SLOPE_DOWN);
@@ -4381,7 +4367,7 @@ namespace OpenRCT2::Ui::Windows
return;
}
break;
- case TrackPitch::Up25:
+ case TrackPitch::up25:
if (!widgetIsDisabled(*w, WIDX_LEVEL) && w->widgets[WIDX_LEVEL].type != WidgetType::empty)
{
w->onMouseDown(WIDX_LEVEL);
@@ -4400,7 +4386,7 @@ namespace OpenRCT2::Ui::Windows
return;
}
break;
- case TrackPitch::Up60:
+ case TrackPitch::up60:
if (!widgetIsDisabled(*w, WIDX_SLOPE_UP) && w->widgets[WIDX_SLOPE_UP].type != WidgetType::empty)
{
w->onMouseDown(WIDX_SLOPE_UP);
@@ -4427,7 +4413,7 @@ namespace OpenRCT2::Ui::Windows
return;
}
break;
- case TrackPitch::Up90:
+ case TrackPitch::up90:
if (IsTrackEnabled(TrackGroup::slopeVertical) && !widgetIsDisabled(*w, WIDX_SLOPE_UP_STEEP)
&& w->widgets[WIDX_SLOPE_UP_VERTICAL].type != WidgetType::empty)
{
@@ -4450,20 +4436,20 @@ namespace OpenRCT2::Ui::Windows
switch (_currentTrackPitchEnd)
{
- case TrackPitch::Up60:
+ case TrackPitch::up60:
if (IsTrackEnabled(TrackGroup::slopeVertical) && !widgetIsDisabled(*w, WIDX_SLOPE_UP_VERTICAL)
&& w->widgets[WIDX_SLOPE_UP_VERTICAL].type != WidgetType::empty)
{
w->onMouseDown(WIDX_SLOPE_UP_VERTICAL);
}
break;
- case TrackPitch::Up25:
+ case TrackPitch::up25:
if (!widgetIsDisabled(*w, WIDX_SLOPE_UP_STEEP) && w->widgets[WIDX_SLOPE_UP_STEEP].type != WidgetType::empty)
{
w->onMouseDown(WIDX_SLOPE_UP_STEEP);
}
break;
- case TrackPitch::None:
+ case TrackPitch::none:
if (!widgetIsDisabled(*w, WIDX_SLOPE_UP) && w->widgets[WIDX_SLOPE_UP].type != WidgetType::empty)
{
w->onMouseDown(WIDX_SLOPE_UP);
@@ -4482,7 +4468,7 @@ namespace OpenRCT2::Ui::Windows
return;
}
break;
- case TrackPitch::Down25:
+ case TrackPitch::down25:
if (!widgetIsDisabled(*w, WIDX_LEVEL) && w->widgets[WIDX_LEVEL].type != WidgetType::empty)
{
w->onMouseDown(WIDX_LEVEL);
@@ -4501,7 +4487,7 @@ namespace OpenRCT2::Ui::Windows
return;
}
break;
- case TrackPitch::Down60:
+ case TrackPitch::down60:
if (!widgetIsDisabled(*w, WIDX_SLOPE_DOWN) && w->widgets[WIDX_SLOPE_DOWN].type != WidgetType::empty)
{
w->onMouseDown(WIDX_SLOPE_DOWN);
@@ -4528,7 +4514,7 @@ namespace OpenRCT2::Ui::Windows
return;
}
break;
- case TrackPitch::Down90:
+ case TrackPitch::down90:
if (IsTrackEnabled(TrackGroup::slopeVertical) && !widgetIsDisabled(*w, WIDX_SLOPE_DOWN_STEEP)
&& w->widgets[WIDX_SLOPE_DOWN_STEEP].type != WidgetType::empty)
{
@@ -4564,13 +4550,13 @@ namespace OpenRCT2::Ui::Windows
switch (_currentTrackRollEnd)
{
- case TrackRoll::None:
+ case TrackRoll::none:
if (!widgetIsDisabled(*w, WIDX_BANK_LEFT) && w->widgets[WIDX_BANK_LEFT].type != WidgetType::empty)
{
w->onMouseDown(WIDX_BANK_LEFT);
}
break;
- case TrackRoll::Right:
+ case TrackRoll::right:
if (!widgetIsDisabled(*w, WIDX_BANK_STRAIGHT) && w->widgets[WIDX_BANK_STRAIGHT].type != WidgetType::empty)
{
w->onMouseDown(WIDX_BANK_STRAIGHT);
@@ -4601,13 +4587,13 @@ namespace OpenRCT2::Ui::Windows
switch (_currentTrackRollEnd)
{
- case TrackRoll::None:
+ case TrackRoll::none:
if (!widgetIsDisabled(*w, WIDX_BANK_RIGHT) && w->widgets[WIDX_BANK_RIGHT].type != WidgetType::empty)
{
w->onMouseDown(WIDX_BANK_RIGHT);
}
break;
- case TrackRoll::Left:
+ case TrackRoll::left:
if (!widgetIsDisabled(*w, WIDX_BANK_STRAIGHT) && w->widgets[WIDX_BANK_STRAIGHT].type != WidgetType::empty)
{
w->onMouseDown(WIDX_BANK_STRAIGHT);
@@ -4715,16 +4701,16 @@ namespace OpenRCT2::Ui::Windows
if (_rideConstructionState2 == RideConstructionState::Selected
|| _rideConstructionState2 == RideConstructionState::Front)
{
- if (type == TrackElemType::MiddleStation || type == TrackElemType::BeginStation)
+ if (type == TrackElemType::middleStation || type == TrackElemType::beginStation)
{
- type = TrackElemType::EndStation;
+ type = TrackElemType::endStation;
}
}
if (_rideConstructionState2 == RideConstructionState::Back)
{
- if (type == TrackElemType::MiddleStation)
+ if (type == TrackElemType::middleStation)
{
- type = TrackElemType::BeginStation;
+ type = TrackElemType::beginStation;
}
}
if (Network::GetMode() == Network::Mode::client)
@@ -4770,31 +4756,30 @@ namespace OpenRCT2::Ui::Windows
const auto& rtd = ride->getRideTypeDescriptor();
if (rtd.specialType == RtdSpecialType::maze)
{
- int32_t flags = GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST;
- auto gameAction = GameActions::MazeSetTrackAction(
- CoordsXYZD{ trackPos, 0 }, true, rideIndex, GC_SET_MAZE_TRACK_BUILD);
+ CommandFlags flags = { CommandFlag::allowDuringPaused, CommandFlag::noSpend, CommandFlag::ghost };
+ auto gameAction = GameActions::MazeSetTrackAction(CoordsXYZD{ trackPos, 0 }, true, rideIndex, MazeBuildMode::build);
gameAction.SetFlags(flags);
auto result = GameActions::Execute(&gameAction, getGameState());
- if (result.Error != GameActions::Status::Ok)
+ if (result.error != GameActions::Status::ok)
return kMoney64Undefined;
_unkF440C5 = { trackPos, static_cast(trackDirection) };
_currentTrackSelectionFlags.set(TrackSelectionFlag::track);
ViewportSetVisibility(ViewportVisibility::undergroundViewOff);
- if (_currentTrackPitchEnd != TrackPitch::None)
+ if (_currentTrackPitchEnd != TrackPitch::none)
ViewportSetVisibility(ViewportVisibility::trackHeights);
- return result.Cost;
+ return result.cost;
}
auto trackPlaceAction = GameActions::TrackPlaceAction(
rideIndex, trackType, ride->type, { trackPos, static_cast(trackDirection) }, 0, 0, 0,
liftHillAndAlternativeState, false);
- trackPlaceAction.SetFlags(GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST);
+ trackPlaceAction.SetFlags({ CommandFlag::allowDuringPaused, CommandFlag::noSpend, CommandFlag::ghost });
// This command must not be sent over the network
auto res = GameActions::Execute(&trackPlaceAction, getGameState());
- if (res.Error != GameActions::Status::Ok)
+ if (res.error != GameActions::Status::ok)
return kMoney64Undefined;
int16_t zBegin{}, zEnd{};
@@ -4813,20 +4798,20 @@ namespace OpenRCT2::Ui::Windows
_unkF440C5 = { trackPos.x, trackPos.y, trackPos.z + zBegin, static_cast(trackDirection) };
_currentTrackSelectionFlags.set(TrackSelectionFlag::track);
- const auto resultData = res.GetData();
+ const auto resultData = res.getData();
const auto visiblity = (resultData.GroundFlags & ELEMENT_IS_UNDERGROUND) ? ViewportVisibility::undergroundViewOn
: ViewportVisibility::undergroundViewOff;
ViewportSetVisibility(visiblity);
- if (_currentTrackPitchEnd != TrackPitch::None)
+ if (_currentTrackPitchEnd != TrackPitch::none)
ViewportSetVisibility(ViewportVisibility::trackHeights);
- if (!(gMapSelectFlags.has(MapSelectFlag::enable)))
+ if (!gMapSelectFlags.has(MapSelectFlag::enable))
{
// Set height to where the next track piece would begin
VirtualFloorSetHeight(trackPos.z - zBegin + zEnd);
}
- return res.Cost;
+ return res.cost;
}
static std::pair WindowRideConstructionUpdateStateGetTrackElement()
@@ -4845,13 +4830,13 @@ namespace OpenRCT2::Ui::Windows
}
auto selectedTrack = _currentlySelectedTrack;
- if (selectedTrack == TrackElemType::None)
+ if (selectedTrack == TrackElemType::none)
{
- return std::make_pair(false, OpenRCT2::TrackElemType::Flat);
+ return std::make_pair(false, OpenRCT2::TrackElemType::flat);
}
bool startsDiagonal = (_currentTrackPieceDirection & (1 << 2)) != 0;
- if (selectedTrack == TrackCurve::LeftLarge || selectedTrack == TrackCurve::RightLarge)
+ if (selectedTrack == TrackCurve::leftLarge || selectedTrack == TrackCurve::rightLarge)
{
if (_rideConstructionState == RideConstructionState::Back)
{
@@ -4863,49 +4848,49 @@ namespace OpenRCT2::Ui::Windows
{
auto trackPiece = GetTrackTypeFromCurve(
selectedTrack.curve, startsDiagonal, startSlope, endSlope, startBank, endBank);
- if (trackPiece != TrackElemType::None)
+ if (trackPiece != TrackElemType::none)
return std::make_pair(true, trackPiece);
else
- return std::make_pair(false, OpenRCT2::TrackElemType::Flat);
+ return std::make_pair(false, OpenRCT2::TrackElemType::flat);
}
auto asTrackType = selectedTrack.trackType;
switch (asTrackType)
{
- case TrackElemType::EndStation:
- case TrackElemType::SBendLeft:
- case TrackElemType::SBendRight:
- if (startSlope != TrackPitch::None || endSlope != TrackPitch::None)
+ case TrackElemType::endStation:
+ case TrackElemType::sBendLeft:
+ case TrackElemType::sBendRight:
+ if (startSlope != TrackPitch::none || endSlope != TrackPitch::none)
{
- return std::make_pair(false, OpenRCT2::TrackElemType::Flat);
+ return std::make_pair(false, OpenRCT2::TrackElemType::flat);
}
- if (startBank != TrackRoll::None || endBank != TrackRoll::None)
+ if (startBank != TrackRoll::none || endBank != TrackRoll::none)
{
- return std::make_pair(false, OpenRCT2::TrackElemType::Flat);
+ return std::make_pair(false, OpenRCT2::TrackElemType::flat);
}
return std::make_pair(true, asTrackType);
- case TrackElemType::LeftVerticalLoop:
- case TrackElemType::RightVerticalLoop:
- if (startBank != TrackRoll::None || endBank != TrackRoll::None)
+ case TrackElemType::leftVerticalLoop:
+ case TrackElemType::rightVerticalLoop:
+ if (startBank != TrackRoll::none || endBank != TrackRoll::none)
{
- return std::make_pair(false, OpenRCT2::TrackElemType::Flat);
+ return std::make_pair(false, OpenRCT2::TrackElemType::flat);
}
if (_rideConstructionState == RideConstructionState::Back)
{
- if (endSlope != TrackPitch::Down25)
+ if (endSlope != TrackPitch::down25)
{
- return std::make_pair(false, OpenRCT2::TrackElemType::Flat);
+ return std::make_pair(false, OpenRCT2::TrackElemType::flat);
}
}
else
{
- if (startSlope != TrackPitch::Up25)
+ if (startSlope != TrackPitch::up25)
{
- return std::make_pair(false, OpenRCT2::TrackElemType::Flat);
+ return std::make_pair(false, OpenRCT2::TrackElemType::flat);
}
}
@@ -4966,20 +4951,20 @@ namespace OpenRCT2::Ui::Windows
{
switch (trackType)
{
- case TrackElemType::FlatToUp60:
- trackType = TrackElemType::FlatToUp60LongBase;
+ case TrackElemType::flatToUp60:
+ trackType = TrackElemType::flatToUp60LongBase;
break;
- case TrackElemType::Up60ToFlat:
- trackType = TrackElemType::Up60ToFlatLongBase;
+ case TrackElemType::up60ToFlat:
+ trackType = TrackElemType::up60ToFlatLongBase;
break;
- case TrackElemType::FlatToDown60:
- trackType = TrackElemType::FlatToDown60LongBase;
+ case TrackElemType::flatToDown60:
+ trackType = TrackElemType::flatToDown60LongBase;
break;
- case TrackElemType::Down60ToFlat:
- trackType = TrackElemType::Down60ToFlatLongBase;
+ case TrackElemType::down60ToFlat:
+ trackType = TrackElemType::down60ToFlatLongBase;
break;
default:
@@ -4991,20 +4976,20 @@ namespace OpenRCT2::Ui::Windows
{
switch (trackType)
{
- case TrackElemType::DiagFlatToUp60:
- trackType = TrackElemType::DiagFlatToUp60LongBase;
+ case TrackElemType::diagFlatToUp60:
+ trackType = TrackElemType::diagFlatToUp60LongBase;
break;
- case TrackElemType::DiagUp60ToFlat:
- trackType = TrackElemType::DiagUp60ToFlatLongBase;
+ case TrackElemType::diagUp60ToFlat:
+ trackType = TrackElemType::diagUp60ToFlatLongBase;
break;
- case TrackElemType::DiagFlatToDown60:
- trackType = TrackElemType::DiagFlatToDown60LongBase;
+ case TrackElemType::diagFlatToDown60:
+ trackType = TrackElemType::diagFlatToDown60LongBase;
break;
- case TrackElemType::DiagDown60ToFlat:
- trackType = TrackElemType::DiagDown60ToFlatLongBase;
+ case TrackElemType::diagDown60ToFlat:
+ trackType = TrackElemType::diagDown60ToFlatLongBase;
break;
default:
@@ -5021,7 +5006,7 @@ namespace OpenRCT2::Ui::Windows
auto coveredVariant = ted.alternativeType;
// this method limits the track element types that can be used
- if (coveredVariant != TrackElemType::None && (availableGroups.get(EnumValue(ted.definition.group))))
+ if (coveredVariant != TrackElemType::none && (availableGroups.get(EnumValue(ted.definition.group))))
{
trackType = coveredVariant;
if (!getGameState().cheats.enableChainLiftOnAllTrack)
@@ -5063,13 +5048,13 @@ namespace OpenRCT2::Ui::Windows
bool turnOffLiftHill = false;
if (!IsTrackEnabled(TrackGroup::liftHillCurve))
{
- if (ted.flags & TRACK_ELEM_FLAG_CURVE_ALLOWS_LIFT)
+ if (ted.flags.has(TrackElementFlag::curveAllowsLift))
{
turnOffLiftHill = true;
}
}
- if (!(ted.flags & TRACK_ELEM_FLAG_ALLOW_LIFT_HILL))
+ if (!ted.flags.has(TrackElementFlag::allowLiftHill))
{
turnOffLiftHill = true;
}
@@ -5079,7 +5064,7 @@ namespace OpenRCT2::Ui::Windows
liftHillAndInvertedState.unset(LiftHillAndInverted::liftHill);
_currentTrackHasLiftHill = false;
- if (trackType == TrackElemType::LeftCurvedLiftHill || trackType == TrackElemType::RightCurvedLiftHill)
+ if (trackType == TrackElemType::leftCurvedLiftHill || trackType == TrackElemType::rightCurvedLiftHill)
{
liftHillAndInvertedState.set(LiftHillAndInverted::liftHill);
}
@@ -5151,7 +5136,7 @@ namespace OpenRCT2::Ui::Windows
const auto& rtd = ride->getRideTypeDescriptor();
if (rtd.specialType == RtdSpecialType::maze)
{
- const int32_t flags = GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST;
+ const CommandFlags flags = { CommandFlag::allowDuringPaused, CommandFlag::noSpend, CommandFlag::ghost };
const CoordsXYZD quadrants[kNumOrthogonalDirections] = {
{ x, y, z, 0 },
{ x, y + 16, z, 1 },
@@ -5160,7 +5145,7 @@ namespace OpenRCT2::Ui::Windows
};
for (const auto& quadrant : quadrants)
{
- auto gameAction = GameActions::MazeSetTrackAction(quadrant, false, rideIndex, GC_SET_MAZE_TRACK_FILL);
+ auto gameAction = GameActions::MazeSetTrackAction(quadrant, false, rideIndex, MazeBuildMode::fill);
gameAction.SetFlags(flags);
auto res = GameActions::Execute(&gameAction, getGameState());
}
@@ -5181,8 +5166,7 @@ namespace OpenRCT2::Ui::Windows
auto trackRemoveAction = GameActions::TrackRemoveAction{
trackType, trackSequence, { next_track.x, next_track.y, z, static_cast(direction) }
};
- trackRemoveAction.SetFlags(
- GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST);
+ trackRemoveAction.SetFlags({ CommandFlag::allowDuringPaused, CommandFlag::noSpend, CommandFlag::ghost });
GameActions::Execute(&trackRemoveAction, getGameState());
}
}
diff --git a/src/openrct2-ui/windows/RideList.cpp b/src/openrct2-ui/windows/RideList.cpp
index bd574be37c..410e481395 100644
--- a/src/openrct2-ui/windows/RideList.cpp
+++ b/src/openrct2-ui/windows/RideList.cpp
@@ -311,7 +311,7 @@ namespace OpenRCT2::Ui::Windows
gDropdown.items[0] = Dropdown::PlainMenuLabel(STR_CLOSE_ALL);
gDropdown.items[1] = Dropdown::PlainMenuLabel(STR_OPEN_ALL);
WindowDropdownShowText(
- { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height(), colours[1], 0, 2);
+ { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() - 1, colours[1], 0, 2);
}
else if (widgetIndex == WIDX_HEADER_CUSTOMISE)
{
@@ -346,8 +346,8 @@ namespace OpenRCT2::Ui::Windows
auto totalWidth = headerWidget.width() - 1 + customWidget.width() - 1;
WindowDropdownShowTextCustomWidth(
- { windowPos.x + headerWidget.left, windowPos.y + headerWidget.top }, headerWidget.height(), colours[1], 0,
- Dropdown::Flag::StayOpen, numItems, totalWidth);
+ { windowPos.x + headerWidget.left, windowPos.y + headerWidget.top }, headerWidget.height() - 1, colours[1],
+ 0, Dropdown::Flag::StayOpen, numItems, totalWidth);
}
}
@@ -587,7 +587,7 @@ namespace OpenRCT2::Ui::Windows
*
* rct2: 0x006B3235
*/
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
WindowDrawWidgets(*this, rt);
DrawTabImages(rt);
@@ -624,7 +624,7 @@ namespace OpenRCT2::Ui::Windows
*
* rct2: 0x006B3240
*/
- void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
+ void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
auto rtCoords = ScreenCoordsXY{ rt.x, rt.y };
Rectangle::fill(
@@ -881,7 +881,7 @@ namespace OpenRCT2::Ui::Windows
*
* rct2: 0x006B38EA
*/
- void DrawTabImages(RenderTarget& rt)
+ void DrawTabImages(Drawing::RenderTarget& rt)
{
int32_t sprite_idx;
diff --git a/src/openrct2-ui/windows/SavePrompt.cpp b/src/openrct2-ui/windows/SavePrompt.cpp
index b92126bc5a..23f8fa2807 100644
--- a/src/openrct2-ui/windows/SavePrompt.cpp
+++ b/src/openrct2-ui/windows/SavePrompt.cpp
@@ -190,7 +190,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
}
diff --git a/src/openrct2-ui/windows/ScenarioSelect.cpp b/src/openrct2-ui/windows/ScenarioSelect.cpp
index 750463c69f..4a35dc1e11 100644
--- a/src/openrct2-ui/windows/ScenarioSelect.cpp
+++ b/src/openrct2-ui/windows/ScenarioSelect.cpp
@@ -267,7 +267,7 @@ namespace OpenRCT2::Ui::Windows
invalidate();
}
- ScreenCoordsXY DrawPreview(RenderTarget& rt, ScreenCoordsXY screenPos)
+ ScreenCoordsXY DrawPreview(Drawing::RenderTarget& rt, ScreenCoordsXY screenPos)
{
auto targetImageType = PreviewImageType::miniMap;
if (Config::Get().interface.scenarioPreviewScreenshots)
@@ -302,7 +302,7 @@ namespace OpenRCT2::Ui::Windows
return frameEndPos;
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
@@ -540,7 +540,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
+ void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
uint8_t paletteIndex = ColourMapA[colours[1].colour].mid_light;
GfxClear(rt, paletteIndex);
@@ -636,7 +636,7 @@ namespace OpenRCT2::Ui::Windows
}
private:
- void DrawCategoryHeading(RenderTarget& rt, int32_t left, int32_t right, int32_t y, StringId stringId) const
+ void DrawCategoryHeading(Drawing::RenderTarget& rt, int32_t left, int32_t right, int32_t y, StringId stringId) const
{
auto baseColour = colours[1];
colour_t lightColour = ColourMapA[baseColour.colour].lighter;
diff --git a/src/openrct2-ui/windows/Scenery.cpp b/src/openrct2-ui/windows/Scenery.cpp
index c3d3892c06..55984ac6ac 100644
--- a/src/openrct2-ui/windows/Scenery.cpp
+++ b/src/openrct2-ui/windows/Scenery.cpp
@@ -67,6 +67,7 @@
#include
using namespace OpenRCT2::Drawing;
+using OpenRCT2::GameActions::CommandFlag;
namespace OpenRCT2::Ui::Windows
{
@@ -506,7 +507,7 @@ namespace OpenRCT2::Ui::Windows
else
{
const auto& listWidget = widgets[WIDX_SCENERY_LIST];
- const auto nonListHeight = height - listWidget.height() + 2;
+ const auto nonListHeight = height - listWidget.height() - 1 + 2;
const auto numRows = static_cast(CountRows());
const auto maxContentHeight = numRows * kSceneryButtonHeight;
@@ -553,8 +554,20 @@ namespace OpenRCT2::Ui::Windows
if (!isToolActive(WindowClass::scenery))
{
- close();
- return;
+ if (_inDragMode)
+ {
+ removeProvisionalTilesFromMap();
+ _provisionalTiles.clear();
+ _inDragMode = false;
+
+ ToolSet(*this, WIDX_SCENERY_BACKGROUND, Tool::arrow);
+ gInputFlags.set(InputFlag::allowRightMouseRemoval);
+ }
+ else
+ {
+ close();
+ return;
+ }
}
if (gWindowSceneryEyedropperEnabled)
@@ -577,23 +590,39 @@ namespace OpenRCT2::Ui::Windows
}
else if (tabSelectedScenery.SceneryType == SCENERY_TYPE_LARGE)
{
- gCurrentToolId = static_cast(
- ObjectManager::GetObjectEntry(tabSelectedScenery.EntryIndex)->tool_id);
+ const auto* sceneryEntry = ObjectManager::GetObjectEntry(
+ tabSelectedScenery.EntryIndex);
+ if (sceneryEntry != nullptr)
+ {
+ gCurrentToolId = static_cast(sceneryEntry->tool_id);
+ }
}
else if (tabSelectedScenery.SceneryType == SCENERY_TYPE_WALL)
{
- gCurrentToolId = static_cast(
- ObjectManager::GetObjectEntry(tabSelectedScenery.EntryIndex)->tool_id);
+ const auto* sceneryEntry = ObjectManager::GetObjectEntry(
+ tabSelectedScenery.EntryIndex);
+ if (sceneryEntry != nullptr)
+ {
+ gCurrentToolId = static_cast(sceneryEntry->tool_id);
+ }
}
else if (tabSelectedScenery.SceneryType == SCENERY_TYPE_PATH_ITEM)
{
- gCurrentToolId = static_cast(
- ObjectManager::GetObjectEntry(tabSelectedScenery.EntryIndex)->tool_id);
+ const auto* sceneryEntry = ObjectManager::GetObjectEntry(
+ tabSelectedScenery.EntryIndex);
+ if (sceneryEntry != nullptr)
+ {
+ gCurrentToolId = static_cast(sceneryEntry->tool_id);
+ }
}
- else
- { // small scenery
- gCurrentToolId = static_cast(
- ObjectManager::GetObjectEntry(tabSelectedScenery.EntryIndex)->tool_id);
+ else if (tabSelectedScenery.SceneryType == SCENERY_TYPE_SMALL)
+ {
+ const auto* sceneryEntry = ObjectManager::GetObjectEntry(
+ tabSelectedScenery.EntryIndex);
+ if (sceneryEntry != nullptr)
+ {
+ gCurrentToolId = static_cast(sceneryEntry->tool_id);
+ }
}
}
else
@@ -699,7 +728,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_SCENERY_BUILD_CLUSTER_BUTTON].type = WidgetType::flatBtn;
auto* sceneryEntry = ObjectManager::GetObjectEntry(tabSelectedScenery.EntryIndex);
- if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_ROTATABLE))
+ if (sceneryEntry != nullptr && sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_ROTATABLE))
{
widgets[WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].type = WidgetType::flatBtn;
}
@@ -738,7 +767,7 @@ namespace OpenRCT2::Ui::Windows
if (tabSelectedScenery.SceneryType == SCENERY_TYPE_BANNER)
{
auto* bannerEntry = ObjectManager::GetObjectEntry(tabSelectedScenery.EntryIndex);
- if (bannerEntry->flags & BANNER_ENTRY_FLAG_HAS_PRIMARY_COLOUR)
+ if (bannerEntry != nullptr && bannerEntry->flags & BANNER_ENTRY_FLAG_HAS_PRIMARY_COLOUR)
{
widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].type = WidgetType::colourBtn;
}
@@ -746,20 +775,22 @@ namespace OpenRCT2::Ui::Windows
else if (tabSelectedScenery.SceneryType == SCENERY_TYPE_LARGE)
{
auto* sceneryEntry = ObjectManager::GetObjectEntry(tabSelectedScenery.EntryIndex);
-
- if (sceneryEntry->flags & LARGE_SCENERY_FLAG_HAS_PRIMARY_COLOUR
- && !(sceneryEntry->flags & LARGE_SCENERY_FLAG_HIDE_PRIMARY_REMAP_BUTTON))
- widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].type = WidgetType::colourBtn;
- if (sceneryEntry->flags & LARGE_SCENERY_FLAG_HAS_SECONDARY_COLOUR
- && !(sceneryEntry->flags & LARGE_SCENERY_FLAG_HIDE_SECONDARY_REMAP_BUTTON))
- widgets[WIDX_SCENERY_SECONDARY_COLOUR_BUTTON].type = WidgetType::colourBtn;
- if (sceneryEntry->flags & LARGE_SCENERY_FLAG_HAS_TERTIARY_COLOUR)
- widgets[WIDX_SCENERY_TERTIARY_COLOUR_BUTTON].type = WidgetType::colourBtn;
+ if (sceneryEntry != nullptr)
+ {
+ if (sceneryEntry->flags & LARGE_SCENERY_FLAG_HAS_PRIMARY_COLOUR
+ && !(sceneryEntry->flags & LARGE_SCENERY_FLAG_HIDE_PRIMARY_REMAP_BUTTON))
+ widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].type = WidgetType::colourBtn;
+ if (sceneryEntry->flags & LARGE_SCENERY_FLAG_HAS_SECONDARY_COLOUR
+ && !(sceneryEntry->flags & LARGE_SCENERY_FLAG_HIDE_SECONDARY_REMAP_BUTTON))
+ widgets[WIDX_SCENERY_SECONDARY_COLOUR_BUTTON].type = WidgetType::colourBtn;
+ if (sceneryEntry->flags & LARGE_SCENERY_FLAG_HAS_TERTIARY_COLOUR)
+ widgets[WIDX_SCENERY_TERTIARY_COLOUR_BUTTON].type = WidgetType::colourBtn;
+ }
}
else if (tabSelectedScenery.SceneryType == SCENERY_TYPE_WALL)
{
auto* wallEntry = ObjectManager::GetObjectEntry(tabSelectedScenery.EntryIndex);
- if (wallEntry->flags & (WALL_SCENERY_HAS_PRIMARY_COLOUR | WALL_SCENERY_HAS_GLASS))
+ if (wallEntry != nullptr && wallEntry->flags & (WALL_SCENERY_HAS_PRIMARY_COLOUR | WALL_SCENERY_HAS_GLASS))
{
widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].type = WidgetType::colourBtn;
@@ -778,7 +809,8 @@ namespace OpenRCT2::Ui::Windows
{
auto* sceneryEntry = ObjectManager::GetObjectEntry(tabSelectedScenery.EntryIndex);
- if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR | SMALL_SCENERY_FLAG_HAS_GLASS))
+ if (sceneryEntry != nullptr
+ && sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR | SMALL_SCENERY_FLAG_HAS_GLASS))
{
widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].type = WidgetType::colourBtn;
@@ -843,7 +875,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_SCENERY_BUILD_CLUSTER_BUTTON].type = canFit ? WidgetType::flatBtn : WidgetType::empty;
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
DrawTabs(rt, windowPos);
@@ -1064,7 +1096,7 @@ namespace OpenRCT2::Ui::Windows
int32_t newMinHeight = getTitleBarTargetHeight() + kDescriptionHeight + 2 * kTabMargin;
// Room for the search/filter widget
- newMinHeight += widgets[WIDX_FILTER_TEXT_BOX].height() + 2 * kInputMargin;
+ newMinHeight += widgets[WIDX_FILTER_TEXT_BOX].height() - 1 + 2 * kInputMargin;
// Fit *all* rows of tabs
newMinHeight += static_cast(1 + (_tabEntries.size() / GetMaxTabCountInARow())) * kTabHeight;
@@ -1540,7 +1572,7 @@ namespace OpenRCT2::Ui::Windows
return { name, price };
}
- void DrawTabs(RenderTarget& rt, const ScreenCoordsXY& offset)
+ void DrawTabs(Drawing::RenderTarget& rt, const ScreenCoordsXY& offset)
{
for (size_t tabIndex = 0; tabIndex < _tabEntries.size(); tabIndex++)
{
@@ -1555,11 +1587,14 @@ namespace OpenRCT2::Ui::Windows
}
}
- void DrawSceneryItem(RenderTarget& rt, ScenerySelection scenerySelection)
+ void DrawSceneryItem(Drawing::RenderTarget& rt, ScenerySelection scenerySelection)
{
if (scenerySelection.SceneryType == SCENERY_TYPE_BANNER)
{
auto bannerEntry = ObjectManager::GetObjectEntry(scenerySelection.EntryIndex);
+ if (bannerEntry == nullptr)
+ return;
+
auto imageId = ImageId(bannerEntry->image + gWindowSceneryRotation * 2, _sceneryPrimaryColour);
GfxDrawSprite(rt, imageId, { 33, 40 });
GfxDrawSprite(rt, imageId.WithIndexOffset(1), { 33, 40 });
@@ -1567,6 +1602,9 @@ namespace OpenRCT2::Ui::Windows
else if (scenerySelection.SceneryType == SCENERY_TYPE_LARGE)
{
auto sceneryEntry = ObjectManager::GetObjectEntry(scenerySelection.EntryIndex);
+ if (sceneryEntry == nullptr)
+ return;
+
auto imageId = ImageId(sceneryEntry->image + gWindowSceneryRotation);
if (sceneryEntry->flags & LARGE_SCENERY_FLAG_HAS_PRIMARY_COLOUR)
imageId = imageId.WithPrimary(_sceneryPrimaryColour);
@@ -1579,6 +1617,9 @@ namespace OpenRCT2::Ui::Windows
else if (scenerySelection.SceneryType == SCENERY_TYPE_WALL)
{
auto wallEntry = ObjectManager::GetObjectEntry(scenerySelection.EntryIndex);
+ if (wallEntry == nullptr)
+ return;
+
auto imageId = ImageId(wallEntry->image);
auto spriteTop = (wallEntry->height * 2) + 0x32;
if (wallEntry->flags & WALL_SCENERY_HAS_GLASS)
@@ -1615,12 +1656,18 @@ namespace OpenRCT2::Ui::Windows
else if (scenerySelection.SceneryType == SCENERY_TYPE_PATH_ITEM)
{
auto* pathAdditionEntry = ObjectManager::GetObjectEntry(scenerySelection.EntryIndex);
+ if (pathAdditionEntry == nullptr)
+ return;
+
auto imageId = ImageId(pathAdditionEntry->image);
GfxDrawSprite(rt, imageId, { 11, 16 });
}
else
{
auto sceneryEntry = ObjectManager::GetObjectEntry(scenerySelection.EntryIndex);
+ if (sceneryEntry == nullptr)
+ return;
+
auto imageId = ImageId(sceneryEntry->image + gWindowSceneryRotation);
if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR))
{
@@ -1658,7 +1705,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
+ void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
GfxClear(rt, ColourMapA[colours[1].colour].mid_light);
@@ -1761,8 +1808,6 @@ namespace OpenRCT2::Ui::Windows
gMapSelectType = getMapSelectQuarter((quadrant ^ 2));
}
- MapInvalidateSelectionRect();
-
// If no change in ghost placement
if ((gSceneryGhostType & SCENERY_GHOST_FLAG_0) && mapTile == gSceneryGhostPosition && quadrant == _unkF64F0E
&& gSceneryPlaceZ == _unkF64F0A && gSceneryPlaceObject.SceneryType == SCENERY_TYPE_SMALL
@@ -1817,8 +1862,6 @@ namespace OpenRCT2::Ui::Windows
gMapSelectPositionB.y = mapTile.y;
gMapSelectType = MapSelectType::full;
- MapInvalidateSelectionRect();
-
// If no change in ghost placement
if ((gSceneryGhostType & SCENERY_GHOST_FLAG_1) && mapTile == gSceneryGhostPosition && z == gSceneryGhostPosition.z)
{
@@ -1856,8 +1899,6 @@ namespace OpenRCT2::Ui::Windows
setMapSelectRange(mapTile);
gMapSelectType = getMapSelectEdge(edge);
- MapInvalidateSelectionRect();
-
// If no change in ghost placement
if ((gSceneryGhostType & SCENERY_GHOST_FLAG_2) && mapTile == gSceneryGhostPosition
&& edge == gSceneryGhostWallRotation && gSceneryPlaceZ == _unkF64F0A)
@@ -1905,21 +1946,8 @@ namespace OpenRCT2::Ui::Windows
}
auto* sceneryEntry = ObjectManager::GetObjectEntry(selection.EntryIndex);
- gMapSelectionTiles.clear();
-
- for (auto& tile : sceneryEntry->tiles)
- {
- CoordsXY tileLocation = { tile.offset };
- auto rotatedTileCoords = tileLocation.Rotate(direction);
-
- rotatedTileCoords.x += mapTile.x;
- rotatedTileCoords.y += mapTile.y;
-
- gMapSelectionTiles.push_back(rotatedTileCoords);
- }
gMapSelectFlags.set(MapSelectFlag::enableConstruct);
- MapInvalidateMapSelectionTiles();
// If no change in ghost placement
if ((gSceneryGhostType & SCENERY_GHOST_FLAG_3) && mapTile == gSceneryGhostPosition && gSceneryPlaceZ == _unkF64F0A
@@ -1929,6 +1957,12 @@ namespace OpenRCT2::Ui::Windows
return;
}
+ MapSelection::clearSelectedTiles();
+ for (auto& tile : sceneryEntry->tiles)
+ {
+ MapSelection::addSelectedTile(mapTile + tile.offset.Rotate(direction));
+ }
+
SceneryRemoveGhostToolPlacement();
gSceneryPlaceObject.SceneryType = SCENERY_TYPE_LARGE;
@@ -1977,8 +2011,6 @@ namespace OpenRCT2::Ui::Windows
gMapSelectPositionB.y = mapTile.y;
gMapSelectType = MapSelectType::full;
- MapInvalidateSelectionRect();
-
// If no change in ghost placement
if ((gSceneryGhostType & SCENERY_GHOST_FLAG_4) && mapTile == gSceneryGhostPosition && z == gSceneryGhostPosition.z
&& direction == gSceneryPlaceRotation)
@@ -1999,9 +2031,6 @@ namespace OpenRCT2::Ui::Windows
*/
void onToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenPos) override
{
- MapInvalidateSelectionRect();
- MapInvalidateMapSelectionTiles();
-
gMapSelectFlags.unset(MapSelectFlag::enable);
gMapSelectFlags.unset(MapSelectFlag::enableConstruct);
@@ -2057,12 +2086,12 @@ namespace OpenRCT2::Ui::Windows
// 6e252b
auto smallSceneryPlaceAction = GameActions::SmallSceneryPlaceAction(
loc, quadrant, entryIndex, primaryColour, secondaryColour, tertiaryColour);
- smallSceneryPlaceAction.SetFlags(GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED);
+ smallSceneryPlaceAction.SetFlags({ CommandFlag::ghost, CommandFlag::allowDuringPaused });
auto res = GameActions::Execute(&smallSceneryPlaceAction, getGameState());
- if (res.Error != GameActions::Status::Ok)
+ if (res.error != GameActions::Status::ok)
return kMoney64Undefined;
- const auto placementData = res.GetData();
+ const auto placementData = res.getData();
gSceneryPlaceRotation = loc.direction;
gSceneryPlaceObject.SceneryType = SCENERY_TYPE_SMALL;
@@ -2082,7 +2111,7 @@ namespace OpenRCT2::Ui::Windows
}
gSceneryGhostType |= SCENERY_GHOST_FLAG_0;
- return res.Cost;
+ return res.cost;
}
money64 TryPlaceGhostPathAddition(CoordsXYZ loc, ObjectEntryIndex entryIndex)
@@ -2091,9 +2120,9 @@ namespace OpenRCT2::Ui::Windows
// 6e265b
auto footpathAdditionPlaceAction = GameActions::FootpathAdditionPlaceAction(loc, entryIndex);
- footpathAdditionPlaceAction.SetFlags(GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED);
+ footpathAdditionPlaceAction.SetFlags({ CommandFlag::ghost, CommandFlag::allowDuringPaused });
footpathAdditionPlaceAction.SetCallback([=](const GameActions::GameAction* ga, const GameActions::Result* result) {
- if (result->Error != GameActions::Status::Ok)
+ if (result->error != GameActions::Status::ok)
{
return;
}
@@ -2101,10 +2130,10 @@ namespace OpenRCT2::Ui::Windows
gSceneryGhostType |= SCENERY_GHOST_FLAG_1;
});
auto res = GameActions::Execute(&footpathAdditionPlaceAction, getGameState());
- if (res.Error != GameActions::Status::Ok)
+ if (res.error != GameActions::Status::ok)
return kMoney64Undefined;
- return res.Cost;
+ return res.cost;
}
money64 TryPlaceGhostWall(
@@ -2116,13 +2145,12 @@ namespace OpenRCT2::Ui::Windows
// 6e26b0
auto wallPlaceAction = GameActions::WallPlaceAction(
entryIndex, loc, edge, primaryColour, secondaryColour, tertiaryColour);
- wallPlaceAction.SetFlags(
- GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND);
+ wallPlaceAction.SetFlags({ CommandFlag::ghost, CommandFlag::allowDuringPaused, CommandFlag::noSpend });
wallPlaceAction.SetCallback([=](const GameActions::GameAction* ga, const GameActions::Result* result) {
- if (result->Error != GameActions::Status::Ok)
+ if (result->error != GameActions::Status::ok)
return;
- const auto placementData = result->GetData();
+ const auto placementData = result->getData();
gSceneryGhostPosition = { loc, placementData.BaseHeight };
gSceneryGhostWallRotation = edge;
@@ -2130,10 +2158,10 @@ namespace OpenRCT2::Ui::Windows
});
auto res = GameActions::Execute(&wallPlaceAction, getGameState());
- if (res.Error != GameActions::Status::Ok)
+ if (res.error != GameActions::Status::ok)
return kMoney64Undefined;
- return res.Cost;
+ return res.cost;
}
money64 TryPlaceGhostLargeScenery(
@@ -2145,13 +2173,12 @@ namespace OpenRCT2::Ui::Windows
// 6e25a7
auto sceneryPlaceAction = GameActions::LargeSceneryPlaceAction(
loc, entryIndex, primaryColour, secondaryColour, tertiaryColour);
- sceneryPlaceAction.SetFlags(
- GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND);
+ sceneryPlaceAction.SetFlags({ CommandFlag::ghost, CommandFlag::allowDuringPaused, CommandFlag::noSpend });
auto res = GameActions::Execute(&sceneryPlaceAction, getGameState());
- if (res.Error != GameActions::Status::Ok)
+ if (res.error != GameActions::Status::ok)
return kMoney64Undefined;
- const auto placementData = res.GetData();
+ const auto placementData = res.getData();
gSceneryPlaceRotation = loc.direction;
@@ -2168,7 +2195,7 @@ namespace OpenRCT2::Ui::Windows
}
gSceneryGhostType |= SCENERY_GHOST_FLAG_3;
- return res.Cost;
+ return res.cost;
}
money64 TryPlaceGhostBanner(CoordsXYZD loc, ObjectEntryIndex entryIndex)
@@ -2178,17 +2205,16 @@ namespace OpenRCT2::Ui::Windows
// 6e2612
auto primaryColour = _sceneryPrimaryColour;
auto bannerPlaceAction = GameActions::BannerPlaceAction(loc, entryIndex, primaryColour);
- bannerPlaceAction.SetFlags(
- GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND);
+ bannerPlaceAction.SetFlags({ CommandFlag::ghost, CommandFlag::allowDuringPaused, CommandFlag::noSpend });
auto res = GameActions::Execute(&bannerPlaceAction, getGameState());
- if (res.Error != GameActions::Status::Ok)
+ if (res.error != GameActions::Status::ok)
return kMoney64Undefined;
gSceneryGhostPosition = loc;
gSceneryGhostPosition.z += kPathHeightStep;
gSceneryPlaceRotation = loc.direction;
gSceneryGhostType |= SCENERY_GHOST_FLAG_4;
- return res.Cost;
+ return res.cost;
}
/**
@@ -2973,7 +2999,7 @@ namespace OpenRCT2::Ui::Windows
zAttemptRange = 20;
}
- auto success = GameActions::Status::Unknown;
+ auto success = GameActions::Status::unknown;
// Try find a valid z coordinate
for (; zAttemptRange != 0; zAttemptRange--)
{
@@ -2983,13 +3009,13 @@ namespace OpenRCT2::Ui::Windows
auto& gameState = getGameState();
auto res = GameActions::Query(&smallSceneryPlaceAction, gameState);
- success = res.Error;
- if (res.Error == GameActions::Status::Ok)
+ success = res.error;
+ if (res.error == GameActions::Status::ok)
{
break;
}
- if (res.Error == GameActions::Status::InsufficientFunds)
+ if (res.error == GameActions::Status::insufficientFunds)
{
break;
}
@@ -3000,7 +3026,7 @@ namespace OpenRCT2::Ui::Windows
}
// Actually place
- if (success == GameActions::Status::Ok || ((q + 1 == quantity) && forceError))
+ if (success == GameActions::Status::ok || ((q + 1 == quantity) && forceError))
{
auto smallSceneryPlaceAction = GameActions::SmallSceneryPlaceAction(
{ cur_grid_x, cur_grid_y, gSceneryPlaceZ, gSceneryPlaceRotation }, quadrant, selectedScenery,
@@ -3008,20 +3034,20 @@ namespace OpenRCT2::Ui::Windows
smallSceneryPlaceAction.SetCallback(
[=](const GameActions::GameAction* ga, const GameActions::Result* result) {
- if (result->Error == GameActions::Status::Ok)
+ if (result->error == GameActions::Status::ok)
{
- Audio::Play3D(Audio::SoundId::placeItem, result->Position);
+ Audio::Play3D(Audio::SoundId::placeItem, result->position);
}
});
auto& gameState = getGameState();
auto res = GameActions::Execute(&smallSceneryPlaceAction, gameState);
- if (res.Error == GameActions::Status::Ok)
+ if (res.error == GameActions::Status::ok)
{
forceError = false;
}
- if (res.Error == GameActions::Status::InsufficientFunds)
+ if (res.error == GameActions::Status::insufficientFunds)
{
break;
}
@@ -3042,11 +3068,11 @@ namespace OpenRCT2::Ui::Windows
auto footpathAdditionPlaceAction = GameActions::FootpathAdditionPlaceAction({ gridPos, z }, selectedScenery);
footpathAdditionPlaceAction.SetCallback([](const GameActions::GameAction* ga, const GameActions::Result* result) {
- if (result->Error != GameActions::Status::Ok)
+ if (result->error != GameActions::Status::ok)
{
return;
}
- Audio::Play3D(Audio::SoundId::placeItem, result->Position);
+ Audio::Play3D(Audio::SoundId::placeItem, result->position);
});
auto& gameState = getGameState();
@@ -3100,12 +3126,12 @@ namespace OpenRCT2::Ui::Windows
auto& gameState = getGameState();
auto res = GameActions::Query(&wallPlaceAction, gameState);
- if (res.Error == GameActions::Status::Ok)
+ if (res.error == GameActions::Status::ok)
{
break;
}
- if (const auto* message = std::get_if(&res.ErrorMessage))
+ if (const auto* message = std::get_if(&res.errorMessage))
{
if (*message == STR_NOT_ENOUGH_CASH_REQUIRES || *message == STR_CAN_ONLY_BUILD_THIS_ON_WATER)
{
@@ -3167,8 +3193,7 @@ namespace OpenRCT2::Ui::Windows
auto location = tile.location;
location.z = tile.calculatedZ;
auto wallRemoveAction = GameActions::WallRemoveAction(location);
- wallRemoveAction.SetFlags(
- GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST);
+ wallRemoveAction.SetFlags({ CommandFlag::allowDuringPaused, CommandFlag::noSpend, CommandFlag::ghost });
wallRemoveAction.Execute(gameState);
}
}
@@ -3190,12 +3215,12 @@ namespace OpenRCT2::Ui::Windows
auto wallPlaceAction = GameActions::WallPlaceAction(
tabSelection.EntryIndex, { x, y, gSceneryPlaceZ }, _startEdge, _sceneryPrimaryColour,
_scenerySecondaryColour, _sceneryTertiaryColour);
- wallPlaceAction.SetFlags(GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED);
+ wallPlaceAction.SetFlags({ CommandFlag::ghost, CommandFlag::allowDuringPaused });
auto result = GameActions::Execute(&wallPlaceAction, gameState);
- if (result.Error == GameActions::Status::Ok)
+ if (result.error == GameActions::Status::ok)
{
- const auto placementData = result.GetData();
+ const auto placementData = result.getData();
_provisionalTiles.push_back({ CoordsXYZD(x, y, gSceneryPlaceZ, _startEdge), placementData.BaseHeight });
}
else
@@ -3242,11 +3267,11 @@ namespace OpenRCT2::Ui::Windows
auto z = gSceneryPlaceZ > 0 ? gSceneryPlaceZ : TileElementHeight(_dragStartPos);
Audio::Play3D(Audio::SoundId::error, { _dragStartPos, z });
- if (_lastProvisionalError.Error != GameActions::Status::Ok)
+ if (_lastProvisionalError.error != GameActions::Status::ok)
{
auto windowManager = Ui::GetWindowManager();
windowManager->ShowError(
- _lastProvisionalError.GetErrorTitle(), _lastProvisionalError.GetErrorMessage(), true);
+ _lastProvisionalError.getErrorTitle(), _lastProvisionalError.getErrorMessage(), true);
}
_inDragMode = false;
@@ -3264,10 +3289,10 @@ namespace OpenRCT2::Ui::Windows
auto& gameState = getGameState();
auto result = GameActions::Execute(&wallPlaceAction, gameState);
- if (result.Error == GameActions::Status::Ok)
+ if (result.error == GameActions::Status::ok)
{
anySuccessful = true;
- lastLocation = result.Position;
+ lastLocation = result.position;
}
}
@@ -3303,12 +3328,12 @@ namespace OpenRCT2::Ui::Windows
auto& gameState = getGameState();
auto res = GameActions::Query(&sceneryPlaceAction, gameState);
- if (res.Error == GameActions::Status::Ok)
+ if (res.error == GameActions::Status::ok)
{
break;
}
- if (const auto* message = std::get_if(&res.ErrorMessage))
+ if (const auto* message = std::get_if(&res.errorMessage))
{
if (*message == STR_NOT_ENOUGH_CASH_REQUIRES || *message == STR_CAN_ONLY_BUILD_THIS_ON_WATER)
{
@@ -3327,9 +3352,9 @@ namespace OpenRCT2::Ui::Windows
auto sceneryPlaceAction = GameActions::LargeSceneryPlaceAction(
loc, selectedScenery, _sceneryPrimaryColour, _scenerySecondaryColour, _sceneryTertiaryColour);
sceneryPlaceAction.SetCallback([=](const GameActions::GameAction* ga, const GameActions::Result* result) {
- if (result->Error == GameActions::Status::Ok)
+ if (result->error == GameActions::Status::ok)
{
- Audio::Play3D(Audio::SoundId::placeItem, result->Position);
+ Audio::Play3D(Audio::SoundId::placeItem, result->position);
}
else
{
@@ -3354,10 +3379,10 @@ namespace OpenRCT2::Ui::Windows
auto primaryColour = _sceneryPrimaryColour;
auto bannerPlaceAction = GameActions::BannerPlaceAction(loc, selectedScenery, primaryColour);
bannerPlaceAction.SetCallback([=](const GameActions::GameAction* ga, const GameActions::Result* result) {
- if (result->Error == GameActions::Status::Ok)
+ if (result->error == GameActions::Status::ok)
{
- auto data = result->GetData();
- Audio::Play3D(Audio::SoundId::placeItem, result->Position);
+ auto data = result->getData();
+ Audio::Play3D(Audio::SoundId::placeItem, result->position);
ContextOpenDetailWindow(WindowDetail::banner, data.bannerId.ToUnderlying());
}
});
@@ -3515,7 +3540,7 @@ namespace OpenRCT2::Ui::Windows
{
auto* toolWindow = ContextOpenWindow(WindowClass::scenery);
ToolSet(*toolWindow, WIDX_SCENERY_BACKGROUND, Tool::arrow);
- gInputFlags.set(InputFlag::unk6);
+ gInputFlags.set(InputFlag::allowRightMouseRemoval);
}
}
} // namespace OpenRCT2::Ui::Windows
diff --git a/src/openrct2-ui/windows/SceneryScatter.cpp b/src/openrct2-ui/windows/SceneryScatter.cpp
index 6c9c1e99dd..9fc6d14023 100644
--- a/src/openrct2-ui/windows/SceneryScatter.cpp
+++ b/src/openrct2-ui/windows/SceneryScatter.cpp
@@ -181,7 +181,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gWindowSceneryScatterSize));
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
WindowDrawWidgets(*this, rt);
diff --git a/src/openrct2-ui/windows/ServerList.cpp b/src/openrct2-ui/windows/ServerList.cpp
index efcbc0cee1..dfa38b9001 100644
--- a/src/openrct2-ui/windows/ServerList.cpp
+++ b/src/openrct2-ui/windows/ServerList.cpp
@@ -305,7 +305,7 @@ namespace OpenRCT2::Ui::Windows
return { fallback, ft };
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
@@ -326,7 +326,7 @@ namespace OpenRCT2::Ui::Windows
DrawTextBasic(rt, windowPos + ScreenCoordsXY{ 8, height - 15 }, _statusText, ft, { COLOUR_WHITE });
}
- void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
+ void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
uint8_t paletteIndex = ColourMapA[colours[1].colour].mid_light;
GfxClear(rt, paletteIndex);
diff --git a/src/openrct2-ui/windows/ServerStart.cpp b/src/openrct2-ui/windows/ServerStart.cpp
index e2e6806156..adea8f28c1 100644
--- a/src/openrct2-ui/windows/ServerStart.cpp
+++ b/src/openrct2-ui/windows/ServerStart.cpp
@@ -229,7 +229,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
DrawTextBasic(rt, windowPos + ScreenCoordsXY{ 6, widgets[WIDX_PORT_INPUT].top }, STR_PORT, {}, { colours[1] });
diff --git a/src/openrct2-ui/windows/ShortcutKeys.cpp b/src/openrct2-ui/windows/ShortcutKeys.cpp
index a04b199b40..7cd951b77d 100644
--- a/src/openrct2-ui/windows/ShortcutKeys.cpp
+++ b/src/openrct2-ui/windows/ShortcutKeys.cpp
@@ -121,7 +121,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
@@ -251,7 +251,7 @@ namespace OpenRCT2::Ui::Windows
setWidgetPressed(static_cast(WIDX_TAB_0 + _currentTabIndex), true);
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -297,7 +297,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
+ void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
auto rtCoords = ScreenCoordsXY{ rt.x, rt.y };
Rectangle::fill(
@@ -472,7 +472,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void DrawTabImages(RenderTarget& rt) const
+ void DrawTabImages(Drawing::RenderTarget& rt) const
{
for (size_t i = 0; i < _tabs.size(); i++)
{
@@ -480,7 +480,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void DrawTabImage(RenderTarget& rt, size_t tabIndex) const
+ void DrawTabImage(Drawing::RenderTarget& rt, size_t tabIndex) const
{
const auto& tabDesc = _tabs[tabIndex];
auto widgetIndex = static_cast(WIDX_TAB_0 + tabIndex);
@@ -501,14 +501,15 @@ namespace OpenRCT2::Ui::Windows
}
}
- void DrawSeparator(RenderTarget& rt, int32_t y, int32_t scrollWidth)
+ void DrawSeparator(Drawing::RenderTarget& rt, int32_t y, int32_t scrollWidth)
{
const int32_t top = y + (kScrollableRowHeight / 2) - 1;
Rectangle::fill(rt, { { 0, top }, { scrollWidth, top } }, ColourMapA[colours[1].colour].mid_dark);
Rectangle::fill(rt, { { 0, top + 1 }, { scrollWidth, top + 1 } }, ColourMapA[colours[1].colour].lightest);
}
- void DrawItem(RenderTarget& rt, int32_t y, int32_t scrollWidth, const ShortcutStringPair& shortcut, bool isHighlighted)
+ void DrawItem(
+ Drawing::RenderTarget& rt, int32_t y, int32_t scrollWidth, const ShortcutStringPair& shortcut, bool isHighlighted)
{
auto format = STR_BLACK_STRING;
if (isHighlighted)
diff --git a/src/openrct2-ui/windows/Sign.cpp b/src/openrct2-ui/windows/Sign.cpp
index f0f906318d..e4b4cf9dc8 100644
--- a/src/openrct2-ui/windows/Sign.cpp
+++ b/src/openrct2-ui/windows/Sign.cpp
@@ -135,7 +135,7 @@ namespace OpenRCT2::Ui::Windows
Widget& viewportWidget = widgets[WIDX_VIEWPORT];
ViewportCreate(
*this, windowPos + ScreenCoordsXY{ viewportWidget.left + 1, viewportWidget.top + 1 },
- viewportWidget.width() - 2, viewportWidget.height() - 1, Focus(CoordsXYZ{ signViewPosition, viewZ }));
+ viewportWidget.width() - 2, viewportWidget.height() - 2, Focus(CoordsXYZ{ signViewPosition, viewZ }));
viewport->flags = Config::Get().general.alwaysShowGridlines ? VIEWPORT_FLAG_GRIDLINES : VIEWPORT_FLAG_NONE;
invalidate();
@@ -292,7 +292,7 @@ namespace OpenRCT2::Ui::Windows
text_colour_btn->image = getColourButtonImage(_textColour);
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
@@ -318,7 +318,7 @@ namespace OpenRCT2::Ui::Windows
Widget* viewportWidget = &widgets[WIDX_VIEWPORT];
ViewportCreate(
*this, windowPos + ScreenCoordsXY{ viewportWidget->left + 1, viewportWidget->top + 1 },
- viewportWidget->width() - 2, viewportWidget->height() - 1, Focus(CoordsXYZ{ signViewPos }));
+ viewportWidget->width() - 2, viewportWidget->height() - 2, Focus(CoordsXYZ{ signViewPos }));
if (viewport != nullptr)
viewport->flags = Config::Get().general.alwaysShowGridlines ? VIEWPORT_FLAG_GRIDLINES : VIEWPORT_FLAG_NONE;
invalidate();
diff --git a/src/openrct2-ui/windows/Staff.cpp b/src/openrct2-ui/windows/Staff.cpp
index d62cfd78f6..f986fbf6b3 100644
--- a/src/openrct2-ui/windows/Staff.cpp
+++ b/src/openrct2-ui/windows/Staff.cpp
@@ -228,7 +228,7 @@ namespace OpenRCT2::Ui::Windows
CommonPrepareDrawAfter();
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -388,7 +388,7 @@ namespace OpenRCT2::Ui::Windows
Network::GetCurrentPlayerId() };
pickupAction.SetCallback(
[peepnum = number](const GameActions::GameAction* ga, const GameActions::Result* result) {
- if (result->Error != GameActions::Status::Ok)
+ if (result->error != GameActions::Status::ok)
return;
auto* windowMgr = GetWindowManager();
@@ -435,7 +435,7 @@ namespace OpenRCT2::Ui::Windows
gDropdown.items[1] = Dropdown::PlainMenuLabel(STR_CLEAR_PATROL_AREA);
auto ddPos = ScreenCoordsXY{ widget->left + windowPos.x, widget->top + windowPos.y };
- int32_t extraHeight = widget->height() + 1;
+ int32_t extraHeight = widget->height();
WindowDropdownShowText(ddPos, extraHeight, colours[1], 0, 2);
gDropdown.defaultIndex = 0;
@@ -540,7 +540,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_FIRE].right = width - 2;
}
- void OverviewDraw(RenderTarget& rt)
+ void OverviewDraw(Drawing::RenderTarget& rt)
{
// Draw the viewport no sound sprite
if (viewport != nullptr)
@@ -567,19 +567,19 @@ namespace OpenRCT2::Ui::Windows
DrawTextEllipsised(rt, screenPos, widgetWidth, STR_BLACK_STRING, ft, { TextAlignment::centre });
}
- void DrawOverviewTabImage(RenderTarget& rt)
+ void DrawOverviewTabImage(Drawing::RenderTarget& rt)
{
if (isWidgetDisabled(WIDX_TAB_1))
return;
const auto& widget = widgets[WIDX_TAB_1];
int32_t widgetWidth = widget.width() - 2;
- int32_t widgetHeight = widget.height() - 1;
+ int32_t widgetHeight = widget.height() - 2;
auto screenCoords = windowPos + ScreenCoordsXY{ widget.left + 1, widget.top + 1 };
if (page == WINDOW_STAFF_OVERVIEW)
widgetHeight++;
- RenderTarget clippedRT;
+ Drawing::RenderTarget clippedRT;
if (!ClipDrawPixelInfo(clippedRT, rt, screenCoords, widgetWidth, widgetHeight))
{
return;
@@ -616,7 +616,7 @@ namespace OpenRCT2::Ui::Windows
{
const Widget& viewportWidget = widgets[WIDX_VIEWPORT];
const auto reqViewportWidth = viewportWidget.width() - 2;
- const auto reqViewportHeight = viewportWidget.height() - 1;
+ const auto reqViewportHeight = viewportWidget.height() - 2;
viewport->pos = windowPos + ScreenCoordsXY{ viewportWidget.left + 1, viewportWidget.top + 1 };
if (viewport->width != reqViewportWidth || viewport->height != reqViewportHeight)
@@ -668,8 +668,6 @@ namespace OpenRCT2::Ui::Windows
if (widgetIndex != WIDX_PICKUP)
return;
- MapInvalidateSelectionRect();
-
gMapSelectFlags.unset(MapSelectFlag::enable);
auto mapCoords = FootpathGetCoordinatesFromPos({ screenCoords.x, screenCoords.y + 16 }, nullptr, nullptr);
@@ -679,7 +677,6 @@ namespace OpenRCT2::Ui::Windows
gMapSelectType = MapSelectType::full;
gMapSelectPositionA = mapCoords;
gMapSelectPositionB = mapCoords;
- MapInvalidateSelectionRect();
}
gPickupPeepImage = ImageId();
@@ -722,7 +719,7 @@ namespace OpenRCT2::Ui::Windows
{ destCoords, tileElement->GetBaseZ() },
Network::GetCurrentPlayerId() };
pickupAction.SetCallback([](const GameActions::GameAction* ga, const GameActions::Result* result) {
- if (result->Error != GameActions::Status::Ok)
+ if (result->error != GameActions::Status::ok)
return;
ToolCancel();
gPickupPeepImage = ImageId();
@@ -802,7 +799,7 @@ namespace OpenRCT2::Ui::Windows
}
auto ddPos = ScreenCoordsXY{ ddWidget->left + windowPos.x, ddWidget->top + windowPos.y };
- int32_t ddHeight = ddWidget->height() + 1;
+ int32_t ddHeight = ddWidget->height();
int32_t ddWidth = ddWidget->width() - 4;
WindowDropdownShowTextCustomWidth(ddPos, ddHeight, colours[1], 0, Dropdown::Flag::StayOpen, numCostumes, ddWidth);
@@ -931,7 +928,7 @@ namespace OpenRCT2::Ui::Windows
#pragma endregion
#pragma region Statistics tab events
- void StatsDraw(RenderTarget& rt)
+ void StatsDraw(Drawing::RenderTarget& rt)
{
auto staff = GetStaff();
if (staff == nullptr)
@@ -1159,7 +1156,7 @@ namespace OpenRCT2::Ui::Windows
auto screenPos = ScreenCoordsXY{ viewWidget.left + 1 + windowPos.x, viewWidget.top + 1 + windowPos.y };
int32_t viewportWidth = viewWidget.width() - 2;
- int32_t viewportHeight = viewWidget.height() - 1;
+ int32_t viewportHeight = viewWidget.height() - 2;
ViewportCreate(*this, screenPos, viewportWidth, viewportHeight, focus.value());
flags |= WindowFlag::noScrolling;
@@ -1178,7 +1175,7 @@ namespace OpenRCT2::Ui::Windows
gDropdown.items[1] = Dropdown::PlainMenuLabel(STR_FOLLOW_SUBJECT_TIP);
WindowDropdownShowText(
- { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, 2);
+ { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height(), colours[1], 0, 2);
gDropdown.defaultIndex = 0;
}
@@ -1188,14 +1185,14 @@ namespace OpenRCT2::Ui::Windows
WindowFollowSprite(*main, EntityId::FromUnderlying(number));
}
- void DrawTabImages(RenderTarget& rt)
+ void DrawTabImages(Drawing::RenderTarget& rt)
{
DrawOverviewTabImage(rt);
DrawTabImage(rt, WINDOW_STAFF_OPTIONS, SPR_TAB_STAFF_OPTIONS_0);
DrawTabImage(rt, WINDOW_STAFF_STATISTICS, SPR_TAB_STATS_0);
}
- void DrawTabImage(RenderTarget& rt, int32_t p, int32_t baseImageId)
+ void DrawTabImage(Drawing::RenderTarget& rt, int32_t p, int32_t baseImageId)
{
WidgetIndex widgetIndex = WIDX_TAB_1 + p;
Widget* widget = &widgets[widgetIndex];
diff --git a/src/openrct2-ui/windows/StaffFirePrompt.cpp b/src/openrct2-ui/windows/StaffFirePrompt.cpp
index cf94694324..afc3473248 100644
--- a/src/openrct2-ui/windows/StaffFirePrompt.cpp
+++ b/src/openrct2-ui/windows/StaffFirePrompt.cpp
@@ -73,7 +73,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
diff --git a/src/openrct2-ui/windows/StaffList.cpp b/src/openrct2-ui/windows/StaffList.cpp
index ae05ddd7c2..a7ec8e9a25 100644
--- a/src/openrct2-ui/windows/StaffList.cpp
+++ b/src/openrct2-ui/windows/StaffList.cpp
@@ -273,7 +273,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_STAFF_LIST_HIRE_BUTTON].right = width - 11;
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -367,7 +367,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
+ void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
auto rtCoords = ScreenCoordsXY{ rt.x, rt.y };
Rectangle::fill(
@@ -546,10 +546,10 @@ namespace OpenRCT2::Ui::Windows
auto hireStaffAction = GameActions::StaffHireNewAction(autoPosition, staffType, costume, staffOrders);
hireStaffAction.SetCallback([=](const GameActions::GameAction*, const GameActions::Result* res) -> void {
- if (res->Error != GameActions::Status::Ok)
+ if (res->error != GameActions::Status::ok)
return;
- auto actionResult = res->GetData();
+ auto actionResult = res->getData();
auto* staff = getGameState().entities.GetEntity(actionResult.StaffEntityId);
if (staff == nullptr)
return;
@@ -564,7 +564,7 @@ namespace OpenRCT2::Ui::Windows
Network::GetCurrentPlayerId() };
pickupAction.SetCallback(
[staffId = staff->Id](const GameActions::GameAction* ga, const GameActions::Result* result) {
- if (result->Error != GameActions::Status::Ok)
+ if (result->error != GameActions::Status::ok)
return;
auto* staff2 = getGameState().entities.GetEntity(staffId);
@@ -595,7 +595,7 @@ namespace OpenRCT2::Ui::Windows
return static_cast(_selectedTab);
}
- void DrawTabImages(RenderTarget& rt) const
+ void DrawTabImages(Drawing::RenderTarget& rt) const
{
const auto& gameState = getGameState();
DrawTabImage(rt, WINDOW_STAFF_LIST_TAB_HANDYMEN, AnimationPeepType::handyman, gameState.park.staffHandymanColour);
@@ -604,7 +604,7 @@ namespace OpenRCT2::Ui::Windows
DrawTabImage(rt, WINDOW_STAFF_LIST_TAB_ENTERTAINERS, AnimationPeepType::entertainer);
}
- void DrawTabImage(RenderTarget& rt, int32_t tabIndex, AnimationPeepType type, colour_t colour) const
+ void DrawTabImage(Drawing::RenderTarget& rt, int32_t tabIndex, AnimationPeepType type, colour_t colour) const
{
PeepAnimationsObject* animObj = findPeepAnimationsObjectForType(type);
if (animObj == nullptr)
@@ -622,7 +622,7 @@ namespace OpenRCT2::Ui::Windows
windowPos + ScreenCoordsXY{ (widget.left + widget.right) / 2, widget.bottom - 6 });
}
- void DrawTabImage(RenderTarget& rt, int32_t tabIndex, AnimationPeepType type) const
+ void DrawTabImage(Drawing::RenderTarget& rt, int32_t tabIndex, AnimationPeepType type) const
{
PeepAnimationsObject* animObj = findPeepAnimationsObjectForType(type);
if (animObj == nullptr)
diff --git a/src/openrct2-ui/windows/TextInput.cpp b/src/openrct2-ui/windows/TextInput.cpp
index 7746bf6773..3eba555bfe 100644
--- a/src/openrct2-ui/windows/TextInput.cpp
+++ b/src/openrct2-ui/windows/TextInput.cpp
@@ -196,7 +196,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
diff --git a/src/openrct2-ui/windows/Themes.cpp b/src/openrct2-ui/windows/Themes.cpp
index 42ab14757e..b6ed3c6b70 100644
--- a/src/openrct2-ui/windows/Themes.cpp
+++ b/src/openrct2-ui/windows/Themes.cpp
@@ -388,7 +388,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
// Widgets
WindowDrawWidgets(*this, rt);
@@ -453,7 +453,7 @@ namespace OpenRCT2::Ui::Windows
}
WindowDropdownShowTextCustomWidth(
- { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0,
+ { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height(), colours[1], 0,
Dropdown::Flag::StayOpen, num_items, widget->width() - 4);
gDropdown.items[static_cast(ThemeManagerGetAvailableThemeIndex())].setChecked(true);
@@ -715,7 +715,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
+ void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
ScreenCoordsXY screenCoords;
@@ -906,7 +906,7 @@ namespace OpenRCT2::Ui::Windows
return 0;
}
- void WindowThemesDrawTabImages(RenderTarget& rt)
+ void WindowThemesDrawTabImages(Drawing::RenderTarget& rt)
{
for (int32_t i = 0; i < WINDOW_THEMES_TAB_COUNT; i++)
{
diff --git a/src/openrct2-ui/windows/TileInspector.cpp b/src/openrct2-ui/windows/TileInspector.cpp
index 51a12de56c..30f1bbb927 100644
--- a/src/openrct2-ui/windows/TileInspector.cpp
+++ b/src/openrct2-ui/windows/TileInspector.cpp
@@ -904,7 +904,7 @@ static uint64_t PageDisabledWidgets[] = {
gDropdown.items[1] = Dropdown::MenuLabel(STR_TILE_INSPECTOR_WALL_SLOPED_LEFT);
gDropdown.items[2] = Dropdown::MenuLabel(STR_TILE_INSPECTOR_WALL_SLOPED_RIGHT);
WindowDropdownShowTextCustomWidth(
- { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0,
+ { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height(), colours[1], 0,
Dropdown::Flag::StayOpen, 3, widget->width() - 4);
// Set current value as checked
@@ -969,7 +969,6 @@ static uint64_t PageDisabledWidgets[] = {
void onToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override
{
- MapInvalidateSelectionRect();
gMapSelectFlags.set(MapSelectFlag::enable);
CoordsXY mapCoords;
@@ -999,7 +998,6 @@ static uint64_t PageDisabledWidgets[] = {
gMapSelectFlags.unset(MapSelectFlag::enable);
gMapSelectType = MapSelectType::full;
- MapInvalidateSelectionRect();
}
void onToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override
@@ -1046,7 +1044,7 @@ static uint64_t PageDisabledWidgets[] = {
invalidateWidget(WIDX_LIST);
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
ScreenCoordsXY screenCoords(windowPos.x, windowPos.y);
@@ -1584,7 +1582,7 @@ static uint64_t PageDisabledWidgets[] = {
}
}
- void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
+ void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
const int32_t listWidth = widgets[WIDX_LIST].width() - 1;
Rectangle::fill(
@@ -1595,7 +1593,7 @@ static uint64_t PageDisabledWidgets[] = {
{
auto& listWidget = widgets[WIDX_LIST];
auto centrePos = ScreenCoordsXY{ listWidget.width() / 2,
- (listWidget.height() - FontGetLineHeight(FontStyle::medium)) / 2 };
+ (listWidget.height() - 1 - FontGetLineHeight(FontStyle::medium)) / 2 };
auto ft = Formatter{};
auto textPaint = TextPaint{ colours[1], TextAlignment::centre };
DrawTextWrapped(rt, centrePos, listWidth, STR_TILE_INSPECTOR_SELECT_TILE_HINT, ft, textPaint);
diff --git a/src/openrct2-ui/windows/TitleExit.cpp b/src/openrct2-ui/windows/TitleExit.cpp
index 548e39a504..97cefee22e 100644
--- a/src/openrct2-ui/windows/TitleExit.cpp
+++ b/src/openrct2-ui/windows/TitleExit.cpp
@@ -44,7 +44,7 @@ namespace OpenRCT2::Ui::Windows
};
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
}
diff --git a/src/openrct2-ui/windows/TitleLogo.cpp b/src/openrct2-ui/windows/TitleLogo.cpp
index 55b4041693..41683e0dc6 100644
--- a/src/openrct2-ui/windows/TitleLogo.cpp
+++ b/src/openrct2-ui/windows/TitleLogo.cpp
@@ -57,7 +57,7 @@ namespace OpenRCT2::Ui::Windows
*
* rct2: 0x0066B872
*/
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
auto screenCoords = windowPos + ScreenCoordsXY{ 2, 2 };
GfxDrawSprite(rt, ImageId(SPR_G2_LOGO), screenCoords);
diff --git a/src/openrct2-ui/windows/TitleMenu.cpp b/src/openrct2-ui/windows/TitleMenu.cpp
index 62e6dac5ea..65df8a8e39 100644
--- a/src/openrct2-ui/windows/TitleMenu.cpp
+++ b/src/openrct2-ui/windows/TitleMenu.cpp
@@ -212,11 +212,11 @@ namespace OpenRCT2::Ui::Windows
int32_t yOffset = 0;
if (i > 5)
{
- yOffset = -(widget->height() + 5 + (i * 12));
+ yOffset = -(widget->height() - 1 + 5 + (i * 12));
}
WindowDropdownShowText(
- windowPos + ScreenCoordsXY{ widget->left, widget->top + yOffset }, widget->height() + 1,
+ windowPos + ScreenCoordsXY{ widget->left, widget->top + yOffset }, widget->height(),
colours[0].withFlag(ColourFlag::translucent, true), Dropdown::Flag::StayOpen, i);
}
}
@@ -275,7 +275,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
Rectangle::filter(rt, _filterRect, FilterPaletteID::palette51);
drawWidgets(rt);
diff --git a/src/openrct2-ui/windows/TitleOptions.cpp b/src/openrct2-ui/windows/TitleOptions.cpp
index 29f8b69703..87ea4896bc 100644
--- a/src/openrct2-ui/windows/TitleOptions.cpp
+++ b/src/openrct2-ui/windows/TitleOptions.cpp
@@ -43,7 +43,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
}
diff --git a/src/openrct2-ui/windows/TitleVersion.cpp b/src/openrct2-ui/windows/TitleVersion.cpp
index fe9999d5f1..cadeb66624 100644
--- a/src/openrct2-ui/windows/TitleVersion.cpp
+++ b/src/openrct2-ui/windows/TitleVersion.cpp
@@ -24,7 +24,7 @@ namespace OpenRCT2::Ui::Windows
class TitleVersionWindow final : public Window
{
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
// Write name and version information
const auto whiteOutline = ColourWithFlags{ COLOUR_WHITE }.withFlag(ColourFlag::withOutline, true);
diff --git a/src/openrct2-ui/windows/Tooltip.cpp b/src/openrct2-ui/windows/Tooltip.cpp
index ceb503f1e3..bcf558fef4 100644
--- a/src/openrct2-ui/windows/Tooltip.cpp
+++ b/src/openrct2-ui/windows/Tooltip.cpp
@@ -103,7 +103,7 @@ namespace OpenRCT2::Ui::Windows
UpdatePosition(gTooltipCursor);
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
int32_t left = windowPos.x;
int32_t top = windowPos.y;
diff --git a/src/openrct2-ui/windows/TopToolbar.cpp b/src/openrct2-ui/windows/TopToolbar.cpp
index 09b5ab78ed..940a1f5d81 100644
--- a/src/openrct2-ui/windows/TopToolbar.cpp
+++ b/src/openrct2-ui/windows/TopToolbar.cpp
@@ -313,7 +313,7 @@ namespace OpenRCT2::Ui::Windows
SetItems(items);
WindowDropdownShowText(
- { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1,
+ { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height(),
colours[1].withFlag(ColourFlag::translucent, true), 0, TOP_TOOLBAR_VIEW_MENU_COUNT);
auto mvpFlags = WindowGetMain()->viewport->flags;
@@ -445,7 +445,7 @@ namespace OpenRCT2::Ui::Windows
#endif
WindowDropdownShowText(
- { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1,
+ { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height(),
colours[1].withFlag(ColourFlag::translucent, true), 0, i);
gDropdown.defaultIndex = DDIDX_SHOW_MAP;
}
@@ -512,7 +512,7 @@ namespace OpenRCT2::Ui::Windows
}
WindowDropdownShowText(
- { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1,
+ { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height(),
colours[0].withFlag(ColourFlag::translucent, true), 0, num_items);
// Set checkmarks
@@ -624,7 +624,7 @@ namespace OpenRCT2::Ui::Windows
}
WindowDropdownShowText(
- { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1,
+ { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height(),
colours[0].withFlag(ColourFlag::translucent, true), Dropdown::Flag::StayOpen, numItems);
}
@@ -648,7 +648,7 @@ namespace OpenRCT2::Ui::Windows
SetItems(items);
WindowDropdownShowText(
- { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1,
+ { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height(),
colours[0].withFlag(ColourFlag::translucent, true), Dropdown::Flag::StayOpen, TOP_TOOLBAR_CHEATS_COUNT);
// Disable items that are not yet available in multiplayer
@@ -724,7 +724,7 @@ namespace OpenRCT2::Ui::Windows
gDropdown.items[DDIDX_DEBUG_PAINT] = Dropdown::ToggleOption(STR_DEBUG_DROPDOWN_DEBUG_PAINT);
WindowDropdownShowText(
- { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1,
+ { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height(),
colours[0].withFlag(ColourFlag::translucent, true), Dropdown::Flag::StayOpen, TOP_TOOLBAR_DEBUG_COUNT);
auto* windowMgr = GetWindowManager();
@@ -768,7 +768,7 @@ namespace OpenRCT2::Ui::Windows
gDropdown.items[DDIDX_MULTIPLAYER_RECONNECT] = Dropdown::PlainMenuLabel(STR_MULTIPLAYER_RECONNECT);
WindowDropdownShowText(
- { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1,
+ { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height(),
colours[0].withFlag(ColourFlag::translucent, true), 0, TOP_TOOLBAR_NETWORK_COUNT);
gDropdown.items[DDIDX_MULTIPLAYER_RECONNECT].setDisabled(!Network::IsDesynchronised());
@@ -1261,16 +1261,16 @@ namespace OpenRCT2::Ui::Windows
};
uint32_t mapImageId = _imageIdByRotation[GetCurrentRotation()];
- widgets[WIDX_MAP].image = ImageId(mapImageId, FilterPaletteID::paletteNull);
+ widgets[WIDX_MAP].image = ImageId(mapImageId, Drawing::FilterPaletteID::paletteNull);
}
}
void ApplyAudioState()
{
if (!OpenRCT2::Audio::gGameSoundsOff)
- widgets[WIDX_MUTE].image = ImageId(SPR_G2_TOOLBAR_MUTE, FilterPaletteID::paletteNull);
+ widgets[WIDX_MUTE].image = ImageId(SPR_G2_TOOLBAR_MUTE, Drawing::FilterPaletteID::paletteNull);
else
- widgets[WIDX_MUTE].image = ImageId(SPR_G2_TOOLBAR_UNMUTE, FilterPaletteID::paletteNull);
+ widgets[WIDX_MUTE].image = ImageId(SPR_G2_TOOLBAR_UNMUTE, Drawing::FilterPaletteID::paletteNull);
}
void ApplyFootpathPressed()
@@ -1371,7 +1371,7 @@ namespace OpenRCT2::Ui::Windows
AlignButtonsCentre();
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
const auto& gameState = getGameState();
int32_t imgId;
diff --git a/src/openrct2-ui/windows/TrackDesignManage.cpp b/src/openrct2-ui/windows/TrackDesignManage.cpp
index d4f9ec98a3..f79bb05cd2 100644
--- a/src/openrct2-ui/windows/TrackDesignManage.cpp
+++ b/src/openrct2-ui/windows/TrackDesignManage.cpp
@@ -133,7 +133,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
Formatter::Common().Add(_trackDesignFileReference->name.c_str());
drawWidgets(rt);
@@ -183,7 +183,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
diff --git a/src/openrct2-ui/windows/TrackDesignPlace.cpp b/src/openrct2-ui/windows/TrackDesignPlace.cpp
index cc08d55099..9a65afe4f8 100644
--- a/src/openrct2-ui/windows/TrackDesignPlace.cpp
+++ b/src/openrct2-ui/windows/TrackDesignPlace.cpp
@@ -21,6 +21,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -40,6 +41,8 @@
using namespace OpenRCT2::Numerics;
using namespace OpenRCT2::TrackMetaData;
+using OpenRCT2::GameActions::CommandFlag;
+using OpenRCT2::GameActions::CommandFlags;
namespace OpenRCT2::Ui::Windows
{
@@ -108,7 +111,7 @@ namespace OpenRCT2::Ui::Windows
setWidgets(_trackPlaceWidgets);
WindowInitScrollWidgets(*this);
ToolSet(*this, WIDX_PRICE, Tool::crosshair);
- gInputFlags.set(InputFlag::unk6);
+ gInputFlags.set(InputFlag::allowRightMouseRemoval);
WindowPushOthersRight(*this);
ShowGridlines();
_miniPreview.resize(kTrackMiniPreviewSize.width * kTrackMiniPreviewSize.height);
@@ -121,7 +124,6 @@ namespace OpenRCT2::Ui::Windows
{
ClearProvisional();
ViewportSetVisibility(ViewportVisibility::standard);
- MapInvalidateMapSelectionTiles();
gMapSelectFlags.unset(MapSelectFlag::enableConstruct);
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
HideGridlines();
@@ -172,7 +174,6 @@ namespace OpenRCT2::Ui::Windows
{
TrackDesignState tds{};
- MapInvalidateMapSelectionTiles();
gMapSelectFlags.unset(MapSelectFlag::enable);
gMapSelectFlags.unset(MapSelectFlag::enableConstruct);
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
@@ -220,23 +221,25 @@ namespace OpenRCT2::Ui::Windows
{
ClearProvisional();
CoordsXYZD ghostTrackLoc = trackLoc;
- auto res = FindValidTrackDesignPlaceHeight(ghostTrackLoc, GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST);
+ auto res = FindValidTrackDesignPlaceHeight(ghostTrackLoc, { CommandFlag::noSpend, CommandFlag::ghost });
- if (res.Error == GameActions::Status::Ok)
+ if (res.error == GameActions::Status::ok)
{
// Valid location found. Place the ghost at the location.
- auto tdAction = GameActions::TrackDesignAction(ghostTrackLoc, *_trackDesign, !gTrackDesignSceneryToggle);
- tdAction.SetFlags(GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST);
+ auto tdAction = GameActions::TrackDesignAction(
+ ghostTrackLoc, *_trackDesign, !gTrackDesignSceneryToggle,
+ Config::Get().general.defaultInspectionInterval);
+ tdAction.SetFlags({ CommandFlag::noSpend, CommandFlag::ghost });
tdAction.SetCallback([&](const GameActions::GameAction*, const GameActions::Result* result) {
- if (result->Error == GameActions::Status::Ok)
+ if (result->error == GameActions::Status::ok)
{
- _placementGhostRideId = result->GetData();
+ _placementGhostRideId = result->getData();
_placementGhostLoc = ghostTrackLoc;
_hasPlacementGhost = true;
}
});
res = GameActions::Execute(&tdAction, getGameState());
- cost = res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined;
+ cost = res.error == GameActions::Status::ok ? res.cost : kMoney64Undefined;
VirtualFloorSetHeight(ghostTrackLoc.z);
}
@@ -256,7 +259,6 @@ namespace OpenRCT2::Ui::Windows
void onToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override
{
ClearProvisional();
- MapInvalidateMapSelectionTiles();
gMapSelectFlags.unset(MapSelectFlag::enable);
gMapSelectFlags.unset(MapSelectFlag::enableConstruct);
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
@@ -284,30 +286,31 @@ namespace OpenRCT2::Ui::Windows
// Try increasing Z until a feasible placement is found
CoordsXYZ trackLoc = { mapCoords, maybeMapZ.value() };
- auto res = FindValidTrackDesignPlaceHeight(trackLoc, 0);
- if (res.Error != GameActions::Status::Ok)
+ auto res = FindValidTrackDesignPlaceHeight(trackLoc, {});
+ if (res.error != GameActions::Status::ok)
{
// Unable to build track
Audio::Play3D(Audio::SoundId::error, trackLoc);
auto windowManager = GetWindowManager();
- windowManager->ShowError(res.GetErrorTitle(), res.GetErrorMessage());
+ windowManager->ShowError(res.getErrorTitle(), res.getErrorMessage());
return;
}
_placingTrackDesign = true;
auto tdAction = GameActions::TrackDesignAction(
- { trackLoc, _currentTrackPieceDirection }, *_trackDesign, !gTrackDesignSceneryToggle);
+ { trackLoc, _currentTrackPieceDirection }, *_trackDesign, !gTrackDesignSceneryToggle,
+ Config::Get().general.defaultInspectionInterval);
tdAction.SetCallback([&, trackLoc](const GameActions::GameAction*, const GameActions::Result* result) {
- if (result->Error != GameActions::Status::Ok)
+ if (result->error != GameActions::Status::ok)
{
- Audio::Play3D(Audio::SoundId::error, result->Position);
+ Audio::Play3D(Audio::SoundId::error, result->position);
_placingTrackDesign = false;
return;
}
- rideId = result->GetData();
+ rideId = result->getData();
auto getRide = GetRide(rideId);
if (getRide != nullptr)
{
@@ -352,14 +355,14 @@ namespace OpenRCT2::Ui::Windows
DrawMiniPreview(*_trackDesign);
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
auto ft = Formatter::Common();
ft.Add(_trackDesign->gameStateData.name.c_str());
WindowDrawWidgets(*this, rt);
// Draw mini tile preview
- RenderTarget clippedRT;
+ Drawing::RenderTarget clippedRT;
const auto& previewWidget = widgets[WIDX_PREVIEW];
const auto previewCoords = windowPos + ScreenCoordsXY{ previewWidget.left, previewWidget.top };
if (ClipDrawPixelInfo(clippedRT, rt, previewCoords, previewWidget.width(), previewWidget.height()))
@@ -401,10 +404,11 @@ namespace OpenRCT2::Ui::Windows
if (_hasPlacementGhost)
{
auto tdAction = GameActions::TrackDesignAction(
- { _placementGhostLoc }, *_trackDesign, !gTrackDesignSceneryToggle);
- tdAction.SetFlags(GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST);
+ { _placementGhostLoc }, *_trackDesign, !gTrackDesignSceneryToggle,
+ Config::Get().general.defaultInspectionInterval);
+ tdAction.SetFlags({ CommandFlag::noSpend, CommandFlag::ghost });
auto res = GameActions::Execute(&tdAction, getGameState());
- if (res.Error != GameActions::Status::Ok)
+ if (res.error != GameActions::Status::ok)
{
_hasPlacementGhost = false;
}
@@ -651,7 +655,7 @@ namespace OpenRCT2::Ui::Windows
auto bits = trackBlock.quarterTile.Rotate(curTrackRotation & 3).GetBaseQuarterOccupied();
// Station track is a lighter colour
- uint8_t colour = (ted.sequences[0].flags & TRACK_SEQUENCE_FLAG_ORIGIN) ? kPaletteIndexColourStation
+ uint8_t colour = ted.sequences[0].flags.has(SequenceFlag::trackOrigin) ? kPaletteIndexColourStation
: kPaletteIndexColourTrack;
for (int32_t i = 0; i < 4; i++)
@@ -742,19 +746,20 @@ namespace OpenRCT2::Ui::Windows
return &_miniPreview[pixel.y * kTrackMiniPreviewSize.width + pixel.x];
}
- GameActions::Result FindValidTrackDesignPlaceHeight(CoordsXYZ& loc, uint32_t newFlags)
+ GameActions::Result FindValidTrackDesignPlaceHeight(CoordsXYZ& loc, CommandFlags newFlags)
{
GameActions::Result res;
for (int32_t i = 0; i < 7; i++, loc.z += kCoordsZStep)
{
auto tdAction = GameActions::TrackDesignAction(
- CoordsXYZD{ loc.x, loc.y, loc.z, _currentTrackPieceDirection }, *_trackDesign, !gTrackDesignSceneryToggle);
+ CoordsXYZD{ loc.x, loc.y, loc.z, _currentTrackPieceDirection }, *_trackDesign, !gTrackDesignSceneryToggle,
+ Config::Get().general.defaultInspectionInterval);
tdAction.SetFlags(newFlags);
res = GameActions::Query(&tdAction, getGameState());
// If successful don't keep trying.
// If failure due to no money then increasing height only makes problem worse
- if (res.Error == GameActions::Status::Ok || res.Error == GameActions::Status::InsufficientFunds)
+ if (res.error == GameActions::Status::ok || res.error == GameActions::Status::insufficientFunds)
{
return res;
}
diff --git a/src/openrct2-ui/windows/TrackList.cpp b/src/openrct2-ui/windows/TrackList.cpp
index d577872c25..9783599eae 100644
--- a/src/openrct2-ui/windows/TrackList.cpp
+++ b/src/openrct2-ui/windows/TrackList.cpp
@@ -452,7 +452,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
@@ -511,7 +511,7 @@ namespace OpenRCT2::Ui::Windows
g1temp.offset = _trackDesignPreviewPixels.data() + (_currentTrackPieceDirection * kTrackPreviewImageSize);
g1temp.width = 370;
g1temp.height = 217;
- g1temp.flags = G1_FLAG_HAS_TRANSPARENCY;
+ g1temp.flags = { G1Flag::hasTransparency };
GfxSetG1Element(SPR_TEMP, &g1temp);
DrawingEngineInvalidateImage(SPR_TEMP);
GfxDrawSprite(rt, ImageId(SPR_TEMP), trackPreview);
@@ -673,7 +673,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onScrollDraw(const int32_t scrollIndex, RenderTarget& rt) override
+ void onScrollDraw(const int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
uint8_t paletteIndex = ColourMapA[colours[0].colour].mid_light;
GfxClear(rt, paletteIndex);
diff --git a/src/openrct2-ui/windows/Transparency.cpp b/src/openrct2-ui/windows/Transparency.cpp
index 0c13353dec..73f0defddc 100644
--- a/src/openrct2-ui/windows/Transparency.cpp
+++ b/src/openrct2-ui/windows/Transparency.cpp
@@ -141,7 +141,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
// Locate mechanic button image
diff --git a/src/openrct2-ui/windows/ViewClipping.cpp b/src/openrct2-ui/windows/ViewClipping.cpp
index f6f0b320ee..0fef3c583b 100644
--- a/src/openrct2-ui/windows/ViewClipping.cpp
+++ b/src/openrct2-ui/windows/ViewClipping.cpp
@@ -248,14 +248,12 @@ namespace OpenRCT2::Ui::Windows
auto mapCoords = ScreenPosToMapPos(screenCoords, &direction);
if (mapCoords)
{
- MapInvalidateSelectionRect();
gMapSelectFlags.set(MapSelectFlag::enable);
gMapSelectPositionA.x = std::min(_selectionStart.x, mapCoords->x);
gMapSelectPositionB.x = std::max(_selectionStart.x, mapCoords->x);
gMapSelectPositionA.y = std::min(_selectionStart.y, mapCoords->y);
gMapSelectPositionB.y = std::max(_selectionStart.y, mapCoords->y);
gMapSelectType = MapSelectType::full;
- MapInvalidateSelectionRect();
}
}
@@ -290,7 +288,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
WindowDrawWidgets(*this, rt);
diff --git a/src/openrct2-ui/windows/Viewport.cpp b/src/openrct2-ui/windows/Viewport.cpp
index 619b416560..a2d11750fb 100644
--- a/src/openrct2-ui/windows/Viewport.cpp
+++ b/src/openrct2-ui/windows/Viewport.cpp
@@ -149,7 +149,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
@@ -200,7 +200,7 @@ namespace OpenRCT2::Ui::Windows
Widget* viewportWidget = &widgets[WIDX_VIEWPORT];
viewport->pos = windowPos + ScreenCoordsXY{ viewportWidget->left + 1, viewportWidget->top + 1 };
viewport->width = widgets[WIDX_VIEWPORT].width() - 2;
- viewport->height = widgets[WIDX_VIEWPORT].height() - 1;
+ viewport->height = widgets[WIDX_VIEWPORT].height() - 2;
}
}
};
diff --git a/src/openrct2-ui/windows/Water.cpp b/src/openrct2-ui/windows/Water.cpp
index b8af23f4ad..30f3309568 100644
--- a/src/openrct2-ui/windows/Water.cpp
+++ b/src/openrct2-ui/windows/Water.cpp
@@ -149,7 +149,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gLandToolSize));
}
- void onDraw(RenderTarget& rt) override
+ void onDraw(Drawing::RenderTarget& rt) override
{
auto screenCoords = ScreenCoordsXY{ windowPos.x + widgets[WIDX_PREVIEW].midX(),
windowPos.y + widgets[WIDX_PREVIEW].midY() };
@@ -224,7 +224,6 @@ namespace OpenRCT2::Ui::Windows
switch (widgetIndex)
{
case WIDX_BACKGROUND:
- MapInvalidateSelectionRect();
gMapSelectFlags.unset(MapSelectFlag::enable);
gCurrentToolId = Tool::waterDown;
break;
@@ -295,14 +294,12 @@ namespace OpenRCT2::Ui::Windows
*/
void ToolUpdateWater(const ScreenCoordsXY& screenPos)
{
- MapInvalidateSelectionRect();
-
auto* windowMgr = Ui::GetWindowManager();
auto& gameState = getGameState();
if (gCurrentToolId == Tool::upDownArrow)
{
- if (!(gMapSelectFlags.has(MapSelectFlag::enable)))
+ if (!gMapSelectFlags.has(MapSelectFlag::enable))
return;
auto waterLowerAction = GameActions::WaterLowerAction(
@@ -311,10 +308,10 @@ namespace OpenRCT2::Ui::Windows
{ gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y });
auto res = GameActions::Query(&waterLowerAction, gameState);
- money64 lowerCost = res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined;
+ money64 lowerCost = res.error == GameActions::Status::ok ? res.cost : kMoney64Undefined;
res = GameActions::Query(&waterRaiseAction, gameState);
- money64 raiseCost = res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined;
+ money64 raiseCost = res.error == GameActions::Status::ok ? res.cost : kMoney64Undefined;
if (_waterToolRaiseCost != raiseCost || _waterToolLowerCost != lowerCost)
{
@@ -345,7 +342,7 @@ namespace OpenRCT2::Ui::Windows
uint8_t state_changed = 0;
- if (!(gMapSelectFlags.has(MapSelectFlag::enable)))
+ if (!gMapSelectFlags.has(MapSelectFlag::enable))
{
gMapSelectFlags.set(MapSelectFlag::enable);
state_changed++;
@@ -392,7 +389,6 @@ namespace OpenRCT2::Ui::Windows
state_changed++;
}
- MapInvalidateSelectionRect();
if (!state_changed)
return;
@@ -402,10 +398,10 @@ namespace OpenRCT2::Ui::Windows
{ gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y });
auto res = GameActions::Query(&waterLowerAction, gameState);
- money64 lowerCost = res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined;
+ money64 lowerCost = res.error == GameActions::Status::ok ? res.cost : kMoney64Undefined;
res = GameActions::Query(&waterRaiseAction, gameState);
- money64 raiseCost = res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined;
+ money64 raiseCost = res.error == GameActions::Status::ok ? res.cost : kMoney64Undefined;
if (_waterToolRaiseCost != raiseCost || _waterToolLowerCost != lowerCost)
{
@@ -447,7 +443,7 @@ namespace OpenRCT2::Ui::Windows
ShowGridlines();
auto* toolWindow = ContextOpenWindow(WindowClass::water);
ToolSet(*toolWindow, WIDX_BACKGROUND, Tool::waterDown);
- gInputFlags.set(InputFlag::unk6);
+ gInputFlags.set(InputFlag::allowRightMouseRemoval);
}
}
} // namespace OpenRCT2::Ui::Windows
diff --git a/src/openrct2-ui/windows/Windows.h b/src/openrct2-ui/windows/Windows.h
index 4f0220c2fb..a96345c992 100644
--- a/src/openrct2-ui/windows/Windows.h
+++ b/src/openrct2-ui/windows/Windows.h
@@ -219,12 +219,12 @@ namespace OpenRCT2::Ui::Windows
WindowBase* ResearchOpen();
void WindowResearchDevelopmentMouseUp(WidgetIndex widgetIndex, WidgetIndex baseWidgetIndex);
void WindowResearchDevelopmentPrepareDraw(WindowBase* w, WidgetIndex baseWidgetIndex);
- void WindowResearchDevelopmentDraw(WindowBase* w, RenderTarget& rt, WidgetIndex baseWidgetIndex);
+ void WindowResearchDevelopmentDraw(WindowBase* w, Drawing::RenderTarget& rt, WidgetIndex baseWidgetIndex);
void WindowResearchFundingMouseDown(WindowBase* w, WidgetIndex widgetIndex, WidgetIndex baseWidgetIndex);
void WindowResearchFundingMouseUp(WidgetIndex widgetIndex, WidgetIndex baseWidgetIndex);
void WindowResearchFundingDropdown(WidgetIndex widgetIndex, int32_t selectedIndex, WidgetIndex baseWidgetIndex);
void WindowResearchFundingPrepareDraw(WindowBase* w, WidgetIndex baseWidgetIndex);
- void WindowResearchFundingDraw(WindowBase* w, RenderTarget& dpi);
+ void WindowResearchFundingDraw(WindowBase* w, Drawing::RenderTarget& dpi);
// Ride
WindowBase* RideMainOpen(const Ride& ride);
diff --git a/src/openrct2/Context.cpp b/src/openrct2/Context.cpp
index 78867e2f83..e697a8a485 100644
--- a/src/openrct2/Context.cpp
+++ b/src/openrct2/Context.cpp
@@ -19,6 +19,7 @@
#include "Game.h"
#include "GameState.h"
#include "GameStateSnapshots.h"
+#include "Input.h"
#include "OpenRCT2.h"
#include "ParkImporter.h"
#include "PlatformEnvironment.h"
@@ -42,6 +43,7 @@
#include "drawing/Image.h"
#include "drawing/LightFX.h"
#include "entity/EntityTweener.h"
+#include "entity/PatrolArea.h"
#include "interface/Chat.h"
#include "interface/StdInOutConsole.h"
#include "interface/Viewport.h"
@@ -72,6 +74,7 @@
#include "ui/UiContext.h"
#include "ui/WindowManager.h"
#include "world/MapAnimation.h"
+#include "world/MapSelection.h"
#include
#include
@@ -533,9 +536,8 @@ namespace OpenRCT2
Drawing::LightFx::Init();
}
- ViewportInitAll();
-
ContextInit();
+ ResetSubsystems();
if (!gOpenRCT2Headless)
{
@@ -555,6 +557,28 @@ namespace OpenRCT2
return true;
}
+ /**
+ * rct2: 0x006E6EAC
+ */
+ void ResetSubsystems() override
+ {
+ if (!gOpenRCT2NoGraphics)
+ {
+ ColoursInitMaps();
+ }
+
+ WindowInitAll();
+
+ gInputFlags.clearAll();
+ InputSetState(InputState::Reset);
+ gPressedWidget.windowClassification = WindowClass::null;
+ gPickupPeepImage = ImageId();
+ ResetTooltipNotShown();
+ gMapSelectFlags.clearAll();
+ ClearPatrolAreaToRender();
+ TextinputCancel();
+ }
+
private:
void InitialiseRepositories()
{
@@ -1215,7 +1239,7 @@ namespace OpenRCT2
if (!gOpenRCT2Headless)
{
- _preloaderScene->SetOnComplete([&]() { SwitchToStartUpScene(); });
+ GetPreloaderScene()->SetOnComplete([&]() { SwitchToStartUpScene(); });
}
else
{
@@ -1299,6 +1323,8 @@ namespace OpenRCT2
UpdateTimeAccumulators(deltaTime);
+ Network::Update();
+
if (useVariableFrame)
{
RunVariableFrame(deltaTime);
@@ -1307,6 +1333,8 @@ namespace OpenRCT2
{
RunFixedFrame(deltaTime);
}
+
+ Network::Flush();
}
void UpdateTimeAccumulators(float deltaTime)
@@ -1332,7 +1360,7 @@ namespace OpenRCT2
if (_ticksAccumulator < kGameUpdateTimeMS)
{
- const auto sleepTimeSec = (kGameUpdateTimeMS - _ticksAccumulator);
+ const auto sleepTimeSec = std::min(kNetworkUpdateTimeMS, kGameUpdateTimeMS - _ticksAccumulator);
Platform::Sleep(static_cast(sleepTimeSec * 1000.f));
return;
}
@@ -1596,6 +1624,11 @@ namespace OpenRCT2
GetWindowManager()->Init();
}
+ void ContextResetSubsystems()
+ {
+ GetContext()->ResetSubsystems();
+ }
+
bool ContextLoadParkFromStream(void* stream)
{
return GetContext()->LoadParkFromStream(static_cast(stream), "");
diff --git a/src/openrct2/Context.h b/src/openrct2/Context.h
index a6ba477f6d..92e9b33eb5 100644
--- a/src/openrct2/Context.h
+++ b/src/openrct2/Context.h
@@ -119,6 +119,8 @@ namespace OpenRCT2
virtual int32_t RunOpenRCT2(int argc, const char** argv) = 0;
virtual bool Initialise() = 0;
+ virtual void ResetSubsystems() = 0;
+
virtual void InitialiseDrawingEngine() = 0;
virtual void DisposeDrawingEngine() = 0;
@@ -151,6 +153,7 @@ namespace OpenRCT2
[[nodiscard]] IContext* GetContext();
void ContextInit();
+ void ContextResetSubsystems();
void ContextSetCurrentCursor(CursorID cursor);
void ContextUpdateCursorScale();
void ContextHideCursor();
diff --git a/src/openrct2/Editor.cpp b/src/openrct2/Editor.cpp
index eb0596f0b5..44995fc961 100644
--- a/src/openrct2/Editor.cpp
+++ b/src/openrct2/Editor.cpp
@@ -28,7 +28,6 @@
#include "entity/Guest.h"
#include "entity/PatrolArea.h"
#include "entity/Staff.h"
-#include "interface/Viewport.h"
#include "interface/WindowBase.h"
#include "localisation/LocalisationService.h"
#include "management/Finance.h"
@@ -55,6 +54,7 @@
#include
using namespace OpenRCT2;
+using OpenRCT2::GameActions::CommandFlag;
namespace OpenRCT2::Editor
{
@@ -117,7 +117,7 @@ namespace OpenRCT2::Editor
gameState.park.flags |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
gameState.scenarioOptions.category = Scenario::Category::other;
ObjectListLoad();
- ViewportInitAll();
+ ContextResetSubsystems();
WindowBase* mainWindow = OpenEditorWindows();
mainWindow->setViewportLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ());
LoadPalette();
@@ -160,7 +160,7 @@ namespace OpenRCT2::Editor
gLegacyScene = LegacyScene::scenarioEditor;
gameState.editorStep = EditorStep::OptionsSelection;
gameState.scenarioOptions.category = Scenario::Category::other;
- ViewportInitAll();
+ ContextResetSubsystems();
OpenEditorWindows();
FinaliseMainView();
gScreenAge = 0;
@@ -194,7 +194,7 @@ namespace OpenRCT2::Editor
gameState.editorStep = EditorStep::ObjectSelection;
SetAllLandOwned();
ObjectListLoad();
- ViewportInitAll();
+ ContextResetSubsystems();
WindowBase* mainWindow = OpenEditorWindows();
mainWindow->setViewportLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ());
LoadPalette();
@@ -222,7 +222,7 @@ namespace OpenRCT2::Editor
SetAllLandOwned();
gameState.editorStep = EditorStep::ObjectSelection;
ObjectListLoad();
- ViewportInitAll();
+ ContextResetSubsystems();
WindowBase* mainWindow = OpenEditorWindows();
mainWindow->setViewportLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ());
LoadPalette();
@@ -243,11 +243,11 @@ namespace OpenRCT2::Editor
(gameState.mapSize.y - 3) * kCoordsXYStep };
auto landSetRightsAction = GameActions::LandSetRightsAction(range, GameActions::LandSetRightSetting::SetForSale);
- landSetRightsAction.SetFlags(GAME_COMMAND_FLAG_NO_SPEND);
+ landSetRightsAction.SetFlags({ CommandFlag::noSpend });
GameActions::Execute(&landSetRightsAction, gameState);
auto landBuyRightsAction = GameActions::LandBuyRightsAction(range, GameActions::LandBuyRightSetting::BuyLand);
- landBuyRightsAction.SetFlags(GAME_COMMAND_FLAG_NO_SPEND);
+ landBuyRightsAction.SetFlags({ CommandFlag::noSpend });
GameActions::Execute(&landBuyRightsAction, gameState);
}
@@ -262,7 +262,7 @@ namespace OpenRCT2::Editor
getGameState().editorStep = EditorStep::LandscapeEditor;
gScreenAge = 0;
gLegacyScene = LegacyScene::scenarioEditor;
- ViewportInitAll();
+ ContextResetSubsystems();
OpenEditorWindows();
FinaliseMainView();
diff --git a/src/openrct2/Game.cpp b/src/openrct2/Game.cpp
index fb037c21d6..1314b67094 100644
--- a/src/openrct2/Game.cpp
+++ b/src/openrct2/Game.cpp
@@ -364,7 +364,7 @@ void GameLoadInit()
if (!gLoadKeepWindowsOpen)
{
- ViewportInitAll();
+ ContextResetSubsystems();
GameCreateWindows();
}
else
diff --git a/src/openrct2/Game.h b/src/openrct2/Game.h
index 9b08cf16c3..13d5a3b989 100644
--- a/src/openrct2/Game.h
+++ b/src/openrct2/Game.h
@@ -26,6 +26,11 @@ namespace OpenRCT2
// The maximum threshold to advance.
constexpr float kGameUpdateMaxThreshold = kGameUpdateTimeMS * kGameMaxUpdates;
+ // The network update runs at a different rate to the game update.
+ constexpr uint32_t kNetworkUpdateFPS = 140;
+ // The network update interval in milliseconds, (1000 / 140fps) = ~7.14ms
+ constexpr float kNetworkUpdateTimeMS = 1.0f / kNetworkUpdateFPS;
+
constexpr float kGameMinTimeScale = 0.1f;
constexpr float kGameMaxTimeScale = 5.0f;
} // namespace OpenRCT2
@@ -121,19 +126,6 @@ enum class GameCommand : int32_t
Count,
};
-enum : uint32_t
-{
- GAME_COMMAND_FLAG_APPLY = (1 << 0), // If this flag is set, the command is applied, otherwise only the cost is retrieved
- GAME_COMMAND_FLAG_REPLAY = (1 << 1), // Command was issued from replay manager.
- GAME_COMMAND_FLAG_2 = (1 << 2), // Unused
- GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED = (1 << 3), // Allow while paused
- GAME_COMMAND_FLAG_4 = (1 << 4), // Unused
- GAME_COMMAND_FLAG_NO_SPEND = (1 << 5), // Game command is not networked
- GAME_COMMAND_FLAG_GHOST = (1 << 6), // Game command is not networked
- GAME_COMMAND_FLAG_TRACK_DESIGN = (1 << 7),
- GAME_COMMAND_FLAG_NETWORKED = (1u << 31) // Game command is coming from network
-};
-
enum
{
GAME_PAUSED_NORMAL = 1 << 0,
diff --git a/src/openrct2/GameState.cpp b/src/openrct2/GameState.cpp
index d8ec67127b..3de0e5b5a1 100644
--- a/src/openrct2/GameState.cpp
+++ b/src/openrct2/GameState.cpp
@@ -173,7 +173,7 @@ namespace OpenRCT2
getGameState().entities.UpdateMoneyEffect();
// Post-tick network update
- Network::ProcessPending();
+ Network::PostTick();
// Post-tick game actions.
GameActions::ProcessQueue();
@@ -181,6 +181,12 @@ namespace OpenRCT2
}
}
+ // Network has to always tick.
+ if (numUpdates == 0)
+ {
+ Network::Tick();
+ }
+
// Update the game one or more times
for (uint32_t i = 0; i < numUpdates; i++)
{
@@ -251,7 +257,7 @@ namespace OpenRCT2
GetContext()->GetReplayManager()->Update();
- Network::Update();
+ Network::Tick();
auto& gameState = getGameState();
@@ -344,7 +350,7 @@ namespace OpenRCT2
GameActions::ProcessQueue();
- Network::ProcessPending();
+ Network::PostTick();
Network::Flush();
gameState.currentTicks++;
diff --git a/src/openrct2/Input.h b/src/openrct2/Input.h
index 04efdf88b4..7411b8cc34 100644
--- a/src/openrct2/Input.h
+++ b/src/openrct2/Input.h
@@ -33,9 +33,7 @@ namespace OpenRCT2
rightMousePressed,
- // Some of the map tools (clear, footpath, scenery)
- // never read as far as I know.
- unk6,
+ allowRightMouseRemoval,
viewportScrolling,
};
diff --git a/src/openrct2/PlatformEnvironment.cpp b/src/openrct2/PlatformEnvironment.cpp
index 8772048703..f656142adb 100644
--- a/src/openrct2/PlatformEnvironment.cpp
+++ b/src/openrct2/PlatformEnvironment.cpp
@@ -108,6 +108,9 @@ public:
{
default:
case DirBase::rct1:
+ if (basePath.empty())
+ return {};
+
directoryName = kDirectoryNamesRCT2[EnumValue(did)];
break;
case DirBase::rct2:
diff --git a/src/openrct2/ReplayManager.cpp b/src/openrct2/ReplayManager.cpp
index f20979fce2..4a681c1862 100644
--- a/src/openrct2/ReplayManager.cpp
+++ b/src/openrct2/ReplayManager.cpp
@@ -27,12 +27,16 @@
#include "config/Config.h"
#include "core/Compression.h"
#include "core/DataSerialiser.h"
+#include "core/EnumUtils.hpp"
#include "core/FileStream.h"
#include "core/FileSystem.hpp"
#include "core/Path.hpp"
+#include "core/String.hpp"
#include "entity/EntityRegistry.h"
#include "entity/EntityTweener.h"
#include "interface/Window.h"
+#include "localisation/Formatting.h"
+#include "localisation/StringIds.h"
#include "management/NewsItem.h"
#include "object/ObjectManager.h"
#include "object/ObjectRepository.h"
@@ -41,7 +45,10 @@
#include "world/Park.h"
#include
+#include
#include
+#include
+#include
#include
namespace OpenRCT2
@@ -121,6 +128,13 @@ namespace OpenRCT2
NORMALISATION,
};
+ static constexpr std::array modeToName = {
+ "NONE",
+ "RECORDING",
+ "PLAYING",
+ "NORMALISATION",
+ };
+
public:
virtual ~ReplayManager()
{
@@ -415,23 +429,25 @@ namespace OpenRCT2
}
}
- virtual bool StartPlayback(const std::string& file) override
+ void StartPlayback(const std::string& file) override
{
if (_mode != ReplayMode::NONE && _mode != ReplayMode::NORMALISATION)
- return false;
+ throw std::invalid_argument(std::string("Unexpected mode ") + modeToName[EnumValue(_mode)]);
auto replayData = std::make_unique();
- if (!ReadReplayData(file, *replayData))
+ try
{
- LOG_ERROR("Unable to read replay data.");
- return false;
+ ReadReplayData(file, *replayData);
+ }
+ catch (const std::exception&)
+ {
+ throw;
}
if (!LoadReplayDataMap(*replayData))
{
- LOG_ERROR("Unable to load map.");
- return false;
+ throw std::runtime_error("Unable to load map.");
}
getGameState().currentTicks = replayData->tickStart;
@@ -447,8 +463,6 @@ namespace OpenRCT2
if (_mode != ReplayMode::NORMALISATION)
_mode = ReplayMode::PLAYING;
-
- return true;
}
virtual bool IsPlaybackStateMismatching() const override
@@ -485,7 +499,11 @@ namespace OpenRCT2
{
_mode = ReplayMode::NORMALISATION;
- if (!StartPlayback(file))
+ try
+ {
+ StartPlayback(file);
+ }
+ catch (const std::invalid_argument&)
{
return false;
}
@@ -595,23 +613,31 @@ namespace OpenRCT2
return recFile.data;
}
- bool ReadReplayData(const std::string& file, ReplayRecordData& data)
+ void ReadReplayData(const std::string& file, ReplayRecordData& data)
{
fs::path filePath = file;
- if (filePath.extension() != ".parkrep")
- filePath += ".parkrep";
- if (filePath.is_relative())
+ if (filePath.is_absolute())
{
+ if (!fs::exists(filePath))
+ {
+ throw std::runtime_error(FormatStringID(STR_REPLAY_FILE_NOT_FOUND, filePath.u8string().c_str()));
+ }
+ }
+ else if (filePath.is_relative())
+ {
+ if (filePath.extension() != ".parkrep")
+ filePath += ".parkrep";
fs::path replayPath = GetContext()->GetPlatformEnvironment().GetDirectoryPath(
DirBase::user, DirId::replayRecordings)
/ filePath;
- if (fs::is_regular_file(replayPath))
- filePath = replayPath;
+ filePath = replayPath;
}
if (!fs::is_regular_file(filePath))
- return false;
+ {
+ throw std::runtime_error(FormatStringID(STR_REPLAY_FILE_NOT_FOUND, filePath.u8string().c_str()));
+ }
FileStream fileStream(filePath, FileMode::open);
MemoryStream stream = DecompressFile(fileStream);
@@ -620,7 +646,7 @@ namespace OpenRCT2
DataSerialiser serialiser(false, stream);
if (!Serialise(serialiser, data))
{
- return false;
+ throw std::runtime_error(LanguageGetString(STR_REPLAY_NOT_STARTED));
}
// Reset position of all streams.
@@ -628,8 +654,6 @@ namespace OpenRCT2
data.parkParams.SetPosition(0);
data.cheatData.SetPosition(0);
data.gameStateSnapshots.SetPosition(0);
-
- return true;
}
bool SerialiseCheats(DataSerialiser& serialiser)
@@ -837,20 +861,20 @@ namespace OpenRCT2
bool isPositionValid = false;
GameAction* action = command.action.get();
- action->SetFlags(action->GetFlags() | GAME_COMMAND_FLAG_REPLAY);
+ action->SetFlags(action->GetFlags().with(CommandFlag::replay));
GameActions::Result result = GameActions::Execute(action, gameState);
- if (result.Error == GameActions::Status::Ok)
+ if (result.error == GameActions::Status::ok)
{
isPositionValid = true;
}
// Focus camera on event.
- if (!gSilentReplays && isPositionValid && !result.Position.IsNull())
+ if (!gSilentReplays && isPositionValid && !result.position.IsNull())
{
auto* mainWindow = WindowGetMain();
if (mainWindow != nullptr)
- WindowScrollToLocation(*mainWindow, result.Position);
+ WindowScrollToLocation(*mainWindow, result.position);
}
replayQueue.erase(replayQueue.begin());
diff --git a/src/openrct2/ReplayManager.h b/src/openrct2/ReplayManager.h
index d3f3a98bc0..a6a9ef7410 100644
--- a/src/openrct2/ReplayManager.h
+++ b/src/openrct2/ReplayManager.h
@@ -60,7 +60,7 @@ namespace OpenRCT2
virtual bool StopRecording(bool discard = false) = 0;
virtual bool GetCurrentReplayInfo(ReplayRecordInfo& info) const = 0;
- virtual bool StartPlayback(const std::string& file) = 0;
+ virtual void StartPlayback(const std::string& file) = 0;
virtual bool IsPlaybackStateMismatching() const = 0;
virtual bool StopPlayback() = 0;
diff --git a/src/openrct2/SpriteIds.h b/src/openrct2/SpriteIds.h
index 02c5c98864..f53b4f79f5 100644
--- a/src/openrct2/SpriteIds.h
+++ b/src/openrct2/SpriteIds.h
@@ -23,7 +23,7 @@ enum : ImageIndex
SPR_DEFAULT_PALETTE = 1532,
SPR_SCROLLING_TEXT_LEGACY_START = 1542,
- SPR_SCROLLING_TEXT_LEGACY_END = SPR_SCROLLING_TEXT_LEGACY_START + OpenRCT2::kMaxScrollingTextLegacyEntries,
+ SPR_SCROLLING_TEXT_LEGACY_END = SPR_SCROLLING_TEXT_LEGACY_START + OpenRCT2::Drawing::ScrollingText::kMaxLegacyEntries,
SPR_SCROLLING_TEXT_DEFAULT = 1574,
SPR_EDGE_ROCK_BASE = 1579,
@@ -1807,7 +1807,7 @@ enum : ImageIndex
SPR_CSG_END = SPR_CSG_BEGIN + OpenRCT2::RCT1::Limits::kNumLLCsgEntries,
SPR_SCROLLING_TEXT_START = SPR_CSG_END,
- SPR_SCROLLING_TEXT_END = SPR_SCROLLING_TEXT_START + OpenRCT2::kMaxScrollingTextEntries,
+ SPR_SCROLLING_TEXT_END = SPR_SCROLLING_TEXT_START + OpenRCT2::Drawing::ScrollingText::kMaxEntries,
SPR_IMAGE_LIST_LENGTH = 1000000,
SPR_IMAGE_LIST_BEGIN = SPR_SCROLLING_TEXT_END,
diff --git a/src/openrct2/actions/BalloonPressAction.cpp b/src/openrct2/actions/BalloonPressAction.cpp
index f3562fb956..7065ca4c96 100644
--- a/src/openrct2/actions/BalloonPressAction.cpp
+++ b/src/openrct2/actions/BalloonPressAction.cpp
@@ -44,7 +44,7 @@ namespace OpenRCT2::GameActions
if (balloon == nullptr)
{
LOG_ERROR("Balloon not found for spriteIndex %u", _spriteIndex);
- return Result(Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_BALLOON_NOT_FOUND);
+ return Result(Status::invalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_BALLOON_NOT_FOUND);
}
return Result();
}
@@ -55,7 +55,7 @@ namespace OpenRCT2::GameActions
if (balloon == nullptr)
{
LOG_ERROR("Balloon not found for spriteIndex %u", _spriteIndex);
- return Result(Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_BALLOON_NOT_FOUND);
+ return Result(Status::invalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_BALLOON_NOT_FOUND);
}
balloon->Press();
diff --git a/src/openrct2/actions/BannerPlaceAction.cpp b/src/openrct2/actions/BannerPlaceAction.cpp
index 7f8fa5fca4..824653fdb0 100644
--- a/src/openrct2/actions/BannerPlaceAction.cpp
+++ b/src/openrct2/actions/BannerPlaceAction.cpp
@@ -54,56 +54,56 @@ namespace OpenRCT2::GameActions
Result BannerPlaceAction::Query(GameState_t& gameState) const
{
auto res = Result();
- res.Position.x = _loc.x + 16;
- res.Position.y = _loc.y + 16;
- res.Position.z = _loc.z;
- res.Expenditure = ExpenditureType::landscaping;
- res.ErrorTitle = STR_CANT_POSITION_THIS_HERE;
+ res.position.x = _loc.x + 16;
+ res.position.y = _loc.y + 16;
+ res.position.z = _loc.z;
+ res.expenditure = ExpenditureType::landscaping;
+ res.errorTitle = STR_CANT_POSITION_THIS_HERE;
if (!LocationValid(_loc))
{
- return Result(Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_OFF_EDGE_OF_MAP);
+ return Result(Status::invalidParameters, STR_CANT_POSITION_THIS_HERE, STR_OFF_EDGE_OF_MAP);
}
if (!MapCheckCapacityAndReorganise(_loc))
{
LOG_ERROR("No free map elements.");
- return Result(Status::NoFreeElements, STR_CANT_POSITION_THIS_HERE, STR_TILE_ELEMENT_LIMIT_REACHED);
+ return Result(Status::noFreeElements, STR_CANT_POSITION_THIS_HERE, STR_TILE_ELEMENT_LIMIT_REACHED);
}
auto pathElement = GetValidPathElement();
if (pathElement == nullptr)
{
- return Result(Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_CAN_ONLY_BE_BUILT_ACROSS_PATHS);
+ return Result(Status::invalidParameters, STR_CANT_POSITION_THIS_HERE, STR_CAN_ONLY_BE_BUILT_ACROSS_PATHS);
}
if (!MapCanBuildAt(_loc))
{
- return Result(Status::NotOwned, STR_CANT_POSITION_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK);
+ return Result(Status::notOwned, STR_CANT_POSITION_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK);
}
auto baseHeight = _loc.z + kPathHeightStep;
BannerElement* existingBannerElement = MapGetBannerElementAt({ _loc.x, _loc.y, baseHeight }, _loc.direction);
if (existingBannerElement != nullptr)
{
- return Result(Status::ItemAlreadyPlaced, STR_CANT_POSITION_THIS_HERE, STR_BANNER_SIGN_IN_THE_WAY);
+ return Result(Status::itemAlreadyPlaced, STR_CANT_POSITION_THIS_HERE, STR_BANNER_SIGN_IN_THE_WAY);
}
if (HasReachedBannerLimit())
{
LOG_ERROR("No free banners available");
- return Result(Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_TOO_MANY_BANNERS_IN_GAME);
+ return Result(Status::invalidParameters, STR_CANT_POSITION_THIS_HERE, STR_TOO_MANY_BANNERS_IN_GAME);
}
auto* bannerEntry = OpenRCT2::ObjectManager::GetObjectEntry(_bannerType);
if (bannerEntry == nullptr)
{
LOG_ERROR("Banner entry not found for bannerType %u", _bannerType);
- return Result(Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_ERR_BANNER_ELEMENT_NOT_FOUND);
+ return Result(Status::invalidParameters, STR_CANT_POSITION_THIS_HERE, STR_ERR_BANNER_ELEMENT_NOT_FOUND);
}
- res.Cost = bannerEntry->price;
- res.SetData(BannerPlaceActionResult{});
+ res.cost = bannerEntry->price;
+ res.setData(BannerPlaceActionResult{});
return res;
}
@@ -111,39 +111,39 @@ namespace OpenRCT2::GameActions
Result BannerPlaceAction::Execute(GameState_t& gameState) const
{
auto res = Result();
- res.Position.x = _loc.x + 16;
- res.Position.y = _loc.y + 16;
- res.Position.z = _loc.z;
- res.Expenditure = ExpenditureType::landscaping;
- res.ErrorTitle = STR_CANT_POSITION_THIS_HERE;
+ res.position.x = _loc.x + 16;
+ res.position.y = _loc.y + 16;
+ res.position.z = _loc.z;
+ res.expenditure = ExpenditureType::landscaping;
+ res.errorTitle = STR_CANT_POSITION_THIS_HERE;
if (!MapCheckCapacityAndReorganise(_loc))
{
LOG_ERROR("No free map elements.");
- return Result(Status::NoFreeElements, STR_CANT_POSITION_THIS_HERE, STR_TILE_ELEMENT_LIMIT_REACHED);
+ return Result(Status::noFreeElements, STR_CANT_POSITION_THIS_HERE, STR_TILE_ELEMENT_LIMIT_REACHED);
}
auto* bannerEntry = OpenRCT2::ObjectManager::GetObjectEntry(_bannerType);
if (bannerEntry == nullptr)
{
LOG_ERROR("Banner entry not found for bannerType %u", _bannerType);
- return Result(Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_ERR_BANNER_ELEMENT_NOT_FOUND);
+ return Result(Status::invalidParameters, STR_CANT_POSITION_THIS_HERE, STR_ERR_BANNER_ELEMENT_NOT_FOUND);
}
auto banner = CreateBanner();
if (banner == nullptr)
{
LOG_ERROR("No free banners available");
- return Result(Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_TOO_MANY_BANNERS_IN_GAME);
+ return Result(Status::invalidParameters, STR_CANT_POSITION_THIS_HERE, STR_TOO_MANY_BANNERS_IN_GAME);
}
banner->flags = {};
banner->text = {};
- banner->textColour = TextColour::white;
+ banner->textColour = Drawing::TextColour::white;
banner->type = _bannerType; // Banner must be deleted after this point in an early return
banner->colour = _primaryColour;
banner->position = TileCoordsXY(_loc);
- res.SetData(BannerPlaceActionResult{ banner->id });
+ res.setData(BannerPlaceActionResult{ banner->id });
auto* bannerElement = TileElementInsert({ _loc, _loc.z + (2 * kCoordsZStep) }, 0b0000);
Guard::Assert(bannerElement != nullptr);
@@ -151,12 +151,12 @@ namespace OpenRCT2::GameActions
bannerElement->SetPosition(_loc.direction);
bannerElement->ResetAllowedEdges();
bannerElement->SetIndex(banner->id);
- bannerElement->SetGhost(GetFlags() & GAME_COMMAND_FLAG_GHOST);
+ bannerElement->SetGhost(GetFlags().has(CommandFlag::ghost));
MapInvalidateTileFull(_loc);
MapAnimations::MarkTileForInvalidation(TileCoordsXY(_loc));
- res.Cost = bannerEntry->price;
+ res.cost = bannerEntry->price;
return res;
}
@@ -170,7 +170,7 @@ namespace OpenRCT2::GameActions
if (!(pathElement->GetEdges() & (1 << _loc.direction)))
continue;
- if (pathElement->IsGhost() && !(GetFlags() & GAME_COMMAND_FLAG_GHOST))
+ if (pathElement->IsGhost() && !GetFlags().has(CommandFlag::ghost))
continue;
return pathElement;
diff --git a/src/openrct2/actions/BannerRemoveAction.cpp b/src/openrct2/actions/BannerRemoveAction.cpp
index af96b926a9..5e7f876c89 100644
--- a/src/openrct2/actions/BannerRemoveAction.cpp
+++ b/src/openrct2/actions/BannerRemoveAction.cpp
@@ -47,19 +47,19 @@ namespace OpenRCT2::GameActions
Result BannerRemoveAction::Query(GameState_t& gameState) const
{
auto res = Result();
- res.Expenditure = ExpenditureType::landscaping;
- res.Position.x = _loc.x + 16;
- res.Position.y = _loc.y + 16;
- res.Position.z = _loc.z;
- res.ErrorTitle = STR_CANT_REMOVE_THIS;
+ res.expenditure = ExpenditureType::landscaping;
+ res.position.x = _loc.x + 16;
+ res.position.y = _loc.y + 16;
+ res.position.z = _loc.z;
+ res.errorTitle = STR_CANT_REMOVE_THIS;
if (!LocationValid(_loc))
{
- return Result(Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_OFF_EDGE_OF_MAP);
+ return Result(Status::invalidParameters, STR_CANT_REMOVE_THIS, STR_OFF_EDGE_OF_MAP);
}
if (!MapCanBuildAt({ _loc.x, _loc.y, _loc.z - 16 }))
{
- return Result(Status::NotOwned, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK);
+ return Result(Status::notOwned, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK);
}
BannerElement* bannerElement = GetBannerElementAt();
@@ -67,27 +67,27 @@ namespace OpenRCT2::GameActions
{
LOG_ERROR(
"Invalid banner location, x = %d, y = %d, z = %d, direction = %d", _loc.x, _loc.y, _loc.z, _loc.direction);
- return Result(Status::InvalidParameters, STR_CANT_REMOVE_THIS, kStringIdNone);
+ return Result(Status::invalidParameters, STR_CANT_REMOVE_THIS, kStringIdNone);
}
auto bannerIndex = bannerElement->GetIndex();
if (bannerIndex == BannerIndex::GetNull())
{
LOG_ERROR("Invalid banner index %u", bannerIndex);
- return Result(Status::InvalidParameters, STR_CANT_REMOVE_THIS, kStringIdNone);
+ return Result(Status::invalidParameters, STR_CANT_REMOVE_THIS, kStringIdNone);
}
auto banner = bannerElement->GetBanner();
if (banner == nullptr)
{
LOG_ERROR("Invalid banner index %u", bannerIndex);
- return Result(Status::InvalidParameters, STR_CANT_REMOVE_THIS, kStringIdNone);
+ return Result(Status::invalidParameters, STR_CANT_REMOVE_THIS, kStringIdNone);
}
auto* bannerEntry = ObjectManager::GetObjectEntry(banner->type);
if (bannerEntry != nullptr)
{
- res.Cost = -((bannerEntry->price * 3) / 4);
+ res.cost = -((bannerEntry->price * 3) / 4);
}
return res;
@@ -96,38 +96,38 @@ namespace OpenRCT2::GameActions
Result BannerRemoveAction::Execute(GameState_t& gameState) const
{
auto res = Result();
- res.Expenditure = ExpenditureType::landscaping;
- res.Position.x = _loc.x + 16;
- res.Position.y = _loc.y + 16;
- res.Position.z = _loc.z;
- res.ErrorTitle = STR_CANT_REMOVE_THIS;
+ res.expenditure = ExpenditureType::landscaping;
+ res.position.x = _loc.x + 16;
+ res.position.y = _loc.y + 16;
+ res.position.z = _loc.z;
+ res.errorTitle = STR_CANT_REMOVE_THIS;
BannerElement* bannerElement = GetBannerElementAt();
if (bannerElement == nullptr)
{
LOG_ERROR(
"Invalid banner location, x = %d, y = %d, z = %d, direction = %d", _loc.x, _loc.y, _loc.z, _loc.direction);
- return Result(Status::InvalidParameters, STR_CANT_REMOVE_THIS, kStringIdNone);
+ return Result(Status::invalidParameters, STR_CANT_REMOVE_THIS, kStringIdNone);
}
auto bannerIndex = bannerElement->GetIndex();
if (bannerIndex == BannerIndex::GetNull())
{
LOG_ERROR("Invalid banner index %u", bannerIndex);
- return Result(Status::InvalidParameters, STR_CANT_REMOVE_THIS, kStringIdNone);
+ return Result(Status::invalidParameters, STR_CANT_REMOVE_THIS, kStringIdNone);
}
auto banner = bannerElement->GetBanner();
if (banner == nullptr)
{
LOG_ERROR("Invalid banner index %u", bannerIndex);
- return Result(Status::InvalidParameters, STR_CANT_REMOVE_THIS, kStringIdNone);
+ return Result(Status::invalidParameters, STR_CANT_REMOVE_THIS, kStringIdNone);
}
auto* bannerEntry = ObjectManager::GetObjectEntry(banner->type);
if (bannerEntry != nullptr)
{
- res.Cost = -((bannerEntry->price * 3) / 4);
+ res.cost = -((bannerEntry->price * 3) / 4);
}
reinterpret_cast(bannerElement)->RemoveBannerEntry();
@@ -144,7 +144,7 @@ namespace OpenRCT2::GameActions
{
if (bannerElement->GetBaseZ() != _loc.z)
continue;
- if (bannerElement->IsGhost() && !(GetFlags() & GAME_COMMAND_FLAG_GHOST))
+ if (bannerElement->IsGhost() && !GetFlags().has(CommandFlag::ghost))
continue;
if (bannerElement->GetPosition() != _loc.direction)
continue;
diff --git a/src/openrct2/actions/BannerSetColourAction.cpp b/src/openrct2/actions/BannerSetColourAction.cpp
index 1b8348513d..28d96324a3 100644
--- a/src/openrct2/actions/BannerSetColourAction.cpp
+++ b/src/openrct2/actions/BannerSetColourAction.cpp
@@ -57,27 +57,27 @@ namespace OpenRCT2::GameActions
Result BannerSetColourAction::QueryExecute(bool isExecuting) const
{
auto res = Result();
- res.Expenditure = ExpenditureType::landscaping;
- res.Position.x = _loc.x + 16;
- res.Position.y = _loc.y + 16;
- res.Position.z = _loc.z;
- res.ErrorTitle = STR_CANT_REPAINT_THIS;
+ res.expenditure = ExpenditureType::landscaping;
+ res.position.x = _loc.x + 16;
+ res.position.y = _loc.y + 16;
+ res.position.z = _loc.z;
+ res.errorTitle = STR_CANT_REPAINT_THIS;
if (!LocationValid(_loc))
{
LOG_ERROR("Invalid x / y coordinates: x = %d, y = %d", _loc.x, _loc.y);
- return Result(Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_OFF_EDGE_OF_MAP);
+ return Result(Status::invalidParameters, STR_CANT_REPAINT_THIS, STR_OFF_EDGE_OF_MAP);
}
if (_primaryColour > 31)
{
LOG_ERROR("Invalid primary colour %u", _primaryColour);
- return Result(Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_INVALID_COLOUR);
+ return Result(Status::invalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_INVALID_COLOUR);
}
if (!MapCanBuildAt({ _loc.x, _loc.y, _loc.z - 16 }))
{
- return Result(Status::NotOwned, STR_CANT_REPAINT_THIS, STR_LAND_NOT_OWNED_BY_PARK);
+ return Result(Status::notOwned, STR_CANT_REPAINT_THIS, STR_LAND_NOT_OWNED_BY_PARK);
}
auto bannerElement = MapGetBannerElementAt(_loc, _loc.direction);
@@ -85,7 +85,7 @@ namespace OpenRCT2::GameActions
if (bannerElement == nullptr)
{
LOG_ERROR("No banner at x = %d, y = %d, z = %d, direction = %u", _loc.x, _loc.y, _loc.z, _loc.direction);
- return Result(Status::Unknown, STR_CANT_REPAINT_THIS, STR_ERR_BANNER_ELEMENT_NOT_FOUND);
+ return Result(Status::unknown, STR_CANT_REPAINT_THIS, STR_ERR_BANNER_ELEMENT_NOT_FOUND);
}
auto index = bannerElement->GetIndex();
@@ -93,7 +93,7 @@ namespace OpenRCT2::GameActions
if (banner == nullptr)
{
LOG_ERROR("Invalid banner index %u", index);
- return Result(Status::InvalidParameters, STR_CANT_REPAINT_THIS, kStringIdNone);
+ return Result(Status::invalidParameters, STR_CANT_REPAINT_THIS, kStringIdNone);
}
if (isExecuting)
diff --git a/src/openrct2/actions/BannerSetNameAction.cpp b/src/openrct2/actions/BannerSetNameAction.cpp
index e2252acf2c..af0c879c7a 100644
--- a/src/openrct2/actions/BannerSetNameAction.cpp
+++ b/src/openrct2/actions/BannerSetNameAction.cpp
@@ -12,7 +12,7 @@
#include "../Context.h"
#include "../Diagnostic.h"
#include "../core/String.hpp"
-#include "../drawing/Drawing.h"
+#include "../drawing/ScrollingText.h"
#include "../localisation/StringIds.h"
#include "../windows/Intent.h"
#include "../world/Banner.h"
@@ -51,7 +51,7 @@ namespace OpenRCT2::GameActions
if (banner == nullptr)
{
LOG_ERROR("Banner not found for bannerIndex %d", _bannerIndex);
- return Result(Status::InvalidParameters, STR_CANT_RENAME_BANNER, STR_ERR_BANNER_ELEMENT_NOT_FOUND);
+ return Result(Status::invalidParameters, STR_CANT_RENAME_BANNER, STR_ERR_BANNER_ELEMENT_NOT_FOUND);
}
TileElement* tileElement = BannerGetTileElement(_bannerIndex);
@@ -59,7 +59,7 @@ namespace OpenRCT2::GameActions
if (tileElement == nullptr)
{
LOG_ERROR("Banner tile element not found for bannerIndex %d", _bannerIndex);
- return Result(Status::InvalidParameters, STR_CANT_RENAME_BANNER, STR_ERR_BANNER_ELEMENT_NOT_FOUND);
+ return Result(Status::invalidParameters, STR_CANT_RENAME_BANNER, STR_ERR_BANNER_ELEMENT_NOT_FOUND);
}
BannerElement* bannerElement = tileElement->AsBanner();
@@ -67,11 +67,11 @@ namespace OpenRCT2::GameActions
if (!LocationValid(loc))
{
- return Result(Status::InvalidParameters, STR_CANT_RENAME_BANNER, STR_OFF_EDGE_OF_MAP);
+ return Result(Status::invalidParameters, STR_CANT_RENAME_BANNER, STR_OFF_EDGE_OF_MAP);
}
if (!MapCanBuildAt({ loc.x, loc.y, loc.z - 16 }))
{
- return Result(Status::NotOwned, STR_CANT_RENAME_BANNER, STR_LAND_NOT_OWNED_BY_PARK);
+ return Result(Status::notOwned, STR_CANT_RENAME_BANNER, STR_LAND_NOT_OWNED_BY_PARK);
}
return Result();
@@ -83,7 +83,7 @@ namespace OpenRCT2::GameActions
if (banner == nullptr)
{
LOG_ERROR("Banner not found for bannerIndex %d", _bannerIndex);
- return Result(Status::InvalidParameters, STR_CANT_RENAME_BANNER, STR_ERR_BANNER_ELEMENT_NOT_FOUND);
+ return Result(Status::invalidParameters, STR_CANT_RENAME_BANNER, STR_ERR_BANNER_ELEMENT_NOT_FOUND);
}
banner->text = _name;
@@ -92,7 +92,7 @@ namespace OpenRCT2::GameActions
intent.PutExtra(INTENT_EXTRA_BANNER_INDEX, _bannerIndex);
ContextBroadcastIntent(&intent);
- ScrollingTextInvalidate();
+ Drawing::ScrollingText::invalidate();
GfxInvalidateScreen();
return Result();
diff --git a/src/openrct2/actions/BannerSetStyleAction.cpp b/src/openrct2/actions/BannerSetStyleAction.cpp
index 1101da6b14..2048edbcd4 100644
--- a/src/openrct2/actions/BannerSetStyleAction.cpp
+++ b/src/openrct2/actions/BannerSetStyleAction.cpp
@@ -11,6 +11,7 @@
#include "../Context.h"
#include "../Diagnostic.h"
+#include "../drawing/ScrollingText.h"
#include "../localisation/StringIdType.h"
#include "../management/Finance.h"
#include "../windows/Intent.h"
@@ -61,19 +62,19 @@ namespace OpenRCT2::GameActions
if (banner == nullptr)
{
LOG_ERROR("Banner not found for bannerIndex %d", _bannerIndex);
- return Result(Status::InvalidParameters, errorTitle, STR_ERR_BANNER_ELEMENT_NOT_FOUND);
+ return Result(Status::invalidParameters, errorTitle, STR_ERR_BANNER_ELEMENT_NOT_FOUND);
}
- res.Expenditure = ExpenditureType::landscaping;
+ res.expenditure = ExpenditureType::landscaping;
auto location = banner->position.ToCoordsXY().ToTileCentre();
- res.Position = { location, TileElementHeight(location) };
+ res.position = { location, TileElementHeight(location) };
TileElement* tileElement = BannerGetTileElement(_bannerIndex);
if (tileElement == nullptr)
{
LOG_ERROR("Banner tile element not found for bannerIndex %d", _bannerIndex);
- return Result(Status::InvalidParameters, errorTitle, STR_ERR_BANNER_ELEMENT_NOT_FOUND);
+ return Result(Status::invalidParameters, errorTitle, STR_ERR_BANNER_ELEMENT_NOT_FOUND);
}
BannerElement* bannerElement = tileElement->AsBanner();
@@ -81,11 +82,11 @@ namespace OpenRCT2::GameActions
if (!LocationValid(loc))
{
- return Result(Status::InvalidParameters, errorTitle, STR_OFF_EDGE_OF_MAP);
+ return Result(Status::invalidParameters, errorTitle, STR_OFF_EDGE_OF_MAP);
}
if (!MapCanBuildAt({ loc.x, loc.y, loc.z - 16 }))
{
- return Result(Status::NotOwned, errorTitle, STR_LAND_NOT_OWNED_BY_PARK);
+ return Result(Status::notOwned, errorTitle, STR_LAND_NOT_OWNED_BY_PARK);
}
switch (_type)
@@ -94,7 +95,7 @@ namespace OpenRCT2::GameActions
if (_parameter > COLOUR_COUNT)
{
LOG_ERROR("Invalid primary colour %u", _parameter);
- return Result(Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_INVALID_COLOUR);
+ return Result(Status::invalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_INVALID_COLOUR);
}
break;
@@ -102,19 +103,19 @@ namespace OpenRCT2::GameActions
if (_parameter > 13)
{
LOG_ERROR("Invalid text colour %u", _parameter);
- return Result(Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_INVALID_COLOUR);
+ return Result(Status::invalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_INVALID_COLOUR);
}
break;
case BannerSetStyleType::NoEntry:
if (tileElement->AsBanner() == nullptr)
{
LOG_ERROR("Tile element was not a banner.");
- return Result(Status::Unknown, STR_CANT_RENAME_BANNER, kStringIdNone);
+ return Result(Status::unknown, STR_CANT_RENAME_BANNER, kStringIdNone);
}
break;
default:
LOG_ERROR("Invalid banner style type %u", _type);
- return Result(Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_VALUE_OUT_OF_RANGE);
+ return Result(Status::invalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_VALUE_OUT_OF_RANGE);
}
return res;
}
@@ -127,19 +128,19 @@ namespace OpenRCT2::GameActions
if (banner == nullptr)
{
LOG_ERROR("Banner not found for bannerIndex %d", _bannerIndex);
- return Result(Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_BANNER_ELEMENT_NOT_FOUND);
+ return Result(Status::invalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_BANNER_ELEMENT_NOT_FOUND);
}
- res.Expenditure = ExpenditureType::landscaping;
+ res.expenditure = ExpenditureType::landscaping;
auto location = banner->position.ToCoordsXY().ToTileCentre();
- res.Position = { location, TileElementHeight(location) };
+ res.position = { location, TileElementHeight(location) };
TileElement* tileElement = BannerGetTileElement(_bannerIndex);
if (tileElement == nullptr)
{
LOG_ERROR("Banner tile element not found for bannerIndex &u", _bannerIndex);
- return Result(Status::InvalidParameters, STR_CANT_REPAINT_THIS, kStringIdNone);
+ return Result(Status::invalidParameters, STR_CANT_REPAINT_THIS, kStringIdNone);
}
switch (_type)
@@ -148,7 +149,7 @@ namespace OpenRCT2::GameActions
banner->colour = _parameter;
break;
case BannerSetStyleType::TextColour:
- banner->textColour = static_cast(_parameter);
+ banner->textColour = static_cast(_parameter);
break;
case BannerSetStyleType::NoEntry:
{
@@ -156,7 +157,7 @@ namespace OpenRCT2::GameActions
if (bannerElement == nullptr)
{
LOG_ERROR("Tile element was not a banner.");
- return Result(Status::Unknown, STR_CANT_REPAINT_THIS, STR_ERR_BANNER_ELEMENT_NOT_FOUND);
+ return Result(Status::unknown, STR_CANT_REPAINT_THIS, STR_ERR_BANNER_ELEMENT_NOT_FOUND);
}
banner->flags.set(BannerFlag::noEntry, (_parameter != 0));
@@ -170,14 +171,14 @@ namespace OpenRCT2::GameActions
}
default:
LOG_ERROR("Invalid banner style type %u", _type);
- return Result(Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_VALUE_OUT_OF_RANGE);
+ return Result(Status::invalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_VALUE_OUT_OF_RANGE);
}
auto intent = Intent(INTENT_ACTION_UPDATE_BANNER);
intent.PutExtra(INTENT_EXTRA_BANNER_INDEX, _bannerIndex);
ContextBroadcastIntent(&intent);
- ScrollingTextInvalidate();
+ Drawing::ScrollingText::invalidate();
GfxInvalidateScreen();
return res;
diff --git a/src/openrct2/actions/CheatSetAction.cpp b/src/openrct2/actions/CheatSetAction.cpp
index cc2e3fc1e2..4fd2bc6681 100644
--- a/src/openrct2/actions/CheatSetAction.cpp
+++ b/src/openrct2/actions/CheatSetAction.cpp
@@ -79,7 +79,7 @@ namespace OpenRCT2::GameActions
if (static_cast(_cheatType) >= static_cast(CheatType::count))
{
LOG_ERROR("Invalid cheat type %u", _cheatType);
- return Result(Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
+ return Result(Status::invalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
}
ParametersRange validRange = GetParameterRange(static_cast(_cheatType.id));
@@ -89,14 +89,14 @@ namespace OpenRCT2::GameActions
LOG_ERROR(
"The first cheat parameter is out of range. Value = %d, min = %d, max = %d", _param1, validRange.first.first,
validRange.first.second);
- return Result(Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
+ return Result(Status::invalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
}
if (_param2 < validRange.second.first || _param2 > validRange.second.second)
{
LOG_ERROR(
"The second cheat parameter is out of range. Value = %d, min = %d, max = %d", _param2, validRange.second.first,
validRange.second.second);
- return Result(Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
+ return Result(Status::invalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
}
return Result();
@@ -274,7 +274,7 @@ namespace OpenRCT2::GameActions
default:
{
LOG_ERROR("Invalid cheat type %d", _cheatType.id);
- return Result(Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
+ return Result(Status::invalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
}
}
@@ -529,13 +529,11 @@ namespace OpenRCT2::GameActions
if (mechanic != nullptr)
{
- if (ride.mechanicStatus == RIDE_MECHANIC_STATUS_FIXING)
+ if (ride.mechanicStatus == MechanicStatus::fixing)
{
mechanic->RideSubState = PeepRideSubState::approachExit;
}
- else if (
- ride.mechanicStatus == RIDE_MECHANIC_STATUS_CALLING
- || ride.mechanicStatus == RIDE_MECHANIC_STATUS_HEADING)
+ else if (ride.mechanicStatus == MechanicStatus::calling || ride.mechanicStatus == MechanicStatus::heading)
{
mechanic->RemoveFromRide();
}
@@ -574,7 +572,7 @@ namespace OpenRCT2::GameActions
for (auto& ride : RideManager(gameState))
{
// Set inspection interval to 10 minutes
- ride.inspectionInterval = RIDE_INSPECTION_EVERY_10_MINUTES;
+ ride.inspectionInterval = RideInspection::every10Minutes;
}
auto* windowMgr = Ui::GetWindowManager();
windowMgr->InvalidateByClass(WindowClass::ride);
@@ -615,7 +613,7 @@ namespace OpenRCT2::GameActions
void CheatSetAction::AddMoney(money64 amount) const
{
auto& park = getGameState().park;
- park.cash = AddClamp(park.cash, amount);
+ park.cash = AddClamp(park.cash, amount);
auto* windowMgr = Ui::GetWindowManager();
windowMgr->InvalidateByClass(WindowClass::finances);
@@ -706,7 +704,7 @@ namespace OpenRCT2::GameActions
break;
case OBJECT_UMBRELLA:
peep->GiveItem(ShopItem::umbrella);
- peep->UmbrellaColour = ScenarioRandMax(kColourNumOriginal);
+ peep->UmbrellaColour = ScenarioRandMax(kColourNumNormal);
peep->UpdateAnimationGroup();
break;
}
diff --git a/src/openrct2/actions/ClearAction.cpp b/src/openrct2/actions/ClearAction.cpp
index 379a844d9a..c3a9143dd2 100644
--- a/src/openrct2/actions/ClearAction.cpp
+++ b/src/openrct2/actions/ClearAction.cpp
@@ -64,13 +64,13 @@ namespace OpenRCT2::GameActions
Result ClearAction::CreateResult() const
{
auto result = Result();
- result.ErrorTitle = STR_UNABLE_TO_REMOVE_ALL_SCENERY_FROM_HERE;
- result.Expenditure = ExpenditureType::landscaping;
+ result.errorTitle = STR_UNABLE_TO_REMOVE_ALL_SCENERY_FROM_HERE;
+ result.expenditure = ExpenditureType::landscaping;
auto x = (_range.GetX1() + _range.GetX2()) / 2 + 16;
auto y = (_range.GetY1() + _range.GetY2()) / 2 + 16;
auto z = TileElementHeight({ x, y });
- result.Position = CoordsXYZ(x, y, z);
+ result.position = CoordsXYZ(x, y, z);
return result;
}
@@ -80,7 +80,7 @@ namespace OpenRCT2::GameActions
auto result = CreateResult();
auto noValidTiles = true;
- auto error = Status::Ok;
+ auto error = Status::ok;
StringId errorMessage = kStringIdNone;
money64 totalCost = 0;
@@ -100,7 +100,7 @@ namespace OpenRCT2::GameActions
}
else
{
- error = Status::NotOwned;
+ error = Status::notOwned;
errorMessage = STR_LAND_NOT_OWNED_BY_PARK;
}
}
@@ -113,11 +113,11 @@ namespace OpenRCT2::GameActions
if (noValidTiles)
{
- result.Error = error;
- result.ErrorMessage = errorMessage;
+ result.error = error;
+ result.errorMessage = errorMessage;
}
- result.Cost = totalCost;
+ result.cost = totalCost;
return result;
}
@@ -149,11 +149,15 @@ namespace OpenRCT2::GameActions
auto res = executing ? ExecuteNested(&footpathRemoveAction, gameState)
: QueryNested(&footpathRemoveAction, gameState);
- if (res.Error == Status::Ok)
+ if (res.error == Status::ok)
{
- totalCost += res.Cost;
+ totalCost += res.cost;
tileEdited = executing;
}
+ else if (res.error == Status::insufficientFunds)
+ {
+ totalCost += res.cost;
+ }
}
break;
case TileElementType::SmallScenery:
@@ -167,11 +171,15 @@ namespace OpenRCT2::GameActions
auto res = executing ? ExecuteNested(&removeSceneryAction, gameState)
: QueryNested(&removeSceneryAction, gameState);
- if (res.Error == Status::Ok)
+ if (res.error == Status::ok)
{
- totalCost += res.Cost;
+ totalCost += res.cost;
tileEdited = executing;
}
+ else if (res.error == Status::insufficientFunds)
+ {
+ totalCost += res.cost;
+ }
}
break;
case TileElementType::Wall:
@@ -184,11 +192,15 @@ namespace OpenRCT2::GameActions
auto res = executing ? ExecuteNested(&wallRemoveAction, gameState)
: QueryNested(&wallRemoveAction, gameState);
- if (res.Error == Status::Ok)
+ if (res.error == Status::ok)
{
- totalCost += res.Cost;
+ totalCost += res.cost;
tileEdited = executing;
}
+ else if (res.error == Status::insufficientFunds)
+ {
+ totalCost += res.cost;
+ }
}
break;
case TileElementType::LargeScenery:
@@ -197,16 +209,20 @@ namespace OpenRCT2::GameActions
auto removeSceneryAction = LargeSceneryRemoveAction(
{ tilePos, tileElement->GetBaseZ(), tileElement->GetDirection() },
tileElement->AsLargeScenery()->GetSequenceIndex());
- removeSceneryAction.SetFlags(GetFlags() | GAME_COMMAND_FLAG_TRACK_DESIGN);
+ removeSceneryAction.SetFlags(GetFlags().with(CommandFlag::trackDesign));
auto res = executing ? ExecuteNested(&removeSceneryAction, gameState)
: QueryNested(&removeSceneryAction, gameState);
- if (res.Error == Status::Ok)
+ if (res.error == Status::ok)
{
- totalCost += res.Cost;
+ totalCost += res.cost;
tileEdited = executing;
}
+ else if (res.error == Status::insufficientFunds)
+ {
+ totalCost += res.cost;
+ }
}
break;
default:
diff --git a/src/openrct2/actions/CommandFlag.h b/src/openrct2/actions/CommandFlag.h
new file mode 100644
index 0000000000..07e56743c0
--- /dev/null
+++ b/src/openrct2/actions/CommandFlag.h
@@ -0,0 +1,44 @@
+/*****************************************************************************
+ * Copyright (c) 2014-2025 OpenRCT2 developers
+ *
+ * For a complete list of all authors, please refer to contributors.md
+ * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
+ *
+ * OpenRCT2 is licensed under the GNU General Public License version 3.
+ *****************************************************************************/
+
+#pragma once
+
+#include "../core/FlagHolder.hpp"
+
+#include
+
+namespace OpenRCT2::GameActions
+{
+ enum class CommandFlag : uint8_t
+ {
+ /**
+ * If this flag is set, the command is applied, otherwise only the cost is retrieved.
+ */
+ apply,
+ /**
+ * Command was issued from replay manager.
+ */
+ replay,
+ allowDuringPaused = 3,
+ /**
+ * Game command is not networked
+ */
+ noSpend = 5,
+ /**
+ * Game command is not networked
+ */
+ ghost = 6,
+ trackDesign = 7,
+ /**
+ * Game command is coming from network
+ */
+ networked = 31,
+ };
+ using CommandFlags = FlagHolder;
+} // namespace OpenRCT2::GameActions
diff --git a/src/openrct2/actions/FootpathAdditionPlaceAction.cpp b/src/openrct2/actions/FootpathAdditionPlaceAction.cpp
index ed3e3c816a..223274e44f 100644
--- a/src/openrct2/actions/FootpathAdditionPlaceAction.cpp
+++ b/src/openrct2/actions/FootpathAdditionPlaceAction.cpp
@@ -54,44 +54,44 @@ namespace OpenRCT2::GameActions
Result FootpathAdditionPlaceAction::Query(GameState_t& gameState) const
{
auto res = Result();
- res.Expenditure = ExpenditureType::landscaping;
- res.Position = _loc;
+ res.expenditure = ExpenditureType::landscaping;
+ res.position = _loc;
if (!LocationValid(_loc))
{
- return Result(Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_OFF_EDGE_OF_MAP);
+ return Result(Status::invalidParameters, STR_CANT_POSITION_THIS_HERE, STR_OFF_EDGE_OF_MAP);
}
if (!(gLegacyScene == LegacyScene::scenarioEditor || getGameState().cheats.sandboxMode) && !MapIsLocationOwned(_loc))
{
- return Result(Status::Disallowed, STR_CANT_POSITION_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK);
+ return Result(Status::disallowed, STR_CANT_POSITION_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK);
}
if (_loc.z < kFootpathMinHeight)
{
- return Result(Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_TOO_LOW);
+ return Result(Status::invalidParameters, STR_CANT_POSITION_THIS_HERE, STR_TOO_LOW);
}
if (_loc.z > kFootpathMaxHeight)
{
- return Result(Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_TOO_HIGH);
+ return Result(Status::invalidParameters, STR_CANT_POSITION_THIS_HERE, STR_TOO_HIGH);
}
auto tileElement = MapGetFootpathElement(_loc);
if (tileElement == nullptr)
{
LOG_ERROR("No path element at x = %d, y = %d, z = %d", _loc.x, _loc.y, _loc.z);
- return Result(Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_ERR_PATH_ELEMENT_NOT_FOUND);
+ return Result(Status::invalidParameters, STR_CANT_POSITION_THIS_HERE, STR_ERR_PATH_ELEMENT_NOT_FOUND);
}
auto pathElement = tileElement->AsPath();
if (pathElement->IsLevelCrossing(_loc))
{
return Result(
- Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_CANNOT_BUILD_PATH_ADDITIONS_ON_LEVEL_CROSSINGS);
+ Status::invalidParameters, STR_CANT_POSITION_THIS_HERE, STR_CANNOT_BUILD_PATH_ADDITIONS_ON_LEVEL_CROSSINGS);
}
// No change
- if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST) && pathElement->GetAdditionEntryIndex() == _entryIndex
+ if (!GetFlags().has(CommandFlag::ghost) && pathElement->GetAdditionEntryIndex() == _entryIndex
&& !(pathElement->IsBroken()))
{
return res;
@@ -101,40 +101,40 @@ namespace OpenRCT2::GameActions
if (pathAdditionEntry == nullptr)
{
LOG_ERROR("Unknown footpath addition entry for entryIndex %d", _entryIndex);
- return Result(Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_UNKNOWN_OBJECT_TYPE);
+ return Result(Status::invalidParameters, STR_CANT_POSITION_THIS_HERE, STR_UNKNOWN_OBJECT_TYPE);
}
uint16_t sceneryFlags = pathAdditionEntry->flags;
if ((sceneryFlags & PATH_ADDITION_FLAG_DONT_ALLOW_ON_SLOPE) && pathElement->IsSloped())
{
- return Result(Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_CANT_BUILD_THIS_ON_SLOPED_FOOTPATH);
+ return Result(Status::invalidParameters, STR_CANT_POSITION_THIS_HERE, STR_CANT_BUILD_THIS_ON_SLOPED_FOOTPATH);
}
if ((sceneryFlags & PATH_ADDITION_FLAG_DONT_ALLOW_ON_QUEUE) && pathElement->IsQueue())
{
- return Result(Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_CANNOT_PLACE_THESE_ON_QUEUE_LINE_AREA);
+ return Result(Status::invalidParameters, STR_CANT_POSITION_THIS_HERE, STR_CANNOT_PLACE_THESE_ON_QUEUE_LINE_AREA);
}
if (!(sceneryFlags & (PATH_ADDITION_FLAG_JUMPING_FOUNTAIN_WATER | PATH_ADDITION_FLAG_JUMPING_FOUNTAIN_SNOW))
&& (pathElement->GetEdges()) == 0x0F)
{
- return Result(Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_CAN_ONLY_BE_PLACED_ON_PATH_EDGES);
+ return Result(Status::invalidParameters, STR_CANT_POSITION_THIS_HERE, STR_CAN_ONLY_BE_PLACED_ON_PATH_EDGES);
}
if ((sceneryFlags & PATH_ADDITION_FLAG_IS_QUEUE_SCREEN) && !pathElement->IsQueue())
{
- return Result(Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_CAN_ONLY_PLACE_THESE_ON_QUEUE_AREA);
+ return Result(Status::invalidParameters, STR_CANT_POSITION_THIS_HERE, STR_CAN_ONLY_PLACE_THESE_ON_QUEUE_AREA);
}
- res.Cost = pathAdditionEntry->price;
+ res.cost = pathAdditionEntry->price;
// Should place a ghost?
- if (GetFlags() & GAME_COMMAND_FLAG_GHOST)
+ if (GetFlags().has(CommandFlag::ghost))
{
// Check if there is something on the path already
if (pathElement->HasAddition())
{
- return Result(Status::ItemAlreadyPlaced, STR_CANT_POSITION_THIS_HERE, kStringIdNone);
+ return Result(Status::itemAlreadyPlaced, STR_CANT_POSITION_THIS_HERE, kStringIdNone);
}
}
return res;
@@ -143,8 +143,8 @@ namespace OpenRCT2::GameActions
Result FootpathAdditionPlaceAction::Execute(GameState_t& gameState) const
{
auto res = Result();
- res.Position = _loc;
- res.Expenditure = ExpenditureType::landscaping;
+ res.position = _loc;
+ res.expenditure = ExpenditureType::landscaping;
auto tileElement = MapGetFootpathElement(_loc);
auto pathElement = tileElement->AsPath();
@@ -152,11 +152,11 @@ namespace OpenRCT2::GameActions
if (pathElement == nullptr)
{
LOG_ERROR("No path element at x = %d, y = %d, z = %d", _loc.x, _loc.y, _loc.z);
- return Result(Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_ERR_PATH_ELEMENT_NOT_FOUND);
+ return Result(Status::invalidParameters, STR_CANT_POSITION_THIS_HERE, STR_ERR_PATH_ELEMENT_NOT_FOUND);
}
// No change
- if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST) && pathElement->GetAdditionEntryIndex() == _entryIndex
+ if (!GetFlags().has(CommandFlag::ghost) && pathElement->GetAdditionEntryIndex() == _entryIndex
&& !(pathElement->IsBroken()) && !pathElement->AdditionIsGhost())
{
return res;
@@ -166,12 +166,12 @@ namespace OpenRCT2::GameActions
if (pathAdditionEntry == nullptr)
{
LOG_ERROR("Unknown footpath addition entry for entryIndex %d", _entryIndex);
- return Result(Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_UNKNOWN_OBJECT_TYPE);
+ return Result(Status::invalidParameters, STR_CANT_POSITION_THIS_HERE, STR_UNKNOWN_OBJECT_TYPE);
}
- res.Cost = pathAdditionEntry->price;
+ res.cost = pathAdditionEntry->price;
- if (GetFlags() & GAME_COMMAND_FLAG_GHOST)
+ if (GetFlags().has(CommandFlag::ghost))
{
pathElement->SetAdditionIsGhost(true);
}
diff --git a/src/openrct2/actions/FootpathAdditionRemoveAction.cpp b/src/openrct2/actions/FootpathAdditionRemoveAction.cpp
index bf90e9b4b3..73632af68e 100644
--- a/src/openrct2/actions/FootpathAdditionRemoveAction.cpp
+++ b/src/openrct2/actions/FootpathAdditionRemoveAction.cpp
@@ -50,53 +50,53 @@ namespace OpenRCT2::GameActions
{
if (!LocationValid(_loc))
{
- return Result(Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_OFF_EDGE_OF_MAP);
+ return Result(Status::invalidParameters, STR_CANT_REMOVE_THIS, STR_OFF_EDGE_OF_MAP);
}
if (!(gLegacyScene == LegacyScene::scenarioEditor || getGameState().cheats.sandboxMode) && !MapIsLocationOwned(_loc))
{
- return Result(Status::Disallowed, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK);
+ return Result(Status::disallowed, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK);
}
if (_loc.z < kFootpathMinHeight)
{
- return Result(Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_TOO_LOW);
+ return Result(Status::invalidParameters, STR_CANT_REMOVE_THIS, STR_TOO_LOW);
}
if (_loc.z > kFootpathMaxHeight)
{
- return Result(Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_TOO_HIGH);
+ return Result(Status::invalidParameters, STR_CANT_REMOVE_THIS, STR_TOO_HIGH);
}
auto tileElement = MapGetFootpathElement(_loc);
if (tileElement == nullptr)
{
LOG_ERROR("No path element at x = %d, y = %d, z = %d", _loc.x, _loc.y, _loc.z);
- return Result(Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_ERR_PATH_ELEMENT_NOT_FOUND);
+ return Result(Status::invalidParameters, STR_CANT_REMOVE_THIS, STR_ERR_PATH_ELEMENT_NOT_FOUND);
}
auto pathElement = tileElement->AsPath();
if (pathElement == nullptr)
{
LOG_ERROR("No path element at x = %d, y = %d, z = %d", _loc.x, _loc.y, _loc.z);
- return Result(Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_ERR_PATH_ELEMENT_NOT_FOUND);
+ return Result(Status::invalidParameters, STR_CANT_REMOVE_THIS, STR_ERR_PATH_ELEMENT_NOT_FOUND);
}
- if (!pathElement->AdditionIsGhost() && (GetFlags() & GAME_COMMAND_FLAG_GHOST))
+ if (!pathElement->AdditionIsGhost() && (GetFlags().has(CommandFlag::ghost)))
{
LOG_WARNING("Tried to remove non ghost during ghost removal.");
- return Result(Status::Disallowed, STR_CANT_REMOVE_THIS, kStringIdNone);
+ return Result(Status::disallowed, STR_CANT_REMOVE_THIS, kStringIdNone);
}
auto res = Result();
- res.Position = _loc;
- res.Cost = 0.00_GBP;
+ res.position = _loc;
+ res.cost = 0.00_GBP;
return res;
}
Result FootpathAdditionRemoveAction::Execute(GameState_t& gameState) const
{
auto* pathElement = MapGetFootpathElement(_loc);
- if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST))
+ if (!GetFlags().has(CommandFlag::ghost))
{
FootpathInterruptPeeps(_loc);
}
@@ -104,15 +104,15 @@ namespace OpenRCT2::GameActions
if (pathElement == nullptr)
{
LOG_ERROR("No path element at x = %d, y = %d, z = %d", _loc.x, _loc.y, _loc.z);
- return Result(Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_ERR_PATH_ELEMENT_NOT_FOUND);
+ return Result(Status::invalidParameters, STR_CANT_REMOVE_THIS, STR_ERR_PATH_ELEMENT_NOT_FOUND);
}
pathElement->SetAddition(0);
MapInvalidateTileFull(_loc);
auto res = Result();
- res.Position = _loc;
- res.Cost = 0.00_GBP;
+ res.position = _loc;
+ res.cost = 0.00_GBP;
return res;
}
} // namespace OpenRCT2::GameActions
diff --git a/src/openrct2/actions/FootpathLayoutPlaceAction.cpp b/src/openrct2/actions/FootpathLayoutPlaceAction.cpp
index 0b6aa37e9c..a53b296064 100644
--- a/src/openrct2/actions/FootpathLayoutPlaceAction.cpp
+++ b/src/openrct2/actions/FootpathLayoutPlaceAction.cpp
@@ -68,30 +68,30 @@ namespace OpenRCT2::GameActions
Result FootpathLayoutPlaceAction::Query(GameState_t& gameState) const
{
auto res = Result();
- res.Cost = 0;
- res.Expenditure = ExpenditureType::landscaping;
- res.Position = _loc.ToTileCentre();
+ res.cost = 0;
+ res.expenditure = ExpenditureType::landscaping;
+ res.position = _loc.ToTileCentre();
gFootpathGroundFlags = 0;
if (!LocationValid(_loc) || MapIsEdge(_loc))
{
- return Result(Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_OFF_EDGE_OF_MAP);
+ return Result(Status::invalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_OFF_EDGE_OF_MAP);
}
if (!(gLegacyScene == LegacyScene::scenarioEditor || getGameState().cheats.sandboxMode) && !MapIsLocationOwned(_loc))
{
- return Result(Status::Disallowed, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK);
+ return Result(Status::disallowed, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK);
}
if (_loc.z < kFootpathMinHeight)
{
- return Result(Status::Disallowed, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_TOO_LOW);
+ return Result(Status::disallowed, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_TOO_LOW);
}
if (_loc.z > kFootpathMaxHeight)
{
- return Result(Status::Disallowed, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_TOO_HIGH);
+ return Result(Status::disallowed, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_TOO_HIGH);
}
return ElementInsertQuery(std::move(res));
@@ -100,11 +100,11 @@ namespace OpenRCT2::GameActions
Result FootpathLayoutPlaceAction::Execute(GameState_t& gameState) const
{
auto res = Result();
- res.Cost = 0;
- res.Expenditure = ExpenditureType::landscaping;
- res.Position = _loc.ToTileCentre();
+ res.cost = 0;
+ res.expenditure = ExpenditureType::landscaping;
+ res.position = _loc.ToTileCentre();
- if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST))
+ if (!GetFlags().has(CommandFlag::ghost))
{
FootpathInterruptPeeps(_loc);
}
@@ -124,10 +124,10 @@ namespace OpenRCT2::GameActions
if (!MapCheckCapacityAndReorganise(_loc))
{
return Result(
- Status::NoFreeElements, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_TILE_ELEMENT_LIMIT_REACHED);
+ Status::noFreeElements, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_TILE_ELEMENT_LIMIT_REACHED);
}
- res.Cost = 12.00_GBP;
+ res.cost = 12.00_GBP;
QuarterTile quarterTile{ 0b1111, 0 };
auto zLow = _loc.z;
@@ -147,7 +147,7 @@ namespace OpenRCT2::GameActions
if (IsSameAsEntranceElement(*entranceElement))
entranceIsSamePath = true;
else
- res.Cost -= 6.00_GBP;
+ res.cost -= 6.00_GBP;
}
// Do not attempt to build a crossing with a queue or a sloped path.
@@ -155,34 +155,34 @@ namespace OpenRCT2::GameActions
auto crossingMode = isQueue || (_slope.type != FootpathSlopeType::flat) ? CreateCrossingMode::none
: CreateCrossingMode::pathOverTrack;
auto canBuild = MapCanConstructWithClearAt(
- { _loc, zLow, zHigh }, &MapPlaceNonSceneryClearFunc, quarterTile, GetFlags(), kTileSlopeFlat, crossingMode);
- if (!entrancePath && canBuild.Error != Status::Ok)
+ { _loc, zLow, zHigh }, MapPlaceNonSceneryClearFunc, quarterTile, GetFlags(), kTileSlopeFlat, crossingMode);
+ if (!entrancePath && canBuild.error != Status::ok)
{
- canBuild.ErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
+ canBuild.errorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
return canBuild;
}
- res.Cost += canBuild.Cost;
+ res.cost += canBuild.cost;
- const auto clearanceData = canBuild.GetData();
+ const auto clearanceData = canBuild.getData();
gFootpathGroundFlags = clearanceData.GroundFlags;
if (!getGameState().cheats.disableClearanceChecks && (clearanceData.GroundFlags & ELEMENT_IS_UNDERWATER))
{
- return Result(Status::Disallowed, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_CANT_BUILD_THIS_UNDERWATER);
+ return Result(Status::disallowed, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_CANT_BUILD_THIS_UNDERWATER);
}
auto surfaceElement = MapGetSurfaceElementAt(_loc);
if (surfaceElement == nullptr)
{
return Result(
- Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_ERR_SURFACE_ELEMENT_NOT_FOUND);
+ Status::invalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_ERR_SURFACE_ELEMENT_NOT_FOUND);
}
int32_t supportHeight = zLow - surfaceElement->GetBaseZ();
- res.Cost += supportHeight < 0 ? 20.00_GBP : (supportHeight / kPathHeightStep) * 5.00_GBP;
+ res.cost += supportHeight < 0 ? 20.00_GBP : (supportHeight / kPathHeightStep) * 5.00_GBP;
// Prevent the place sound from being spammed
if (entranceIsSamePath)
- res.Cost = 0;
+ res.cost = 0;
return res;
}
@@ -191,12 +191,12 @@ namespace OpenRCT2::GameActions
{
bool entrancePath = false, entranceIsSamePath = false;
- if (!(GetFlags() & (GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_GHOST)))
+ if (!GetFlags().hasAny(CommandFlag::allowDuringPaused, CommandFlag::ghost))
{
FootpathRemoveLitter(_loc);
}
- res.Cost = 12.00_GBP;
+ res.cost = 12.00_GBP;
QuarterTile quarterTile{ 0b1111, 0 };
auto zLow = _loc.z;
@@ -216,7 +216,7 @@ namespace OpenRCT2::GameActions
if (IsSameAsEntranceElement(*entranceElement))
entranceIsSamePath = true;
else
- res.Cost -= 6.00_GBP;
+ res.cost -= 6.00_GBP;
}
// Do not attempt to build a crossing with a queue or a sloped path.
@@ -224,30 +224,30 @@ namespace OpenRCT2::GameActions
auto crossingMode = isQueue || (_slope.type != FootpathSlopeType::flat) ? CreateCrossingMode::none
: CreateCrossingMode::pathOverTrack;
auto canBuild = MapCanConstructWithClearAt(
- { _loc, zLow, zHigh }, &MapPlaceNonSceneryClearFunc, quarterTile, GAME_COMMAND_FLAG_APPLY | GetFlags(),
+ { _loc, zLow, zHigh }, MapPlaceNonSceneryClearFunc, quarterTile, GetFlags().with(CommandFlag::apply),
kTileSlopeFlat, crossingMode);
- if (!entrancePath && canBuild.Error != Status::Ok)
+ if (!entrancePath && canBuild.error != Status::ok)
{
- canBuild.ErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
+ canBuild.errorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
return canBuild;
}
- res.Cost += canBuild.Cost;
+ res.cost += canBuild.cost;
- const auto clearanceData = canBuild.GetData();
+ const auto clearanceData = canBuild.getData();
gFootpathGroundFlags = clearanceData.GroundFlags;
auto surfaceElement = MapGetSurfaceElementAt(_loc);
if (surfaceElement == nullptr)
{
return Result(
- Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_ERR_SURFACE_ELEMENT_NOT_FOUND);
+ Status::invalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_ERR_SURFACE_ELEMENT_NOT_FOUND);
}
int32_t supportHeight = zLow - surfaceElement->GetBaseZ();
- res.Cost += supportHeight < 0 ? 20.00_GBP : (supportHeight / kPathHeightStep) * 5.00_GBP;
+ res.cost += supportHeight < 0 ? 20.00_GBP : (supportHeight / kPathHeightStep) * 5.00_GBP;
if (entrancePath)
{
- if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST) && !entranceIsSamePath)
+ if (!GetFlags().has(CommandFlag::ghost) && !entranceIsSamePath)
{
if (_constructFlags & PathConstructFlag::IsLegacyPathObject)
{
@@ -284,14 +284,14 @@ namespace OpenRCT2::GameActions
pathElement->SetIsBroken(false);
pathElement->SetEdges(_edges);
pathElement->SetCorners(0);
- pathElement->SetGhost(GetFlags() & GAME_COMMAND_FLAG_GHOST);
+ pathElement->SetGhost(GetFlags().has(CommandFlag::ghost));
MapInvalidateTileFull(_loc);
}
// Prevent the place sound from being spammed
if (entranceIsSamePath)
- res.Cost = 0;
+ res.cost = 0;
return res;
}
diff --git a/src/openrct2/actions/FootpathPlaceAction.cpp b/src/openrct2/actions/FootpathPlaceAction.cpp
index 6883a092c8..7bd4df0ec6 100644
--- a/src/openrct2/actions/FootpathPlaceAction.cpp
+++ b/src/openrct2/actions/FootpathPlaceAction.cpp
@@ -77,41 +77,41 @@ namespace OpenRCT2::GameActions
Result FootpathPlaceAction::Query(GameState_t& gameState) const
{
auto res = Result();
- res.Cost = 0;
- res.Expenditure = ExpenditureType::landscaping;
- res.Position = _loc.ToTileCentre();
+ res.cost = 0;
+ res.expenditure = ExpenditureType::landscaping;
+ res.position = _loc.ToTileCentre();
gFootpathGroundFlags = 0;
if (!LocationValid(_loc) || MapIsEdge(_loc))
{
- return Result(Status::InvalidParameters, STR_CANT_BUILD_FOOTPATH_HERE, STR_OFF_EDGE_OF_MAP);
+ return Result(Status::invalidParameters, STR_CANT_BUILD_FOOTPATH_HERE, STR_OFF_EDGE_OF_MAP);
}
if (!(gLegacyScene == LegacyScene::scenarioEditor || getGameState().cheats.sandboxMode) && !MapIsLocationOwned(_loc))
{
- return Result(Status::Disallowed, STR_CANT_BUILD_FOOTPATH_HERE, STR_LAND_NOT_OWNED_BY_PARK);
+ return Result(Status::disallowed, STR_CANT_BUILD_FOOTPATH_HERE, STR_LAND_NOT_OWNED_BY_PARK);
}
if (_slope.type == FootpathSlopeType::irregular || _slope.type == FootpathSlopeType::raise)
{
- return Result(Status::Disallowed, STR_CANT_BUILD_FOOTPATH_HERE, STR_LAND_SLOPE_UNSUITABLE);
+ return Result(Status::disallowed, STR_CANT_BUILD_FOOTPATH_HERE, STR_LAND_SLOPE_UNSUITABLE);
}
if (_loc.z < kFootpathMinHeight)
{
- return Result(Status::Disallowed, STR_CANT_BUILD_FOOTPATH_HERE, STR_TOO_LOW);
+ return Result(Status::disallowed, STR_CANT_BUILD_FOOTPATH_HERE, STR_TOO_LOW);
}
if (_loc.z > kFootpathMaxHeight)
{
- return Result(Status::Disallowed, STR_CANT_BUILD_FOOTPATH_HERE, STR_TOO_HIGH);
+ return Result(Status::disallowed, STR_CANT_BUILD_FOOTPATH_HERE, STR_TOO_HIGH);
}
if (_direction != kInvalidDirection && !DirectionValid(_direction))
{
LOG_ERROR("Direction invalid. direction = %u", _direction);
- return Result(Status::InvalidParameters, STR_CANT_BUILD_FOOTPATH_HERE, STR_ERR_VALUE_OUT_OF_RANGE);
+ return Result(Status::invalidParameters, STR_CANT_BUILD_FOOTPATH_HERE, STR_ERR_VALUE_OUT_OF_RANGE);
}
auto intent = Intent(INTENT_ACTION_REMOVE_PROVISIONAL_FOOTPATH);
@@ -128,11 +128,11 @@ namespace OpenRCT2::GameActions
Result FootpathPlaceAction::Execute(GameState_t& gameState) const
{
auto res = Result();
- res.Cost = 0;
- res.Expenditure = ExpenditureType::landscaping;
- res.Position = _loc.ToTileCentre();
+ res.cost = 0;
+ res.expenditure = ExpenditureType::landscaping;
+ res.position = _loc.ToTileCentre();
- if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST))
+ if (!GetFlags().has(CommandFlag::ghost))
{
FootpathInterruptPeeps(_loc);
}
@@ -142,7 +142,7 @@ namespace OpenRCT2::GameActions
// Force ride construction to recheck area
_currentTrackSelectionFlags.set(TrackSelectionFlag::recheck);
- if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST))
+ if (!GetFlags().has(CommandFlag::ghost))
{
if (_direction != kInvalidDirection && !getGameState().cheats.disableClearanceChecks)
{
@@ -215,17 +215,17 @@ namespace OpenRCT2::GameActions
{
if (_constructFlags & PathConstructFlag::IsQueue && pathElement->IsLevelCrossing(_loc))
{
- return Result(Status::Disallowed, STR_CANT_BUILD_FOOTPATH_HERE, STR_QUEUE_PATHS_CANNOT_BE_USED_FOR_LEVEL_CROSSINGS);
+ return Result(Status::disallowed, STR_CANT_BUILD_FOOTPATH_HERE, STR_QUEUE_PATHS_CANNOT_BE_USED_FOR_LEVEL_CROSSINGS);
}
if (!IsSameAsPathElement(pathElement))
{
- res.Cost += 6.00_GBP;
+ res.cost += 6.00_GBP;
}
- if (GetFlags() & GAME_COMMAND_FLAG_GHOST && !pathElement->IsGhost())
+ if (GetFlags().has(CommandFlag::ghost) && !pathElement->IsGhost())
{
- return Result(Status::ItemAlreadyPlaced, STR_CANT_BUILD_FOOTPATH_HERE, kStringIdNone);
+ return Result(Status::itemAlreadyPlaced, STR_CANT_BUILD_FOOTPATH_HERE, kStringIdNone);
}
return res;
}
@@ -234,12 +234,12 @@ namespace OpenRCT2::GameActions
{
if (!IsSameAsPathElement(pathElement))
{
- res.Cost += 6.00_GBP;
+ res.cost += 6.00_GBP;
}
FootpathQueueChainReset();
- if (!(GetFlags() & GAME_COMMAND_FLAG_TRACK_DESIGN))
+ if (!GetFlags().has(CommandFlag::trackDesign))
{
FootpathRemoveEdgesAt(_loc, reinterpret_cast(pathElement));
}
@@ -289,10 +289,10 @@ namespace OpenRCT2::GameActions
if (!MapCheckCapacityAndReorganise(_loc))
{
- return Result(Status::NoFreeElements, STR_CANT_BUILD_FOOTPATH_HERE, kStringIdNone);
+ return Result(Status::noFreeElements, STR_CANT_BUILD_FOOTPATH_HERE, kStringIdNone);
}
- res.Cost = 12.00_GBP;
+ res.cost = 12.00_GBP;
QuarterTile quarterTile{ 0b1111, 0 };
auto zLow = _loc.z;
@@ -312,7 +312,7 @@ namespace OpenRCT2::GameActions
if (IsSameAsEntranceElement(*entranceElement))
entranceIsSamePath = true;
else
- res.Cost -= 6.00_GBP;
+ res.cost -= 6.00_GBP;
}
// Do not attempt to build a crossing with a queue or a sloped path.
@@ -320,33 +320,33 @@ namespace OpenRCT2::GameActions
auto crossingMode = isQueue || (_slope.type != FootpathSlopeType::flat) ? CreateCrossingMode::none
: CreateCrossingMode::pathOverTrack;
auto canBuild = MapCanConstructWithClearAt(
- { _loc, zLow, zHigh }, &MapPlaceNonSceneryClearFunc, quarterTile, GetFlags(), kTileSlopeFlat, crossingMode);
- if (!entrancePath && canBuild.Error != Status::Ok)
+ { _loc, zLow, zHigh }, MapPlaceNonSceneryClearFunc, quarterTile, GetFlags(), kTileSlopeFlat, crossingMode);
+ if (!entrancePath && canBuild.error != Status::ok)
{
- canBuild.ErrorTitle = STR_CANT_BUILD_FOOTPATH_HERE;
+ canBuild.errorTitle = STR_CANT_BUILD_FOOTPATH_HERE;
return canBuild;
}
- res.Cost += canBuild.Cost;
+ res.cost += canBuild.cost;
- const auto clearanceData = canBuild.GetData();
+ const auto clearanceData = canBuild.getData();
gFootpathGroundFlags = clearanceData.GroundFlags;
if (!getGameState().cheats.disableClearanceChecks && (clearanceData.GroundFlags & ELEMENT_IS_UNDERWATER))
{
- return Result(Status::Disallowed, STR_CANT_BUILD_FOOTPATH_HERE, STR_CANT_BUILD_THIS_UNDERWATER);
+ return Result(Status::disallowed, STR_CANT_BUILD_FOOTPATH_HERE, STR_CANT_BUILD_THIS_UNDERWATER);
}
auto surfaceElement = MapGetSurfaceElementAt(_loc);
if (surfaceElement == nullptr)
{
- return Result(Status::InvalidParameters, STR_CANT_BUILD_FOOTPATH_HERE, STR_ERR_SURFACE_ELEMENT_NOT_FOUND);
+ return Result(Status::invalidParameters, STR_CANT_BUILD_FOOTPATH_HERE, STR_ERR_SURFACE_ELEMENT_NOT_FOUND);
}
int32_t supportHeight = zLow - surfaceElement->GetBaseZ();
- res.Cost += supportHeight < 0 ? 20.00_GBP : (supportHeight / kPathHeightStep) * 5.00_GBP;
+ res.cost += supportHeight < 0 ? 20.00_GBP : (supportHeight / kPathHeightStep) * 5.00_GBP;
// Prevent the place sound from being spammed
if (entranceIsSamePath)
- res.Cost = 0;
+ res.cost = 0;
return res;
}
@@ -355,12 +355,12 @@ namespace OpenRCT2::GameActions
{
bool entrancePath = false, entranceIsSamePath = false;
- if (!(GetFlags() & (GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_GHOST)))
+ if (!GetFlags().hasAny(CommandFlag::allowDuringPaused, CommandFlag::ghost))
{
FootpathRemoveLitter(_loc);
}
- res.Cost = 12.00_GBP;
+ res.cost = 12.00_GBP;
QuarterTile quarterTile{ 0b1111, 0 };
auto zLow = _loc.z;
@@ -380,7 +380,7 @@ namespace OpenRCT2::GameActions
if (IsSameAsEntranceElement(*entranceElement))
entranceIsSamePath = true;
else
- res.Cost -= 6.00_GBP;
+ res.cost -= 6.00_GBP;
}
// Do not attempt to build a crossing with a queue or a sloped.
@@ -388,29 +388,29 @@ namespace OpenRCT2::GameActions
auto crossingMode = isQueue || (_slope.type != FootpathSlopeType::flat) ? CreateCrossingMode::none
: CreateCrossingMode::pathOverTrack;
auto canBuild = MapCanConstructWithClearAt(
- { _loc, zLow, zHigh }, &MapPlaceNonSceneryClearFunc, quarterTile, GAME_COMMAND_FLAG_APPLY | GetFlags(),
+ { _loc, zLow, zHigh }, MapPlaceNonSceneryClearFunc, quarterTile, GetFlags().with(CommandFlag::apply),
kTileSlopeFlat, crossingMode);
- if (!entrancePath && canBuild.Error != Status::Ok)
+ if (!entrancePath && canBuild.error != Status::ok)
{
- canBuild.ErrorTitle = STR_CANT_BUILD_FOOTPATH_HERE;
+ canBuild.errorTitle = STR_CANT_BUILD_FOOTPATH_HERE;
return canBuild;
}
- res.Cost += canBuild.Cost;
+ res.cost += canBuild.cost;
- const auto clearanceData = canBuild.GetData();
+ const auto clearanceData = canBuild.getData();
gFootpathGroundFlags = clearanceData.GroundFlags;
auto surfaceElement = MapGetSurfaceElementAt(_loc);
if (surfaceElement == nullptr)
{
- return Result(Status::InvalidParameters, STR_CANT_BUILD_FOOTPATH_HERE, STR_ERR_SURFACE_ELEMENT_NOT_FOUND);
+ return Result(Status::invalidParameters, STR_CANT_BUILD_FOOTPATH_HERE, STR_ERR_SURFACE_ELEMENT_NOT_FOUND);
}
int32_t supportHeight = zLow - surfaceElement->GetBaseZ();
- res.Cost += supportHeight < 0 ? 20.00_GBP : (supportHeight / kPathHeightStep) * 5.00_GBP;
+ res.cost += supportHeight < 0 ? 20.00_GBP : (supportHeight / kPathHeightStep) * 5.00_GBP;
if (entrancePath)
{
- if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST) && !entranceIsSamePath)
+ if (!GetFlags().has(CommandFlag::ghost) && !entranceIsSamePath)
{
if (_constructFlags & PathConstructFlag::IsLegacyPathObject)
{
@@ -445,15 +445,15 @@ namespace OpenRCT2::GameActions
pathElement->SetRideIndex(RideId::GetNull());
pathElement->SetAdditionStatus(255);
pathElement->SetIsBroken(false);
- pathElement->SetGhost(GetFlags() & GAME_COMMAND_FLAG_GHOST);
+ pathElement->SetGhost(GetFlags().has(CommandFlag::ghost));
FootpathQueueChainReset();
- if (!(GetFlags() & GAME_COMMAND_FLAG_TRACK_DESIGN))
+ if (!GetFlags().has(CommandFlag::trackDesign))
{
FootpathRemoveEdgesAt(_loc, pathElement->as());
}
- if (gLegacyScene == LegacyScene::scenarioEditor && !(GetFlags() & GAME_COMMAND_FLAG_GHOST))
+ if (gLegacyScene == LegacyScene::scenarioEditor && !GetFlags().has(CommandFlag::ghost))
{
AutomaticallySetPeepSpawn();
}
@@ -463,7 +463,7 @@ namespace OpenRCT2::GameActions
// Prevent the place sound from being spammed
if (entranceIsSamePath)
- res.Cost = 0;
+ res.cost = 0;
return res;
}
@@ -505,7 +505,7 @@ namespace OpenRCT2::GameActions
void FootpathPlaceAction::RemoveIntersectingWalls(PathElement* pathElement) const
{
- if (pathElement->IsSloped() && !(GetFlags() & GAME_COMMAND_FLAG_GHOST))
+ if (pathElement->IsSloped() && !GetFlags().has(CommandFlag::ghost))
{
auto direction = pathElement->GetSlopeDirection();
int32_t z = pathElement->GetBaseZ();
@@ -520,7 +520,7 @@ namespace OpenRCT2::GameActions
}
}
- if (!(GetFlags() & GAME_COMMAND_FLAG_TRACK_DESIGN))
+ if (!GetFlags().has(CommandFlag::trackDesign))
FootpathConnectEdges(_loc, reinterpret_cast(pathElement), GetFlags());
FootpathUpdateQueueChains();
diff --git a/src/openrct2/actions/FootpathRemoveAction.cpp b/src/openrct2/actions/FootpathRemoveAction.cpp
index 072adea40c..9513813d45 100644
--- a/src/openrct2/actions/FootpathRemoveAction.cpp
+++ b/src/openrct2/actions/FootpathRemoveAction.cpp
@@ -51,27 +51,27 @@ namespace OpenRCT2::GameActions
Result FootpathRemoveAction::Query(GameState_t& gameState) const
{
auto res = Result();
- res.Cost = 0;
- res.Expenditure = ExpenditureType::landscaping;
- res.Position = { _loc.x + 16, _loc.y + 16, _loc.z };
+ res.cost = 0;
+ res.expenditure = ExpenditureType::landscaping;
+ res.position = { _loc.x + 16, _loc.y + 16, _loc.z };
if (!LocationValid(_loc))
{
- return Result(Status::InvalidParameters, STR_CANT_REMOVE_FOOTPATH_FROM_HERE, STR_OFF_EDGE_OF_MAP);
+ return Result(Status::invalidParameters, STR_CANT_REMOVE_FOOTPATH_FROM_HERE, STR_OFF_EDGE_OF_MAP);
}
if (!(gLegacyScene == LegacyScene::scenarioEditor || getGameState().cheats.sandboxMode) && !MapIsLocationOwned(_loc))
{
- return Result(Status::NotOwned, STR_CANT_REMOVE_FOOTPATH_FROM_HERE, STR_LAND_NOT_OWNED_BY_PARK);
+ return Result(Status::notOwned, STR_CANT_REMOVE_FOOTPATH_FROM_HERE, STR_LAND_NOT_OWNED_BY_PARK);
}
TileElement* footpathElement = GetFootpathElement();
if (footpathElement == nullptr)
{
- return Result(Status::InvalidParameters, STR_CANT_REMOVE_FOOTPATH_FROM_HERE, STR_ERR_PATH_ELEMENT_NOT_FOUND);
+ return Result(Status::invalidParameters, STR_CANT_REMOVE_FOOTPATH_FROM_HERE, STR_ERR_PATH_ELEMENT_NOT_FOUND);
}
- res.Cost = GetRefundPrice(footpathElement);
+ res.cost = GetRefundPrice(footpathElement);
return res;
}
@@ -79,11 +79,11 @@ namespace OpenRCT2::GameActions
Result FootpathRemoveAction::Execute(GameState_t& gameState) const
{
auto res = Result();
- res.Cost = 0;
- res.Expenditure = ExpenditureType::landscaping;
- res.Position = { _loc.x + 16, _loc.y + 16, _loc.z };
+ res.cost = 0;
+ res.expenditure = ExpenditureType::landscaping;
+ res.position = { _loc.x + 16, _loc.y + 16, _loc.z };
- if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST))
+ if (!GetFlags().has(CommandFlag::ghost))
{
FootpathInterruptPeeps(_loc);
FootpathRemoveLitter(_loc);
@@ -94,9 +94,9 @@ namespace OpenRCT2::GameActions
{
FootpathQueueChainReset();
auto bannerRes = RemoveBannersAtElement(gameState, _loc, footpathElement);
- if (bannerRes.Error == Status::Ok)
+ if (bannerRes.error == Status::ok)
{
- res.Cost += bannerRes.Cost;
+ res.cost += bannerRes.cost;
}
FootpathRemoveEdgesAt(_loc, footpathElement);
MapInvalidateTileFull(_loc);
@@ -116,17 +116,17 @@ namespace OpenRCT2::GameActions
}
else
{
- return Result(Status::InvalidParameters, STR_CANT_REMOVE_FOOTPATH_FROM_HERE, kStringIdNone);
+ return Result(Status::invalidParameters, STR_CANT_REMOVE_FOOTPATH_FROM_HERE, kStringIdNone);
}
- res.Cost += GetRefundPrice(footpathElement);
+ res.cost += GetRefundPrice(footpathElement);
return res;
}
TileElement* FootpathRemoveAction::GetFootpathElement() const
{
- bool getGhostPath = GetFlags() & GAME_COMMAND_FLAG_GHOST;
+ bool getGhostPath = GetFlags().has(CommandFlag::ghost);
for (auto* pathElement : TileElementsView(_loc))
{
@@ -167,14 +167,16 @@ namespace OpenRCT2::GameActions
auto bannerRemoveAction = BannerRemoveAction(
{ loc, tileElement->GetBaseZ(), tileElement->AsBanner()->GetPosition() });
bool isGhost = tileElement->IsGhost();
- auto bannerFlags = GetFlags() | (isGhost ? static_cast(GAME_COMMAND_FLAG_GHOST) : 0);
+ auto bannerFlags = GetFlags();
+ if (isGhost)
+ bannerFlags.set(CommandFlag::ghost);
bannerRemoveAction.SetFlags(bannerFlags);
auto res = ExecuteNested(&bannerRemoveAction, gameState);
// Ghost removal is free
- if (res.Error == Status::Ok && !isGhost)
+ if (res.error == Status::ok && !isGhost)
{
- result.Cost += res.Cost;
+ result.cost += res.cost;
}
tileElement--;
}
diff --git a/src/openrct2/actions/GameAction.cpp b/src/openrct2/actions/GameAction.cpp
index 9fdff4938d..a47bce001a 100644
--- a/src/openrct2/actions/GameAction.cpp
+++ b/src/openrct2/actions/GameAction.cpp
@@ -138,12 +138,12 @@ namespace OpenRCT2::GameActions
}
GameAction* action = queued.action.get();
- action->SetFlags(action->GetFlags() | GAME_COMMAND_FLAG_NETWORKED);
+ action->SetFlags(action->GetFlags().with(CommandFlag::networked));
Guard::Assert(action != nullptr);
Result result = Execute(action, getGameState());
- if (result.Error == Status::Ok && Network::GetMode() == Network::Mode::server)
+ if (result.error == Status::ok && Network::GetMode() == Network::Mode::server)
{
// Relay this action to all other clients.
Network::SendGameAction(action);
@@ -197,23 +197,23 @@ namespace OpenRCT2::GameActions
{
Result result = Result();
- result.Error = Status::GamePaused;
- result.ErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
- result.ErrorMessage = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED;
+ result.error = Status::gamePaused;
+ result.errorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
+ result.errorMessage = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED;
return result;
}
auto result = action->Query(gameState);
- if (result.Error == Status::Ok)
+ if (result.error == Status::ok)
{
- if (!FinanceCheckAffordability(result.Cost, action->GetFlags()))
+ if (!FinanceCheckAffordability(result.cost, action->GetFlags()))
{
- result.Error = Status::InsufficientFunds;
- result.ErrorTitle = STR_CANT_DO_THIS;
- result.ErrorMessage = STR_NOT_ENOUGH_CASH_REQUIRES;
- Formatter(result.ErrorMessageArgs.data()).Add(result.Cost);
+ result.error = Status::insufficientFunds;
+ result.errorTitle = STR_CANT_DO_THIS;
+ result.errorMessage = STR_NOT_ENOUGH_CASH_REQUIRES;
+ Formatter(result.errorMessageArgs.data()).Add(result.cost);
}
}
return result;
@@ -266,9 +266,9 @@ namespace OpenRCT2::GameActions
char temp[128] = {};
- if (result.Error != Status::Ok)
+ if (result.error != Status::ok)
{
- snprintf(temp, sizeof(temp), ") Failed, %u", static_cast(result.Error));
+ snprintf(temp, sizeof(temp), ") Failed, %u", static_cast(result.error));
}
else
{
@@ -288,7 +288,7 @@ namespace OpenRCT2::GameActions
Guard::ArgumentNotNull(action);
uint16_t actionFlags = action->GetActionFlags();
- uint32_t flags = action->GetFlags();
+ auto flags = action->GetFlags();
// Some actions are not recorded in the replay.
const auto ignoreForReplays = (actionFlags & Flags::IgnoreForReplays) != 0;
@@ -297,13 +297,13 @@ namespace OpenRCT2::GameActions
if (replayManager != nullptr && (replayManager->IsReplaying() || replayManager->IsNormalising()))
{
// We only accept replay commands as long the replay is active.
- if ((flags & GAME_COMMAND_FLAG_REPLAY) == 0 && !ignoreForReplays)
+ if (!flags.has(CommandFlag::replay) && !ignoreForReplays)
{
// TODO: Introduce proper error.
auto result = Result();
- result.Error = Status::GamePaused;
- result.ErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
- result.ErrorMessage = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED;
+ result.error = Status::gamePaused;
+ result.errorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
+ result.errorMessage = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED;
return result;
}
@@ -311,15 +311,14 @@ namespace OpenRCT2::GameActions
Result result = QueryInternal(action, gameState, topLevel);
#ifdef ENABLE_SCRIPTING
- if (result.Error == Status::Ok
- && ((Network::GetMode() == Network::Mode::none) || (flags & GAME_COMMAND_FLAG_NETWORKED)))
+ if (result.error == Status::ok && ((Network::GetMode() == Network::Mode::none) || flags.has(CommandFlag::networked)))
{
auto& scriptEngine = GetContext()->GetScriptEngine();
scriptEngine.RunGameActionHooks(*action, result, false);
// Script hooks may now have changed the game action result...
}
#endif
- if (result.Error == Status::Ok)
+ if (result.error == Status::ok)
{
if (topLevel)
{
@@ -327,7 +326,7 @@ namespace OpenRCT2::GameActions
if (Network::GetMode() == Network::Mode::client)
{
// As a client we have to wait or send it first.
- if (!(actionFlags & Flags::ClientOnly) && !(flags & GAME_COMMAND_FLAG_NETWORKED))
+ if (!(actionFlags & Flags::ClientOnly) && !flags.has(CommandFlag::networked))
{
LOG_VERBOSE("[%s] GameAction::Execute %s (Out)", GetRealm(), action->GetName());
Network::SendGameAction(action);
@@ -340,7 +339,7 @@ namespace OpenRCT2::GameActions
// If player is the server it would execute right away as where clients execute the commands
// at the beginning of the frame, so we have to put them into the queue.
// This is also the case when its executed from the UI update.
- if (!(actionFlags & Flags::ClientOnly) && !(flags & GAME_COMMAND_FLAG_NETWORKED))
+ if (!(actionFlags & Flags::ClientOnly) && !flags.has(CommandFlag::networked))
{
LOG_VERBOSE("[%s] GameAction::Execute %s (Queue)", GetRealm(), action->GetName());
Enqueue(action, getGameState().currentTicks);
@@ -351,33 +350,38 @@ namespace OpenRCT2::GameActions
}
ActionLogContext logContext;
- LogActionBegin(logContext, action);
+ if (topLevel && !flags.has(CommandFlag::ghost))
+ {
+ LogActionBegin(logContext, action);
+ }
// Execute the action, changing the game state
result = action->Execute(gameState);
#ifdef ENABLE_SCRIPTING
- if (result.Error == Status::Ok)
+ if (result.error == Status::ok)
{
auto& scriptEngine = GetContext()->GetScriptEngine();
scriptEngine.RunGameActionHooks(*action, result, true);
// Script hooks may now have changed the game action result...
}
#endif
-
- LogActionFinish(logContext, action, result);
+ if (topLevel && !flags.has(CommandFlag::ghost))
+ {
+ LogActionFinish(logContext, action, result);
+ }
// If not top level just give away the result.
if (!topLevel)
return result;
// Update money balance
- if (result.Error == Status::Ok && FinanceCheckMoneyRequired(flags) && result.Cost != 0)
+ if (result.error == Status::ok && FinanceCheckMoneyRequired(flags) && result.cost != 0)
{
- FinancePayment(result.Cost, result.Expenditure);
- MoneyEffect::Create(result.Cost, result.Position);
+ FinancePayment(result.cost, result.expenditure);
+ MoneyEffect::Create(result.cost, result.position);
}
- if (!(actionFlags & Flags::ClientOnly) && result.Error == Status::Ok)
+ if (!(actionFlags & Flags::ClientOnly) && result.error == Status::ok)
{
if (Network::GetMode() != Network::Mode::none)
{
@@ -389,26 +393,26 @@ namespace OpenRCT2::GameActions
Network::SetPlayerLastAction(playerIndex, action->GetType());
Network::IncrementPlayerNumCommands(playerIndex);
- if (result.Cost > 0)
+ if (result.cost > 0)
{
- Network::AddPlayerMoneySpent(playerIndex, result.Cost);
+ Network::AddPlayerMoneySpent(playerIndex, result.cost);
}
- if (!result.Position.IsNull())
+ if (!result.position.IsNull())
{
- Network::SetPlayerLastActionCoord(playerIndex, result.Position);
+ Network::SetPlayerLastActionCoord(playerIndex, result.position);
}
}
else
{
- bool commandExecutes = (flags & GAME_COMMAND_FLAG_GHOST) == 0 && (flags & GAME_COMMAND_FLAG_NO_SPEND) == 0;
+ bool commandExecutes = !flags.hasAny(CommandFlag::ghost, CommandFlag::noSpend);
bool recordAction = false;
if (replayManager != nullptr && !ignoreForReplays)
{
if (replayManager->IsRecording() && commandExecutes)
recordAction = true;
- else if (replayManager->IsNormalising() && (flags & GAME_COMMAND_FLAG_REPLAY) != 0)
+ else if (replayManager->IsNormalising() && flags.has(CommandFlag::replay))
recordAction = true; // In normalisation we only feed back actions issued by the replay manager.
}
if (recordAction)
@@ -433,24 +437,24 @@ namespace OpenRCT2::GameActions
}
// Only show errors when its not a ghost and not a preview and also top level action.
- bool shouldShowError = !(flags & GAME_COMMAND_FLAG_GHOST) && !(flags & GAME_COMMAND_FLAG_NO_SPEND) && topLevel;
+ bool shouldShowError = !flags.has(CommandFlag::ghost) && !flags.has(CommandFlag::noSpend) && topLevel;
// In network mode the error should be only shown to the issuer of the action.
if (Network::GetMode() != Network::Mode::none)
{
// If the action was never networked and query fails locally the player id is not assigned.
// So compare only if the action went into the queue otherwise show errors by default.
- const bool isActionFromNetwork = (action->GetFlags() & GAME_COMMAND_FLAG_NETWORKED) != 0;
+ const bool isActionFromNetwork = action->GetFlags().has(CommandFlag::networked);
if (isActionFromNetwork && action->GetPlayer() != Network::GetCurrentPlayerId())
{
shouldShowError = false;
}
}
- if (result.Error != Status::Ok && shouldShowError)
+ if (result.error != Status::ok && shouldShowError)
{
auto windowManager = Ui::GetWindowManager();
- windowManager->ShowError(result.GetErrorTitle(), result.GetErrorMessage());
+ windowManager->ShowError(result.getErrorTitle(), result.getErrorMessage());
}
return result;
diff --git a/src/openrct2/actions/GameAction.h b/src/openrct2/actions/GameAction.h
index 7f4dee877a..9574dccb1f 100644
--- a/src/openrct2/actions/GameAction.h
+++ b/src/openrct2/actions/GameAction.h
@@ -119,7 +119,7 @@ namespace OpenRCT2::GameActions
GameCommand const _type;
Network::PlayerId_t _playerId = { -1 }; // Callee
- uint32_t _flags = 0; // GAME_COMMAND_FLAGS
+ CommandFlags _flags = {};
uint32_t _networkId = 0;
Callback_t _callback;
@@ -139,7 +139,7 @@ namespace OpenRCT2::GameActions
void AcceptFlags(GameActionParameterVisitor& visitor)
{
- visitor.Visit("flags", _flags);
+ visitor.Visit("flags", _flags.holder);
}
Network::PlayerId_t GetPlayer() const
@@ -160,12 +160,12 @@ namespace OpenRCT2::GameActions
// Make sure we execute some things only on the client.
uint16_t flags = 0;
- if ((GetFlags() & GAME_COMMAND_FLAG_GHOST) != 0 || (GetFlags() & GAME_COMMAND_FLAG_NO_SPEND) != 0)
+ if ((GetFlags().has(CommandFlag::ghost)) != 0 || (GetFlags().has(CommandFlag::noSpend)) != 0)
{
flags |= OpenRCT2::GameActions::Flags::ClientOnly;
}
- if (GetFlags() & GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED)
+ if (GetFlags().has(CommandFlag::allowDuringPaused))
{
flags |= OpenRCT2::GameActions::Flags::AllowWhilePaused;
}
@@ -173,15 +173,12 @@ namespace OpenRCT2::GameActions
return flags;
}
- /**
- * Currently used for GAME_COMMAND_FLAGS, needs refactoring once everything is replaced.
- */
- uint32_t GetFlags() const
+ CommandFlags GetFlags() const
{
return _flags;
}
- uint32_t SetFlags(uint32_t flags)
+ CommandFlags SetFlags(CommandFlags flags)
{
return _flags = flags;
}
@@ -213,7 +210,7 @@ namespace OpenRCT2::GameActions
virtual void Serialise(DataSerialiser& stream)
{
- stream << DS_TAG(_networkId) << DS_TAG(_flags) << DS_TAG(_playerId);
+ stream << DS_TAG(_networkId) << DS_TAG(_flags.holder) << DS_TAG(_playerId);
}
// Helper function, allows const Objects to still serialize into DataSerialiser while being const.
diff --git a/src/openrct2/actions/GameActionResult.cpp b/src/openrct2/actions/GameActionResult.cpp
index bb53ea1010..94940c69c6 100644
--- a/src/openrct2/actions/GameActionResult.cpp
+++ b/src/openrct2/actions/GameActionResult.cpp
@@ -8,14 +8,14 @@ using namespace OpenRCT2;
namespace OpenRCT2::GameActions
{
- Result::Result(Status error, StringId title, StringId message, uint8_t* args /*= nullptr*/)
- : Error(error)
- , ErrorTitle(title)
- , ErrorMessage(message)
+ Result::Result(Status status, StringId title, StringId message, uint8_t* args /*= nullptr*/)
+ : error(status)
+ , errorTitle(title)
+ , errorMessage(message)
{
if (args != nullptr)
{
- std::copy_n(args, ErrorMessageArgs.size(), ErrorMessageArgs.begin());
+ std::copy_n(args, errorMessageArgs.size(), errorMessageArgs.begin());
}
}
@@ -33,14 +33,14 @@ namespace OpenRCT2::GameActions
}
};
- std::string Result::GetErrorTitle() const
+ std::string Result::getErrorTitle() const
{
- return std::visit(StringVariantVisitor{ ErrorMessageArgs.data() }, ErrorTitle);
+ return std::visit(StringVariantVisitor{ errorMessageArgs.data() }, errorTitle);
}
- std::string Result::GetErrorMessage() const
+ std::string Result::getErrorMessage() const
{
- return std::visit(StringVariantVisitor{ ErrorMessageArgs.data() }, ErrorMessage);
+ return std::visit(StringVariantVisitor{ errorMessageArgs.data() }, errorMessage);
}
} // namespace OpenRCT2::GameActions
diff --git a/src/openrct2/actions/GameActionResult.h b/src/openrct2/actions/GameActionResult.h
index f40d2b311f..201bc0ed97 100644
--- a/src/openrct2/actions/GameActionResult.h
+++ b/src/openrct2/actions/GameActionResult.h
@@ -28,25 +28,25 @@ namespace OpenRCT2::GameActions
*/
enum class Status : uint16_t
{
- Ok,
- InvalidParameters,
- Disallowed,
- GamePaused,
- InsufficientFunds,
- NotInEditorMode,
+ ok,
+ invalidParameters,
+ disallowed,
+ gamePaused,
+ insufficientFunds,
+ notInEditorMode,
- NotOwned,
- TooLow,
- TooHigh,
- NoClearance,
- ItemAlreadyPlaced,
+ notOwned,
+ tooLow,
+ tooHigh,
+ noClearance,
+ itemAlreadyPlaced,
- NotClosed,
- Broken,
+ notClosed,
+ broken,
- NoFreeElements,
+ noFreeElements,
- Unknown = std::numeric_limits>::max(),
+ unknown = std::numeric_limits>::max(),
};
/**
@@ -57,50 +57,50 @@ namespace OpenRCT2::GameActions
public:
using StringVariant = std::variant;
- Status Error = Status::Ok;
- StringVariant ErrorTitle = kStringIdNone;
- StringVariant ErrorMessage = kStringIdNone;
- std::array ErrorMessageArgs{};
- CoordsXYZ Position = { kLocationNull, kLocationNull, kLocationNull };
- money64 Cost = 0;
- ExpenditureType Expenditure = ExpenditureType::count;
+ Status error = Status::ok;
+ StringVariant errorTitle = kStringIdNone;
+ StringVariant errorMessage = kStringIdNone;
+ std::array errorMessageArgs{};
+ CoordsXYZ position = { kLocationNull, kLocationNull, kLocationNull };
+ money64 cost = 0;
+ ExpenditureType expenditure = ExpenditureType::count;
#ifdef __ANDROID__
// Any_cast throws a bad_any_cast exception on Android
// To avoid this in the Android release, a shared void pointer is used to store the result data.
- std::shared_ptr ResultData;
+ std::shared_ptr resultData;
#else
// Other platforms still use Any as this provides type checks
- std::any ResultData;
+ std::any resultData;
#endif
Result() = default;
- Result(Status error, StringId title, StringId message, uint8_t* args = nullptr);
+ Result(Status status, StringId title, StringId message, uint8_t* args = nullptr);
- std::string GetErrorTitle() const;
- std::string GetErrorMessage() const;
+ std::string getErrorTitle() const;
+ std::string getErrorMessage() const;
// It is recommended to use strong types since a type alias such as 'using MyType = uint32_t'
// is still just uint32_t, this guarantees the data is associated with the correct type.
template
- void SetData(const T&& data)
+ void setData(const T&& data)
{
#ifdef __ANDROID__
- ResultData = std::make_shared(data);
+ resultData = std::make_shared(data);
#else
- ResultData = std::forward(data);
+ resultData = std::forward(data);
#endif
}
template
- T GetData() const
+ T getData() const
{
#ifdef __ANDROID__
- return *static_cast(ResultData.get());
+ return *static_cast(resultData.get());
;
#else
// This function will throw std::bad_any_cast if the type mismatches.
- return std::any_cast(ResultData);
+ return std::any_cast(resultData);
#endif
}
};
diff --git a/src/openrct2/actions/GameSetSpeedAction.cpp b/src/openrct2/actions/GameSetSpeedAction.cpp
index d62a8090e0..3d385c914b 100644
--- a/src/openrct2/actions/GameSetSpeedAction.cpp
+++ b/src/openrct2/actions/GameSetSpeedAction.cpp
@@ -44,7 +44,7 @@ namespace OpenRCT2::GameActions
if (!IsValidSpeed(_speed))
{
LOG_ERROR("Invalid speed %u", _speed);
- return Result(Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
+ return Result(Status::invalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
}
return res;
@@ -57,7 +57,7 @@ namespace OpenRCT2::GameActions
if (!IsValidSpeed(_speed))
{
LOG_ERROR("Invalid speed %u", _speed);
- return Result(Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
+ return Result(Status::invalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
}
gGameSpeed = _speed;
diff --git a/src/openrct2/actions/GuestSetFlagsAction.cpp b/src/openrct2/actions/GuestSetFlagsAction.cpp
index 5183f15ee8..6d33151742 100644
--- a/src/openrct2/actions/GuestSetFlagsAction.cpp
+++ b/src/openrct2/actions/GuestSetFlagsAction.cpp
@@ -47,7 +47,7 @@ namespace OpenRCT2::GameActions
if (peep == nullptr)
{
LOG_ERROR("Guest entity not found for peepID %u", _peepId.ToUnderlying());
- return Result(Status::InvalidParameters, STR_CANT_CHANGE_THIS, kStringIdNone);
+ return Result(Status::invalidParameters, STR_CANT_CHANGE_THIS, kStringIdNone);
}
return Result();
}
@@ -58,7 +58,7 @@ namespace OpenRCT2::GameActions
if (peep == nullptr)
{
LOG_ERROR("Guest entity not found for peepID %u", _peepId.ToUnderlying());
- return Result(Status::InvalidParameters, STR_CANT_CHANGE_THIS, kStringIdNone);
+ return Result(Status::invalidParameters, STR_CANT_CHANGE_THIS, kStringIdNone);
}
peep->PeepFlags = _newFlags;
diff --git a/src/openrct2/actions/GuestSetNameAction.cpp b/src/openrct2/actions/GuestSetNameAction.cpp
index 6c0f622f5a..820d139a9f 100644
--- a/src/openrct2/actions/GuestSetNameAction.cpp
+++ b/src/openrct2/actions/GuestSetNameAction.cpp
@@ -60,14 +60,14 @@ namespace OpenRCT2::GameActions
{
if (_spriteIndex.ToUnderlying() >= kMaxEntities || _spriteIndex.IsNull())
{
- return Result(Status::InvalidParameters, STR_CANT_NAME_GUEST, STR_ERR_VALUE_OUT_OF_RANGE);
+ return Result(Status::invalidParameters, STR_CANT_NAME_GUEST, STR_ERR_VALUE_OUT_OF_RANGE);
}
auto guest = getGameState().entities.TryGetEntity(_spriteIndex);
if (guest == nullptr)
{
LOG_ERROR("Guest entity not found for spriteIndex %u", _spriteIndex);
- return Result(Status::InvalidParameters, STR_CANT_NAME_GUEST, kStringIdNone);
+ return Result(Status::invalidParameters, STR_CANT_NAME_GUEST, kStringIdNone);
}
return Result();
@@ -79,7 +79,7 @@ namespace OpenRCT2::GameActions
if (guest == nullptr)
{
LOG_ERROR("Guest entity not found for spriteIndex %u", _spriteIndex);
- return Result(Status::InvalidParameters, STR_CANT_NAME_GUEST, kStringIdNone);
+ return Result(Status::invalidParameters, STR_CANT_NAME_GUEST, kStringIdNone);
}
auto curName = guest->GetName();
@@ -90,7 +90,7 @@ namespace OpenRCT2::GameActions
if (!guest->SetName(_name))
{
- return Result(Status::Unknown, STR_CANT_NAME_GUEST, kStringIdNone);
+ return Result(Status::unknown, STR_CANT_NAME_GUEST, kStringIdNone);
}
// Easter egg functions are for guests only
@@ -102,7 +102,7 @@ namespace OpenRCT2::GameActions
ContextBroadcastIntent(&intent);
auto res = Result();
- res.Position = guest->GetLocation();
+ res.position = guest->GetLocation();
return res;
}
diff --git a/src/openrct2/actions/LandBuyRightsAction.cpp b/src/openrct2/actions/LandBuyRightsAction.cpp
index c61f5bc4f9..df7accd360 100644
--- a/src/openrct2/actions/LandBuyRightsAction.cpp
+++ b/src/openrct2/actions/LandBuyRightsAction.cpp
@@ -85,8 +85,8 @@ namespace OpenRCT2::GameActions
(validRange.GetY1() + validRange.GetY2()) / 2 + 16, 0 };
centre.z = TileElementHeight(centre);
- res.Position = centre;
- res.Expenditure = ExpenditureType::landPurchase;
+ res.position = centre;
+ res.expenditure = ExpenditureType::landPurchase;
// Game command modified to accept selection size
for (auto y = validRange.GetY1(); y <= validRange.GetY2(); y += kCoordsXYStep)
@@ -96,9 +96,9 @@ namespace OpenRCT2::GameActions
if (!LocationValid({ x, y }))
continue;
auto result = MapBuyLandRightsForTile({ x, y }, isExecuting);
- if (result.Error == Status::Ok)
+ if (result.error == Status::ok)
{
- res.Cost += result.Cost;
+ res.cost += result.cost;
}
}
}
@@ -114,14 +114,14 @@ namespace OpenRCT2::GameActions
if (_setting >= LandBuyRightSetting::Count)
{
LOG_ERROR("Invalid land buying setting %u", _setting);
- return Result(Status::InvalidParameters, kErrorTitles[0], STR_ERR_VALUE_OUT_OF_RANGE);
+ return Result(Status::invalidParameters, kErrorTitles[0], STR_ERR_VALUE_OUT_OF_RANGE);
}
SurfaceElement* surfaceElement = MapGetSurfaceElementAt(loc);
if (surfaceElement == nullptr)
{
LOG_ERROR("No surface at x = %d, y = %d", loc.x, loc.y);
- return Result(Status::InvalidParameters, kErrorTitles[EnumValue(_setting)], STR_ERR_SURFACE_ELEMENT_NOT_FOUND);
+ return Result(Status::invalidParameters, kErrorTitles[EnumValue(_setting)], STR_ERR_SURFACE_ELEMENT_NOT_FOUND);
}
auto res = Result();
@@ -135,14 +135,14 @@ namespace OpenRCT2::GameActions
if (gLegacyScene == LegacyScene::scenarioEditor || (surfaceElement->GetOwnership() & OWNERSHIP_AVAILABLE) == 0)
{
- return Result(Status::NotOwned, kErrorTitles[EnumValue(_setting)], STR_LAND_NOT_FOR_SALE);
+ return Result(Status::notOwned, kErrorTitles[EnumValue(_setting)], STR_LAND_NOT_FOR_SALE);
}
if (isExecuting)
{
surfaceElement->SetOwnership(OWNERSHIP_OWNED);
Park::UpdateFencesAroundTile(loc);
}
- res.Cost = getGameState().scenarioOptions.landPrice;
+ res.cost = getGameState().scenarioOptions.landPrice;
return res;
case LandBuyRightSetting::BuyConstructionRights: // 2
@@ -154,7 +154,7 @@ namespace OpenRCT2::GameActions
if (gLegacyScene == LegacyScene::scenarioEditor
|| (surfaceElement->GetOwnership() & OWNERSHIP_CONSTRUCTION_RIGHTS_AVAILABLE) == 0)
{
- return Result(Status::NotOwned, kErrorTitles[EnumValue(_setting)], STR_CONSTRUCTION_RIGHTS_NOT_FOR_SALE);
+ return Result(Status::notOwned, kErrorTitles[EnumValue(_setting)], STR_CONSTRUCTION_RIGHTS_NOT_FOR_SALE);
}
if (isExecuting)
@@ -163,12 +163,12 @@ namespace OpenRCT2::GameActions
uint16_t baseZ = surfaceElement->GetBaseZ();
MapInvalidateTile({ loc, baseZ, baseZ + 16 });
}
- res.Cost = getGameState().scenarioOptions.constructionRightsPrice;
+ res.cost = getGameState().scenarioOptions.constructionRightsPrice;
return res;
default:
LOG_ERROR("Invalid land buying setting %u", _setting);
- return Result(Status::InvalidParameters, kErrorTitles[0], STR_ERR_VALUE_OUT_OF_RANGE);
+ return Result(Status::invalidParameters, kErrorTitles[0], STR_ERR_VALUE_OUT_OF_RANGE);
}
}
} // namespace OpenRCT2::GameActions
diff --git a/src/openrct2/actions/LandLowerAction.cpp b/src/openrct2/actions/LandLowerAction.cpp
index 6295306819..dd93bfdb2a 100644
--- a/src/openrct2/actions/LandLowerAction.cpp
+++ b/src/openrct2/actions/LandLowerAction.cpp
@@ -76,8 +76,8 @@ namespace OpenRCT2::GameActions
auto validRange = ClampRangeWithinMap(_range);
- res.Position = { _coords.x, _coords.y, TileElementHeight(_coords) };
- res.Expenditure = ExpenditureType::landscaping;
+ res.position = { _coords.x, _coords.y, TileElementHeight(_coords) };
+ res.expenditure = ExpenditureType::landscaping;
if (isExecuting)
{
@@ -127,13 +127,13 @@ namespace OpenRCT2::GameActions
landSetHeightAction.SetFlags(GetFlags());
auto result = isExecuting ? ExecuteNested(&landSetHeightAction, gameState)
: QueryNested(&landSetHeightAction, gameState);
- if (result.Error == Status::Ok)
+ if (result.error == Status::ok)
{
- res.Cost += result.Cost;
+ res.cost += result.cost;
}
else
{
- result.ErrorTitle = STR_CANT_LOWER_LAND_HERE;
+ result.errorTitle = STR_CANT_LOWER_LAND_HERE;
return result;
}
}
@@ -141,7 +141,7 @@ namespace OpenRCT2::GameActions
if (!withinOwnership)
{
- return Result(Status::Disallowed, STR_CANT_LOWER_LAND_HERE, STR_LAND_NOT_OWNED_BY_PARK);
+ return Result(Status::disallowed, STR_CANT_LOWER_LAND_HERE, STR_LAND_NOT_OWNED_BY_PARK);
}
// Force ride construction to recheck area
diff --git a/src/openrct2/actions/LandRaiseAction.cpp b/src/openrct2/actions/LandRaiseAction.cpp
index 6d2237fd13..15134436b1 100644
--- a/src/openrct2/actions/LandRaiseAction.cpp
+++ b/src/openrct2/actions/LandRaiseAction.cpp
@@ -77,8 +77,8 @@ namespace OpenRCT2::GameActions
auto validRange = ClampRangeWithinMap(_range);
- res.Position = { _coords.x, _coords.y, TileElementHeight(_coords) };
- res.Expenditure = ExpenditureType::landscaping;
+ res.position = { _coords.x, _coords.y, TileElementHeight(_coords) };
+ res.expenditure = ExpenditureType::landscaping;
if (isExecuting)
{
@@ -131,13 +131,13 @@ namespace OpenRCT2::GameActions
landSetHeightAction.SetFlags(GetFlags());
auto result = isExecuting ? ExecuteNested(&landSetHeightAction, gameState)
: QueryNested(&landSetHeightAction, gameState);
- if (result.Error == Status::Ok)
+ if (result.error == Status::ok)
{
- res.Cost += result.Cost;
+ res.cost += result.cost;
}
else
{
- result.ErrorTitle = STR_CANT_RAISE_LAND_HERE;
+ result.errorTitle = STR_CANT_RAISE_LAND_HERE;
return result;
}
}
@@ -145,7 +145,7 @@ namespace OpenRCT2::GameActions
if (!withinOwnership)
{
- return Result(Status::Disallowed, STR_CANT_RAISE_LAND_HERE, STR_LAND_NOT_OWNED_BY_PARK);
+ return Result(Status::disallowed, STR_CANT_RAISE_LAND_HERE, STR_LAND_NOT_OWNED_BY_PARK);
}
// Force ride construction to recheck area
diff --git a/src/openrct2/actions/LandSetHeightAction.cpp b/src/openrct2/actions/LandSetHeightAction.cpp
index 2321b64a0a..48939c5ab6 100644
--- a/src/openrct2/actions/LandSetHeightAction.cpp
+++ b/src/openrct2/actions/LandSetHeightAction.cpp
@@ -62,20 +62,20 @@ namespace OpenRCT2::GameActions
{
if (gameState.park.flags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES)
{
- return Result(Status::Disallowed, STR_FORBIDDEN_BY_THE_LOCAL_AUTHORITY, kStringIdNone);
+ return Result(Status::disallowed, STR_FORBIDDEN_BY_THE_LOCAL_AUTHORITY, kStringIdNone);
}
StringId errorMessage = CheckParameters();
if (errorMessage != kStringIdNone)
{
- return Result(Status::Disallowed, kStringIdNone, errorMessage);
+ return Result(Status::disallowed, kStringIdNone, errorMessage);
}
if (gLegacyScene != LegacyScene::scenarioEditor && !gameState.cheats.sandboxMode)
{
if (!MapIsLocationInPark(_coords))
{
- return Result(Status::Disallowed, STR_LAND_NOT_OWNED_BY_PARK, kStringIdNone);
+ return Result(Status::disallowed, STR_LAND_NOT_OWNED_BY_PARK, kStringIdNone);
}
}
@@ -88,7 +88,7 @@ namespace OpenRCT2::GameActions
TileElement* tileElement = CheckTreeObstructions();
if (tileElement != nullptr)
{
- auto res = Result(Status::Disallowed, kStringIdNone, kStringIdNone);
+ auto res = Result(Status::disallowed, kStringIdNone, kStringIdNone);
MapGetObstructionErrorText(tileElement, res);
return res;
}
@@ -102,13 +102,13 @@ namespace OpenRCT2::GameActions
errorMessage = CheckRideSupports();
if (errorMessage != kStringIdNone)
{
- return Result(Status::Disallowed, kStringIdNone, errorMessage);
+ return Result(Status::disallowed, kStringIdNone, errorMessage);
}
}
auto* surfaceElement = MapGetSurfaceElementAt(_coords);
if (surfaceElement == nullptr)
- return Result(Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_SURFACE_ELEMENT_NOT_FOUND);
+ return Result(Status::invalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_SURFACE_ELEMENT_NOT_FOUND);
// We need to check if there is _currently_ a level crossing on the tile.
// For that, we need the old height, so we can't use the _height variable.
@@ -116,13 +116,13 @@ namespace OpenRCT2::GameActions
auto* pathElement = MapGetFootpathElement(oldCoords);
if (pathElement != nullptr && pathElement->AsPath()->IsLevelCrossing(oldCoords))
{
- return Result(Status::Disallowed, STR_REMOVE_LEVEL_CROSSING_FIRST, kStringIdNone);
+ return Result(Status::disallowed, STR_REMOVE_LEVEL_CROSSING_FIRST, kStringIdNone);
}
TileElement* tileElement = CheckFloatingStructures(reinterpret_cast(surfaceElement), _height);
if (tileElement != nullptr)
{
- auto res = Result(Status::Disallowed, kStringIdNone, kStringIdNone);
+ auto res = Result(Status::disallowed, kStringIdNone, kStringIdNone);
MapGetObstructionErrorText(tileElement, res);
return res;
}
@@ -140,17 +140,17 @@ namespace OpenRCT2::GameActions
}
auto clearResult = MapCanConstructWithClearAt(
- { _coords, _height * kCoordsZStep, zCorner * kCoordsZStep }, &MapSetLandHeightClearFunc, { 0b1111, 0 }, 0,
+ { _coords, _height * kCoordsZStep, zCorner * kCoordsZStep }, MapSetLandHeightClearFunc, { 0b1111, 0 }, {},
_style, CreateCrossingMode::none);
- if (clearResult.Error != Status::Ok)
+ if (clearResult.error != Status::ok)
{
- clearResult.Error = Status::Disallowed;
+ clearResult.error = Status::disallowed;
return clearResult;
}
}
auto res = Result();
- res.Cost = sceneryRemovalCost + GetSurfaceHeightChangeCost(surfaceElement);
- res.Expenditure = ExpenditureType::landscaping;
+ res.cost = sceneryRemovalCost + GetSurfaceHeightChangeCost(surfaceElement);
+ res.expenditure = ExpenditureType::landscaping;
return res;
}
@@ -169,15 +169,15 @@ namespace OpenRCT2::GameActions
auto* surfaceElement = MapGetSurfaceElementAt(_coords);
if (surfaceElement == nullptr)
- return Result(Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_SURFACE_ELEMENT_NOT_FOUND);
+ return Result(Status::invalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_SURFACE_ELEMENT_NOT_FOUND);
cost += GetSurfaceHeightChangeCost(surfaceElement);
SetSurfaceHeight(reinterpret_cast(surfaceElement));
auto res = Result();
- res.Position = { _coords.x + 16, _coords.y + 16, surfaceHeight };
- res.Cost = cost;
- res.Expenditure = ExpenditureType::landscaping;
+ res.position = { _coords.x + 16, _coords.y + 16, surfaceHeight };
+ res.cost = cost;
+ res.expenditure = ExpenditureType::landscaping;
return res;
}
@@ -347,16 +347,16 @@ namespace OpenRCT2::GameActions
MapInvalidateTileFull(_coords);
}
- int32_t LandSetHeightAction::MapSetLandHeightClearFunc(
- TileElement** tile_element, [[maybe_unused]] const CoordsXY& coords, [[maybe_unused]] uint8_t flags,
+ bool LandSetHeightAction::MapSetLandHeightClearFunc(
+ TileElement** tile_element, [[maybe_unused]] const CoordsXY& coords, [[maybe_unused]] CommandFlags flags,
[[maybe_unused]] money64* price)
{
if ((*tile_element)->GetType() == TileElementType::Surface)
- return 0;
+ return true;
if ((*tile_element)->GetType() == TileElementType::SmallScenery)
- return 0;
+ return true;
- return 1;
+ return false;
}
} // namespace OpenRCT2::GameActions
diff --git a/src/openrct2/actions/LandSetHeightAction.h b/src/openrct2/actions/LandSetHeightAction.h
index 191d56ec4e..c5a0791f46 100644
--- a/src/openrct2/actions/LandSetHeightAction.h
+++ b/src/openrct2/actions/LandSetHeightAction.h
@@ -46,8 +46,8 @@ namespace OpenRCT2::GameActions
*
* rct2: 0x00663CB9
*/
- static int32_t MapSetLandHeightClearFunc(
- TileElement** tile_element, [[maybe_unused]] const CoordsXY& coords, [[maybe_unused]] uint8_t flags,
+ static bool MapSetLandHeightClearFunc(
+ TileElement** tile_element, [[maybe_unused]] const CoordsXY& coords, [[maybe_unused]] CommandFlags flags,
[[maybe_unused]] money64* price);
};
} // namespace OpenRCT2::GameActions
diff --git a/src/openrct2/actions/LandSetRightsAction.cpp b/src/openrct2/actions/LandSetRightsAction.cpp
index 4b47b49ad9..f5f68fe0a7 100644
--- a/src/openrct2/actions/LandSetRightsAction.cpp
+++ b/src/openrct2/actions/LandSetRightsAction.cpp
@@ -83,12 +83,12 @@ namespace OpenRCT2::GameActions
(validRange.GetY1() + validRange.GetY2()) / 2 + 16, 0 };
centre.z = TileElementHeight(centre);
- res.Position = centre;
- res.Expenditure = ExpenditureType::landPurchase;
+ res.position = centre;
+ res.expenditure = ExpenditureType::landPurchase;
if (!isInEditorMode() && !getGameState().cheats.sandboxMode)
{
- return Result(Status::NotInEditorMode, kStringIdNone, STR_LAND_NOT_FOR_SALE);
+ return Result(Status::notInEditorMode, kStringIdNone, STR_LAND_NOT_FOR_SALE);
}
// Game command modified to accept selection size
@@ -99,9 +99,9 @@ namespace OpenRCT2::GameActions
if (!LocationValid({ x, y }))
continue;
auto result = MapBuyLandRightsForTile({ x, y }, isExecuting);
- if (result.Error == Status::Ok)
+ if (result.error == Status::ok)
{
- res.Cost += result.Cost;
+ res.cost += result.cost;
}
}
}
@@ -120,7 +120,7 @@ namespace OpenRCT2::GameActions
if (surfaceElement == nullptr)
{
LOG_ERROR("No surface at x = %d, y = %d", loc.x, loc.y);
- return Result(Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_SURFACE_ELEMENT_NOT_FOUND);
+ return Result(Status::invalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_SURFACE_ELEMENT_NOT_FOUND);
}
auto res = Result();
@@ -195,23 +195,23 @@ namespace OpenRCT2::GameActions
{
// Buying land
if (!(currentOwnership & OWNERSHIP_OWNED) && (_ownership & OWNERSHIP_OWNED))
- res.Cost = gameState.scenarioOptions.landPrice;
+ res.cost = gameState.scenarioOptions.landPrice;
// Buying construction rights
if (!(currentOwnership & OWNERSHIP_CONSTRUCTION_RIGHTS_OWNED)
&& (_ownership & OWNERSHIP_CONSTRUCTION_RIGHTS_OWNED))
- res.Cost = gameState.scenarioOptions.constructionRightsPrice;
+ res.cost = gameState.scenarioOptions.constructionRightsPrice;
}
else
{
// Selling land
if ((currentOwnership & OWNERSHIP_OWNED) && !(_ownership & OWNERSHIP_OWNED))
- res.Cost = -gameState.scenarioOptions.landPrice;
+ res.cost = -gameState.scenarioOptions.landPrice;
// Selling construction rights
if ((currentOwnership & OWNERSHIP_CONSTRUCTION_RIGHTS_OWNED)
&& !(_ownership & OWNERSHIP_CONSTRUCTION_RIGHTS_OWNED))
- res.Cost = -gameState.scenarioOptions.constructionRightsPrice;
+ res.cost = -gameState.scenarioOptions.constructionRightsPrice;
}
if (isExecuting)
@@ -234,7 +234,7 @@ namespace OpenRCT2::GameActions
}
default:
LOG_ERROR("Invalid setting %u to set land rights", _setting);
- return Result(Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
+ return Result(Status::invalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
}
}
} // namespace OpenRCT2::GameActions
diff --git a/src/openrct2/actions/LandSmoothAction.cpp b/src/openrct2/actions/LandSmoothAction.cpp
index 8c65e4b5bf..23ddcfbd73 100644
--- a/src/openrct2/actions/LandSmoothAction.cpp
+++ b/src/openrct2/actions/LandSmoothAction.cpp
@@ -238,9 +238,9 @@ namespace OpenRCT2::GameActions
landSetHeightAction.SetFlags(GetFlags());
auto res = isExecuting ? ExecuteNested(&landSetHeightAction, gameState)
: QueryNested(&landSetHeightAction, gameState);
- if (res.Error == Status::Ok)
+ if (res.error == Status::ok)
{
- totalCost += res.Cost;
+ totalCost += res.cost;
}
}
return totalCost;
@@ -326,9 +326,9 @@ namespace OpenRCT2::GameActions
expectedLandHeight += landChangePerTile;
// change land of current tile
auto result = SmoothLandTile(gameState, direction, isExecuting, nextLoc, surfaceElement);
- if (result.Error == Status::Ok)
+ if (result.error == Status::ok)
{
- totalCost += result.Cost;
+ totalCost += result.cost;
}
}
return totalCost;
@@ -351,9 +351,9 @@ namespace OpenRCT2::GameActions
int32_t centreZ = TileElementHeight(_coords);
auto res = Result();
- res.ErrorTitle = kErrorTitles[_isLowering ? 0 : 1];
- res.Expenditure = ExpenditureType::landscaping;
- res.Position = { _coords.x, _coords.y, centreZ };
+ res.errorTitle = kErrorTitles[_isLowering ? 0 : 1];
+ res.expenditure = ExpenditureType::landscaping;
+ res.position = { _coords.x, _coords.y, centreZ };
// Do the smoothing
switch (selectionType)
@@ -370,7 +370,7 @@ namespace OpenRCT2::GameActions
{
int32_t z = std::clamp(
static_cast(TileElementGetCornerHeight(surfaceElement, 2)), minHeight, maxHeight);
- res.Cost += SmoothLandRowByCorner(
+ res.cost += SmoothLandRowByCorner(
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, -32, -32, 0, 2);
}
}
@@ -380,7 +380,7 @@ namespace OpenRCT2::GameActions
{
int32_t z = std::clamp(
static_cast(TileElementGetCornerHeight(surfaceElement, 3)), minHeight, maxHeight);
- res.Cost += SmoothLandRowByCorner(
+ res.cost += SmoothLandRowByCorner(
gameState, isExecuting, { validRange.GetX1(), validRange.GetY2() }, z, -32, 32, 1, 3);
}
}
@@ -390,7 +390,7 @@ namespace OpenRCT2::GameActions
{
int32_t z = std::clamp(
static_cast(TileElementGetCornerHeight(surfaceElement, 0)), minHeight, maxHeight);
- res.Cost += SmoothLandRowByCorner(
+ res.cost += SmoothLandRowByCorner(
gameState, isExecuting, { validRange.GetX2(), validRange.GetY2() }, z, 32, 32, 2, 0);
}
}
@@ -400,7 +400,7 @@ namespace OpenRCT2::GameActions
{
int32_t z = std::clamp(
static_cast(TileElementGetCornerHeight(surfaceElement, 1)), minHeight, maxHeight);
- res.Cost += SmoothLandRowByCorner(
+ res.cost += SmoothLandRowByCorner(
gameState, isExecuting, { validRange.GetX2(), validRange.GetY1() }, z, 32, -32, 3, 1);
}
}
@@ -416,7 +416,7 @@ namespace OpenRCT2::GameActions
static_cast(TileElementGetCornerHeight(surfaceElement, 3)), minHeight, maxHeight);
z2 = std::clamp(
static_cast(TileElementGetCornerHeight(surfaceElement, 2)), minHeight, maxHeight);
- res.Cost += SmoothLandRowByEdge(
+ res.cost += SmoothLandRowByEdge(
gameState, isExecuting, { validRange.GetX1(), y }, z1, z2, -32, 0, 0, 1, 3, 2);
}
@@ -427,7 +427,7 @@ namespace OpenRCT2::GameActions
static_cast(TileElementGetCornerHeight(surfaceElement, 1)), minHeight, maxHeight);
z2 = std::clamp(
static_cast(TileElementGetCornerHeight(surfaceElement, 0)), minHeight, maxHeight);
- res.Cost += SmoothLandRowByEdge(
+ res.cost += SmoothLandRowByEdge(
gameState, isExecuting, { validRange.GetX2(), y }, z1, z2, 32, 0, 2, 3, 1, 0);
}
}
@@ -441,7 +441,7 @@ namespace OpenRCT2::GameActions
static_cast(TileElementGetCornerHeight(surfaceElement, 1)), minHeight, maxHeight);
z2 = std::clamp(
static_cast(TileElementGetCornerHeight(surfaceElement, 2)), minHeight, maxHeight);
- res.Cost += SmoothLandRowByEdge(
+ res.cost += SmoothLandRowByEdge(
gameState, isExecuting, { x, validRange.GetY1() }, z1, z2, 0, -32, 0, 3, 1, 2);
}
@@ -452,7 +452,7 @@ namespace OpenRCT2::GameActions
static_cast(TileElementGetCornerHeight(surfaceElement, 0)), minHeight, maxHeight);
z2 = std::clamp(
static_cast(TileElementGetCornerHeight(surfaceElement, 3)), minHeight, maxHeight);
- res.Cost += SmoothLandRowByEdge(
+ res.cost += SmoothLandRowByEdge(
gameState, isExecuting, { x, validRange.GetY2() }, z1, z2, 0, 32, 1, 2, 0, 3);
}
}
@@ -487,16 +487,16 @@ namespace OpenRCT2::GameActions
// Smooth the corners
int32_t z = MapGetCornerHeight(newBaseZ, newSlope, 2);
- res.Cost += SmoothLandRowByCorner(
+ res.cost += SmoothLandRowByCorner(
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, -32, -32, 0, 2);
z = MapGetCornerHeight(newBaseZ, newSlope, 0);
- res.Cost += SmoothLandRowByCorner(
+ res.cost += SmoothLandRowByCorner(
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, 32, 32, 2, 0);
z = MapGetCornerHeight(newBaseZ, newSlope, 3);
- res.Cost += SmoothLandRowByCorner(
+ res.cost += SmoothLandRowByCorner(
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, -32, 32, 1, 3);
z = MapGetCornerHeight(newBaseZ, newSlope, 1);
- res.Cost += SmoothLandRowByCorner(
+ res.cost += SmoothLandRowByCorner(
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, 32, -32, 3, 1);
// Smooth the edges
@@ -504,54 +504,54 @@ namespace OpenRCT2::GameActions
{
case MapSelectType::corner0:
z = MapGetCornerHeight(newBaseZ, newSlope, 0);
- res.Cost += SmoothLandRowByCorner(
+ res.cost += SmoothLandRowByCorner(
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, 32, 0, 3, 0);
- res.Cost += SmoothLandRowByCorner(
+ res.cost += SmoothLandRowByCorner(
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, 0, 32, 1, 0);
z = MapGetCornerHeight(newBaseZ, newSlope, 3);
- res.Cost += SmoothLandRowByCorner(
+ res.cost += SmoothLandRowByCorner(
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, -32, 0, 0, 3);
z = MapGetCornerHeight(newBaseZ, newSlope, 1);
- res.Cost += SmoothLandRowByCorner(
+ res.cost += SmoothLandRowByCorner(
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, 0, -32, 0, 1);
break;
case MapSelectType::corner1:
z = MapGetCornerHeight(newBaseZ, newSlope, 1);
- res.Cost += SmoothLandRowByCorner(
+ res.cost += SmoothLandRowByCorner(
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, 32, 0, 2, 1);
- res.Cost += SmoothLandRowByCorner(
+ res.cost += SmoothLandRowByCorner(
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, 0, -32, 0, 1);
z = MapGetCornerHeight(newBaseZ, newSlope, 2);
- res.Cost += SmoothLandRowByCorner(
+ res.cost += SmoothLandRowByCorner(
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, -32, 0, 1, 2);
z = MapGetCornerHeight(newBaseZ, newSlope, 0);
- res.Cost += SmoothLandRowByCorner(
+ res.cost += SmoothLandRowByCorner(
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, 0, 32, 1, 0);
break;
case MapSelectType::corner2:
z = MapGetCornerHeight(newBaseZ, newSlope, 2);
- res.Cost += SmoothLandRowByCorner(
+ res.cost += SmoothLandRowByCorner(
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, -32, 0, 1, 2);
- res.Cost += SmoothLandRowByCorner(
+ res.cost += SmoothLandRowByCorner(
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, 0, -32, 3, 2);
z = MapGetCornerHeight(newBaseZ, newSlope, 1);
- res.Cost += SmoothLandRowByCorner(
+ res.cost += SmoothLandRowByCorner(
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, 32, 0, 2, 1);
z = MapGetCornerHeight(newBaseZ, newSlope, 3);
- res.Cost += SmoothLandRowByCorner(
+ res.cost += SmoothLandRowByCorner(
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, 0, 32, 2, 3);
break;
case MapSelectType::corner3:
z = MapGetCornerHeight(newBaseZ, newSlope, 3);
- res.Cost += SmoothLandRowByCorner(
+ res.cost += SmoothLandRowByCorner(
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, -32, 0, 0, 3);
- res.Cost += SmoothLandRowByCorner(
+ res.cost += SmoothLandRowByCorner(
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, 0, 32, 2, 3);
z = MapGetCornerHeight(newBaseZ, newSlope, 0);
- res.Cost += SmoothLandRowByCorner(
+ res.cost += SmoothLandRowByCorner(
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, 32, 0, 3, 0);
z = MapGetCornerHeight(newBaseZ, newSlope, 2);
- res.Cost += SmoothLandRowByCorner(
+ res.cost += SmoothLandRowByCorner(
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, 0, -32, 3, 2);
break;
default:
@@ -611,38 +611,38 @@ namespace OpenRCT2::GameActions
uint8_t z3 = MapGetCornerHeight(newBaseZ, newSlope, c3);
uint8_t z4 = MapGetCornerHeight(newBaseZ, newSlope, c4);
// Smooth the edge at the top of the new slope
- res.Cost += SmoothLandRowByEdge(
+ res.cost += SmoothLandRowByEdge(
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z1, z2, stepOffsets[edge].x,
stepOffsets[edge].y, c3, c4, c1, c2);
// Smooth the edge at the bottom of the new slope
- res.Cost += SmoothLandRowByEdge(
+ res.cost += SmoothLandRowByEdge(
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z3, z4, -stepOffsets[edge].x,
-stepOffsets[edge].y, c1, c2, c3, c4);
// Smooth corners
- res.Cost += SmoothLandRowByCorner(
+ res.cost += SmoothLandRowByCorner(
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z1, -stepOffsets[edge].y,
stepOffsets[edge].x, c2, c1);
- res.Cost += SmoothLandRowByCorner(
+ res.cost += SmoothLandRowByCorner(
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z2, stepOffsets[edge].y,
-stepOffsets[edge].x, c1, c2);
int32_t z = MapGetCornerHeight(newBaseZ, newSlope, 2);
- res.Cost += SmoothLandRowByCorner(
+ res.cost += SmoothLandRowByCorner(
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, -32, -32, 0, 2);
z = MapGetCornerHeight(newBaseZ, newSlope, 0);
- res.Cost += SmoothLandRowByCorner(
+ res.cost += SmoothLandRowByCorner(
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, 32, 32, 2, 0);
z = MapGetCornerHeight(newBaseZ, newSlope, 3);
- res.Cost += SmoothLandRowByCorner(
+ res.cost += SmoothLandRowByCorner(
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, -32, 32, 1, 3);
z = MapGetCornerHeight(newBaseZ, newSlope, 1);
- res.Cost += SmoothLandRowByCorner(
+ res.cost += SmoothLandRowByCorner(
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, 32, -32, 3, 1);
break;
}
default:
LOG_ERROR("Invalid map selection type %u", _selectionType);
- return Result(Status::InvalidParameters, std::get(res.ErrorTitle), STR_ERR_VALUE_OUT_OF_RANGE);
+ return Result(Status::invalidParameters, std::get(res.errorTitle), STR_ERR_VALUE_OUT_OF_RANGE);
} // switch selectionType
// Raise / lower the land tool selection area
@@ -659,7 +659,7 @@ namespace OpenRCT2::GameActions
lowerLandAction.SetFlags(GetFlags());
result = isExecuting ? ExecuteNested(&lowerLandAction, gameState) : QueryNested(&lowerLandAction, gameState);
}
- if (result.Error != Status::Ok)
+ if (result.error != Status::ok)
{
return result;
}
@@ -668,7 +668,7 @@ namespace OpenRCT2::GameActions
{
Audio::Play3D(Audio::SoundId::placeItem, { _coords.x, _coords.y, centreZ });
}
- res.Cost += result.Cost;
+ res.cost += result.cost;
return res;
}
} // namespace OpenRCT2::GameActions
diff --git a/src/openrct2/actions/LargeSceneryPlaceAction.cpp b/src/openrct2/actions/LargeSceneryPlaceAction.cpp
index 96ea7bf184..6355a94c0f 100644
--- a/src/openrct2/actions/LargeSceneryPlaceAction.cpp
+++ b/src/openrct2/actions/LargeSceneryPlaceAction.cpp
@@ -67,12 +67,12 @@ namespace OpenRCT2::GameActions
Result LargeSceneryPlaceAction::Query(GameState_t& gameState) const
{
auto res = Result();
- res.ErrorTitle = STR_CANT_POSITION_THIS_HERE;
- res.Expenditure = ExpenditureType::landscaping;
+ res.errorTitle = STR_CANT_POSITION_THIS_HERE;
+ res.expenditure = ExpenditureType::landscaping;
int16_t surfaceHeight = TileElementHeight(_loc);
- res.Position.x = _loc.x + 16;
- res.Position.y = _loc.y + 16;
- res.Position.z = surfaceHeight;
+ res.position.x = _loc.x + 16;
+ res.position.y = _loc.y + 16;
+ res.position.z = surfaceHeight;
auto resultData = LargeSceneryPlaceActionResult{};
@@ -81,29 +81,29 @@ namespace OpenRCT2::GameActions
if (_primaryColour >= COLOUR_COUNT)
{
LOG_ERROR("Invalid primary colour %u", _primaryColour);
- return Result(Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_ERR_INVALID_COLOUR);
+ return Result(Status::invalidParameters, STR_CANT_POSITION_THIS_HERE, STR_ERR_INVALID_COLOUR);
}
else if (_secondaryColour >= COLOUR_COUNT)
{
LOG_ERROR("Invalid secondary colour %u", _secondaryColour);
- return Result(Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_ERR_INVALID_COLOUR);
+ return Result(Status::invalidParameters, STR_CANT_POSITION_THIS_HERE, STR_ERR_INVALID_COLOUR);
}
else if (_tertiaryColour >= COLOUR_COUNT)
{
LOG_ERROR("Invalid tertiary colour %u", _tertiaryColour);
- return Result(Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_ERR_INVALID_COLOUR);
+ return Result(Status::invalidParameters, STR_CANT_POSITION_THIS_HERE, STR_ERR_INVALID_COLOUR);
}
else if (_sceneryType >= kMaxLargeSceneryObjects)
{
LOG_ERROR("Invalid sceneryType %u", _sceneryType);
- return Result(Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_ERR_VALUE_OUT_OF_RANGE);
+ return Result(Status::invalidParameters, STR_CANT_POSITION_THIS_HERE, STR_ERR_VALUE_OUT_OF_RANGE);
}
auto* sceneryEntry = ObjectManager::GetObjectEntry(_sceneryType);
if (sceneryEntry == nullptr)
{
LOG_ERROR("Large scenery entry not found for sceneryType %u", _sceneryType);
- return Result(Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_UNKNOWN_OBJECT_TYPE);
+ return Result(Status::invalidParameters, STR_CANT_POSITION_THIS_HERE, STR_UNKNOWN_OBJECT_TYPE);
}
const auto totalNumTiles = sceneryEntry->tiles.size();
@@ -114,14 +114,14 @@ namespace OpenRCT2::GameActions
maxHeight = _loc.z;
}
- res.Position.z = maxHeight;
+ res.position.z = maxHeight;
if (sceneryEntry->scrolling_mode != kScrollingModeNone)
{
if (HasReachedBannerLimit())
{
LOG_ERROR("No free banners available");
- return Result(Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_TOO_MANY_BANNERS_IN_GAME);
+ return Result(Status::invalidParameters, STR_CANT_POSITION_THIS_HERE, STR_TOO_MANY_BANNERS_IN_GAME);
}
}
@@ -138,28 +138,28 @@ namespace OpenRCT2::GameActions
QuarterTile quarterTile = QuarterTile{ tile.corners, 0 }.Rotate(_loc.direction);
const auto isTree = (sceneryEntry->flags & LARGE_SCENERY_FLAG_IS_TREE) != 0;
auto canBuild = MapCanConstructWithClearAt(
- { curTile, zLow, zHigh }, &MapPlaceSceneryClearFunc, quarterTile, GetFlags(), kTileSlopeFlat,
+ { curTile, zLow, zHigh }, MapPlaceSceneryClearFunc, quarterTile, GetFlags(), kTileSlopeFlat,
CreateCrossingMode::none, isTree);
- if (canBuild.Error != Status::Ok)
+ if (canBuild.error != Status::ok)
{
- canBuild.ErrorTitle = STR_CANT_POSITION_THIS_HERE;
+ canBuild.errorTitle = STR_CANT_POSITION_THIS_HERE;
return canBuild;
}
- supportsCost += canBuild.Cost;
+ supportsCost += canBuild.cost;
- const auto clearanceData = canBuild.GetData();
+ const auto clearanceData = canBuild.getData();
int32_t tempSceneryGroundFlags = clearanceData.GroundFlags & (ELEMENT_IS_ABOVE_GROUND | ELEMENT_IS_UNDERGROUND);
if (!gameState.cheats.disableClearanceChecks)
{
if ((clearanceData.GroundFlags & ELEMENT_IS_UNDERWATER) || (clearanceData.GroundFlags & ELEMENT_IS_UNDERGROUND))
{
- return Result(Status::Disallowed, STR_CANT_POSITION_THIS_HERE, STR_CANT_BUILD_THIS_UNDERWATER);
+ return Result(Status::disallowed, STR_CANT_POSITION_THIS_HERE, STR_CANT_BUILD_THIS_UNDERWATER);
}
if (resultData.GroundFlags && !(resultData.GroundFlags & tempSceneryGroundFlags))
{
return Result(
- Status::Disallowed, STR_CANT_POSITION_THIS_HERE, STR_CANT_BUILD_PARTLY_ABOVE_AND_PARTLY_BELOW_GROUND);
+ Status::disallowed, STR_CANT_POSITION_THIS_HERE, STR_CANT_BUILD_PARTLY_ABOVE_AND_PARTLY_BELOW_GROUND);
}
}
@@ -167,27 +167,27 @@ namespace OpenRCT2::GameActions
if (!LocationValid(curTile) || MapIsEdge(curTile))
{
- return Result(Status::Disallowed, STR_CANT_POSITION_THIS_HERE, STR_OFF_EDGE_OF_MAP);
+ return Result(Status::disallowed, STR_CANT_POSITION_THIS_HERE, STR_OFF_EDGE_OF_MAP);
}
if (gLegacyScene != LegacyScene::scenarioEditor && !MapIsLocationOwned({ curTile, zLow })
&& !gameState.cheats.sandboxMode)
{
- return Result(Status::Disallowed, STR_CANT_POSITION_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK);
+ return Result(Status::disallowed, STR_CANT_POSITION_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK);
}
}
if (!CheckMapCapacity(sceneryEntry->tiles, totalNumTiles))
{
LOG_ERROR("No free map elements available");
- return Result(Status::NoFreeElements, STR_CANT_POSITION_THIS_HERE, STR_TILE_ELEMENT_LIMIT_REACHED);
+ return Result(Status::noFreeElements, STR_CANT_POSITION_THIS_HERE, STR_TILE_ELEMENT_LIMIT_REACHED);
}
// Force ride construction to recheck area
_currentTrackSelectionFlags.set(TrackSelectionFlag::recheck);
- res.Cost = sceneryEntry->price + supportsCost;
- res.SetData(std::move(resultData));
+ res.cost = sceneryEntry->price + supportsCost;
+ res.setData(std::move(resultData));
return res;
}
@@ -195,13 +195,13 @@ namespace OpenRCT2::GameActions
Result LargeSceneryPlaceAction::Execute(GameState_t& gameState) const
{
auto res = Result();
- res.ErrorTitle = STR_CANT_POSITION_THIS_HERE;
- res.Expenditure = ExpenditureType::landscaping;
+ res.errorTitle = STR_CANT_POSITION_THIS_HERE;
+ res.expenditure = ExpenditureType::landscaping;
int16_t surfaceHeight = TileElementHeight(_loc);
- res.Position.x = _loc.x + 16;
- res.Position.y = _loc.y + 16;
- res.Position.z = surfaceHeight;
+ res.position.x = _loc.x + 16;
+ res.position.y = _loc.y + 16;
+ res.position.z = surfaceHeight;
auto resultData = LargeSceneryPlaceActionResult{};
@@ -211,13 +211,13 @@ namespace OpenRCT2::GameActions
if (sceneryEntry == nullptr)
{
LOG_ERROR("Large scenery entry not found for sceneryType = %u", _sceneryType);
- return Result(Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_UNKNOWN_OBJECT_TYPE);
+ return Result(Status::invalidParameters, STR_CANT_POSITION_THIS_HERE, STR_UNKNOWN_OBJECT_TYPE);
}
if (sceneryEntry->tiles.empty())
{
LOG_ERROR("Invalid large scenery object, sceneryType = %u", _sceneryType);
- return Result(Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, kStringIdNone);
+ return Result(Status::invalidParameters, STR_CANT_POSITION_THIS_HERE, kStringIdNone);
}
int16_t maxHeight = GetMaxSurfaceHeight(sceneryEntry->tiles);
@@ -227,7 +227,7 @@ namespace OpenRCT2::GameActions
maxHeight = _loc.z;
}
- res.Position.z = maxHeight;
+ res.position.z = maxHeight;
// Allocate banner
Banner* banner = nullptr;
@@ -237,12 +237,12 @@ namespace OpenRCT2::GameActions
if (banner == nullptr)
{
LOG_ERROR("No free banners available");
- return Result(Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_TOO_MANY_BANNERS_IN_GAME);
+ return Result(Status::invalidParameters, STR_CANT_POSITION_THIS_HERE, STR_TOO_MANY_BANNERS_IN_GAME);
}
banner->text = {};
banner->colour = 2;
- banner->textColour = TextColour::white;
+ banner->textColour = Drawing::TextColour::white;
banner->flags = { BannerFlag::isLargeScenery };
banner->type = 0;
banner->position = TileCoordsXY(_loc);
@@ -270,24 +270,24 @@ namespace OpenRCT2::GameActions
QuarterTile quarterTile = QuarterTile{ tile.corners, 0 }.Rotate(_loc.direction);
const auto isTree = (sceneryEntry->flags & LARGE_SCENERY_FLAG_IS_TREE) != 0;
auto canBuild = MapCanConstructWithClearAt(
- { curTile, zLow, zHigh }, &MapPlaceSceneryClearFunc, quarterTile, GetFlags(), kTileSlopeFlat,
+ { curTile, zLow, zHigh }, MapPlaceSceneryClearFunc, quarterTile, GetFlags(), kTileSlopeFlat,
CreateCrossingMode::none, isTree);
- if (canBuild.Error != Status::Ok)
+ if (canBuild.error != Status::ok)
{
if (banner != nullptr)
{
DeleteBanner(banner->id);
}
- canBuild.ErrorTitle = STR_CANT_POSITION_THIS_HERE;
+ canBuild.errorTitle = STR_CANT_POSITION_THIS_HERE;
return canBuild;
}
- supportsCost += canBuild.Cost;
+ supportsCost += canBuild.cost;
- const auto clearanceData = canBuild.GetData();
+ const auto clearanceData = canBuild.getData();
resultData.GroundFlags = clearanceData.GroundFlags & (ELEMENT_IS_ABOVE_GROUND | ELEMENT_IS_UNDERGROUND);
- if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST))
+ if (!GetFlags().has(CommandFlag::ghost))
{
FootpathRemoveLitter({ curTile, zLow });
if (!getGameState().cheats.disableClearanceChecks)
@@ -319,8 +319,8 @@ namespace OpenRCT2::GameActions
// Force ride construction to recheck area
_currentTrackSelectionFlags.set(TrackSelectionFlag::recheck);
- res.Cost = sceneryEntry->price + supportsCost;
- res.SetData(std::move(resultData));
+ res.cost = sceneryEntry->price + supportsCost;
+ res.setData(std::move(resultData));
return res;
}
@@ -389,7 +389,7 @@ namespace OpenRCT2::GameActions
sceneryElement.SetSecondaryColour(_secondaryColour);
sceneryElement.SetTertiaryColour(_tertiaryColour);
- if (GetFlags() & GAME_COMMAND_FLAG_GHOST)
+ if (GetFlags().has(CommandFlag::ghost))
{
sceneryElement.SetGhost(true);
}
diff --git a/src/openrct2/actions/LargeSceneryRemoveAction.cpp b/src/openrct2/actions/LargeSceneryRemoveAction.cpp
index f7aed19016..bf29e736c4 100644
--- a/src/openrct2/actions/LargeSceneryRemoveAction.cpp
+++ b/src/openrct2/actions/LargeSceneryRemoveAction.cpp
@@ -53,19 +53,19 @@ namespace OpenRCT2::GameActions
{
auto res = Result();
- const uint32_t flags = GetFlags();
+ const auto flags = GetFlags();
- res.Position.x = _loc.x + 16;
- res.Position.y = _loc.y + 16;
- res.Position.z = _loc.z;
- res.Expenditure = ExpenditureType::landscaping;
- res.Cost = 0;
+ res.position.x = _loc.x + 16;
+ res.position.y = _loc.y + 16;
+ res.position.z = _loc.z;
+ res.expenditure = ExpenditureType::landscaping;
+ res.cost = 0;
TileElement* tileElement = FindLargeSceneryElement(_loc, _tileIndex);
if (tileElement == nullptr)
{
LOG_ERROR("No large scenery element to remove at x = %d, y = %d", _loc.x, _loc.y);
- return Result(Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS);
+ return Result(Status::invalidParameters, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS);
}
auto* sceneryEntry = tileElement->AsLargeScenery()->GetEntry();
@@ -73,7 +73,7 @@ namespace OpenRCT2::GameActions
if (sceneryEntry == nullptr)
{
LOG_WARNING("Scenery entry at x = %d, y = %d not removed because it is an unknown object type", _loc.x, _loc.y);
- return Result(Status::Unknown, STR_CANT_REMOVE_THIS, STR_UNKNOWN_OBJECT_TYPE);
+ return Result(Status::unknown, STR_CANT_REMOVE_THIS, STR_UNKNOWN_OBJECT_TYPE);
}
auto rotatedOffsets = CoordsXYZ{ CoordsXY{ sceneryEntry->tiles[_tileIndex].offset }.Rotate(_loc.direction),
@@ -94,26 +94,26 @@ namespace OpenRCT2::GameActions
{
if (sceneryEntry->HasFlag(LARGE_SCENERY_FLAG_IS_TREE))
{
- res.Error = Status::NoClearance;
- res.ErrorTitle = STR_CANT_REMOVE_THIS;
- res.ErrorMessage = STR_FORBIDDEN_BY_THE_LOCAL_AUTHORITY;
+ res.error = Status::noClearance;
+ res.errorTitle = STR_CANT_REMOVE_THIS;
+ res.errorMessage = STR_FORBIDDEN_BY_THE_LOCAL_AUTHORITY;
return res;
}
}
if (!MapIsLocationOwned({ currentTile.x, currentTile.y, currentTile.z }))
{
- return Result(Status::NoClearance, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK);
+ return Result(Status::noClearance, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK);
}
}
if (!LocationValid(currentTile))
{
- return Result(Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_OFF_EDGE_OF_MAP);
+ return Result(Status::invalidParameters, STR_CANT_REMOVE_THIS, STR_OFF_EDGE_OF_MAP);
}
// Prevent duplicate costs when using the clear scenery tool that overlaps multiple large
// scenery tile elements.
- if (flags & GAME_COMMAND_FLAG_TRACK_DESIGN)
+ if (flags.has(CommandFlag::trackDesign))
{
if (tileElement->AsLargeScenery()->IsAccounted())
calculate_cost = false;
@@ -124,7 +124,7 @@ namespace OpenRCT2::GameActions
}
if (calculate_cost)
- res.Cost = sceneryEntry->removal_price;
+ res.cost = sceneryEntry->removal_price;
return res;
}
@@ -133,17 +133,17 @@ namespace OpenRCT2::GameActions
{
auto res = Result();
- res.Position.x = _loc.x + 16;
- res.Position.y = _loc.y + 16;
- res.Position.z = _loc.z;
- res.Expenditure = ExpenditureType::landscaping;
- res.Cost = 0;
+ res.position.x = _loc.x + 16;
+ res.position.y = _loc.y + 16;
+ res.position.z = _loc.z;
+ res.expenditure = ExpenditureType::landscaping;
+ res.cost = 0;
TileElement* tileElement = FindLargeSceneryElement(_loc, _tileIndex);
if (tileElement == nullptr)
{
LOG_ERROR("No large scenery element to remove at %d, y = %d", _loc.x, _loc.y);
- return Result(Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS);
+ return Result(Status::invalidParameters, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS);
}
auto* sceneryEntry = tileElement->AsLargeScenery()->GetEntry();
@@ -151,7 +151,7 @@ namespace OpenRCT2::GameActions
if (sceneryEntry == nullptr)
{
LOG_WARNING("Scenery entry at x = %d, y = %d not removed because it is an unknown object type", _loc.x, _loc.y);
- return Result(Status::Unknown, STR_CANT_REMOVE_THIS, kStringIdNone);
+ return Result(Status::unknown, STR_CANT_REMOVE_THIS, kStringIdNone);
}
tileElement->RemoveBannerEntry();
@@ -171,7 +171,7 @@ namespace OpenRCT2::GameActions
{
if (!MapIsLocationOwned({ currentTile.x, currentTile.y, currentTile.z }))
{
- return Result(Status::NoClearance, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK);
+ return Result(Status::noClearance, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK);
}
}
@@ -187,14 +187,14 @@ namespace OpenRCT2::GameActions
}
}
- res.Cost = sceneryEntry->removal_price;
+ res.cost = sceneryEntry->removal_price;
return res;
}
TileElement* LargeSceneryRemoveAction::FindLargeSceneryElement(const CoordsXYZ& pos, int32_t sequenceIndex) const
{
- const bool isGhost = GetFlags() & GAME_COMMAND_FLAG_GHOST;
+ const bool isGhost = GetFlags().has(CommandFlag::ghost);
for (auto* sceneryElement : TileElementsView(pos))
{
// If we are removing ghost elements
diff --git a/src/openrct2/actions/LargeScenerySetColourAction.cpp b/src/openrct2/actions/LargeScenerySetColourAction.cpp
index d4a5a43ef5..cd803749db 100644
--- a/src/openrct2/actions/LargeScenerySetColourAction.cpp
+++ b/src/openrct2/actions/LargeScenerySetColourAction.cpp
@@ -65,33 +65,33 @@ namespace OpenRCT2::GameActions
Result LargeScenerySetColourAction::QueryExecute(bool isExecuting) const
{
auto res = Result();
- res.Expenditure = ExpenditureType::landscaping;
- res.Position.x = _loc.x + 16;
- res.Position.y = _loc.y + 16;
- res.Position.z = TileElementHeight(_loc);
- res.ErrorTitle = STR_CANT_REPAINT_THIS;
+ res.expenditure = ExpenditureType::landscaping;
+ res.position.x = _loc.x + 16;
+ res.position.y = _loc.y + 16;
+ res.position.z = TileElementHeight(_loc);
+ res.errorTitle = STR_CANT_REPAINT_THIS;
auto mapSizeMax = GetMapSizeMaxXY();
if (_loc.x < 0 || _loc.y < 0 || _loc.x > mapSizeMax.x || _loc.y > mapSizeMax.y)
{
LOG_ERROR("Invalid x / y coordinates: x = %d, y = %d", _loc.x, _loc.y);
- return Result(Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_VALUE_OUT_OF_RANGE);
+ return Result(Status::invalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_VALUE_OUT_OF_RANGE);
}
if (_primaryColour >= COLOUR_COUNT)
{
LOG_ERROR("Invalid primary colour %u", _primaryColour);
- return Result(Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_INVALID_COLOUR);
+ return Result(Status::invalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_INVALID_COLOUR);
}
else if (_secondaryColour >= COLOUR_COUNT)
{
LOG_ERROR("Invalid secondary colour %u", _secondaryColour);
- return Result(Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_INVALID_COLOUR);
+ return Result(Status::invalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_INVALID_COLOUR);
}
else if (_tertiaryColour >= COLOUR_COUNT)
{
LOG_ERROR("Invalid tertiary colour %u", _tertiaryColour);
- return Result(Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_INVALID_COLOUR);
+ return Result(Status::invalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_INVALID_COLOUR);
}
auto largeElement = MapGetLargeScenerySegment(_loc, _tileIndex);
@@ -101,10 +101,10 @@ namespace OpenRCT2::GameActions
LOG_ERROR(
"Could not find large scenery at: x = %d, y = %d, z = %d, direction = %d, tileIndex = %u", _loc.x, _loc.y,
_loc.z, _loc.direction, _tileIndex);
- return Result(Status::InvalidParameters, STR_CANT_REPAINT_THIS, kStringIdNone);
+ return Result(Status::invalidParameters, STR_CANT_REPAINT_THIS, kStringIdNone);
}
- if ((GetFlags() & GAME_COMMAND_FLAG_GHOST) && !(largeElement->IsGhost()))
+ if ((GetFlags().has(CommandFlag::ghost)) && !(largeElement->IsGhost()))
{
return res;
}
@@ -114,7 +114,7 @@ namespace OpenRCT2::GameActions
if (sceneryEntry == nullptr)
{
LOG_ERROR("Scenery element doesn't have scenery entry");
- return Result(Status::Unknown, STR_CANT_REPAINT_THIS, kStringIdNone);
+ return Result(Status::unknown, STR_CANT_REPAINT_THIS, kStringIdNone);
}
// Work out the base tile coordinates (Tile with index 0)
auto rotatedBaseCoordsOffset = CoordsXYZ{ CoordsXY{ sceneryEntry->tiles[_tileIndex].offset }.Rotate(_loc.direction),
@@ -132,13 +132,13 @@ namespace OpenRCT2::GameActions
{
if (!MapIsLocationOwned(currentTile))
{
- return Result(Status::NotOwned, STR_CANT_REPAINT_THIS, STR_LAND_NOT_OWNED_BY_PARK);
+ return Result(Status::notOwned, STR_CANT_REPAINT_THIS, STR_LAND_NOT_OWNED_BY_PARK);
}
}
if (!LocationValid(currentTile))
{
- return Result(Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_OFF_EDGE_OF_MAP);
+ return Result(Status::invalidParameters, STR_CANT_REPAINT_THIS, STR_OFF_EDGE_OF_MAP);
}
auto tileElement = MapGetLargeScenerySegment({ currentTile.x, currentTile.y, _loc.z, _loc.direction }, tile.index);
@@ -148,7 +148,7 @@ namespace OpenRCT2::GameActions
LOG_ERROR(
"Large scenery element not found at: x = %d, y = %d, z = %d, direction = %d", _loc.x, _loc.y, _loc.z,
_loc.direction);
- return Result(Status::Unknown, STR_CANT_REPAINT_THIS, kStringIdNone);
+ return Result(Status::unknown, STR_CANT_REPAINT_THIS, kStringIdNone);
}
if (isExecuting)
{
diff --git a/src/openrct2/actions/MapChangeSizeAction.cpp b/src/openrct2/actions/MapChangeSizeAction.cpp
index 9724933444..227926b02c 100644
--- a/src/openrct2/actions/MapChangeSizeAction.cpp
+++ b/src/openrct2/actions/MapChangeSizeAction.cpp
@@ -47,11 +47,11 @@ namespace OpenRCT2::GameActions
{
if (_targetSize.x > kMaximumMapSizeTechnical || _targetSize.y > kMaximumMapSizeTechnical)
{
- return Result(Status::InvalidParameters, STR_CANT_INCREASE_MAP_SIZE_ANY_FURTHER, STR_ERR_VALUE_OUT_OF_RANGE);
+ return Result(Status::invalidParameters, STR_CANT_INCREASE_MAP_SIZE_ANY_FURTHER, STR_ERR_VALUE_OUT_OF_RANGE);
}
if (_targetSize.x < kMinimumMapSizeTechnical || _targetSize.y < kMinimumMapSizeTechnical)
{
- return Result(Status::InvalidParameters, STR_CANT_DECREASE_MAP_SIZE_ANY_FURTHER, STR_ERR_VALUE_OUT_OF_RANGE);
+ return Result(Status::invalidParameters, STR_CANT_DECREASE_MAP_SIZE_ANY_FURTHER, STR_ERR_VALUE_OUT_OF_RANGE);
}
return Result();
}
diff --git a/src/openrct2/actions/MazePlaceTrackAction.cpp b/src/openrct2/actions/MazePlaceTrackAction.cpp
index 54bc77b0c5..9ce5939205 100644
--- a/src/openrct2/actions/MazePlaceTrackAction.cpp
+++ b/src/openrct2/actions/MazePlaceTrackAction.cpp
@@ -50,41 +50,41 @@ namespace OpenRCT2::GameActions
{
auto res = Result();
- res.Position = _loc + CoordsXYZ{ 8, 8, 0 };
- res.Expenditure = ExpenditureType::rideConstruction;
- res.ErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
+ res.position = _loc + CoordsXYZ{ 8, 8, 0 };
+ res.expenditure = ExpenditureType::rideConstruction;
+ res.errorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
if ((_loc.z & 0xF) != 0)
{
- res.Error = Status::Unknown;
- res.ErrorMessage = STR_INVALID_HEIGHT;
+ res.error = Status::unknown;
+ res.errorMessage = STR_INVALID_HEIGHT;
return res;
}
if (!LocationValid(_loc))
{
- res.Error = Status::InvalidParameters;
- res.ErrorMessage = STR_OFF_EDGE_OF_MAP;
+ res.error = Status::invalidParameters;
+ res.errorMessage = STR_OFF_EDGE_OF_MAP;
return res;
}
if (!MapIsLocationOwned(_loc) && !gameState.cheats.sandboxMode)
{
- res.Error = Status::NotOwned;
- res.ErrorMessage = STR_LAND_NOT_OWNED_BY_PARK;
+ res.error = Status::notOwned;
+ res.errorMessage = STR_LAND_NOT_OWNED_BY_PARK;
return res;
}
if (!MapCheckCapacityAndReorganise(_loc))
{
- res.Error = Status::NoFreeElements;
- res.ErrorMessage = STR_TILE_ELEMENT_LIMIT_REACHED;
+ res.error = Status::noFreeElements;
+ res.errorMessage = STR_TILE_ELEMENT_LIMIT_REACHED;
return res;
}
auto surfaceElement = MapGetSurfaceElementAt(_loc);
if (surfaceElement == nullptr)
{
- res.Error = Status::Unknown;
- res.ErrorMessage = STR_INVALID_SELECTION_OF_OBJECTS;
+ res.error = Status::unknown;
+ res.errorMessage = STR_INVALID_SELECTION_OF_OBJECTS;
return res;
}
@@ -100,33 +100,33 @@ namespace OpenRCT2::GameActions
const auto& rtd = ride->getRideTypeDescriptor();
if (heightDifference > rtd.Heights.MaxHeight)
{
- res.Error = Status::TooHigh;
- res.ErrorMessage = STR_TOO_HIGH_FOR_SUPPORTS;
+ res.error = Status::tooHigh;
+ res.errorMessage = STR_TOO_HIGH_FOR_SUPPORTS;
return res;
}
}
auto canBuild = MapCanConstructWithClearAt(
- { _loc.ToTileStart(), baseHeight, clearanceHeight }, &MapPlaceNonSceneryClearFunc, { 0b1111, 0 }, GetFlags(),
+ { _loc.ToTileStart(), baseHeight, clearanceHeight }, MapPlaceNonSceneryClearFunc, { 0b1111, 0 }, GetFlags(),
kTileSlopeFlat);
- if (canBuild.Error != Status::Ok)
+ if (canBuild.error != Status::ok)
{
- canBuild.ErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
+ canBuild.errorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
return canBuild;
}
- const auto clearanceData = canBuild.GetData();
+ const auto clearanceData = canBuild.getData();
if (clearanceData.GroundFlags & ELEMENT_IS_UNDERWATER)
{
- res.Error = Status::NoClearance;
- res.ErrorMessage = STR_RIDE_CANT_BUILD_THIS_UNDERWATER;
+ res.error = Status::noClearance;
+ res.errorMessage = STR_RIDE_CANT_BUILD_THIS_UNDERWATER;
return res;
}
if (clearanceData.GroundFlags & ELEMENT_IS_UNDERGROUND)
{
- res.Error = Status::NoClearance;
- res.ErrorMessage = STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND;
+ res.error = Status::noClearance;
+ res.errorMessage = STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND;
return res;
}
@@ -134,12 +134,12 @@ namespace OpenRCT2::GameActions
if (ride == nullptr || ride->type == kRideTypeNull)
{
LOG_ERROR("Ride not found for rideIndex %u", _rideIndex);
- res.Error = Status::InvalidParameters;
- res.ErrorMessage = STR_ERR_RIDE_NOT_FOUND;
+ res.error = Status::invalidParameters;
+ res.errorMessage = STR_ERR_RIDE_NOT_FOUND;
return res;
}
- res.Cost = MazeCalculateCost(canBuild.Cost, *ride, _loc);
+ res.cost = MazeCalculateCost(canBuild.cost, *ride, _loc);
return res;
}
@@ -148,21 +148,21 @@ namespace OpenRCT2::GameActions
{
auto res = Result();
- res.Position = _loc + CoordsXYZ{ 8, 8, 0 };
- res.Expenditure = ExpenditureType::rideConstruction;
- res.ErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
+ res.position = _loc + CoordsXYZ{ 8, 8, 0 };
+ res.expenditure = ExpenditureType::rideConstruction;
+ res.errorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
auto ride = GetRide(_rideIndex);
if (ride == nullptr)
{
LOG_ERROR("Ride not found for rideIndex %u", _rideIndex);
- res.Error = Status::InvalidParameters;
- res.ErrorMessage = STR_ERR_RIDE_NOT_FOUND;
+ res.error = Status::invalidParameters;
+ res.errorMessage = STR_ERR_RIDE_NOT_FOUND;
return res;
}
- uint32_t flags = GetFlags();
- if (!(flags & GAME_COMMAND_FLAG_GHOST))
+ auto flags = GetFlags();
+ if (!flags.has(CommandFlag::ghost))
{
FootpathRemoveLitter(_loc);
WallRemoveAt({ _loc.ToTileStart(), _loc.z, _loc.z + 32 });
@@ -172,15 +172,15 @@ namespace OpenRCT2::GameActions
auto clearanceHeight = _loc.z + kMazeClearanceHeight;
auto canBuild = MapCanConstructWithClearAt(
- { _loc.ToTileStart(), baseHeight, clearanceHeight }, &MapPlaceNonSceneryClearFunc, { 0b1111, 0 },
- GetFlags() | GAME_COMMAND_FLAG_APPLY, kTileSlopeFlat);
- if (canBuild.Error != Status::Ok)
+ { _loc.ToTileStart(), baseHeight, clearanceHeight }, MapPlaceNonSceneryClearFunc, { 0b1111, 0 },
+ GetFlags().with(CommandFlag::apply), kTileSlopeFlat);
+ if (canBuild.error != Status::ok)
{
- canBuild.ErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
+ canBuild.errorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
return canBuild;
}
- res.Cost = MazeCalculateCost(canBuild.Cost, *ride, _loc);
+ res.cost = MazeCalculateCost(canBuild.cost, *ride, _loc);
auto startLoc = _loc.ToTileStart();
@@ -188,11 +188,11 @@ namespace OpenRCT2::GameActions
Guard::Assert(trackElement != nullptr);
trackElement->SetClearanceZ(clearanceHeight);
- trackElement->SetTrackType(TrackElemType::Maze);
+ trackElement->SetTrackType(TrackElemType::maze);
trackElement->SetRideType(ride->type);
trackElement->SetRideIndex(_rideIndex);
trackElement->SetMazeEntry(_mazeEntry);
- trackElement->SetGhost(flags & GAME_COMMAND_FLAG_GHOST);
+ trackElement->SetGhost(flags.has(CommandFlag::ghost));
MapInvalidateTileFull(startLoc);
diff --git a/src/openrct2/actions/MazeSetTrackAction.cpp b/src/openrct2/actions/MazeSetTrackAction.cpp
index 0ca2fcf3e8..86fa63997a 100644
--- a/src/openrct2/actions/MazeSetTrackAction.cpp
+++ b/src/openrct2/actions/MazeSetTrackAction.cpp
@@ -58,7 +58,8 @@ namespace OpenRCT2::GameActions
};
// clang-format on
- MazeSetTrackAction::MazeSetTrackAction(const CoordsXYZD& location, bool initialPlacement, RideId rideIndex, uint8_t mode)
+ MazeSetTrackAction::MazeSetTrackAction(
+ const CoordsXYZD& location, bool initialPlacement, RideId rideIndex, MazeBuildMode mode)
: _loc(location)
, _initialPlacement(initialPlacement)
, _rideIndex(rideIndex)
@@ -84,41 +85,41 @@ namespace OpenRCT2::GameActions
{
auto res = Result();
- res.Position = _loc + CoordsXYZ{ 8, 8, 0 };
- res.Expenditure = ExpenditureType::rideConstruction;
- res.ErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
- if ((_loc.z & 0xF) != 0 && _mode == GC_SET_MAZE_TRACK_BUILD)
+ res.position = _loc + CoordsXYZ{ 8, 8, 0 };
+ res.expenditure = ExpenditureType::rideConstruction;
+ res.errorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
+ if ((_loc.z & 0xF) != 0 && _mode == MazeBuildMode::build)
{
- res.Error = Status::Unknown;
- res.ErrorMessage = STR_INVALID_HEIGHT;
+ res.error = Status::unknown;
+ res.errorMessage = STR_INVALID_HEIGHT;
return res;
}
if (!LocationValid(_loc))
{
- res.Error = Status::InvalidParameters;
- res.ErrorMessage = STR_OFF_EDGE_OF_MAP;
+ res.error = Status::invalidParameters;
+ res.errorMessage = STR_OFF_EDGE_OF_MAP;
return res;
}
if (!MapIsLocationOwned(_loc) && !gameState.cheats.sandboxMode)
{
- res.Error = Status::NotOwned;
- res.ErrorMessage = STR_LAND_NOT_OWNED_BY_PARK;
+ res.error = Status::notOwned;
+ res.errorMessage = STR_LAND_NOT_OWNED_BY_PARK;
return res;
}
if (!MapCheckCapacityAndReorganise(_loc))
{
- res.Error = Status::NoFreeElements;
- res.ErrorMessage = STR_TILE_ELEMENT_LIMIT_REACHED;
+ res.error = Status::noFreeElements;
+ res.errorMessage = STR_TILE_ELEMENT_LIMIT_REACHED;
return res;
}
auto surfaceElement = MapGetSurfaceElementAt(_loc);
if (surfaceElement == nullptr)
{
- res.Error = Status::Unknown;
- res.ErrorMessage = STR_INVALID_SELECTION_OF_OBJECTS;
+ res.error = Status::unknown;
+ res.errorMessage = STR_INVALID_SELECTION_OF_OBJECTS;
return res;
}
@@ -134,40 +135,40 @@ namespace OpenRCT2::GameActions
const auto& rtd = ride->getRideTypeDescriptor();
if (heightDifference > rtd.Heights.MaxHeight)
{
- res.Error = Status::TooHigh;
- res.ErrorMessage = STR_TOO_HIGH_FOR_SUPPORTS;
+ res.error = Status::tooHigh;
+ res.errorMessage = STR_TOO_HIGH_FOR_SUPPORTS;
return res;
}
}
- TileElement* tileElement = MapGetTrackElementAtOfTypeFromRide(_loc, TrackElemType::Maze, _rideIndex);
+ TileElement* tileElement = MapGetTrackElementAtOfTypeFromRide(_loc, TrackElemType::maze, _rideIndex);
if (tileElement == nullptr)
{
- if (_mode != GC_SET_MAZE_TRACK_BUILD)
+ if (_mode != MazeBuildMode::build)
{
- res.Error = Status::Unknown;
- res.ErrorMessage = STR_INVALID_SELECTION_OF_OBJECTS;
+ res.error = Status::unknown;
+ res.errorMessage = STR_INVALID_SELECTION_OF_OBJECTS;
return res;
}
auto constructResult = MapCanConstructAt({ _loc.ToTileStart(), baseHeight, clearanceHeight }, { 0b1111, 0 });
- if (constructResult.Error != Status::Ok)
+ if (constructResult.error != Status::ok)
{
- constructResult.ErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
+ constructResult.errorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
return constructResult;
}
- const auto clearanceData = constructResult.GetData();
+ const auto clearanceData = constructResult.getData();
if (clearanceData.GroundFlags & ELEMENT_IS_UNDERWATER)
{
- res.Error = Status::NoClearance;
- res.ErrorMessage = STR_RIDE_CANT_BUILD_THIS_UNDERWATER;
+ res.error = Status::noClearance;
+ res.errorMessage = STR_RIDE_CANT_BUILD_THIS_UNDERWATER;
return res;
}
if (clearanceData.GroundFlags & ELEMENT_IS_UNDERGROUND)
{
- res.Error = Status::NoClearance;
- res.ErrorMessage = STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND;
+ res.error = Status::noClearance;
+ res.errorMessage = STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND;
return res;
}
@@ -175,12 +176,12 @@ namespace OpenRCT2::GameActions
if (ride == nullptr || !RideTypeIsValid(ride->type))
{
LOG_ERROR("Ride not found for rideIndex %u", _rideIndex);
- res.Error = Status::NoClearance;
- res.ErrorMessage = STR_ERR_RIDE_NOT_FOUND;
+ res.error = Status::noClearance;
+ res.errorMessage = STR_ERR_RIDE_NOT_FOUND;
return res;
}
- res.Cost = MazeCalculateCost(constructResult.Cost, *ride, _loc);
+ res.cost = MazeCalculateCost(constructResult.cost, *ride, _loc);
return res;
}
@@ -192,30 +193,30 @@ namespace OpenRCT2::GameActions
{
auto res = Result();
- res.Position = _loc + CoordsXYZ{ 8, 8, 0 };
- res.Expenditure = ExpenditureType::rideConstruction;
- res.ErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
+ res.position = _loc + CoordsXYZ{ 8, 8, 0 };
+ res.expenditure = ExpenditureType::rideConstruction;
+ res.errorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
auto ride = GetRide(_rideIndex);
if (ride == nullptr)
{
LOG_ERROR("Ride not found for rideIndex %u", _rideIndex);
- res.Error = Status::InvalidParameters;
- res.ErrorMessage = STR_ERR_RIDE_NOT_FOUND;
+ res.error = Status::invalidParameters;
+ res.errorMessage = STR_ERR_RIDE_NOT_FOUND;
return res;
}
- uint32_t flags = GetFlags();
- if (!(flags & GAME_COMMAND_FLAG_GHOST))
+ auto flags = GetFlags();
+ if (!flags.has(CommandFlag::ghost))
{
FootpathRemoveLitter(_loc);
WallRemoveAt({ _loc.ToTileStart(), _loc.z, _loc.z + 32 });
}
- auto tileElement = MapGetTrackElementAtOfTypeFromRide(_loc, TrackElemType::Maze, _rideIndex);
+ auto tileElement = MapGetTrackElementAtOfTypeFromRide(_loc, TrackElemType::maze, _rideIndex);
if (tileElement == nullptr)
{
- res.Cost = MazeCalculateCost(0, *ride, _loc);
+ res.cost = MazeCalculateCost(0, *ride, _loc);
auto startLoc = _loc.ToTileStart();
@@ -223,11 +224,11 @@ namespace OpenRCT2::GameActions
Guard::Assert(trackElement != nullptr);
trackElement->SetClearanceZ(_loc.z + kMazeClearanceHeight);
- trackElement->SetTrackType(TrackElemType::Maze);
+ trackElement->SetTrackType(TrackElemType::maze);
trackElement->SetRideType(ride->type);
trackElement->SetRideIndex(_rideIndex);
trackElement->SetMazeEntry(0xFFFF);
- trackElement->SetGhost(flags & GAME_COMMAND_FLAG_GHOST);
+ trackElement->SetGhost(flags.has(CommandFlag::ghost));
tileElement = trackElement->as();
@@ -237,7 +238,7 @@ namespace OpenRCT2::GameActions
ride->getStation().SetBaseZ(tileElement->GetBaseZ());
ride->getStation().Start = { 0, 0 };
- if (_initialPlacement && !(flags & GAME_COMMAND_FLAG_GHOST))
+ if (_initialPlacement && !flags.has(CommandFlag::ghost))
{
ride->overallView = startLoc;
}
@@ -245,7 +246,7 @@ namespace OpenRCT2::GameActions
switch (_mode)
{
- case GC_SET_MAZE_TRACK_BUILD:
+ case MazeBuildMode::build:
{
uint8_t segmentOffset = MazeGetSegmentBit(_loc);
@@ -262,7 +263,7 @@ namespace OpenRCT2::GameActions
auto previousElementLoc = CoordsXY{ _loc }.ToTileStart() - CoordsDirectionDelta[_loc.direction];
TileElement* previousTileElement = MapGetTrackElementAtOfTypeFromRide(
- { previousElementLoc, _loc.z }, TrackElemType::Maze, _rideIndex);
+ { previousElementLoc, _loc.z }, TrackElemType::maze, _rideIndex);
if (previousTileElement != nullptr)
{
@@ -278,24 +279,24 @@ namespace OpenRCT2::GameActions
break;
}
- case GC_SET_MAZE_TRACK_MOVE:
+ case MazeBuildMode::move:
break;
- case GC_SET_MAZE_TRACK_FILL:
+ case MazeBuildMode::fill:
if (!_initialPlacement)
{
auto previousSegment = CoordsXY{ _loc.x - CoordsDirectionDelta[_loc.direction].x / 2,
_loc.y - CoordsDirectionDelta[_loc.direction].y / 2 };
tileElement = MapGetTrackElementAtOfTypeFromRide(
- { previousSegment, _loc.z }, TrackElemType::Maze, _rideIndex);
+ { previousSegment, _loc.z }, TrackElemType::maze, _rideIndex);
MapInvalidateTileFull(previousSegment.ToTileStart());
if (tileElement == nullptr)
{
LOG_ERROR("No surface found");
- res.Error = Status::Unknown;
- res.ErrorMessage = STR_ERR_SURFACE_ELEMENT_NOT_FOUND;
+ res.error = Status::unknown;
+ res.errorMessage = STR_ERR_SURFACE_ELEMENT_NOT_FOUND;
return res;
}
@@ -316,7 +317,7 @@ namespace OpenRCT2::GameActions
auto nextElementLoc = previousSegment.ToTileStart() + CoordsDirectionDelta[direction1];
TileElement* tmp_tileElement = MapGetTrackElementAtOfTypeFromRide(
- { nextElementLoc, _loc.z }, TrackElemType::Maze, _rideIndex);
+ { nextElementLoc, _loc.z }, TrackElemType::maze, _rideIndex);
if (tmp_tileElement != nullptr)
{
diff --git a/src/openrct2/actions/MazeSetTrackAction.h b/src/openrct2/actions/MazeSetTrackAction.h
index 72a0f221a1..f504b9dbec 100644
--- a/src/openrct2/actions/MazeSetTrackAction.h
+++ b/src/openrct2/actions/MazeSetTrackAction.h
@@ -13,17 +13,24 @@
namespace OpenRCT2::GameActions
{
+ enum class MazeBuildMode : uint8_t
+ {
+ build,
+ move,
+ fill,
+ };
+
class MazeSetTrackAction final : public GameActionBase
{
private:
CoordsXYZD _loc;
bool _initialPlacement{};
RideId _rideIndex{ RideId::GetNull() };
- uint8_t _mode{};
+ MazeBuildMode _mode{};
public:
MazeSetTrackAction() = default;
- MazeSetTrackAction(const CoordsXYZD& location, bool initialPlacement, RideId rideIndex, uint8_t mode);
+ MazeSetTrackAction(const CoordsXYZD& location, bool initialPlacement, RideId rideIndex, MazeBuildMode mode);
void AcceptParameters(GameActionParameterVisitor&) final;
void Serialise(DataSerialiser& stream) override;
diff --git a/src/openrct2/actions/ParkEntrancePlaceAction.cpp b/src/openrct2/actions/ParkEntrancePlaceAction.cpp
index 831f631bb3..4faadb0d49 100644
--- a/src/openrct2/actions/ParkEntrancePlaceAction.cpp
+++ b/src/openrct2/actions/ParkEntrancePlaceAction.cpp
@@ -61,28 +61,28 @@ namespace OpenRCT2::GameActions
{
if (!isInEditorMode() && !getGameState().cheats.sandboxMode)
{
- return Result(Status::NotInEditorMode, STR_CANT_BUILD_THIS_HERE, kStringIdNone);
+ return Result(Status::notInEditorMode, STR_CANT_BUILD_THIS_HERE, kStringIdNone);
}
auto res = Result();
- res.Expenditure = ExpenditureType::landPurchase;
- res.Position = _loc;
+ res.expenditure = ExpenditureType::landPurchase;
+ res.position = _loc;
auto mapSizeUnits = GetMapSizeUnits() - CoordsXY{ kCoordsXYStep, kCoordsXYStep };
if (!LocationValid(_loc) || _loc.x <= kCoordsXYStep || _loc.y <= kCoordsXYStep || _loc.x >= mapSizeUnits.x
|| _loc.y >= mapSizeUnits.y)
{
- return Result(Status::InvalidParameters, STR_CANT_BUILD_THIS_HERE, STR_TOO_CLOSE_TO_EDGE_OF_MAP);
+ return Result(Status::invalidParameters, STR_CANT_BUILD_THIS_HERE, STR_TOO_CLOSE_TO_EDGE_OF_MAP);
}
if (!CheckMapCapacity(3))
{
- return Result(Status::NoFreeElements, STR_CANT_BUILD_THIS_HERE, STR_ERR_LANDSCAPE_DATA_AREA_FULL);
+ return Result(Status::noFreeElements, STR_CANT_BUILD_THIS_HERE, STR_ERR_LANDSCAPE_DATA_AREA_FULL);
}
if (gameState.park.entrances.size() >= OpenRCT2::Limits::kMaxParkEntrances)
{
- return Result(Status::InvalidParameters, STR_CANT_BUILD_THIS_HERE, STR_ERR_TOO_MANY_PARK_ENTRANCES);
+ return Result(Status::invalidParameters, STR_CANT_BUILD_THIS_HERE, STR_ERR_TOO_MANY_PARK_ENTRANCES);
}
auto zLow = _loc.z;
@@ -100,9 +100,9 @@ namespace OpenRCT2::GameActions
entranceLoc.y += CoordsDirectionDelta[(_loc.direction + 1) & 0x3].y * 2;
}
- if (auto res2 = MapCanConstructAt({ entranceLoc, zLow, zHigh }, { 0b1111, 0 }); res2.Error != Status::Ok)
+ if (auto res2 = MapCanConstructAt({ entranceLoc, zLow, zHigh }, { 0b1111, 0 }); res2.error != Status::ok)
{
- res2.ErrorTitle = STR_CANT_BUILD_THIS_HERE;
+ res2.errorTitle = STR_CANT_BUILD_THIS_HERE;
return res2;
}
@@ -110,7 +110,7 @@ namespace OpenRCT2::GameActions
EntranceElement* entranceElement = MapGetParkEntranceElementAt(entranceLoc, false);
if (entranceElement != nullptr)
{
- return Result(Status::ItemAlreadyPlaced, STR_CANT_BUILD_THIS_HERE, kStringIdNone);
+ return Result(Status::itemAlreadyPlaced, STR_CANT_BUILD_THIS_HERE, kStringIdNone);
}
}
@@ -120,10 +120,10 @@ namespace OpenRCT2::GameActions
Result ParkEntrancePlaceAction::Execute(GameState_t& gameState) const
{
auto res = Result();
- res.Expenditure = ExpenditureType::landPurchase;
- res.Position = CoordsXYZ{ _loc.x, _loc.y, _loc.z };
+ res.expenditure = ExpenditureType::landPurchase;
+ res.position = CoordsXYZ{ _loc.x, _loc.y, _loc.z };
- uint32_t flags = GetFlags();
+ auto flags = GetFlags();
getGameState().park.entrances.push_back(_loc);
@@ -143,7 +143,7 @@ namespace OpenRCT2::GameActions
entranceLoc.y += CoordsDirectionDelta[(_loc.direction + 1) & 0x3].y * 2;
}
- if (!(flags & GAME_COMMAND_FLAG_GHOST))
+ if (!flags.has(CommandFlag::ghost))
{
SurfaceElement* surfaceElement = MapGetSurfaceElementAt(entranceLoc);
if (surfaceElement != nullptr)
@@ -156,7 +156,7 @@ namespace OpenRCT2::GameActions
Guard::Assert(entranceElement != nullptr);
entranceElement->SetClearanceZ(zHigh);
- entranceElement->SetGhost(flags & GAME_COMMAND_FLAG_GHOST);
+ entranceElement->SetGhost(flags.has(CommandFlag::ghost));
entranceElement->SetDirection(_loc.direction);
entranceElement->SetSequenceIndex(index);
entranceElement->SetEntranceType(ENTRANCE_TYPE_PARK_ENTRANCE);
@@ -172,7 +172,7 @@ namespace OpenRCT2::GameActions
if (!entranceElement->IsGhost())
{
- FootpathConnectEdges(entranceLoc, entranceElement->as(), GAME_COMMAND_FLAG_APPLY);
+ FootpathConnectEdges(entranceLoc, entranceElement->as(), { CommandFlag::apply });
}
Park::UpdateFences(entranceLoc);
diff --git a/src/openrct2/actions/ParkEntranceRemoveAction.cpp b/src/openrct2/actions/ParkEntranceRemoveAction.cpp
index e3b76272fd..395984a466 100644
--- a/src/openrct2/actions/ParkEntranceRemoveAction.cpp
+++ b/src/openrct2/actions/ParkEntranceRemoveAction.cpp
@@ -46,22 +46,22 @@ namespace OpenRCT2::GameActions
{
if (!isInEditorMode() && !getGameState().cheats.sandboxMode)
{
- return Result(Status::NotInEditorMode, STR_CANT_REMOVE_THIS, kStringIdNone);
+ return Result(Status::notInEditorMode, STR_CANT_REMOVE_THIS, kStringIdNone);
}
auto res = Result();
- res.Expenditure = ExpenditureType::landPurchase;
- res.Position = _loc;
- res.ErrorTitle = STR_CANT_REMOVE_THIS;
+ res.expenditure = ExpenditureType::landPurchase;
+ res.position = _loc;
+ res.errorTitle = STR_CANT_REMOVE_THIS;
if (!LocationValid(_loc))
{
- return Result(Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_OFF_EDGE_OF_MAP);
+ return Result(Status::invalidParameters, STR_CANT_REMOVE_THIS, STR_OFF_EDGE_OF_MAP);
}
if (ParkEntranceGetIndex(_loc) == -1)
{
LOG_ERROR("No park entrance at x = %d, y = %d, z = %d", _loc.x, _loc.y, _loc.z);
- return Result(Status::InvalidParameters, STR_CANT_REMOVE_THIS, kStringIdNone);
+ return Result(Status::invalidParameters, STR_CANT_REMOVE_THIS, kStringIdNone);
}
return res;
}
@@ -69,15 +69,15 @@ namespace OpenRCT2::GameActions
Result ParkEntranceRemoveAction::Execute(GameState_t& gameState) const
{
auto res = Result();
- res.Expenditure = ExpenditureType::landPurchase;
- res.Position = _loc;
- res.ErrorTitle = STR_CANT_REMOVE_THIS;
+ res.expenditure = ExpenditureType::landPurchase;
+ res.position = _loc;
+ res.errorTitle = STR_CANT_REMOVE_THIS;
auto entranceIndex = ParkEntranceGetIndex(_loc);
if (entranceIndex == -1)
{
LOG_ERROR("No park entrance at x = %d, y = %d, z = %d", _loc.x, _loc.y, _loc.z);
- return Result(Status::InvalidParameters, STR_CANT_REMOVE_THIS, kStringIdNone);
+ return Result(Status::invalidParameters, STR_CANT_REMOVE_THIS, kStringIdNone);
}
auto& park = getGameState().park;
diff --git a/src/openrct2/actions/ParkMarketingAction.cpp b/src/openrct2/actions/ParkMarketingAction.cpp
index 44c60c2da6..a4bcb231c1 100644
--- a/src/openrct2/actions/ParkMarketingAction.cpp
+++ b/src/openrct2/actions/ParkMarketingAction.cpp
@@ -52,12 +52,12 @@ namespace OpenRCT2::GameActions
{
if (static_cast(_type) >= std::size(AdvertisingCampaignPricePerWeek) || _numWeeks >= 256)
{
- return Result(Status::InvalidParameters, STR_CANT_START_MARKETING_CAMPAIGN, STR_ERR_VALUE_OUT_OF_RANGE);
+ return Result(Status::invalidParameters, STR_CANT_START_MARKETING_CAMPAIGN, STR_ERR_VALUE_OUT_OF_RANGE);
}
if (getGameState().park.flags & PARK_FLAGS_FORBID_MARKETING_CAMPAIGN)
{
return Result(
- Status::Disallowed, STR_CANT_START_MARKETING_CAMPAIGN, STR_MARKETING_CAMPAIGNS_FORBIDDEN_BY_LOCAL_AUTHORITY);
+ Status::disallowed, STR_CANT_START_MARKETING_CAMPAIGN, STR_MARKETING_CAMPAIGNS_FORBIDDEN_BY_LOCAL_AUTHORITY);
}
return CreateResult();
@@ -89,9 +89,9 @@ namespace OpenRCT2::GameActions
Result ParkMarketingAction::CreateResult() const
{
auto result = Result();
- result.ErrorTitle = STR_CANT_START_MARKETING_CAMPAIGN;
- result.Expenditure = ExpenditureType::marketing;
- result.Cost = CalculatePrice();
+ result.errorTitle = STR_CANT_START_MARKETING_CAMPAIGN;
+ result.expenditure = ExpenditureType::marketing;
+ result.cost = CalculatePrice();
return result;
}
diff --git a/src/openrct2/actions/ParkSetDateAction.cpp b/src/openrct2/actions/ParkSetDateAction.cpp
index 583ffde866..8b3c5407ae 100644
--- a/src/openrct2/actions/ParkSetDateAction.cpp
+++ b/src/openrct2/actions/ParkSetDateAction.cpp
@@ -50,17 +50,17 @@ namespace OpenRCT2::GameActions
if (_year < 0 || _year >= kMaxYear)
{
LOG_ERROR("Invalid park date year %d", _year);
- return Result(Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
+ return Result(Status::invalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
}
else if (_month < 0 || _month >= MONTH_COUNT)
{
LOG_ERROR("Invalid park date month %d", _year);
- return Result(Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
+ return Result(Status::invalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
}
else if (_day < 0 || _day >= 31)
{
LOG_ERROR("Invalid park date day %d", _year);
- return Result(Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
+ return Result(Status::invalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
}
return Result();
diff --git a/src/openrct2/actions/ParkSetEntranceFeeAction.cpp b/src/openrct2/actions/ParkSetEntranceFeeAction.cpp
index 02f6bd76a5..e95949dfde 100644
--- a/src/openrct2/actions/ParkSetEntranceFeeAction.cpp
+++ b/src/openrct2/actions/ParkSetEntranceFeeAction.cpp
@@ -46,17 +46,17 @@ namespace OpenRCT2::GameActions
if ((getGameState().park.flags & PARK_FLAGS_NO_MONEY) != 0)
{
LOG_ERROR("Can't set park entrance fee because the park has no money");
- return Result(Status::Disallowed, STR_ERR_CANT_CHANGE_PARK_ENTRANCE_FEE, kStringIdNone);
+ return Result(Status::disallowed, STR_ERR_CANT_CHANGE_PARK_ENTRANCE_FEE, kStringIdNone);
}
else if (!Park::EntranceFeeUnlocked())
{
LOG_ERROR("Park entrance fee is locked");
- return Result(Status::Disallowed, STR_ERR_CANT_CHANGE_PARK_ENTRANCE_FEE, kStringIdNone);
+ return Result(Status::disallowed, STR_ERR_CANT_CHANGE_PARK_ENTRANCE_FEE, kStringIdNone);
}
else if (_fee < 0.00_GBP || _fee > kMaxEntranceFee)
{
LOG_ERROR("Invalid park entrance fee %d", _fee);
- return Result(Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
+ return Result(Status::invalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
}
return Result();
diff --git a/src/openrct2/actions/ParkSetLoanAction.cpp b/src/openrct2/actions/ParkSetLoanAction.cpp
index c32654d84e..f283e6ad19 100644
--- a/src/openrct2/actions/ParkSetLoanAction.cpp
+++ b/src/openrct2/actions/ParkSetLoanAction.cpp
@@ -45,18 +45,18 @@ namespace OpenRCT2::GameActions
auto& park = getGameState().park;
if (_value > park.bankLoan && _value > park.maxBankLoan)
{
- return Result(Status::Disallowed, STR_CANT_BORROW_ANY_MORE_MONEY, STR_BANK_REFUSES_TO_INCREASE_LOAN);
+ return Result(Status::disallowed, STR_CANT_BORROW_ANY_MORE_MONEY, STR_BANK_REFUSES_TO_INCREASE_LOAN);
}
if (_value < park.bankLoan && _value < 0.00_GBP)
{
- return Result(Status::InvalidParameters, STR_CANT_PAY_BACK_LOAN, STR_LOAN_CANT_BE_NEGATIVE);
+ return Result(Status::invalidParameters, STR_CANT_PAY_BACK_LOAN, STR_LOAN_CANT_BE_NEGATIVE);
}
// The “isPayingBack” check is needed to allow increasing the loan when the player is in debt.
const auto isPayingBack = park.bankLoan > _value;
const auto amountToPayBack = park.bankLoan - _value;
if (isPayingBack && amountToPayBack > park.cash)
{
- return Result(Status::InsufficientFunds, STR_CANT_PAY_BACK_LOAN, STR_NOT_ENOUGH_CASH_AVAILABLE);
+ return Result(Status::insufficientFunds, STR_CANT_PAY_BACK_LOAN, STR_NOT_ENOUGH_CASH_AVAILABLE);
}
return Result();
}
diff --git a/src/openrct2/actions/ParkSetNameAction.cpp b/src/openrct2/actions/ParkSetNameAction.cpp
index ea47f52c85..95b4ea1a3f 100644
--- a/src/openrct2/actions/ParkSetNameAction.cpp
+++ b/src/openrct2/actions/ParkSetNameAction.cpp
@@ -48,7 +48,7 @@ namespace OpenRCT2::GameActions
if (_name.empty())
{
LOG_ERROR("Can't set park name to empty string");
- return Result(Status::InvalidParameters, STR_CANT_RENAME_PARK, STR_INVALID_NAME_FOR_PARK);
+ return Result(Status::invalidParameters, STR_CANT_RENAME_PARK, STR_INVALID_NAME_FOR_PARK);
}
return Result();
}
@@ -60,7 +60,7 @@ namespace OpenRCT2::GameActions
if (_name != park.name)
{
park.name = _name;
- ScrollingTextInvalidate();
+ Drawing::ScrollingText::invalidate();
GfxInvalidateScreen();
}
return Result();
diff --git a/src/openrct2/actions/ParkSetParameterAction.cpp b/src/openrct2/actions/ParkSetParameterAction.cpp
index 8a6b5df475..be583c8be3 100644
--- a/src/openrct2/actions/ParkSetParameterAction.cpp
+++ b/src/openrct2/actions/ParkSetParameterAction.cpp
@@ -46,11 +46,11 @@ namespace OpenRCT2::GameActions
if (_parameter >= ParkParameter::Count)
{
LOG_ERROR("Invalid park parameter %d", _parameter);
- return Result(Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
+ return Result(Status::invalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
}
auto res = Result();
- res.ErrorTitle = kErrorTitles[EnumValue(_parameter)];
+ res.errorTitle = kErrorTitles[EnumValue(_parameter)];
return res;
}
@@ -81,11 +81,11 @@ namespace OpenRCT2::GameActions
break;
default:
LOG_ERROR("Invalid park parameter %d", _parameter);
- return Result(Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
+ return Result(Status::invalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
}
auto res = Result();
- res.ErrorTitle = kErrorTitles[EnumValue(_parameter)];
+ res.errorTitle = kErrorTitles[EnumValue(_parameter)];
return res;
}
} // namespace OpenRCT2::GameActions
diff --git a/src/openrct2/actions/ParkSetResearchFundingAction.cpp b/src/openrct2/actions/ParkSetResearchFundingAction.cpp
index fd2a3e0442..7de77f035f 100644
--- a/src/openrct2/actions/ParkSetResearchFundingAction.cpp
+++ b/src/openrct2/actions/ParkSetResearchFundingAction.cpp
@@ -48,7 +48,7 @@ namespace OpenRCT2::GameActions
if (_fundingAmount >= RESEARCH_FUNDING_COUNT)
{
LOG_ERROR("Invalid research funding amount %d", _fundingAmount);
- return Result(Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
+ return Result(Status::invalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
}
return Result();
}
diff --git a/src/openrct2/actions/PeepPickupAction.cpp b/src/openrct2/actions/PeepPickupAction.cpp
index 10143d25d1..78b5ee0869 100644
--- a/src/openrct2/actions/PeepPickupAction.cpp
+++ b/src/openrct2/actions/PeepPickupAction.cpp
@@ -51,19 +51,19 @@ namespace OpenRCT2::GameActions
if (_entityId.ToUnderlying() >= kMaxEntities || _entityId.IsNull())
{
LOG_ERROR("Failed to pick up peep for sprite %d", _entityId);
- return Result(Status::InvalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE, kStringIdNone);
+ return Result(Status::invalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE, kStringIdNone);
}
if (!_loc.IsNull() && !LocationValid(_loc))
{
- return Result(Status::InvalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE, kStringIdNone);
+ return Result(Status::invalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE, kStringIdNone);
}
auto* const peep = getGameState().entities.TryGetEntity(_entityId);
if (peep == nullptr)
{
LOG_ERROR("Failed to pick up peep for sprite %d", _entityId);
- return Result(Status::InvalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE, kStringIdNone);
+ return Result(Status::invalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE, kStringIdNone);
}
auto res = Result();
@@ -72,10 +72,10 @@ namespace OpenRCT2::GameActions
{
case PeepPickupType::Pickup:
{
- res.Position = peep->GetLocation();
+ res.position = peep->GetLocation();
if (!peep->CanBePickedUp())
{
- return Result(Status::Disallowed, STR_ERR_CANT_PLACE_PERSON_HERE, kStringIdNone);
+ return Result(Status::disallowed, STR_ERR_CANT_PLACE_PERSON_HERE, kStringIdNone);
}
Peep* existing = Network::GetPickupPeep(_owner);
if (existing != nullptr)
@@ -94,23 +94,23 @@ namespace OpenRCT2::GameActions
}
break;
case PeepPickupType::Cancel:
- res.Position = peep->GetLocation();
+ res.position = peep->GetLocation();
break;
case PeepPickupType::Place:
- res.Position = _loc;
+ res.position = _loc;
if (Network::GetPickupPeep(_owner) != peep)
{
- return Result(Status::Unknown, STR_ERR_CANT_PLACE_PERSON_HERE, kStringIdNone);
+ return Result(Status::unknown, STR_ERR_CANT_PLACE_PERSON_HERE, kStringIdNone);
}
- if (auto res2 = peep->Place(TileCoordsXYZ(_loc), false); res2.Error != Status::Ok)
+ if (auto res2 = peep->Place(TileCoordsXYZ(_loc), false); res2.error != Status::ok)
{
return res2;
}
break;
default:
LOG_ERROR("Invalid peep pickup type %u", _type);
- return Result(Status::InvalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE, kStringIdNone);
+ return Result(Status::invalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE, kStringIdNone);
}
return res;
}
@@ -121,7 +121,7 @@ namespace OpenRCT2::GameActions
if (peep == nullptr)
{
LOG_ERROR("Failed to pick up peep for sprite %d", _entityId);
- return Result(Status::InvalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE, kStringIdNone);
+ return Result(Status::invalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE, kStringIdNone);
}
auto res = Result();
@@ -130,7 +130,7 @@ namespace OpenRCT2::GameActions
{
case PeepPickupType::Pickup:
{
- res.Position = peep->GetLocation();
+ res.position = peep->GetLocation();
Peep* existing = Network::GetPickupPeep(_owner);
if (existing != nullptr)
@@ -159,7 +159,7 @@ namespace OpenRCT2::GameActions
break;
case PeepPickupType::Cancel:
{
- res.Position = peep->GetLocation();
+ res.position = peep->GetLocation();
Peep* const pickedUpPeep = Network::GetPickupPeep(_owner);
if (pickedUpPeep != nullptr)
@@ -170,8 +170,8 @@ namespace OpenRCT2::GameActions
}
break;
case PeepPickupType::Place:
- res.Position = _loc;
- if (auto res2 = peep->Place(TileCoordsXYZ(_loc), true); res2.Error != Status::Ok)
+ res.position = _loc;
+ if (auto res2 = peep->Place(TileCoordsXYZ(_loc), true); res2.error != Status::ok)
{
return res2;
}
@@ -179,7 +179,7 @@ namespace OpenRCT2::GameActions
break;
default:
LOG_ERROR("Invalid peep pickup type %u", _type);
- return Result(Status::InvalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE, kStringIdNone);
+ return Result(Status::invalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE, kStringIdNone);
}
return res;
}
diff --git a/src/openrct2/actions/PeepSpawnPlaceAction.cpp b/src/openrct2/actions/PeepSpawnPlaceAction.cpp
index 79777bf968..0526f8a579 100644
--- a/src/openrct2/actions/PeepSpawnPlaceAction.cpp
+++ b/src/openrct2/actions/PeepSpawnPlaceAction.cpp
@@ -48,37 +48,37 @@ namespace OpenRCT2::GameActions
{
if (!isInEditorMode() && !getGameState().cheats.sandboxMode)
{
- return Result(Status::NotInEditorMode, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, kStringIdNone);
+ return Result(Status::notInEditorMode, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, kStringIdNone);
}
auto res = Result();
- res.Expenditure = ExpenditureType::landPurchase;
- res.Position = _location;
+ res.expenditure = ExpenditureType::landPurchase;
+ res.position = _location;
auto mapSizeUnits = GetMapSizeUnits() - CoordsXY{ 16, 16 };
if (!LocationValid(_location) || _location.x <= 16 || _location.y <= 16 || _location.x >= mapSizeUnits.x
|| _location.y >= mapSizeUnits.y)
{
- return Result(Status::InvalidParameters, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, STR_OFF_EDGE_OF_MAP);
+ return Result(Status::invalidParameters, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, STR_OFF_EDGE_OF_MAP);
}
// Verify footpath exists at location, and retrieve coordinates
auto pathElement = MapGetPathElementAt(TileCoordsXYZ{ _location });
if (pathElement == nullptr)
{
- return Result(Status::InvalidParameters, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, STR_CAN_ONLY_BE_BUILT_ON_PATHS);
+ return Result(Status::invalidParameters, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, STR_CAN_ONLY_BE_BUILT_ON_PATHS);
}
// Verify location is unowned
auto surfaceMapElement = MapGetSurfaceElementAt(_location);
if (surfaceMapElement == nullptr)
{
- return Result(Status::Unknown, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, STR_ERR_SURFACE_ELEMENT_NOT_FOUND);
+ return Result(Status::unknown, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, STR_ERR_SURFACE_ELEMENT_NOT_FOUND);
}
if (surfaceMapElement->GetOwnership() != OWNERSHIP_UNOWNED)
{
return Result(
- Status::InvalidParameters, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, STR_ERR_MUST_BE_OUTSIDE_PARK_BOUNDARIES);
+ Status::invalidParameters, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, STR_ERR_MUST_BE_OUTSIDE_PARK_BOUNDARIES);
}
return res;
@@ -87,8 +87,8 @@ namespace OpenRCT2::GameActions
Result PeepSpawnPlaceAction::Execute(GameState_t& gameState) const
{
auto res = Result();
- res.Expenditure = ExpenditureType::landPurchase;
- res.Position = _location;
+ res.expenditure = ExpenditureType::landPurchase;
+ res.position = _location;
// Shift the spawn point to the edge of the tile
auto spawnPos = CoordsXY{ _location.ToTileCentre() }
diff --git a/src/openrct2/actions/RideCreateAction.cpp b/src/openrct2/actions/RideCreateAction.cpp
index 0d2d20fad1..dcf4f21627 100644
--- a/src/openrct2/actions/RideCreateAction.cpp
+++ b/src/openrct2/actions/RideCreateAction.cpp
@@ -32,12 +32,13 @@ namespace OpenRCT2::GameActions
{
RideCreateAction::RideCreateAction(
ride_type_t rideType, ObjectEntryIndex subType, uint8_t trackColourPreset, uint8_t vehicleColourPreset,
- ObjectEntryIndex entranceObjectIndex)
+ ObjectEntryIndex entranceObjectIndex, RideInspection inspectionInterval)
: _rideType(rideType)
, _subType(subType)
, _entranceObjectIndex(entranceObjectIndex)
, _trackColourPreset(trackColourPreset)
, _vehicleColourPreset(vehicleColourPreset)
+ , _inspectionInterval(inspectionInterval)
{
}
@@ -48,6 +49,7 @@ namespace OpenRCT2::GameActions
visitor.Visit("entranceObject", _entranceObjectIndex);
visitor.Visit("colour1", _trackColourPreset);
visitor.Visit("colour2", _vehicleColourPreset);
+ visitor.Visit("inspectionInterval", _inspectionInterval);
}
ride_type_t RideCreateAction::GetRideType() const
@@ -70,53 +72,59 @@ namespace OpenRCT2::GameActions
GameAction::Serialise(stream);
stream << DS_TAG(_rideType) << DS_TAG(_subType) << DS_TAG(_entranceObjectIndex) << DS_TAG(_trackColourPreset)
- << DS_TAG(_vehicleColourPreset);
+ << DS_TAG(_vehicleColourPreset) << DS_TAG(_inspectionInterval);
}
Result RideCreateAction::Query(GameState_t& gameState) const
{
+ if (_inspectionInterval > RideInspection::never)
+ {
+ LOG_ERROR("Invalid inspection interval: %u", EnumValue(_inspectionInterval));
+ return Result(Status::invalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_ERR_VALUE_OUT_OF_RANGE);
+ }
+
auto rideIndex = GetNextFreeRideId();
if (rideIndex.IsNull())
{
// No more free slots available.
- return Result(Status::NoFreeElements, STR_CANT_CREATE_NEW_RIDE_ATTRACTION, STR_TOO_MANY_RIDES);
+ return Result(Status::noFreeElements, STR_CANT_CREATE_NEW_RIDE_ATTRACTION, STR_TOO_MANY_RIDES);
}
if (_rideType >= RIDE_TYPE_COUNT)
{
LOG_ERROR("Invalid ride type %d", _rideType);
- return Result(Status::InvalidParameters, STR_CANT_CREATE_NEW_RIDE_ATTRACTION, STR_INVALID_RIDE_TYPE);
+ return Result(Status::invalidParameters, STR_CANT_CREATE_NEW_RIDE_ATTRACTION, STR_INVALID_RIDE_TYPE);
}
int32_t rideEntryIndex = RideGetEntryIndex(_rideType, _subType);
if (rideEntryIndex >= kMaxRideObjects)
{
LOG_ERROR("Ride entry not found for rideType %d, subType %d", _rideType, _subType);
- return Result(Status::InvalidParameters, STR_CANT_CREATE_NEW_RIDE_ATTRACTION, STR_INVALID_RIDE_TYPE);
+ return Result(Status::invalidParameters, STR_CANT_CREATE_NEW_RIDE_ATTRACTION, STR_INVALID_RIDE_TYPE);
}
const auto& colourPresets = GetRideTypeDescriptor(_rideType).ColourPresets;
if (_trackColourPreset >= colourPresets.count)
{
LOG_ERROR("Can't create ride, invalid colour preset %d", _trackColourPreset);
- return Result(Status::InvalidParameters, STR_CANT_CREATE_NEW_RIDE_ATTRACTION, STR_ERR_INVALID_COLOUR);
+ return Result(Status::invalidParameters, STR_CANT_CREATE_NEW_RIDE_ATTRACTION, STR_ERR_INVALID_COLOUR);
}
const auto* rideEntry = GetRideEntryByIndex(rideEntryIndex);
if (rideEntry == nullptr)
{
LOG_ERROR("Ride entry not found for rideEntryIndex %d", rideEntryIndex);
- return Result(Status::InvalidParameters, STR_CANT_CREATE_NEW_RIDE_ATTRACTION, STR_UNKNOWN_OBJECT_TYPE);
+ return Result(Status::invalidParameters, STR_CANT_CREATE_NEW_RIDE_ATTRACTION, STR_UNKNOWN_OBJECT_TYPE);
}
const auto* presetList = rideEntry->vehicle_preset_list;
if ((presetList->count > 0 && presetList->count != 255) && _vehicleColourPreset >= presetList->count)
{
- return Result(Status::InvalidParameters, STR_CANT_CREATE_NEW_RIDE_ATTRACTION, kStringIdNone);
+ return Result(Status::invalidParameters, STR_CANT_CREATE_NEW_RIDE_ATTRACTION, kStringIdNone);
}
auto res = Result();
- res.SetData(RideId{ rideIndex });
+ res.setData(RideId{ rideIndex });
return res;
}
@@ -135,7 +143,7 @@ namespace OpenRCT2::GameActions
LOG_ERROR(
"Ride entry not found for index rideEntryIndex %u (from rideType %u, subType %u)", rideEntryIndex, _rideType,
_subType);
- return Result(Status::Unknown, STR_CANT_CREATE_NEW_RIDE_ATTRACTION, STR_UNKNOWN_OBJECT_TYPE);
+ return Result(Status::unknown, STR_CANT_CREATE_NEW_RIDE_ATTRACTION, STR_UNKNOWN_OBJECT_TYPE);
}
ride->type = _rideType;
@@ -274,7 +282,7 @@ namespace OpenRCT2::GameActions
ride->upkeepCost = kMoney64Undefined;
ride->reliability = kRideInitialReliability;
ride->unreliabilityFactor = 1;
- ride->inspectionInterval = RIDE_INSPECTION_EVERY_30_MINUTES;
+ ride->inspectionInterval = _inspectionInterval;
ride->lastCrashType = RIDE_CRASH_TYPE_NONE;
ride->incomePerHour = kMoney64Undefined;
ride->profit = kMoney64Undefined;
@@ -294,8 +302,8 @@ namespace OpenRCT2::GameActions
auto* windowMgr = Ui::GetWindowManager();
windowMgr->InvalidateByClass(WindowClass::rideList);
- res.Expenditure = ExpenditureType::rideConstruction;
- res.SetData(RideId{ rideIndex });
+ res.expenditure = ExpenditureType::rideConstruction;
+ res.setData(RideId{ rideIndex });
return res;
}
diff --git a/src/openrct2/actions/RideCreateAction.h b/src/openrct2/actions/RideCreateAction.h
index 910bea53d6..b386d45ddb 100644
--- a/src/openrct2/actions/RideCreateAction.h
+++ b/src/openrct2/actions/RideCreateAction.h
@@ -21,12 +21,13 @@ namespace OpenRCT2::GameActions
ObjectEntryIndex _entranceObjectIndex{ kObjectEntryIndexNull };
uint8_t _trackColourPreset{ COLOUR_NULL };
uint8_t _vehicleColourPreset{ COLOUR_NULL };
+ RideInspection _inspectionInterval{ RideInspection::every30Minutes };
public:
RideCreateAction() = default;
RideCreateAction(
ride_type_t rideType, ObjectEntryIndex subType, uint8_t trackColourPreset, uint8_t vehicleColourPreset,
- ObjectEntryIndex entranceStyleIndex);
+ ObjectEntryIndex entranceStyleIndex, RideInspection inspectionInterval);
void AcceptParameters(GameActionParameterVisitor&) final;
diff --git a/src/openrct2/actions/RideDemolishAction.cpp b/src/openrct2/actions/RideDemolishAction.cpp
index f511324130..d73215282a 100644
--- a/src/openrct2/actions/RideDemolishAction.cpp
+++ b/src/openrct2/actions/RideDemolishAction.cpp
@@ -14,7 +14,7 @@
#include "../Diagnostic.h"
#include "../GameState.h"
#include "../core/MemoryStream.h"
-#include "../drawing/Drawing.h"
+#include "../drawing/ScrollingText.h"
#include "../entity/EntityList.h"
#include "../management/NewsItem.h"
#include "../peep/RideUseSystem.h"
@@ -61,7 +61,7 @@ namespace OpenRCT2::GameActions
if (ride == nullptr)
{
LOG_ERROR("Ride not found for rideIndex %u", _rideIndex.ToUnderlying());
- return Result(Status::InvalidParameters, STR_CANT_DEMOLISH_RIDE, STR_ERR_RIDE_NOT_FOUND);
+ return Result(Status::invalidParameters, STR_CANT_DEMOLISH_RIDE, STR_ERR_RIDE_NOT_FOUND);
}
if ((ride->lifecycleFlags & (RIDE_LIFECYCLE_INDESTRUCTIBLE | RIDE_LIFECYCLE_INDESTRUCTIBLE_TRACK)
@@ -69,7 +69,7 @@ namespace OpenRCT2::GameActions
&& !getGameState().cheats.makeAllDestructible)
{
return Result(
- Status::NoClearance, STR_CANT_DEMOLISH_RIDE,
+ Status::noClearance, STR_CANT_DEMOLISH_RIDE,
STR_LOCAL_AUTHORITY_FORBIDS_DEMOLITION_OR_MODIFICATIONS_TO_THIS_RIDE);
}
@@ -79,22 +79,22 @@ namespace OpenRCT2::GameActions
{
if (ride->status != RideStatus::closed && ride->status != RideStatus::simulating)
{
- return Result(Status::Disallowed, STR_CANT_REFURBISH_RIDE, STR_MUST_BE_CLOSED_FIRST);
+ return Result(Status::disallowed, STR_CANT_REFURBISH_RIDE, STR_MUST_BE_CLOSED_FIRST);
}
if (ride->numRiders > 0)
{
- return Result(Status::Disallowed, STR_CANT_REFURBISH_RIDE, STR_RIDE_NOT_YET_EMPTY);
+ return Result(Status::disallowed, STR_CANT_REFURBISH_RIDE, STR_RIDE_NOT_YET_EMPTY);
}
if (!(ride->lifecycleFlags & RIDE_LIFECYCLE_EVER_BEEN_OPENED)
|| ride->getRideTypeDescriptor().AvailableBreakdowns == 0)
{
- return Result(Status::Disallowed, STR_CANT_REFURBISH_RIDE, STR_CANT_REFURBISH_NOT_NEEDED);
+ return Result(Status::disallowed, STR_CANT_REFURBISH_RIDE, STR_CANT_REFURBISH_NOT_NEEDED);
}
- result.ErrorTitle = STR_CANT_REFURBISH_RIDE;
- result.Cost = GetRefurbishPrice(*ride);
+ result.errorTitle = STR_CANT_REFURBISH_RIDE;
+ result.cost = GetRefurbishPrice(*ride);
}
return result;
@@ -106,7 +106,7 @@ namespace OpenRCT2::GameActions
if (ride == nullptr)
{
LOG_ERROR("Ride not found for rideIndex %u", _rideIndex.ToUnderlying());
- return Result(Status::InvalidParameters, STR_CANT_DEMOLISH_RIDE, STR_ERR_RIDE_NOT_FOUND);
+ return Result(Status::invalidParameters, STR_CANT_DEMOLISH_RIDE, STR_ERR_RIDE_NOT_FOUND);
}
switch (_modifyType)
@@ -117,7 +117,7 @@ namespace OpenRCT2::GameActions
return RefurbishRide(gameState, *ride);
default:
LOG_ERROR("Unknown ride demolish type %d", _modifyType);
- return Result(Status::InvalidParameters, STR_CANT_DO_THIS, STR_ERR_VALUE_OUT_OF_RANGE);
+ return Result(Status::invalidParameters, STR_CANT_DO_THIS, STR_ERR_VALUE_OUT_OF_RANGE);
}
}
@@ -146,13 +146,13 @@ namespace OpenRCT2::GameActions
MarketingCancelCampaignsForRide(_rideIndex);
auto res = Result();
- res.Expenditure = ExpenditureType::rideConstruction;
- res.Cost = refundPrice;
+ res.expenditure = ExpenditureType::rideConstruction;
+ res.cost = refundPrice;
if (!ride.overallView.IsNull())
{
auto xy = ride.overallView.ToTileCentre();
- res.Position = { xy, TileElementHeight(xy) };
+ res.position = { xy, TileElementHeight(xy) };
}
ride.remove();
@@ -171,7 +171,7 @@ namespace OpenRCT2::GameActions
windowMgr->BroadcastIntent(Intent(INTENT_ACTION_REFRESH_RIDE_LIST));
windowMgr->BroadcastIntent(Intent(INTENT_ACTION_REFRESH_GUEST_LIST));
- ScrollingTextInvalidate();
+ Drawing::ScrollingText::invalidate();
GfxInvalidateScreen();
return res;
@@ -179,13 +179,13 @@ namespace OpenRCT2::GameActions
money64 RideDemolishAction::MazeRemoveTrack(GameState_t& gameState, const CoordsXYZD& coords) const
{
- auto setMazeTrack = MazeSetTrackAction(coords, false, _rideIndex, GC_SET_MAZE_TRACK_FILL);
+ auto setMazeTrack = MazeSetTrackAction(coords, false, _rideIndex, MazeBuildMode::fill);
setMazeTrack.SetFlags(GetFlags());
auto execRes = ExecuteNested(&setMazeTrack, gameState);
- if (execRes.Error == Status::Ok)
+ if (execRes.error == Status::ok)
{
- return execRes.Cost;
+ return execRes.cost;
}
return kMoney64Undefined;
@@ -224,19 +224,19 @@ namespace OpenRCT2::GameActions
const auto location = CoordsXYZD(tileCoords, trackElement->GetBaseZ(), trackElement->GetDirection());
const auto type = trackElement->GetTrackType();
- if (type != TrackElemType::Maze)
+ if (type != TrackElemType::maze)
{
auto trackRemoveAction = TrackRemoveAction(type, trackElement->GetSequenceIndex(), location);
- trackRemoveAction.SetFlags(GAME_COMMAND_FLAG_NO_SPEND);
+ trackRemoveAction.SetFlags({ CommandFlag::noSpend });
- auto removRes = ExecuteNested(&trackRemoveAction, gameState);
- if (removRes.Error != Status::Ok)
+ auto removeRes = ExecuteNested(&trackRemoveAction, gameState);
+ if (removeRes.error != Status::ok)
{
TileElementRemove(tileElement);
}
else
{
- refundPrice += removRes.Cost;
+ refundPrice += removeRes.cost;
}
}
else
@@ -271,8 +271,8 @@ namespace OpenRCT2::GameActions
Result RideDemolishAction::RefurbishRide(GameState_t& gameState, Ride& ride) const
{
auto res = Result();
- res.Expenditure = ExpenditureType::rideConstruction;
- res.Cost = GetRefurbishPrice(ride);
+ res.expenditure = ExpenditureType::rideConstruction;
+ res.cost = GetRefurbishPrice(ride);
ride.renew();
@@ -284,7 +284,7 @@ namespace OpenRCT2::GameActions
if (!ride.overallView.IsNull())
{
auto location = ride.overallView.ToTileCentre();
- res.Position = { location, TileElementHeight(location) };
+ res.position = { location, TileElementHeight(location) };
}
auto* windowMgr = Ui::GetWindowManager();
diff --git a/src/openrct2/actions/RideEntranceExitPlaceAction.cpp b/src/openrct2/actions/RideEntranceExitPlaceAction.cpp
index 90acdf34bf..791204bb5c 100644
--- a/src/openrct2/actions/RideEntranceExitPlaceAction.cpp
+++ b/src/openrct2/actions/RideEntranceExitPlaceAction.cpp
@@ -64,23 +64,23 @@ namespace OpenRCT2::GameActions
if (ride == nullptr)
{
LOG_ERROR("Ride not found for rideIndex %u", _rideIndex.ToUnderlying());
- return Result(Status::InvalidParameters, errorTitle, STR_ERR_RIDE_NOT_FOUND);
+ return Result(Status::invalidParameters, errorTitle, STR_ERR_RIDE_NOT_FOUND);
}
if (_stationNum.ToUnderlying() >= Limits::kMaxStationsPerRide)
{
LOG_ERROR("Invalid station number for ride. stationNum: %u", _stationNum.ToUnderlying());
- return Result(Status::InvalidParameters, errorTitle, STR_ERR_VALUE_OUT_OF_RANGE);
+ return Result(Status::invalidParameters, errorTitle, STR_ERR_VALUE_OUT_OF_RANGE);
}
if (ride->status != RideStatus::closed && ride->status != RideStatus::simulating)
{
- return Result(Status::NotClosed, errorTitle, STR_MUST_BE_CLOSED_FIRST);
+ return Result(Status::notClosed, errorTitle, STR_MUST_BE_CLOSED_FIRST);
}
if (ride->lifecycleFlags & RIDE_LIFECYCLE_INDESTRUCTIBLE_TRACK)
{
- return Result(Status::Disallowed, errorTitle, STR_NOT_ALLOWED_TO_MODIFY_STATION);
+ return Result(Status::disallowed, errorTitle, STR_NOT_ALLOWED_TO_MODIFY_STATION);
}
const auto& station = ride->getStation(_stationNum);
@@ -93,9 +93,9 @@ namespace OpenRCT2::GameActions
rideEntranceExitRemove.SetFlags(GetFlags());
auto result = QueryNested(&rideEntranceExitRemove, gameState);
- if (result.Error != Status::Ok)
+ if (result.error != Status::ok)
{
- result.ErrorTitle = errorTitle;
+ result.errorTitle = errorTitle;
return result;
}
}
@@ -103,41 +103,41 @@ namespace OpenRCT2::GameActions
auto z = ride->getStation(_stationNum).GetBaseZ();
if (!LocationValid(_loc))
{
- return Result(Status::InvalidParameters, errorTitle, STR_OFF_EDGE_OF_MAP);
+ return Result(Status::invalidParameters, errorTitle, STR_OFF_EDGE_OF_MAP);
}
if (!getGameState().cheats.sandboxMode && !MapIsLocationOwned({ _loc, z }))
{
- return Result(Status::NotOwned, errorTitle, STR_LAND_NOT_OWNED_BY_PARK);
+ return Result(Status::notOwned, errorTitle, STR_LAND_NOT_OWNED_BY_PARK);
}
if (!MapCheckCapacityAndReorganise(_loc))
{
- return Result(Status::NoFreeElements, errorTitle, STR_TILE_ELEMENT_LIMIT_REACHED);
+ return Result(Status::noFreeElements, errorTitle, STR_TILE_ELEMENT_LIMIT_REACHED);
}
auto clear_z = z + (_isExit ? RideExitHeight : RideEntranceHeight);
auto canBuild = MapCanConstructWithClearAt(
- { _loc, z, clear_z }, &MapPlaceNonSceneryClearFunc, { 0b1111, 0 }, GetFlags(), kTileSlopeFlat);
- if (canBuild.Error != Status::Ok)
+ { _loc, z, clear_z }, MapPlaceNonSceneryClearFunc, { 0b1111, 0 }, GetFlags(), kTileSlopeFlat);
+ if (canBuild.error != Status::ok)
{
- canBuild.ErrorTitle = errorTitle;
+ canBuild.errorTitle = errorTitle;
return canBuild;
}
- const auto clearanceData = canBuild.GetData();
+ const auto clearanceData = canBuild.getData();
if (clearanceData.GroundFlags & ELEMENT_IS_UNDERWATER)
{
- return Result(Status::Disallowed, errorTitle, STR_RIDE_CANT_BUILD_THIS_UNDERWATER);
+ return Result(Status::disallowed, errorTitle, STR_RIDE_CANT_BUILD_THIS_UNDERWATER);
}
if (z > MaxRideEntranceOrExitHeight)
{
- return Result(Status::Disallowed, errorTitle, STR_TOO_HIGH);
+ return Result(Status::disallowed, errorTitle, STR_TOO_HIGH);
}
auto res = Result();
- res.Position = { _loc.ToTileCentre(), z };
- res.Expenditure = ExpenditureType::rideConstruction;
- res.Cost += canBuild.Cost;
+ res.position = { _loc.ToTileCentre(), z };
+ res.expenditure = ExpenditureType::rideConstruction;
+ res.cost += canBuild.cost;
return res;
}
@@ -151,10 +151,10 @@ namespace OpenRCT2::GameActions
if (ride == nullptr)
{
LOG_ERROR("Ride not found for rideIndex %u", _rideIndex.ToUnderlying());
- return Result(Status::InvalidParameters, errorTitle, STR_ERR_RIDE_NOT_FOUND);
+ return Result(Status::invalidParameters, errorTitle, STR_ERR_RIDE_NOT_FOUND);
}
- if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST))
+ if (!GetFlags().has(CommandFlag::ghost))
{
RideClearForConstruction(*ride);
ride->removePeeps();
@@ -169,15 +169,15 @@ namespace OpenRCT2::GameActions
rideEntranceExitRemove.SetFlags(GetFlags());
auto result = ExecuteNested(&rideEntranceExitRemove, gameState);
- if (result.Error != Status::Ok)
+ if (result.error != Status::ok)
{
- result.ErrorTitle = errorTitle;
+ result.errorTitle = errorTitle;
return result;
}
}
auto z = station.GetBaseZ();
- if (!(GetFlags() & GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED) && !(GetFlags() & GAME_COMMAND_FLAG_GHOST)
+ if (!GetFlags().has(CommandFlag::allowDuringPaused) && !GetFlags().has(CommandFlag::ghost)
&& !getGameState().cheats.disableClearanceChecks)
{
FootpathRemoveLitter({ _loc, z });
@@ -186,18 +186,18 @@ namespace OpenRCT2::GameActions
auto clear_z = z + (_isExit ? RideExitHeight : RideEntranceHeight);
auto canBuild = MapCanConstructWithClearAt(
- { _loc, z, clear_z }, &MapPlaceNonSceneryClearFunc, { 0b1111, 0 }, GetFlags() | GAME_COMMAND_FLAG_APPLY,
+ { _loc, z, clear_z }, MapPlaceNonSceneryClearFunc, { 0b1111, 0 }, GetFlags().with(CommandFlag::apply),
kTileSlopeFlat);
- if (canBuild.Error != Status::Ok)
+ if (canBuild.error != Status::ok)
{
- canBuild.ErrorTitle = errorTitle;
+ canBuild.errorTitle = errorTitle;
return canBuild;
}
auto res = Result();
- res.Position = { _loc.ToTileCentre(), z };
- res.Expenditure = ExpenditureType::rideConstruction;
- res.Cost += canBuild.Cost;
+ res.position = { _loc.ToTileCentre(), z };
+ res.expenditure = ExpenditureType::rideConstruction;
+ res.cost += canBuild.cost;
auto* entranceElement = TileElementInsert(CoordsXYZ{ _loc, z }, 0b1111);
Guard::Assert(entranceElement != nullptr);
@@ -207,7 +207,7 @@ namespace OpenRCT2::GameActions
entranceElement->SetEntranceType(_isExit ? ENTRANCE_TYPE_RIDE_EXIT : ENTRANCE_TYPE_RIDE_ENTRANCE);
entranceElement->SetStationIndex(_stationNum);
entranceElement->SetRideIndex(_rideIndex);
- entranceElement->SetGhost(GetFlags() & GAME_COMMAND_FLAG_GHOST);
+ entranceElement->SetGhost(GetFlags().has(CommandFlag::ghost));
if (_isExit)
{
@@ -224,7 +224,7 @@ namespace OpenRCT2::GameActions
FootpathQueueChainReset();
- if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST))
+ if (!GetFlags().has(CommandFlag::ghost))
{
MazeEntranceHedgeRemoval({ _loc, entranceElement->as() });
}
@@ -244,37 +244,37 @@ namespace OpenRCT2::GameActions
if (!getGameState().cheats.sandboxMode && !MapIsLocationOwned(loc))
{
- return Result(Status::NotOwned, errorTitle, STR_LAND_NOT_OWNED_BY_PARK);
+ return Result(Status::notOwned, errorTitle, STR_LAND_NOT_OWNED_BY_PARK);
}
if (!MapCheckCapacityAndReorganise(loc))
{
- return Result(Status::NoFreeElements, errorTitle, STR_TILE_ELEMENT_LIMIT_REACHED);
+ return Result(Status::noFreeElements, errorTitle, STR_TILE_ELEMENT_LIMIT_REACHED);
}
int16_t baseZ = loc.z;
int16_t clearZ = baseZ + (isExit ? RideExitHeight : RideEntranceHeight);
auto canBuild = MapCanConstructWithClearAt(
- { loc, baseZ, clearZ }, &MapPlaceNonSceneryClearFunc, { 0b1111, 0 }, 0, kTileSlopeFlat);
- if (canBuild.Error != Status::Ok)
+ { loc, baseZ, clearZ }, MapPlaceNonSceneryClearFunc, { 0b1111, 0 }, {}, kTileSlopeFlat);
+ if (canBuild.error != Status::ok)
{
- canBuild.ErrorTitle = errorTitle;
+ canBuild.errorTitle = errorTitle;
return canBuild;
}
- const auto clearanceData = canBuild.GetData();
+ const auto clearanceData = canBuild.getData();
if (clearanceData.GroundFlags & ELEMENT_IS_UNDERWATER)
{
- return Result(Status::Disallowed, errorTitle, STR_RIDE_CANT_BUILD_THIS_UNDERWATER);
+ return Result(Status::disallowed, errorTitle, STR_RIDE_CANT_BUILD_THIS_UNDERWATER);
}
if (baseZ > MaxRideEntranceOrExitHeight)
{
- return Result(Status::Disallowed, errorTitle, STR_TOO_HIGH);
+ return Result(Status::disallowed, errorTitle, STR_TOO_HIGH);
}
auto res = Result();
- res.Position = { loc.ToTileCentre(), TileElementHeight(loc) };
- res.Expenditure = ExpenditureType::rideConstruction;
- res.Cost += canBuild.Cost;
+ res.position = { loc.ToTileCentre(), TileElementHeight(loc) };
+ res.expenditure = ExpenditureType::rideConstruction;
+ res.cost += canBuild.cost;
return res;
}
} // namespace OpenRCT2::GameActions
diff --git a/src/openrct2/actions/RideEntranceExitRemoveAction.cpp b/src/openrct2/actions/RideEntranceExitRemoveAction.cpp
index 686daf2016..83c79ff140 100644
--- a/src/openrct2/actions/RideEntranceExitRemoveAction.cpp
+++ b/src/openrct2/actions/RideEntranceExitRemoveAction.cpp
@@ -49,7 +49,7 @@ namespace OpenRCT2::GameActions
}
static TileElement* FindEntranceElement(
- const CoordsXY& loc, RideId rideIndex, StationIndex stationNum, int32_t entranceType, uint32_t flags)
+ const CoordsXY& loc, RideId rideIndex, StationIndex stationNum, int32_t entranceType)
{
for (auto* entranceElement : TileElementsView