2014-04-19 04:16:20 +02:00
/*****************************************************************************
2024-01-01 12:52:28 +01:00
* Copyright ( c ) 2014 - 2024 OpenRCT2 developers
2014-04-19 04:16:20 +02:00
*
2018-06-15 14:07:34 +02:00
* For a complete list of all authors , please refer to contributors . md
* Interested in contributing ? Visit https : //github.com/OpenRCT2/OpenRCT2
2014-04-19 04:16:20 +02:00
*
2018-06-15 14:07:34 +02:00
* OpenRCT2 is licensed under the GNU General Public License version 3.
2014-04-19 04:16:20 +02:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2018-06-22 23:21:44 +02:00
# include "../interface/Theme.h"
2017-08-02 00:20:32 +02:00
2018-11-21 23:16:04 +01:00
# include <iterator>
2018-06-22 23:21:44 +02:00
# include <openrct2-ui/interface/Dropdown.h>
# include <openrct2-ui/interface/Widget.h>
# include <openrct2-ui/windows/Window.h>
2017-10-27 20:12:01 +02:00
# include <openrct2/Context.h>
2017-11-30 18:17:06 +01:00
# include <openrct2/Game.h>
2024-01-22 16:03:39 +01:00
# include <openrct2/GameState.h>
2022-08-11 00:00:58 +02:00
# include <openrct2/actions/RideDemolishAction.h>
# include <openrct2/actions/RideSetStatusAction.h>
2018-06-22 23:21:44 +02:00
# include <openrct2/config/Config.h>
# include <openrct2/drawing/Drawing.h>
# include <openrct2/interface/Colour.h>
2021-12-12 00:06:06 +01:00
# include <openrct2/localisation/Formatter.h>
2018-01-06 18:32:25 +01:00
# include <openrct2/localisation/Localisation.h>
2017-10-27 20:12:01 +02:00
# include <openrct2/network/network.h>
2017-10-08 22:15:41 +02:00
# include <openrct2/sprites.h>
2020-03-23 22:33:57 +01:00
# include <openrct2/util/Util.h>
2017-10-21 16:03:33 +02:00
# include <openrct2/windows/Intent.h>
2018-03-19 23:28:40 +01:00
# include <openrct2/world/Park.h>
2014-04-19 04:16:20 +02:00
2024-03-10 14:52:35 +01:00
namespace OpenRCT2 : : Ui : : Windows
2021-10-17 15:31:56 +02:00
{
2024-03-10 14:52:35 +01:00
static constexpr StringId WINDOW_TITLE = STR_NONE ;
static constexpr int32_t WH = 240 ;
static constexpr int32_t WW = 340 ;
2014-04-19 04:16:20 +02:00
2024-03-10 14:52:35 +01:00
enum
{
PAGE_RIDES ,
PAGE_SHOPS_AND_STALLS ,
PAGE_KIOSKS_AND_FACILITIES ,
PAGE_COUNT
} ;
2014-04-19 04:16:20 +02:00
2024-03-10 14:52:35 +01:00
enum WindowRideListWidgetIdx
{
WIDX_BACKGROUND ,
WIDX_TITLE ,
WIDX_CLOSE ,
WIDX_PAGE_BACKGROUND ,
WIDX_OPEN_CLOSE_ALL ,
WIDX_CURRENT_INFORMATION_TYPE ,
WIDX_INFORMATION_TYPE_DROPDOWN ,
WIDX_SORT ,
WIDX_TAB_1 ,
WIDX_TAB_2 ,
WIDX_TAB_3 ,
WIDX_LIST ,
WIDX_CLOSE_LIGHT ,
WIDX_OPEN_LIGHT ,
WIDX_QUICK_DEMOLISH ,
} ;
// clang-format off
2023-07-09 22:07:14 +02:00
static Widget _rideListWidgets [ ] = {
2020-05-09 16:44:21 +02:00
WINDOW_SHIM ( WINDOW_TITLE , WW , WH ) ,
2020-11-27 04:14:20 +01:00
MakeWidget ( { 0 , 43 } , { 340 , 197 } , WindowWidgetType : : Resize , WindowColour : : Secondary ) , // tab page background
2022-12-24 17:47:22 +01:00
MakeWidget ( { 315 , 60 } , { 24 , 24 } , WindowWidgetType : : FlatBtn , WindowColour : : Secondary , ImageId ( SPR_TOGGLE_OPEN_CLOSE ) , STR_OPEN_OR_CLOSE_ALL_RIDES ) , // open / close all toggle
2020-11-27 04:14:20 +01:00
MakeWidget ( { 150 , 46 } , { 124 , 12 } , WindowWidgetType : : DropdownMenu , WindowColour : : Secondary ) , // current information type
MakeWidget ( { 262 , 47 } , { 11 , 10 } , WindowWidgetType : : Button , WindowColour : : Secondary , STR_DROPDOWN_GLYPH , STR_RIDE_LIST_INFORMATION_TYPE_TIP ) , // information type dropdown button
MakeWidget ( { 280 , 46 } , { 54 , 12 } , WindowWidgetType : : Button , WindowColour : : Secondary , STR_SORT , STR_RIDE_LIST_SORT_TIP ) , // sort button
2020-08-29 04:31:31 +02:00
MakeTab ( { 3 , 17 } , STR_LIST_RIDES_TIP ) , // tab 1
MakeTab ( { 34 , 17 } , STR_LIST_SHOPS_AND_STALLS_TIP ) , // tab 2
MakeTab ( { 65 , 17 } , STR_LIST_KIOSKS_AND_FACILITIES_TIP ) , // tab 3
2020-11-27 04:14:20 +01:00
MakeWidget ( { 3 , 60 } , { 334 , 177 } , WindowWidgetType : : Scroll , WindowColour : : Secondary , SCROLL_VERTICAL ) , // list
2022-12-24 17:47:22 +01:00
MakeWidget ( { 320 , 62 } , { 14 , 14 } , WindowWidgetType : : ImgBtn , WindowColour : : Secondary , ImageId ( SPR_G2_RCT1_CLOSE_BUTTON_0 ) ) ,
MakeWidget ( { 320 , 76 } , { 14 , 14 } , WindowWidgetType : : ImgBtn , WindowColour : : Secondary , ImageId ( SPR_G2_RCT1_OPEN_BUTTON_0 ) ) ,
MakeWidget ( { 315 , 90 } , { 24 , 24 } , WindowWidgetType : : FlatBtn , WindowColour : : Secondary , ImageId ( SPR_DEMOLISH ) , STR_QUICK_DEMOLISH_RIDE ) ,
2024-03-09 15:15:45 +01:00
kWidgetsEnd ,
2014-04-19 04:16:20 +02:00
} ;
2024-03-10 14:52:35 +01:00
// clang-format on
2014-04-19 04:16:20 +02:00
2024-03-10 14:52:35 +01:00
enum
{
INFORMATION_TYPE_STATUS ,
INFORMATION_TYPE_POPULARITY ,
INFORMATION_TYPE_SATISFACTION ,
INFORMATION_TYPE_PROFIT ,
INFORMATION_TYPE_TOTAL_CUSTOMERS ,
INFORMATION_TYPE_TOTAL_PROFIT ,
INFORMATION_TYPE_CUSTOMERS ,
INFORMATION_TYPE_AGE ,
INFORMATION_TYPE_INCOME ,
INFORMATION_TYPE_RUNNING_COST ,
INFORMATION_TYPE_QUEUE_LENGTH ,
INFORMATION_TYPE_QUEUE_TIME ,
INFORMATION_TYPE_RELIABILITY ,
INFORMATION_TYPE_DOWN_TIME ,
INFORMATION_TYPE_GUESTS_FAVOURITE ,
INFORMATION_TYPE_EXCITEMENT ,
INFORMATION_TYPE_INTENSITY ,
INFORMATION_TYPE_NAUSEA ,
DROPDOWN_LIST_COUNT ,
} ;
2016-07-14 14:07:49 +02:00
2024-03-10 14:52:35 +01:00
static constexpr StringId ride_info_type_string_mapping [ DROPDOWN_LIST_COUNT ] = {
STR_STATUS ,
STR_POPULARITY ,
STR_SATISFACTION ,
STR_PROFIT ,
STR_RIDE_LIST_TOTAL_CUSTOMERS ,
STR_RIDE_LIST_TOTAL_PROFIT ,
STR_RIDE_LIST_CUSTOMERS_PER_HOUR ,
STR_RIDE_LIST_AGE ,
STR_RIDE_LIST_INCOME ,
STR_RIDE_LIST_RUNNING_COST ,
STR_QUEUE_LENGTH ,
STR_QUEUE_TIME ,
STR_RELIABILITY ,
STR_DOWN_TIME ,
STR_GUESTS_FAVOURITE ,
STR_RIDE_LIST_EXCITEMENT ,
STR_RIDE_LIST_INTENSITY ,
STR_RIDE_LIST_NAUSEA ,
} ;
2016-04-09 15:04:09 +02:00
2024-03-10 14:52:35 +01:00
static constexpr StringId ride_list_statusbar_count_strings [ PAGE_COUNT ] = {
STR_NUMBER_RIDES ,
STR_NUMBER_SHOPS_AND_STALLS ,
STR_NUMBER_TOILETS_AND_INFORMATION_KIOSKS ,
} ;
2016-07-14 14:07:49 +02:00
2024-03-10 14:52:35 +01:00
static constexpr bool ride_info_type_money_mapping [ DROPDOWN_LIST_COUNT ] = {
false , // Status
false , // Popularity
false , // Satisfaction
true , // Profit
false , // Total customers
true , // Total profit
false , // Customers
false , // Age
true , // Income
true , // Running_cost
false , // Queue length
false , // Queue time
false , // Reliability
false , // Down time
false , // Guests favourite
false , // Excitement
false , // Intensity
false , // Nausea
} ;
2023-05-21 22:03:42 +02:00
2024-03-10 14:52:35 +01:00
static constexpr StringId page_names [ ] = {
STR_RIDES ,
STR_SHOPS_AND_STALLS ,
STR_TOILETS_AND_INFORMATION_KIOSKS ,
2023-05-21 22:03:42 +02:00
} ;
2017-06-06 23:24:18 +02:00
2024-03-10 14:52:35 +01:00
class RideListWindow final : public Window
2018-06-22 23:21:44 +02:00
{
2024-03-10 14:52:35 +01:00
private :
bool _quickDemolishMode = false ;
int32_t _windowRideListInformationType = INFORMATION_TYPE_STATUS ;
2020-06-13 23:36:43 +02:00
2024-03-10 14:52:35 +01:00
struct RideListEntry
2021-11-07 12:05:14 +01:00
{
2024-03-10 14:52:35 +01:00
RideId Id ;
u8string Name ;
} ;
std : : vector < RideListEntry > _rideList ;
public :
void OnOpen ( ) override
2021-11-07 12:05:14 +01:00
{
2024-03-10 14:52:35 +01:00
widgets = _rideListWidgets ;
WindowInitScrollWidgets ( * this ) ;
page = PAGE_RIDES ;
selected_list_item = - 1 ;
frame_no = 0 ;
min_width = 340 ;
min_height = 240 ;
max_width = 400 ;
max_height = 700 ;
RefreshList ( ) ;
2014-04-19 04:16:20 +02:00
2024-03-10 14:52:35 +01:00
list_information_type = 0 ;
2023-06-26 03:21:54 +02:00
2024-03-10 14:52:35 +01:00
_windowRideListInformationType = INFORMATION_TYPE_STATUS ;
_quickDemolishMode = false ;
}
2023-06-26 03:21:54 +02:00
2024-03-10 14:52:35 +01:00
/**
*
* rct2 : 0x006B38A7
*/
void OnResize ( ) override
2021-11-07 12:05:14 +01:00
{
2024-03-10 14:52:35 +01:00
if ( width < min_width )
{
Invalidate ( ) ;
width = min_width ;
}
if ( height < min_height )
{
Invalidate ( ) ;
height = min_height ;
}
widgets [ WIDX_SORT ] . left = width - 60 ;
widgets [ WIDX_SORT ] . right = width - 60 + 54 ;
2024-04-14 19:27:32 +02:00
ResizeDropdown ( WIDX_CURRENT_INFORMATION_TYPE , { 150 , 46 } , { width - 216 , kDropdownHeight } ) ;
2024-03-10 14:52:35 +01:00
// Refreshing the list can be a very intensive operation
// owing to its use of ride_has_any_track_elements().
// This makes sure it's only refreshed every 64 ticks.
if ( ! ( gCurrentRealTimeTicks & 0x3f ) )
{
RefreshList ( ) ;
}
2021-11-07 12:05:14 +01:00
}
2017-06-06 23:24:18 +02:00
2024-03-10 14:52:35 +01:00
/**
*
* rct2 : 0x006B3511
*/
void OnMouseUp ( WidgetIndex widgetIndex ) override
2021-11-07 12:05:14 +01:00
{
2024-03-10 14:52:35 +01:00
switch ( widgetIndex )
{
case WIDX_CLOSE :
WindowClose ( * this ) ;
break ;
case WIDX_SORT :
list_information_type = _windowRideListInformationType ;
2021-11-07 12:05:14 +01:00
selected_list_item = - 1 ;
2024-03-10 14:52:35 +01:00
RefreshList ( ) ;
break ;
case WIDX_TAB_1 :
case WIDX_TAB_2 :
case WIDX_TAB_3 :
if ( page ! = widgetIndex - WIDX_TAB_1 )
2021-11-07 12:05:14 +01:00
{
2024-03-10 14:52:35 +01:00
page = widgetIndex - WIDX_TAB_1 ;
frame_no = 0 ;
selected_list_item = - 1 ;
if ( page ! = PAGE_RIDES & & _windowRideListInformationType > INFORMATION_TYPE_RUNNING_COST )
{
_windowRideListInformationType = INFORMATION_TYPE_STATUS ;
}
RefreshList ( ) ;
2021-11-07 12:05:14 +01:00
}
2024-03-10 14:52:35 +01:00
break ;
case WIDX_CLOSE_LIGHT :
CloseAllRides ( ) ;
break ;
case WIDX_OPEN_LIGHT :
OpenAllRides ( ) ;
break ;
case WIDX_QUICK_DEMOLISH :
if ( NetworkGetMode ( ) ! = NETWORK_MODE_CLIENT )
{
_quickDemolishMode = ! _quickDemolishMode ;
}
else
{
_quickDemolishMode = false ;
}
Invalidate ( ) ;
break ;
}
}
/**
*
* rct2 : 0x006B3532
*/
void OnMouseDown ( WidgetIndex widgetIndex ) override
{
if ( widgetIndex = = WIDX_OPEN_CLOSE_ALL )
{
const auto & widget = widgets [ widgetIndex ] ;
gDropdownItems [ 0 ] . Format = STR_CLOSE_ALL ;
gDropdownItems [ 1 ] . Format = STR_OPEN_ALL ;
WindowDropdownShowText (
{ windowPos . x + widget . left , windowPos . y + widget . top } , widget . height ( ) , colours [ 1 ] , 0 , 2 ) ;
}
else if ( widgetIndex = = WIDX_INFORMATION_TYPE_DROPDOWN )
{
const auto & widget = widgets [ widgetIndex - 1 ] ;
int32_t lastType ;
if ( page = = PAGE_RIDES )
lastType = INFORMATION_TYPE_NAUSEA ;
else
lastType = INFORMATION_TYPE_RUNNING_COST ;
int32_t numItems = 0 ;
int32_t selectedIndex = - 1 ;
for ( int32_t type = INFORMATION_TYPE_STATUS ; type < = lastType ; type + + )
2021-11-07 12:05:14 +01:00
{
2024-03-26 21:35:55 +01:00
if ( ( GetGameState ( ) . Park . Flags & PARK_FLAGS_NO_MONEY ) )
2024-03-10 14:52:35 +01:00
{
if ( ride_info_type_money_mapping [ type ] )
{
continue ;
}
}
if ( type = = _windowRideListInformationType )
{
selectedIndex = numItems ;
}
gDropdownItems [ numItems ] . Format = STR_DROPDOWN_MENU_LABEL ;
gDropdownItems [ numItems ] . Args = ride_info_type_string_mapping [ type ] ;
numItems + + ;
2021-11-07 12:05:14 +01:00
}
2024-03-10 14:52:35 +01:00
WindowDropdownShowTextCustomWidth (
{ windowPos . x + widget . left , windowPos . y + widget . top } , widget . height ( ) , colours [ 1 ] , 0 ,
Dropdown : : Flag : : StayOpen , numItems , widget . width ( ) - 3 ) ;
if ( selectedIndex ! = - 1 )
2021-11-07 12:05:14 +01:00
{
2024-03-10 14:52:35 +01:00
Dropdown : : SetChecked ( selectedIndex , true ) ;
2021-11-07 12:05:14 +01:00
}
2024-03-10 14:52:35 +01:00
}
2021-11-07 12:05:14 +01:00
}
2014-04-20 04:31:54 +02:00
2024-03-10 14:52:35 +01:00
/**
*
* rct2 : 0x006B3547
*/
void OnDropdown ( WidgetIndex widgetIndex , int32_t dropdownIndex ) override
2021-11-07 12:05:14 +01:00
{
2024-03-10 14:52:35 +01:00
if ( widgetIndex = = WIDX_OPEN_CLOSE_ALL )
{
if ( dropdownIndex = = 0 )
{
CloseAllRides ( ) ;
}
else if ( dropdownIndex = = 1 )
{
OpenAllRides ( ) ;
}
2017-06-06 23:24:18 +02:00
2024-03-10 14:52:35 +01:00
Invalidate ( ) ;
}
else if ( widgetIndex = = WIDX_INFORMATION_TYPE_DROPDOWN )
2018-06-22 23:21:44 +02:00
{
2024-03-10 14:52:35 +01:00
if ( dropdownIndex = = - 1 )
return ;
int32_t informationType = INFORMATION_TYPE_STATUS ;
uint32_t arg = static_cast < uint32_t > ( gDropdownItems [ dropdownIndex ] . Args ) ;
for ( size_t i = 0 ; i < std : : size ( ride_info_type_string_mapping ) ; i + + )
2021-11-07 12:05:14 +01:00
{
2024-03-10 14:52:35 +01:00
if ( arg = = ride_info_type_string_mapping [ i ] )
2021-11-07 12:05:14 +01:00
{
2024-03-10 14:52:35 +01:00
informationType = static_cast < int32_t > ( i ) ;
2021-11-07 12:05:14 +01:00
}
}
2024-03-10 14:52:35 +01:00
_windowRideListInformationType = informationType ;
Invalidate ( ) ;
}
}
2021-11-07 12:05:14 +01:00
2024-03-10 14:52:35 +01:00
/**
*
* rct2 : 0x006B386B
*/
void OnUpdate ( ) override
{
frame_no = ( frame_no + 1 ) % 64 ;
WidgetInvalidate ( * this , WIDX_TAB_1 + page ) ;
if ( _windowRideListInformationType ! = INFORMATION_TYPE_STATUS )
Invalidate ( ) ;
}
/**
*
* rct2 : 0x006B35A1
*/
ScreenSize OnScrollGetSize ( int32_t scrollIndex ) override
{
2024-04-14 19:27:32 +02:00
const auto newHeight = static_cast < int32_t > ( _rideList . size ( ) * SCROLLABLE_ROW_HEIGHT ) ;
2024-03-10 14:52:35 +01:00
if ( selected_list_item ! = - 1 )
{
selected_list_item = - 1 ;
Invalidate ( ) ;
2017-06-06 23:24:18 +02:00
}
2024-03-10 14:52:35 +01:00
auto top = newHeight - widgets [ WIDX_LIST ] . bottom + widgets [ WIDX_LIST ] . top + 21 ;
if ( top < 0 )
top = 0 ;
if ( top < scrolls [ 0 ] . v_top )
2018-06-22 23:21:44 +02:00
{
2024-03-10 14:52:35 +01:00
scrolls [ 0 ] . v_top = top ;
Invalidate ( ) ;
2017-06-06 23:24:18 +02:00
}
2024-03-10 14:52:35 +01:00
return { 0 , newHeight } ;
2017-06-06 23:24:18 +02:00
}
2014-04-19 04:16:20 +02:00
2024-03-10 14:52:35 +01:00
/**
*
* rct2 : 0x006B361F
*/
void OnScrollMouseDown ( int32_t scrollIndex , const ScreenCoordsXY & screenCoords ) override
2017-11-20 17:08:14 +01:00
{
2024-04-14 19:27:32 +02:00
const auto index = screenCoords . y / SCROLLABLE_ROW_HEIGHT ;
2024-03-10 14:52:35 +01:00
if ( index < 0 | | static_cast < size_t > ( index ) > = _rideList . size ( ) )
return ;
// Open ride window
const auto selectedRideId = _rideList [ index ] . Id ;
if ( _quickDemolishMode & & NetworkGetMode ( ) ! = NETWORK_MODE_CLIENT )
2021-11-07 12:05:14 +01:00
{
2024-03-10 14:52:35 +01:00
auto gameAction = RideDemolishAction ( selectedRideId , RIDE_MODIFY_DEMOLISH ) ;
GameActions : : Execute ( & gameAction ) ;
RefreshList ( ) ;
2021-11-07 12:05:14 +01:00
}
2024-03-10 14:52:35 +01:00
else
2021-11-07 12:05:14 +01:00
{
2024-03-10 14:52:35 +01:00
auto intent = Intent ( WindowClass : : Ride ) ;
intent . PutExtra ( INTENT_EXTRA_RIDE_ID , selectedRideId . ToUnderlying ( ) ) ;
ContextOpenIntent ( & intent ) ;
2021-11-07 12:05:14 +01:00
}
2024-03-10 14:52:35 +01:00
}
2021-11-07 12:05:14 +01:00
2024-03-10 14:52:35 +01:00
/**
*
* rct2 : 0x006B35EF
*/
void OnScrollMouseOver ( int32_t scrollIndex , const ScreenCoordsXY & screenCoords ) override
{
2024-04-14 19:27:32 +02:00
const auto index = screenCoords . y / SCROLLABLE_ROW_HEIGHT ;
2024-03-10 14:52:35 +01:00
if ( index < 0 | | static_cast < size_t > ( index ) > = _rideList . size ( ) )
return ;
selected_list_item = index ;
2021-11-07 12:05:14 +01:00
Invalidate ( ) ;
2017-11-20 17:08:14 +01:00
}
2024-03-10 14:52:35 +01:00
/**
*
* rct2 : 0x006B3182
*/
void OnPrepareDraw ( ) override
2017-11-20 17:08:14 +01:00
{
2024-03-10 14:52:35 +01:00
widgets [ WIDX_CURRENT_INFORMATION_TYPE ] . text = ride_info_type_string_mapping [ _windowRideListInformationType ] ;
2017-06-06 23:24:18 +02:00
2024-03-10 14:52:35 +01:00
// Set correct active tab
for ( int32_t i = 0 ; i < 3 ; i + + )
pressed_widgets & = ~ ( 1 < < ( WIDX_TAB_1 + i ) ) ;
pressed_widgets | = 1LL < < ( WIDX_TAB_1 + page ) ;
widgets [ WIDX_TITLE ] . text = page_names [ page ] ;
if ( _quickDemolishMode )
pressed_widgets | = ( 1uLL < < WIDX_QUICK_DEMOLISH ) ;
else
pressed_widgets & = ~ ( 1uLL < < WIDX_QUICK_DEMOLISH ) ;
ResizeFrameWithPage ( ) ;
widgets [ WIDX_LIST ] . right = width - 26 ;
widgets [ WIDX_LIST ] . bottom = height - 15 ;
widgets [ WIDX_OPEN_CLOSE_ALL ] . right = width - 2 ;
widgets [ WIDX_OPEN_CLOSE_ALL ] . left = width - 25 ;
widgets [ WIDX_CLOSE_LIGHT ] . right = width - 7 ;
widgets [ WIDX_CLOSE_LIGHT ] . left = width - 20 ;
widgets [ WIDX_OPEN_LIGHT ] . right = width - 7 ;
widgets [ WIDX_OPEN_LIGHT ] . left = width - 20 ;
widgets [ WIDX_QUICK_DEMOLISH ] . right = width - 2 ;
widgets [ WIDX_QUICK_DEMOLISH ] . left = width - 25 ;
if ( ThemeGetFlags ( ) & UITHEME_FLAG_USE_LIGHTS_RIDE )
2017-11-20 17:08:14 +01:00
{
2024-03-10 14:52:35 +01:00
widgets [ WIDX_OPEN_CLOSE_ALL ] . type = WindowWidgetType : : Empty ;
widgets [ WIDX_CLOSE_LIGHT ] . type = WindowWidgetType : : ImgBtn ;
widgets [ WIDX_OPEN_LIGHT ] . type = WindowWidgetType : : ImgBtn ;
const auto & rideManager = GetRideManager ( ) ;
auto allClosed = true ;
auto allOpen = false ;
if ( _rideList . size ( ) > 0 & & std : : size ( rideManager ) ! = 0 )
2021-11-07 12:05:14 +01:00
{
2024-03-10 14:52:35 +01:00
auto c = static_cast < RideClassification > ( page ) ;
allClosed = std : : none_of ( rideManager . begin ( ) , rideManager . end ( ) , [ c ] ( const Ride & rideRef ) {
return rideRef . GetClassification ( ) = = c & & rideRef . status = = RideStatus : : Open ;
} ) ;
allOpen = std : : none_of ( rideManager . begin ( ) , rideManager . end ( ) , [ c ] ( const Ride & rideRef ) {
return rideRef . GetClassification ( ) = = c & & rideRef . status ! = RideStatus : : Open ;
} ) ;
2021-11-07 12:05:14 +01:00
}
2014-04-19 04:16:20 +02:00
2024-03-10 14:52:35 +01:00
const auto closeLightImage (
SPR_G2_RCT1_CLOSE_BUTTON_0 + ( allClosed ? 1 : 0 ) * 2 + WidgetIsPressed ( * this , WIDX_CLOSE_LIGHT ) ) ;
widgets [ WIDX_CLOSE_LIGHT ] . image = ImageId ( closeLightImage ) ;
const auto openLightImage = SPR_G2_RCT1_OPEN_BUTTON_0 + ( allOpen ? 1 : 0 ) * 2
+ WidgetIsPressed ( * this , WIDX_OPEN_LIGHT ) ;
widgets [ WIDX_OPEN_LIGHT ] . image = ImageId ( openLightImage ) ;
widgets [ WIDX_QUICK_DEMOLISH ] . top = widgets [ WIDX_OPEN_LIGHT ] . bottom + 3 ;
}
else
{
widgets [ WIDX_OPEN_CLOSE_ALL ] . type = WindowWidgetType : : FlatBtn ;
widgets [ WIDX_CLOSE_LIGHT ] . type = WindowWidgetType : : Empty ;
widgets [ WIDX_OPEN_LIGHT ] . type = WindowWidgetType : : Empty ;
widgets [ WIDX_QUICK_DEMOLISH ] . top = widgets [ WIDX_OPEN_CLOSE_ALL ] . bottom + 3 ;
}
widgets [ WIDX_QUICK_DEMOLISH ] . bottom = widgets [ WIDX_QUICK_DEMOLISH ] . top + 23 ;
widgets [ WIDX_QUICK_DEMOLISH ] . type = NetworkGetMode ( ) ! = NETWORK_MODE_CLIENT ? WindowWidgetType : : FlatBtn
: WindowWidgetType : : Empty ;
2021-11-07 12:05:14 +01:00
}
2017-06-06 23:24:18 +02:00
2024-03-10 14:52:35 +01:00
/**
*
* rct2 : 0x006B3235
*/
void OnDraw ( DrawPixelInfo & dpi ) override
2021-11-07 12:05:14 +01:00
{
2024-03-10 14:52:35 +01:00
WindowDrawWidgets ( * this , dpi ) ;
DrawTabImages ( dpi ) ;
// Draw number of attractions on bottom
auto ft = Formatter ( ) ;
ft . Add < uint16_t > ( static_cast < uint16_t > ( _rideList . size ( ) ) ) ;
DrawTextBasic (
dpi , windowPos + ScreenCoordsXY { 4 , widgets [ WIDX_LIST ] . bottom + 2 } , ride_list_statusbar_count_strings [ page ] ,
ft ) ;
2021-11-07 12:05:14 +01:00
}
2014-04-23 18:29:16 +02:00
2024-03-10 14:52:35 +01:00
/**
*
* rct2 : 0x006B3240
*/
void OnScrollDraw ( int32_t scrollIndex , DrawPixelInfo & dpi ) override
2018-06-22 23:21:44 +02:00
{
2024-03-10 14:52:35 +01:00
auto dpiCoords = ScreenCoordsXY { dpi . x , dpi . y } ;
GfxFillRect (
dpi , { dpiCoords , dpiCoords + ScreenCoordsXY { dpi . width , dpi . height } } , ColourMapA [ colours [ 1 ] ] . mid_light ) ;
2019-08-03 19:11:30 +02:00
2024-03-10 14:52:35 +01:00
auto y = 0 ;
for ( size_t i = 0 ; i < _rideList . size ( ) ; i + + )
{
StringId format = ( _quickDemolishMode ? STR_RED_STRINGID : STR_BLACK_STRING ) ;
if ( i = = static_cast < size_t > ( selected_list_item ) )
{
// Background highlight
2024-04-14 19:27:32 +02:00
GfxFilterRect ( dpi , { 0 , y , 800 , y + SCROLLABLE_ROW_HEIGHT - 1 } , FilterPaletteID : : PaletteDarken1 ) ;
2024-03-10 14:52:35 +01:00
format = ( _quickDemolishMode ? STR_LIGHTPINK_STRINGID : STR_WINDOW_COLOUR_2_STRINGID ) ;
}
2021-11-07 12:05:14 +01:00
2024-03-10 14:52:35 +01:00
// Get ride
const auto * ridePtr = GetRide ( _rideList [ i ] . Id ) ;
if ( ridePtr = = nullptr )
continue ;
// Ride name
auto ft = Formatter ( ) ;
ridePtr - > FormatNameTo ( ft ) ;
DrawTextEllipsised ( dpi , { 0 , y - 1 } , 159 , format , ft ) ;
// Ride information
ft = Formatter ( ) ;
ft . Increment ( 2 ) ;
auto formatSecondaryEnabled = true ;
StringId formatSecondary = 0 ;
switch ( _windowRideListInformationType )
{
case INFORMATION_TYPE_STATUS :
formatSecondaryEnabled = false ;
ft . Rewind ( ) ;
ridePtr - > FormatStatusTo ( ft ) ;
// Make test red and bold if broken down or crashed
if ( ( ridePtr - > lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN )
| | ( ridePtr - > lifecycle_flags & RIDE_LIFECYCLE_CRASHED ) )
{
format = STR_RED_OUTLINED_STRING ;
}
break ;
case INFORMATION_TYPE_POPULARITY :
formatSecondary = STR_POPULARITY_UNKNOWN_LABEL ;
if ( ridePtr - > popularity ! = 255 )
{
formatSecondary = STR_POPULARITY_LABEL ;
ft . Add < uint16_t > ( ridePtr - > popularity * 4 ) ;
}
break ;
case INFORMATION_TYPE_SATISFACTION :
formatSecondary = STR_SATISFACTION_UNKNOWN_LABEL ;
if ( ridePtr - > satisfaction ! = 255 )
{
formatSecondary = STR_SATISFACTION_LABEL ;
ft . Add < uint16_t > ( ridePtr - > satisfaction * 5 ) ;
}
break ;
case INFORMATION_TYPE_PROFIT :
formatSecondary = 0 ;
if ( ridePtr - > profit ! = kMoney64Undefined )
{
formatSecondary = STR_PROFIT_LABEL ;
ft . Add < money64 > ( ridePtr - > profit ) ;
}
break ;
case INFORMATION_TYPE_TOTAL_CUSTOMERS :
formatSecondary = STR_RIDE_LIST_TOTAL_CUSTOMERS_LABEL ;
ft . Add < uint32_t > ( ridePtr - > total_customers ) ;
break ;
case INFORMATION_TYPE_TOTAL_PROFIT :
formatSecondary = 0 ;
if ( ridePtr - > total_profit ! = kMoney64Undefined )
{
formatSecondary = STR_RIDE_LIST_TOTAL_PROFIT_LABEL ;
ft . Add < money64 > ( ridePtr - > total_profit ) ;
}
break ;
case INFORMATION_TYPE_CUSTOMERS :
formatSecondary = STR_RIDE_LIST_CUSTOMERS_PER_HOUR_LABEL ;
ft . Add < uint32_t > ( RideCustomersPerHour ( * ridePtr ) ) ;
break ;
case INFORMATION_TYPE_AGE :
{
const auto age = DateGetYear ( ridePtr - > GetAge ( ) ) ;
switch ( age )
{
case 0 :
formatSecondary = STR_RIDE_LIST_BUILT_THIS_YEAR_LABEL ;
break ;
case 1 :
formatSecondary = STR_RIDE_LIST_BUILT_LAST_YEAR_LABEL ;
break ;
default :
formatSecondary = STR_RIDE_LIST_BUILT_X_YEARS_AGO_LABEL ;
break ;
}
ft . Add < int16_t > ( age ) ;
break ;
}
case INFORMATION_TYPE_INCOME :
formatSecondary = 0 ;
if ( ridePtr - > income_per_hour ! = kMoney64Undefined )
{
formatSecondary = STR_RIDE_LIST_INCOME_LABEL ;
ft . Add < money64 > ( ridePtr - > income_per_hour ) ;
}
break ;
case INFORMATION_TYPE_RUNNING_COST :
formatSecondary = STR_RIDE_LIST_RUNNING_COST_UNKNOWN ;
if ( ridePtr - > upkeep_cost ! = kMoney64Undefined )
{
formatSecondary = STR_RIDE_LIST_RUNNING_COST_LABEL ;
ft . Add < money64 > ( ridePtr - > upkeep_cost * 16 ) ;
}
break ;
case INFORMATION_TYPE_QUEUE_LENGTH :
{
const auto queueLength = ridePtr - > GetTotalQueueLength ( ) ;
ft . Add < uint16_t > ( queueLength ) ;
if ( queueLength = = 1 )
{
formatSecondary = STR_QUEUE_ONE_PERSON ;
}
else if ( queueLength > 1 )
{
formatSecondary = STR_QUEUE_PEOPLE ;
}
else
{
formatSecondary = STR_QUEUE_EMPTY ;
}
break ;
}
case INFORMATION_TYPE_QUEUE_TIME :
{
const auto maxQueueTime = ridePtr - > GetMaxQueueTime ( ) ;
ft . Add < uint16_t > ( maxQueueTime ) ;
if ( maxQueueTime > 1 )
{
formatSecondary = STR_QUEUE_TIME_PLURAL_LABEL ;
}
else
{
formatSecondary = STR_QUEUE_TIME_LABEL ;
}
break ;
}
case INFORMATION_TYPE_RELIABILITY :
ft . Add < uint16_t > ( ridePtr - > reliability_percentage ) ;
formatSecondary = STR_RELIABILITY_LABEL ;
break ;
case INFORMATION_TYPE_DOWN_TIME :
ft . Add < uint16_t > ( ridePtr - > downtime ) ;
formatSecondary = STR_DOWN_TIME_LABEL ;
break ;
case INFORMATION_TYPE_GUESTS_FAVOURITE :
formatSecondary = 0 ;
if ( ridePtr - > IsRide ( ) )
{
ft . Add < uint32_t > ( ridePtr - > guests_favourite ) ;
formatSecondary = ridePtr - > guests_favourite = = 1 ? STR_GUESTS_FAVOURITE_LABEL
: STR_GUESTS_FAVOURITE_PLURAL_LABEL ;
}
break ;
case INFORMATION_TYPE_EXCITEMENT :
formatSecondary = STR_RATING_UKNOWN_LABEL ;
if ( RideHasRatings ( * ridePtr ) )
{
formatSecondary = STR_EXCITEMENT_LABEL ;
ft . Add < uint16_t > ( ridePtr - > excitement ) ;
}
break ;
case INFORMATION_TYPE_INTENSITY :
formatSecondary = STR_RATING_UKNOWN_LABEL ;
if ( RideHasRatings ( * ridePtr ) )
{
formatSecondary = STR_INTENSITY_LABEL ;
ft . Add < uint16_t > ( ridePtr - > intensity ) ;
}
break ;
case INFORMATION_TYPE_NAUSEA :
formatSecondary = STR_RATING_UKNOWN_LABEL ;
if ( RideHasRatings ( * ridePtr ) )
{
formatSecondary = STR_NAUSEA_LABEL ;
ft . Add < uint16_t > ( ridePtr - > nausea ) ;
}
break ;
}
2021-11-07 12:05:14 +01:00
2024-03-10 14:52:35 +01:00
if ( formatSecondaryEnabled )
{
ft . Rewind ( ) ;
ft . Add < StringId > ( formatSecondary ) ;
}
DrawTextEllipsised ( dpi , { 160 , y - 1 } , 157 , format , ft ) ;
2024-04-14 19:27:32 +02:00
y + = SCROLLABLE_ROW_HEIGHT ;
2024-03-10 14:52:35 +01:00
}
2021-11-07 12:05:14 +01:00
}
2024-03-10 14:52:35 +01:00
void RefreshListWrapper ( )
2021-11-07 12:05:14 +01:00
{
2024-03-10 14:52:35 +01:00
RefreshList ( ) ;
2021-11-07 12:05:14 +01:00
}
2014-04-19 04:16:20 +02:00
2024-03-10 14:52:35 +01:00
private :
/**
*
* rct2 : 0x006B38EA
*/
void DrawTabImages ( DrawPixelInfo & dpi )
2021-11-07 12:05:14 +01:00
{
2024-03-10 14:52:35 +01:00
int32_t sprite_idx ;
2018-06-22 23:21:44 +02:00
2024-03-10 14:52:35 +01:00
// Rides tab
sprite_idx = SPR_TAB_RIDE_0 ;
if ( page = = PAGE_RIDES )
sprite_idx + = frame_no / 4 ;
GfxDrawSprite (
dpi , ImageId ( sprite_idx ) , windowPos + ScreenCoordsXY { widgets [ WIDX_TAB_1 ] . left , widgets [ WIDX_TAB_1 ] . top } ) ;
// Shops and stalls tab
sprite_idx = SPR_TAB_SHOPS_AND_STALLS_0 ;
if ( page = = PAGE_SHOPS_AND_STALLS )
sprite_idx + = frame_no / 4 ;
GfxDrawSprite (
dpi , ImageId ( sprite_idx ) , windowPos + ScreenCoordsXY { widgets [ WIDX_TAB_2 ] . left , widgets [ WIDX_TAB_2 ] . top } ) ;
// Information kiosks and facilities tab
sprite_idx = SPR_TAB_KIOSKS_AND_FACILITIES_0 ;
if ( page = = PAGE_KIOSKS_AND_FACILITIES )
sprite_idx + = ( frame_no / 4 ) % 8 ;
GfxDrawSprite (
dpi , ImageId ( sprite_idx ) , windowPos + ScreenCoordsXY { widgets [ WIDX_TAB_3 ] . left , widgets [ WIDX_TAB_3 ] . top } ) ;
2017-06-06 23:24:18 +02:00
}
2024-03-10 14:52:35 +01:00
/**
* Used in RefreshList ( ) to handle the sorting of the list .
* Uses a lambda function ( predicate ) as exit criteria for the algorithm .
*/
template < typename TSortPred > void SortListByPredicate ( const TSortPred & pred )
2019-07-31 20:50:06 +02:00
{
2024-03-10 14:52:35 +01:00
std : : sort ( _rideList . begin ( ) , _rideList . end ( ) , [ & pred ] ( const auto & lhs , const auto & rhs ) {
const Ride * rideLhs = GetRide ( lhs . Id ) ;
const Ride * rideRhs = GetRide ( rhs . Id ) ;
if ( rideLhs = = nullptr | | rideRhs = = nullptr )
{
return false ;
}
return ! pred ( * rideLhs , * rideRhs ) ;
} ) ;
2019-07-31 20:50:06 +02:00
}
2014-04-20 04:31:54 +02:00
2024-03-10 14:52:35 +01:00
void SortListByName ( )
{
std : : sort ( _rideList . begin ( ) , _rideList . end ( ) , [ ] ( const auto & lhs , const auto & rhs ) {
return ! ( 0 < = StrLogicalCmp ( lhs . Name . c_str ( ) , rhs . Name . c_str ( ) ) ) ;
} ) ;
}
2017-06-06 23:24:18 +02:00
2024-03-10 14:52:35 +01:00
/**
*
* rct2 : 0x006B39A8
*/
void RefreshList ( )
2018-06-22 23:21:44 +02:00
{
2024-03-10 14:52:35 +01:00
_rideList . clear ( ) ;
for ( auto & rideRef : GetRideManager ( ) )
2021-11-07 12:05:14 +01:00
{
2024-03-10 14:52:35 +01:00
if ( rideRef . GetClassification ( ) ! = static_cast < RideClassification > ( page )
| | ( rideRef . status = = RideStatus : : Closed & & ! RideHasAnyTrackElements ( rideRef ) ) )
{
continue ;
}
2017-06-06 23:24:18 +02:00
2024-03-10 14:52:35 +01:00
if ( rideRef . window_invalidate_flags & RIDE_INVALIDATE_RIDE_LIST )
{
rideRef . window_invalidate_flags & = ~ RIDE_INVALIDATE_RIDE_LIST ;
}
2021-11-07 12:05:14 +01:00
2024-03-10 14:52:35 +01:00
RideListEntry entry { } ;
entry . Id = rideRef . id ;
entry . Name = rideRef . GetName ( ) ;
_rideList . push_back ( std : : move ( entry ) ) ;
}
switch ( list_information_type )
2019-07-21 02:28:33 +02:00
{
2021-11-07 12:05:14 +01:00
case INFORMATION_TYPE_STATUS :
2024-03-10 14:52:35 +01:00
SortListByName ( ) ;
2021-11-07 12:05:14 +01:00
break ;
case INFORMATION_TYPE_POPULARITY :
2024-03-10 14:52:35 +01:00
SortListByPredicate ( [ ] ( const Ride & thisRide , const Ride & otherRide ) - > bool {
return thisRide . popularity * 4 < = otherRide . popularity * 4 ;
} ) ;
2021-11-07 12:05:14 +01:00
break ;
case INFORMATION_TYPE_SATISFACTION :
2024-03-10 14:52:35 +01:00
SortListByPredicate ( [ ] ( const Ride & thisRide , const Ride & otherRide ) - > bool {
return thisRide . satisfaction * 5 < = otherRide . satisfaction * 5 ;
} ) ;
2021-11-07 12:05:14 +01:00
break ;
case INFORMATION_TYPE_PROFIT :
2024-03-10 14:52:35 +01:00
SortListByPredicate ( [ ] ( const Ride & thisRide , const Ride & otherRide ) - > bool {
return thisRide . profit < = otherRide . profit ;
} ) ;
2021-11-07 12:05:14 +01:00
break ;
case INFORMATION_TYPE_TOTAL_CUSTOMERS :
2024-03-10 14:52:35 +01:00
SortListByPredicate ( [ ] ( const Ride & thisRide , const Ride & otherRide ) - > bool {
return thisRide . total_customers < = otherRide . total_customers ;
} ) ;
2021-11-07 12:05:14 +01:00
break ;
case INFORMATION_TYPE_TOTAL_PROFIT :
2024-03-10 14:52:35 +01:00
SortListByPredicate ( [ ] ( const Ride & thisRide , const Ride & otherRide ) - > bool {
return thisRide . total_profit < = otherRide . total_profit ;
} ) ;
2021-11-07 12:05:14 +01:00
break ;
case INFORMATION_TYPE_CUSTOMERS :
2024-03-10 14:52:35 +01:00
SortListByPredicate ( [ ] ( const Ride & thisRide , const Ride & otherRide ) - > bool {
return RideCustomersPerHour ( thisRide ) < = RideCustomersPerHour ( otherRide ) ;
} ) ;
2021-11-07 12:05:14 +01:00
break ;
case INFORMATION_TYPE_AGE :
2024-03-10 14:52:35 +01:00
SortListByPredicate ( [ ] ( const Ride & thisRide , const Ride & otherRide ) - > bool {
return thisRide . build_date < = otherRide . build_date ;
} ) ;
2021-11-07 12:05:14 +01:00
break ;
case INFORMATION_TYPE_INCOME :
2024-03-10 14:52:35 +01:00
SortListByPredicate ( [ ] ( const Ride & thisRide , const Ride & otherRide ) - > bool {
return thisRide . income_per_hour < = otherRide . income_per_hour ;
} ) ;
2021-11-07 12:05:14 +01:00
break ;
case INFORMATION_TYPE_RUNNING_COST :
2024-03-10 14:52:35 +01:00
SortListByPredicate ( [ ] ( const Ride & thisRide , const Ride & otherRide ) - > bool {
return thisRide . upkeep_cost < = otherRide . upkeep_cost ;
} ) ;
2021-11-07 12:05:14 +01:00
break ;
case INFORMATION_TYPE_QUEUE_LENGTH :
2024-03-10 14:52:35 +01:00
SortListByPredicate ( [ ] ( const Ride & thisRide , const Ride & otherRide ) - > bool {
return thisRide . GetTotalQueueLength ( ) < = otherRide . GetTotalQueueLength ( ) ;
} ) ;
2021-11-07 12:05:14 +01:00
break ;
case INFORMATION_TYPE_QUEUE_TIME :
2024-03-10 14:52:35 +01:00
SortListByPredicate ( [ ] ( const Ride & thisRide , const Ride & otherRide ) - > bool {
return thisRide . GetMaxQueueTime ( ) < = otherRide . GetMaxQueueTime ( ) ;
} ) ;
2021-11-07 12:05:14 +01:00
break ;
case INFORMATION_TYPE_RELIABILITY :
2024-03-10 14:52:35 +01:00
SortListByPredicate ( [ ] ( const Ride & thisRide , const Ride & otherRide ) - > bool {
return thisRide . reliability_percentage < = otherRide . reliability_percentage ;
} ) ;
2021-11-07 12:05:14 +01:00
break ;
case INFORMATION_TYPE_DOWN_TIME :
2024-03-10 14:52:35 +01:00
SortListByPredicate ( [ ] ( const Ride & thisRide , const Ride & otherRide ) - > bool {
return thisRide . downtime < = otherRide . downtime ;
} ) ;
2021-11-07 12:05:14 +01:00
break ;
case INFORMATION_TYPE_GUESTS_FAVOURITE :
2024-03-10 14:52:35 +01:00
SortListByPredicate ( [ ] ( const Ride & thisRide , const Ride & otherRide ) - > bool {
return thisRide . guests_favourite < = otherRide . guests_favourite ;
} ) ;
2021-11-07 12:05:14 +01:00
break ;
2022-03-11 12:17:14 +01:00
case INFORMATION_TYPE_EXCITEMENT :
2024-03-10 14:52:35 +01:00
SortListByPredicate ( [ ] ( const Ride & thisRide , const Ride & otherRide ) - > bool {
return thisRide . excitement < = otherRide . excitement ;
} ) ;
2022-03-11 12:17:14 +01:00
break ;
case INFORMATION_TYPE_INTENSITY :
2024-03-10 14:52:35 +01:00
SortListByPredicate ( [ ] ( const Ride & thisRide , const Ride & otherRide ) - > bool {
return thisRide . intensity < = otherRide . intensity ;
} ) ;
2022-03-11 12:17:14 +01:00
break ;
case INFORMATION_TYPE_NAUSEA :
2024-03-10 14:52:35 +01:00
SortListByPredicate ( [ ] ( const Ride & thisRide , const Ride & otherRide ) - > bool {
return thisRide . nausea < = otherRide . nausea ;
} ) ;
2022-03-11 12:17:14 +01:00
break ;
2021-11-07 12:05:14 +01:00
}
2024-03-10 14:52:35 +01:00
selected_list_item = - 1 ;
Invalidate ( ) ;
2017-06-06 23:24:18 +02:00
}
2023-05-21 22:03:42 +02:00
2024-03-10 14:52:35 +01:00
// window_ride_list_close_all
void CloseAllRides ( )
2021-11-07 12:05:14 +01:00
{
2024-03-10 14:52:35 +01:00
for ( auto & rideRef : GetRideManager ( ) )
2021-11-07 12:05:14 +01:00
{
2024-03-10 14:52:35 +01:00
if ( rideRef . status ! = RideStatus : : Closed
& & rideRef . GetClassification ( ) = = static_cast < RideClassification > ( page ) )
{
auto gameAction = RideSetStatusAction ( rideRef . id , RideStatus : : Closed ) ;
GameActions : : Execute ( & gameAction ) ;
}
2021-11-07 12:05:14 +01:00
}
}
2024-03-10 14:52:35 +01:00
// window_ride_list_open_all
void OpenAllRides ( )
2019-08-03 19:11:30 +02:00
{
2024-03-10 14:52:35 +01:00
for ( auto & rideRef : GetRideManager ( ) )
2021-11-07 12:05:14 +01:00
{
2024-03-10 14:52:35 +01:00
if ( rideRef . status ! = RideStatus : : Open & & rideRef . GetClassification ( ) = = static_cast < RideClassification > ( page ) )
{
auto gameAction = RideSetStatusAction ( rideRef . id , RideStatus : : Open ) ;
GameActions : : Execute ( & gameAction ) ;
}
2021-11-07 12:05:14 +01:00
}
2019-08-03 19:11:30 +02:00
}
2024-03-10 14:52:35 +01:00
} ;
2014-04-20 04:31:54 +02:00
2024-03-10 14:52:35 +01:00
/**
*
* rct2 : 0x006B30BC
*/
2024-03-17 07:37:46 +01:00
WindowBase * RideListOpen ( )
2018-06-22 23:21:44 +02:00
{
2024-03-10 14:52:35 +01:00
// Check if window is already open
auto * window = WindowBringToFrontByClass ( WindowClass : : RideList ) ;
if ( window = = nullptr )
2019-08-03 19:11:30 +02:00
{
2024-03-10 14:52:35 +01:00
window = WindowCreate < RideListWindow > ( WindowClass : : RideList , ScreenCoordsXY ( 32 , 32 ) , WW , WH , WF_10 | WF_RESIZABLE ) ;
2019-08-03 19:11:30 +02:00
}
2024-03-10 14:52:35 +01:00
return window ;
2017-06-06 23:24:18 +02:00
}
2021-11-07 12:05:14 +01:00
2024-03-10 14:52:35 +01:00
void WindowRideListRefreshList ( WindowBase * w )
2021-11-07 12:05:14 +01:00
{
2024-03-10 14:52:35 +01:00
dynamic_cast < RideListWindow * > ( w ) - > RefreshListWrapper ( ) ;
2021-11-07 12:05:14 +01:00
}
2024-03-10 14:52:35 +01:00
} // namespace OpenRCT2::Ui::Windows