mirror of https://github.com/OpenRCT2/OpenRCT2.git
Fix openrct2ui errors
This commit is contained in:
parent
3155c661fa
commit
3f45976009
|
@ -1181,7 +1181,8 @@ static void window_editor_objective_options_rides_scrollpaint(rct_window* w, rct
|
|||
}
|
||||
|
||||
// Ride name
|
||||
gfx_draw_string_left(dpi, stringId, &ride->name, COLOUR_BLACK, 15, y);
|
||||
ride->FormatNameTo(gCommonFormatArgs);
|
||||
gfx_draw_string_left(dpi, stringId, gCommonFormatArgs, COLOUR_BLACK, 15, y);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1191,8 +1191,14 @@ static void window_finances_marketing_paint(rct_window* w, rct_drawpixelinfo* dp
|
|||
case ADVERTISING_CAMPAIGN_RIDE:
|
||||
{
|
||||
auto ride = get_ride(campaign->RideId);
|
||||
set_format_arg(0, rct_string_id, ride->name);
|
||||
set_format_arg(2, uint32_t, ride->name_arguments);
|
||||
if (ride != nullptr)
|
||||
{
|
||||
ride->FormatNameTo(gCommonFormatArgs);
|
||||
}
|
||||
else
|
||||
{
|
||||
set_format_arg(0, rct_string_id, STR_NONE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ADVERTISING_CAMPAIGN_FOOD_OR_DRINK_FREE:
|
||||
|
|
|
@ -1702,20 +1702,15 @@ void window_guest_rides_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
|
||||
y = w->y + window_guest_rides_widgets[WIDX_PAGE_BACKGROUND].bottom - 12;
|
||||
|
||||
rct_string_id ride_string_id = STR_PEEP_FAVOURITE_RIDE_NOT_AVAILABLE;
|
||||
uint32_t ride_string_arguments = 0;
|
||||
if (peep->favourite_ride != 0xFF)
|
||||
set_format_arg(0, rct_string_id, STR_PEEP_FAVOURITE_RIDE_NOT_AVAILABLE);
|
||||
if (peep->favourite_ride != RIDE_ID_NULL)
|
||||
{
|
||||
auto ride = get_ride(peep->favourite_ride);
|
||||
if (ride != nullptr)
|
||||
{
|
||||
ride_string_arguments = ride->name_arguments;
|
||||
ride_string_id = ride->name;
|
||||
ride->FormatNameTo(gCommonFormatArgs);
|
||||
}
|
||||
}
|
||||
set_format_arg(0, rct_string_id, ride_string_id);
|
||||
set_format_arg(2, uint32_t, ride_string_arguments);
|
||||
|
||||
gfx_draw_string_left_clipped(dpi, STR_FAVOURITE_RIDE, gCommonFormatArgs, COLOUR_BLACK, x, y, w->width - 14);
|
||||
}
|
||||
|
||||
|
|
|
@ -136,6 +136,26 @@ static rct_window_event_list window_guest_list_events = {
|
|||
};
|
||||
// clang-format on
|
||||
|
||||
struct FilterArguments
|
||||
{
|
||||
uint8_t args[12]{};
|
||||
|
||||
rct_string_id GetFirstStringId()
|
||||
{
|
||||
rct_string_id firstStrId{};
|
||||
std::memcpy(&firstStrId, args, sizeof(firstStrId));
|
||||
return firstStrId;
|
||||
}
|
||||
};
|
||||
static bool operator==(const FilterArguments& l, const FilterArguments& r)
|
||||
{
|
||||
return std::memcmp(l.args, r.args, sizeof(l.args)) == 0;
|
||||
}
|
||||
static bool operator!=(const FilterArguments& l, const FilterArguments& r)
|
||||
{
|
||||
return !(l == r);
|
||||
}
|
||||
|
||||
static uint32_t _window_guest_list_last_find_groups_tick;
|
||||
static uint32_t _window_guest_list_last_find_groups_selected_view;
|
||||
static uint32_t _window_guest_list_last_find_groups_wait;
|
||||
|
@ -148,11 +168,10 @@ static uint32_t _window_guest_list_selected_view; // 0x00F1EE13
|
|||
static int32_t _window_guest_list_num_pages; // 0x00F1EE08
|
||||
static int32_t _window_guest_list_num_groups; // 0x00F1AF22
|
||||
static bool _window_guest_list_tracking_only;
|
||||
static uint16_t _window_guest_list_filter_arguments[4];
|
||||
static FilterArguments _window_guest_list_filter_arguments;
|
||||
|
||||
static uint16_t _window_guest_list_groups_num_guests[240];
|
||||
static uint32_t _window_guest_list_groups_argument_1[240];
|
||||
static uint32_t _window_guest_list_groups_argument_2[240];
|
||||
static FilterArguments _window_guest_list_groups_arguments[240];
|
||||
static uint8_t _window_guest_list_groups_guest_faces[240 * 58];
|
||||
static uint8_t _window_guest_list_group_index[240];
|
||||
|
||||
|
@ -161,7 +180,7 @@ static char _window_guest_list_filter_name[32];
|
|||
static int32_t window_guest_list_is_peep_in_filter(Peep* peep);
|
||||
static void window_guest_list_find_groups();
|
||||
|
||||
static void get_arguments_from_peep(Peep* peep, uint32_t* argument_1, uint32_t* argument_2);
|
||||
static FilterArguments get_arguments_from_peep(const Peep* peep);
|
||||
|
||||
static bool guest_should_be_visible(Peep* peep);
|
||||
|
||||
|
@ -235,61 +254,60 @@ rct_window* window_guest_list_open_with_filter(int32_t type, int32_t index)
|
|||
_window_guest_list_selected_page = 0;
|
||||
_window_guest_list_num_pages = 1;
|
||||
_window_guest_list_tracking_only = false;
|
||||
_window_guest_list_filter_arguments = {};
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case GLFT_GUESTS_ON_RIDE:
|
||||
{
|
||||
Ride* ride = get_ride(index & 0x000000FF);
|
||||
_window_guest_list_filter_arguments[0] = STR_ON_RIDE;
|
||||
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_IN_RIDE))
|
||||
auto ride = get_ride(index & 0xFF);
|
||||
if (ride != nullptr)
|
||||
{
|
||||
_window_guest_list_filter_arguments[0] = STR_IN_RIDE;
|
||||
}
|
||||
_window_guest_list_filter_arguments[1] = ride->name;
|
||||
_window_guest_list_filter_arguments[2] = ride->name_arguments_type_name;
|
||||
_window_guest_list_filter_arguments[3] = ride->name_arguments_number;
|
||||
set_format_arg_on(
|
||||
_window_guest_list_filter_arguments.args, 0, rct_string_id,
|
||||
ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_IN_RIDE) ? STR_IN_RIDE : STR_ON_RIDE);
|
||||
ride->FormatNameTo(_window_guest_list_filter_arguments.args + 2);
|
||||
|
||||
_window_guest_list_selected_filter = 0;
|
||||
_window_guest_list_highlighted_index = 0xFFFF;
|
||||
_window_guest_list_selected_tab = 0;
|
||||
_window_guest_list_selected_view = 0;
|
||||
_window_guest_list_selected_filter = 0;
|
||||
_window_guest_list_highlighted_index = 0xFFFF;
|
||||
_window_guest_list_selected_tab = 0;
|
||||
_window_guest_list_selected_view = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case GLFT_GUESTS_IN_QUEUE:
|
||||
{
|
||||
Ride* ride = get_ride(index & 0x000000FF);
|
||||
_window_guest_list_filter_arguments[0] = STR_QUEUING_FOR;
|
||||
_window_guest_list_filter_arguments[1] = ride->name;
|
||||
_window_guest_list_filter_arguments[2] = ride->name_arguments_type_name;
|
||||
_window_guest_list_filter_arguments[3] = ride->name_arguments_number;
|
||||
auto ride = get_ride(index & 0xFF);
|
||||
if (ride != nullptr)
|
||||
{
|
||||
set_format_arg_on(_window_guest_list_filter_arguments.args, 0, rct_string_id, STR_QUEUING_FOR);
|
||||
ride->FormatNameTo(_window_guest_list_filter_arguments.args + 2);
|
||||
|
||||
_window_guest_list_selected_filter = 0;
|
||||
_window_guest_list_highlighted_index = 0xFFFF;
|
||||
_window_guest_list_selected_tab = 0;
|
||||
_window_guest_list_selected_view = 0;
|
||||
_window_guest_list_selected_filter = 0;
|
||||
_window_guest_list_highlighted_index = 0xFFFF;
|
||||
_window_guest_list_selected_tab = 0;
|
||||
_window_guest_list_selected_view = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case GLFT_GUESTS_THINKING_ABOUT_RIDE:
|
||||
{
|
||||
Ride* ride = get_ride(index & 0x000000FF);
|
||||
_window_guest_list_filter_arguments[0] = STR_NONE;
|
||||
_window_guest_list_filter_arguments[1] = ride->name;
|
||||
_window_guest_list_filter_arguments[2] = ride->name_arguments_type_name;
|
||||
_window_guest_list_filter_arguments[3] = ride->name_arguments_number;
|
||||
auto ride = get_ride(index & 0xFF);
|
||||
if (ride != nullptr)
|
||||
{
|
||||
set_format_arg_on(_window_guest_list_filter_arguments.args, 0, rct_string_id, STR_NONE);
|
||||
ride->FormatNameTo(_window_guest_list_filter_arguments.args + 2);
|
||||
|
||||
_window_guest_list_selected_filter = 1;
|
||||
_window_guest_list_highlighted_index = 0xFFFF;
|
||||
_window_guest_list_selected_tab = 0;
|
||||
_window_guest_list_selected_view = 1;
|
||||
_window_guest_list_selected_filter = 1;
|
||||
_window_guest_list_highlighted_index = 0xFFFF;
|
||||
_window_guest_list_selected_tab = 0;
|
||||
_window_guest_list_selected_view = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case GLFT_GUESTS_THINKING_X:
|
||||
{
|
||||
_window_guest_list_filter_arguments[0] = PeepThoughts[(index & 0x000000FF)];
|
||||
_window_guest_list_filter_arguments[1] = 0;
|
||||
_window_guest_list_filter_arguments[2] = 0;
|
||||
_window_guest_list_filter_arguments[3] = 0;
|
||||
set_format_arg_on(_window_guest_list_filter_arguments.args, 0, rct_string_id, PeepThoughts[index & 0xFF]);
|
||||
|
||||
_window_guest_list_selected_filter = 1;
|
||||
_window_guest_list_highlighted_index = 0xFFFF;
|
||||
|
@ -572,8 +590,7 @@ static void window_guest_list_scrollmousedown(rct_window* w, int32_t scrollIndex
|
|||
i = y / SUMMARISED_GUEST_ROW_HEIGHT;
|
||||
if (i < _window_guest_list_num_groups)
|
||||
{
|
||||
std::memcpy(_window_guest_list_filter_arguments + 0, &_window_guest_list_groups_argument_1[i], 4);
|
||||
std::memcpy(_window_guest_list_filter_arguments + 2, &_window_guest_list_groups_argument_2[i], 4);
|
||||
_window_guest_list_filter_arguments = _window_guest_list_groups_arguments[i];
|
||||
_window_guest_list_selected_filter = _window_guest_list_selected_view;
|
||||
_window_guest_list_selected_tab = PAGE_INDIVIDUAL;
|
||||
window_guest_list_widgets[WIDX_TRACKING].type = WWT_FLATBTN;
|
||||
|
@ -677,7 +694,7 @@ static void window_guest_list_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
{
|
||||
if (_window_guest_list_selected_filter != -1)
|
||||
{
|
||||
if (_window_guest_list_filter_arguments[0] != 0xFFFF)
|
||||
if (_window_guest_list_filter_arguments.GetFirstStringId() != STR_NONE)
|
||||
{
|
||||
format = filterNames[_window_guest_list_selected_filter]; // Not sure whether the index will ever be 2
|
||||
}
|
||||
|
@ -695,7 +712,7 @@ static void window_guest_list_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
{
|
||||
format = STR_ALL_GUESTS_SUMMARISED;
|
||||
}
|
||||
gfx_draw_string_left_clipped(dpi, format, _window_guest_list_filter_arguments, COLOUR_BLACK, x, y, 310);
|
||||
gfx_draw_string_left_clipped(dpi, format, _window_guest_list_filter_arguments.args, COLOUR_BLACK, x, y, 310);
|
||||
|
||||
// Number of guests (list items)
|
||||
if (_window_guest_list_selected_tab == PAGE_INDIVIDUAL)
|
||||
|
@ -719,7 +736,6 @@ static void window_guest_list_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi,
|
|||
rct_string_id format;
|
||||
Peep* peep;
|
||||
rct_peep_thought* thought;
|
||||
uint32_t argument_1, argument_2;
|
||||
|
||||
// Background fill
|
||||
gfx_fill_rect(dpi, dpi->x, dpi->y, dpi->x + dpi->width - 1, dpi->y + dpi->height - 1, ColourMapA[w->colours[1]].mid_light);
|
||||
|
@ -831,14 +847,15 @@ static void window_guest_list_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi,
|
|||
j * 8, y + 12, 0);
|
||||
|
||||
// Draw action
|
||||
set_format_arg(0, uint32_t, _window_guest_list_groups_argument_1[i]);
|
||||
set_format_arg(4, uint32_t, _window_guest_list_groups_argument_2[i]);
|
||||
set_format_arg(10, uint32_t, numGuests);
|
||||
std::memcpy(
|
||||
gCommonFormatArgs, _window_guest_list_groups_arguments[i].args,
|
||||
std::min(sizeof(gCommonFormatArgs), sizeof(_window_guest_list_groups_arguments[i].args)));
|
||||
gfx_draw_string_left_clipped(dpi, format, gCommonFormatArgs, COLOUR_BLACK, 0, y, 414);
|
||||
|
||||
// Draw guest count
|
||||
set_format_arg(8, rct_string_id, STR_GUESTS_COUNT_COMMA_SEP);
|
||||
gfx_draw_string_right(dpi, format, gCommonFormatArgs + 8, COLOUR_BLACK, 326, y);
|
||||
set_format_arg(0, rct_string_id, STR_GUESTS_COUNT_COMMA_SEP);
|
||||
set_format_arg(2, uint32_t, numGuests);
|
||||
gfx_draw_string_right(dpi, format, gCommonFormatArgs, COLOUR_BLACK, 326, y);
|
||||
}
|
||||
y += SUMMARISED_GUEST_ROW_HEIGHT;
|
||||
}
|
||||
|
@ -861,21 +878,18 @@ static void window_guest_list_textinput(rct_window* w, rct_widgetindex widgetInd
|
|||
*/
|
||||
static int32_t window_guest_list_is_peep_in_filter(Peep* peep)
|
||||
{
|
||||
char temp;
|
||||
|
||||
temp = _window_guest_list_selected_view;
|
||||
char temp = _window_guest_list_selected_view;
|
||||
_window_guest_list_selected_view = _window_guest_list_selected_filter;
|
||||
uint32_t argument1, argument2;
|
||||
get_arguments_from_peep(peep, &argument1, &argument2);
|
||||
auto peepArgs = get_arguments_from_peep(peep);
|
||||
|
||||
_window_guest_list_selected_view = temp;
|
||||
|
||||
if (_window_guest_list_filter_arguments[0] == 0xFFFF && _window_guest_list_selected_filter == 1)
|
||||
argument1 |= 0xFFFF;
|
||||
if (_window_guest_list_filter_arguments.GetFirstStringId() == STR_NONE && _window_guest_list_selected_filter == 1)
|
||||
{
|
||||
set_format_arg_on(_window_guest_list_filter_arguments.args, 0, rct_string_id, STR_NONE);
|
||||
}
|
||||
|
||||
uint32_t check1 = _window_guest_list_filter_arguments[0] | (_window_guest_list_filter_arguments[1] << 16);
|
||||
uint32_t check2 = _window_guest_list_filter_arguments[2] | (_window_guest_list_filter_arguments[3] << 16);
|
||||
if (argument1 == check1 && argument2 == check2)
|
||||
if (_window_guest_list_filter_arguments == peepArgs)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -889,37 +903,27 @@ static int32_t window_guest_list_is_peep_in_filter(Peep* peep)
|
|||
* argument_1 (0x013CE952) gCommonFormatArgs
|
||||
* argument_2 (0x013CE954) gCommonFormatArgs + 2
|
||||
*/
|
||||
static void get_arguments_from_peep(Peep* peep, uint32_t* argument_1, uint32_t* argument_2)
|
||||
static FilterArguments get_arguments_from_peep(const Peep* peep)
|
||||
{
|
||||
FilterArguments result;
|
||||
switch (_window_guest_list_selected_view)
|
||||
{
|
||||
case VIEW_ACTIONS:
|
||||
get_arguments_from_action(peep, argument_1, argument_2);
|
||||
peep->FormatActionTo(result.args);
|
||||
break;
|
||||
case VIEW_THOUGHTS:
|
||||
{
|
||||
rct_peep_thought* thought = &peep->thoughts[0];
|
||||
auto thought = &peep->thoughts[0];
|
||||
if (thought->freshness <= 5 && thought->type != PEEP_THOUGHT_TYPE_NONE)
|
||||
{
|
||||
// HACK The out arguments here are used to draw the group text so we just return
|
||||
// gCommonFormatArgs as two uint32_ts.
|
||||
std::memset(gCommonFormatArgs, 0, sizeof(*argument_1) + sizeof(*argument_2));
|
||||
std::memset(gCommonFormatArgs, 0, sizeof(gCommonFormatArgs));
|
||||
peep_thought_set_format_args(thought);
|
||||
std::memcpy(argument_1, gCommonFormatArgs, sizeof(*argument_1));
|
||||
std::memcpy(argument_2, gCommonFormatArgs + sizeof(*argument_1), sizeof(*argument_2));
|
||||
}
|
||||
else
|
||||
{
|
||||
*argument_1 = 0;
|
||||
*argument_2 = 0;
|
||||
std::memcpy(result.args, gCommonFormatArgs, std::min(sizeof(gCommonFormatArgs), sizeof(result.args)));
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
*argument_1 = 0;
|
||||
*argument_2 = 0;
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -965,10 +969,8 @@ static void window_guest_list_find_groups()
|
|||
_window_guest_list_groups_num_guests[groupIndex] = 1;
|
||||
peep->flags &= ~(SPRITE_FLAGS_PEEP_VISIBLE);
|
||||
|
||||
get_arguments_from_peep(
|
||||
peep, &_window_guest_list_groups_argument_1[groupIndex], &_window_guest_list_groups_argument_2[groupIndex]);
|
||||
std::memcpy(_window_guest_list_filter_arguments + 0, &_window_guest_list_groups_argument_1[groupIndex], 4);
|
||||
std::memcpy(_window_guest_list_filter_arguments + 2, &_window_guest_list_groups_argument_2[groupIndex], 4);
|
||||
_window_guest_list_groups_arguments[groupIndex] = get_arguments_from_peep(peep);
|
||||
_window_guest_list_filter_arguments = _window_guest_list_groups_arguments[groupIndex];
|
||||
|
||||
_window_guest_list_group_index[groupIndex] = groupIndex;
|
||||
faceIndex = groupIndex * 56;
|
||||
|
@ -981,11 +983,9 @@ static void window_guest_list_find_groups()
|
|||
if (peep2->outside_of_park != 0 || !(peep2->flags & SPRITE_FLAGS_PEEP_VISIBLE))
|
||||
continue;
|
||||
|
||||
uint32_t argument1, argument2;
|
||||
// Get and check if in same group
|
||||
get_arguments_from_peep(peep2, &argument1, &argument2);
|
||||
if (argument1 != _window_guest_list_groups_argument_1[groupIndex]
|
||||
|| argument2 != _window_guest_list_groups_argument_2[groupIndex])
|
||||
auto argument12 = get_arguments_from_peep(peep2);
|
||||
if (argument12 != _window_guest_list_groups_arguments[groupIndex])
|
||||
continue;
|
||||
|
||||
// Assign guest
|
||||
|
@ -999,13 +999,13 @@ static void window_guest_list_find_groups()
|
|||
- SPR_PEEP_SMALL_FACE_VERY_VERY_UNHAPPY;
|
||||
}
|
||||
|
||||
if (_window_guest_list_filter_arguments[0] == 0)
|
||||
if (_window_guest_list_filter_arguments.GetFirstStringId() == 0)
|
||||
{
|
||||
_window_guest_list_num_groups--;
|
||||
continue;
|
||||
}
|
||||
|
||||
int32_t curr_num_guests = _window_guest_list_groups_num_guests[groupIndex];
|
||||
auto curr_num_guests = _window_guest_list_groups_num_guests[groupIndex];
|
||||
int32_t swap_position = 0;
|
||||
// This section places the groups in size order.
|
||||
bool gotoNextPeep = false;
|
||||
|
@ -1025,23 +1025,13 @@ static void window_guest_list_find_groups()
|
|||
continue;
|
||||
}
|
||||
|
||||
int32_t argument_1 = _window_guest_list_groups_argument_1[groupIndex];
|
||||
int32_t argument_2 = _window_guest_list_groups_argument_2[groupIndex];
|
||||
int32_t bl = _window_guest_list_group_index[groupIndex];
|
||||
auto arguments12 = _window_guest_list_groups_arguments[groupIndex];
|
||||
auto bl = _window_guest_list_group_index[groupIndex];
|
||||
|
||||
do
|
||||
{
|
||||
int32_t temp = curr_num_guests;
|
||||
curr_num_guests = _window_guest_list_groups_num_guests[swap_position];
|
||||
_window_guest_list_groups_num_guests[swap_position] = temp;
|
||||
|
||||
temp = argument_1;
|
||||
argument_1 = _window_guest_list_groups_argument_1[swap_position];
|
||||
_window_guest_list_groups_argument_1[swap_position] = temp;
|
||||
|
||||
temp = argument_2;
|
||||
argument_2 = _window_guest_list_groups_argument_2[swap_position];
|
||||
_window_guest_list_groups_argument_2[swap_position] = temp;
|
||||
std::swap(curr_num_guests, _window_guest_list_groups_num_guests[swap_position]);
|
||||
std::swap(arguments12, _window_guest_list_groups_arguments[swap_position]);
|
||||
|
||||
uint8_t temp_faces[56];
|
||||
std::memcpy(temp_faces, &(_window_guest_list_groups_guest_faces[groupIndex * 56]), 56);
|
||||
|
@ -1050,9 +1040,7 @@ static void window_guest_list_find_groups()
|
|||
&(_window_guest_list_groups_guest_faces[swap_position * 56]), 56);
|
||||
std::memcpy(&(_window_guest_list_groups_guest_faces[swap_position * 56]), temp_faces, 56);
|
||||
|
||||
temp = _window_guest_list_group_index[swap_position];
|
||||
_window_guest_list_group_index[swap_position] = bl;
|
||||
bl = temp;
|
||||
std::swap(bl, _window_guest_list_group_index[swap_position]);
|
||||
} while (++swap_position <= groupIndex);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -417,11 +417,15 @@ static void window_maze_construction_tooldown(rct_window* w, rct_widgetindex wid
|
|||
*/
|
||||
static void window_maze_construction_invalidate(rct_window* w)
|
||||
{
|
||||
Ride* ride = get_ride(_currentRideIndex);
|
||||
|
||||
// Set window title arguments
|
||||
set_format_arg(4, rct_string_id, ride->name);
|
||||
set_format_arg(6, uint32_t, ride->name_arguments);
|
||||
auto ride = get_ride(_currentRideIndex);
|
||||
if (ride != nullptr)
|
||||
{
|
||||
ride->FormatNameTo(gCommonFormatArgs + 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
set_format_arg(4, rct_string_id, STR_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -103,16 +103,11 @@ static int32_t ride_value_compare(const void* a, const void* b)
|
|||
|
||||
static int32_t ride_name_compare(const void* a, const void* b)
|
||||
{
|
||||
char rideAName[256], rideBName[256];
|
||||
Ride *rideA, *rideB;
|
||||
|
||||
rideA = get_ride(*((uint8_t*)a));
|
||||
rideB = get_ride(*((uint8_t*)b));
|
||||
|
||||
format_string(rideAName, 256, rideA->name, &rideA->name_arguments);
|
||||
format_string(rideBName, 256, rideB->name, &rideB->name_arguments);
|
||||
|
||||
return _strcmpi(rideAName, rideBName);
|
||||
auto rideA = get_ride(*((uint8_t*)a));
|
||||
auto rideB = get_ride(*((uint8_t*)b));
|
||||
auto rideAName = rideA->GetName();
|
||||
auto rideBName = rideB->GetName();
|
||||
return _strcmpi(rideAName.c_str(), rideBName.c_str());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -289,9 +284,12 @@ static void window_new_campaign_mousedown(rct_window* w, rct_widgetindex widgetI
|
|||
if (window_new_campaign_rides[i] == RIDE_ID_NULL)
|
||||
break;
|
||||
|
||||
Ride* ride = get_ride(window_new_campaign_rides[i]);
|
||||
auto ride = get_ride(window_new_campaign_rides[i]);
|
||||
if (ride == nullptr)
|
||||
break;
|
||||
|
||||
gDropdownItemsFormat[i] = STR_DROPDOWN_MENU_LABEL;
|
||||
gDropdownItemsArgs[i] = ((uint64_t)ride->name_arguments << 16ULL) | ride->name;
|
||||
ride->FormatNameTo(&gDropdownItemsArgs[i]);
|
||||
numItems++;
|
||||
}
|
||||
|
||||
|
@ -356,9 +354,12 @@ static void window_new_campaign_invalidate(rct_window* w)
|
|||
window_new_campaign_widgets[WIDX_RIDE_LABEL].text = STR_MARKETING_RIDE;
|
||||
if (w->campaign.ride_id != SELECTED_RIDE_UNDEFINED)
|
||||
{
|
||||
Ride* ride = get_ride(w->campaign.ride_id);
|
||||
window_new_campaign_widgets[WIDX_RIDE_DROPDOWN].text = ride->name;
|
||||
set_format_arg(0, uint32_t, ride->name_arguments);
|
||||
auto ride = get_ride(w->campaign.ride_id);
|
||||
if (ride != nullptr)
|
||||
{
|
||||
window_new_campaign_widgets[WIDX_RIDE_DROPDOWN].text = STR_STRINGID;
|
||||
ride->FormatNameTo(gCommonFormatArgs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ADVERTISING_CAMPAIGN_FOOD_OR_DRINK_FREE:
|
||||
|
|
|
@ -2569,9 +2569,8 @@ static void window_ride_main_invalidate(rct_window* w)
|
|||
if (ride->lifecycle_flags & (RIDE_LIFECYCLE_INDESTRUCTIBLE | RIDE_LIFECYCLE_INDESTRUCTIBLE_TRACK))
|
||||
w->disabled_widgets |= (1 << WIDX_DEMOLISH);
|
||||
|
||||
set_format_arg(0, rct_string_id, ride->name);
|
||||
set_format_arg(2, uint32_t, ride->name_arguments);
|
||||
set_format_arg(6, uint16_t, RideNaming[ride->type].name);
|
||||
ride->FormatNameTo(gCommonFormatArgs);
|
||||
|
||||
uint32_t spriteIds[] = {
|
||||
SPR_CLOSED,
|
||||
SPR_OPEN,
|
||||
|
@ -3013,8 +3012,7 @@ static void window_ride_vehicle_invalidate(rct_window* w)
|
|||
ride = get_ride(w->number);
|
||||
rideEntry = ride->GetRideEntry();
|
||||
|
||||
set_format_arg(0, rct_string_id, ride->name);
|
||||
set_format_arg(2, uint32_t, ride->name_arguments);
|
||||
ride->FormatNameTo(gCommonFormatArgs);
|
||||
|
||||
// Widget setup
|
||||
carsPerTrain = ride->num_cars_per_train - rideEntry->zero_cars;
|
||||
|
@ -3571,8 +3569,7 @@ static void window_ride_operating_invalidate(rct_window* w)
|
|||
|
||||
ride = get_ride(w->number);
|
||||
|
||||
set_format_arg(0, rct_string_id, ride->name);
|
||||
set_format_arg(2, uint32_t, ride->name_arguments);
|
||||
ride->FormatNameTo(gCommonFormatArgs);
|
||||
|
||||
// Widget setup
|
||||
w->pressed_widgets &= ~(
|
||||
|
@ -4147,8 +4144,8 @@ static void window_ride_maintenance_invalidate(rct_window* w)
|
|||
window_ride_set_pressed_tab(w);
|
||||
|
||||
Ride* ride = get_ride(w->number);
|
||||
set_format_arg(0, rct_string_id, ride->name);
|
||||
set_format_arg(2, uint32_t, ride->name_arguments);
|
||||
|
||||
ride->FormatNameTo(gCommonFormatArgs);
|
||||
|
||||
window_ride_maintenance_widgets[WIDX_INSPECTION_INTERVAL].text = RideInspectionIntervalNames[ride->inspection_interval];
|
||||
|
||||
|
@ -4699,8 +4696,7 @@ static void window_ride_colour_invalidate(rct_window* w)
|
|||
ride = get_ride(w->number);
|
||||
rideEntry = ride->GetRideEntry();
|
||||
|
||||
set_format_arg(0, rct_string_id, ride->name);
|
||||
set_format_arg(2, uint32_t, ride->name_arguments);
|
||||
ride->FormatNameTo(gCommonFormatArgs);
|
||||
|
||||
// Track colours
|
||||
int32_t colourScheme = w->ride_colour;
|
||||
|
@ -5213,8 +5209,7 @@ static void window_ride_music_invalidate(rct_window* w)
|
|||
window_ride_set_pressed_tab(w);
|
||||
|
||||
Ride* ride = get_ride(w->number);
|
||||
set_format_arg(0, rct_string_id, ride->name);
|
||||
set_format_arg(2, uint32_t, ride->name_arguments);
|
||||
ride->FormatNameTo(gCommonFormatArgs);
|
||||
|
||||
// Set selected music
|
||||
window_ride_music_widgets[WIDX_MUSIC].text = MusicStyleNames[ride->music];
|
||||
|
@ -5541,8 +5536,7 @@ static void window_ride_measurements_invalidate(rct_window* w)
|
|||
window_ride_set_pressed_tab(w);
|
||||
|
||||
Ride* ride = get_ride(w->number);
|
||||
set_format_arg(0, rct_string_id, ride->name);
|
||||
set_format_arg(2, uint32_t, ride->name_arguments);
|
||||
ride->FormatNameTo(gCommonFormatArgs);
|
||||
|
||||
window_ride_measurements_widgets[WIDX_SAVE_TRACK_DESIGN].tooltip = STR_SAVE_TRACK_DESIGN_NOT_POSSIBLE;
|
||||
window_ride_measurements_widgets[WIDX_SAVE_TRACK_DESIGN].type = WWT_EMPTY;
|
||||
|
@ -5989,9 +5983,7 @@ static void window_ride_graphs_invalidate(rct_window* w)
|
|||
window_ride_set_pressed_tab(w);
|
||||
|
||||
ride = get_ride(w->number);
|
||||
|
||||
set_format_arg(0, rct_string_id, ride->name);
|
||||
set_format_arg(2, uint32_t, ride->name_arguments);
|
||||
ride->FormatNameTo(gCommonFormatArgs);
|
||||
|
||||
// Set pressed graph button type
|
||||
w->pressed_widgets &= ~(1 << WIDX_GRAPH_VELOCITY);
|
||||
|
@ -6524,8 +6516,7 @@ static void window_ride_income_invalidate(rct_window* w)
|
|||
window_ride_set_pressed_tab(w);
|
||||
|
||||
Ride* ride = get_ride(w->number);
|
||||
set_format_arg(0, rct_string_id, ride->name);
|
||||
set_format_arg(2, uint32_t, ride->name_arguments);
|
||||
ride->FormatNameTo(gCommonFormatArgs);
|
||||
|
||||
rideEntry = ride->GetRideEntry();
|
||||
|
||||
|
@ -6799,8 +6790,7 @@ static void window_ride_customer_invalidate(rct_window* w)
|
|||
window_ride_set_pressed_tab(w);
|
||||
|
||||
Ride* ride = get_ride(w->number);
|
||||
set_format_arg(0, rct_string_id, ride->name);
|
||||
set_format_arg(2, uint32_t, ride->name_arguments);
|
||||
ride->FormatNameTo(gCommonFormatArgs);
|
||||
|
||||
window_ride_customer_widgets[WIDX_SHOW_GUESTS_THOUGHTS].type = WWT_FLATBTN;
|
||||
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_IS_SHOP))
|
||||
|
|
|
@ -864,8 +864,9 @@ static void window_ride_construction_resize(rct_window* w)
|
|||
case TRACK_SLOPE_DOWN_60:
|
||||
disabledWidgets |= (1ULL << WIDX_SLOPE_UP) | (1ULL << WIDX_SLOPE_UP_STEEP);
|
||||
if (!is_track_enabled(TRACK_SLOPE_LONG)
|
||||
&& !(is_track_enabled(TRACK_SLOPE_STEEP_LONG)
|
||||
&& !track_piece_direction_is_diagonal(_currentTrackPieceDirection)))
|
||||
&& !(
|
||||
is_track_enabled(TRACK_SLOPE_STEEP_LONG)
|
||||
&& !track_piece_direction_is_diagonal(_currentTrackPieceDirection)))
|
||||
{
|
||||
disabledWidgets |= (1ULL << WIDX_LEVEL);
|
||||
}
|
||||
|
@ -876,8 +877,9 @@ static void window_ride_construction_resize(rct_window* w)
|
|||
case TRACK_SLOPE_UP_60:
|
||||
disabledWidgets |= (1ULL << WIDX_SLOPE_DOWN_STEEP) | (1ULL << WIDX_SLOPE_DOWN);
|
||||
if (!is_track_enabled(TRACK_SLOPE_LONG)
|
||||
&& !(is_track_enabled(TRACK_SLOPE_STEEP_LONG)
|
||||
&& !track_piece_direction_is_diagonal(_currentTrackPieceDirection)))
|
||||
&& !(
|
||||
is_track_enabled(TRACK_SLOPE_STEEP_LONG)
|
||||
&& !track_piece_direction_is_diagonal(_currentTrackPieceDirection)))
|
||||
{
|
||||
disabledWidgets |= (1ULL << WIDX_LEVEL);
|
||||
}
|
||||
|
@ -2236,12 +2238,13 @@ static void window_ride_construction_tooldown(rct_window* w, rct_widgetindex wid
|
|||
*/
|
||||
static void window_ride_construction_invalidate(rct_window* w)
|
||||
{
|
||||
Ride* ride;
|
||||
rct_string_id stringId;
|
||||
auto ride = get_ride(_currentRideIndex);
|
||||
if (ride == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ride = get_ride(_currentRideIndex);
|
||||
|
||||
stringId = STR_RIDE_CONSTRUCTION_SPECIAL;
|
||||
rct_string_id stringId = STR_RIDE_CONSTRUCTION_SPECIAL;
|
||||
if (_currentTrackCurve & 0x100)
|
||||
{
|
||||
stringId = RideConfigurationStringIds[_currentTrackCurve & 0xFF];
|
||||
|
@ -2284,8 +2287,7 @@ static void window_ride_construction_invalidate(rct_window* w)
|
|||
}
|
||||
|
||||
// Set window title arguments
|
||||
set_format_arg(4, rct_string_id, ride->name);
|
||||
set_format_arg(6, uint32_t, ride->name_arguments);
|
||||
ride->FormatNameTo(gCommonFormatArgs + 4);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -781,7 +781,6 @@ void window_ride_list_refresh_list(rct_window* w)
|
|||
{
|
||||
int32_t i;
|
||||
Ride *ride, *otherRide;
|
||||
char bufferA[128], bufferB[128];
|
||||
int32_t list_index = 0;
|
||||
|
||||
FOR_ALL_RIDES (i, ride)
|
||||
|
@ -800,17 +799,19 @@ void window_ride_list_refresh_list(rct_window* w)
|
|||
switch (w->list_information_type)
|
||||
{
|
||||
case INFORMATION_TYPE_STATUS:
|
||||
format_string_to_upper(bufferA, 128, ride->name, &ride->name_arguments);
|
||||
{
|
||||
auto strA = ride->GetName();
|
||||
while (--current_list_position >= 0)
|
||||
{
|
||||
otherRide = get_ride(w->list_item_positions[current_list_position]);
|
||||
format_string_to_upper(bufferB, 128, otherRide->name, &otherRide->name_arguments);
|
||||
if (strcmp(bufferA, bufferB) >= 0)
|
||||
auto strB = ride->GetName();
|
||||
if (_strcmpi(strA.c_str(), strB.c_str()) >= 0)
|
||||
break;
|
||||
|
||||
window_bubble_list_item(w, current_list_position);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case INFORMATION_TYPE_POPULARITY:
|
||||
while (--current_list_position >= 0)
|
||||
{
|
||||
|
|
|
@ -131,6 +131,8 @@ static rct_window_event_list window_sign_small_events = {
|
|||
};
|
||||
// clang-format on
|
||||
|
||||
static void window_sign_show_text_input(rct_window* w);
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006BA305
|
||||
|
@ -203,11 +205,6 @@ rct_window* window_sign_open(rct_windownumber number)
|
|||
*/
|
||||
static void window_sign_mouseup(rct_window* w, rct_widgetindex widgetIndex)
|
||||
{
|
||||
auto banner = GetBanner(w->number);
|
||||
int32_t x = banner->position.x << 5;
|
||||
int32_t y = banner->position.y << 5;
|
||||
auto tile_element = map_get_first_element_at(x / 32, y / 32);
|
||||
|
||||
switch (widgetIndex)
|
||||
{
|
||||
case WIDX_CLOSE:
|
||||
|
@ -215,6 +212,10 @@ static void window_sign_mouseup(rct_window* w, rct_widgetindex widgetIndex)
|
|||
break;
|
||||
case WIDX_SIGN_DEMOLISH:
|
||||
{
|
||||
auto banner = GetBanner(w->number);
|
||||
int32_t x = banner->position.x << 5;
|
||||
int32_t y = banner->position.y << 5;
|
||||
auto tile_element = map_get_first_element_at(x / 32, y / 32);
|
||||
while (1)
|
||||
{
|
||||
if (tile_element->GetType() == TILE_ELEMENT_TYPE_LARGE_SCENERY)
|
||||
|
@ -238,17 +239,8 @@ static void window_sign_mouseup(rct_window* w, rct_widgetindex widgetIndex)
|
|||
break;
|
||||
}
|
||||
case WIDX_SIGN_TEXT:
|
||||
{
|
||||
auto stringId = banner->string_idx;
|
||||
if (banner->flags & BANNER_FLAG_LINKED_TO_RIDE)
|
||||
{
|
||||
Ride* ride = get_ride(banner->ride_index);
|
||||
set_format_arg(16, uint32_t, ride->name_arguments);
|
||||
stringId = ride->name;
|
||||
}
|
||||
window_text_input_open(w, WIDX_SIGN_TEXT, STR_SIGN_TEXT_TITLE, STR_SIGN_TEXT_PROMPT, stringId, 0, 32);
|
||||
window_sign_show_text_input(w);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -458,11 +450,6 @@ rct_window* window_sign_small_open(rct_windownumber number)
|
|||
*/
|
||||
static void window_sign_small_mouseup(rct_window* w, rct_widgetindex widgetIndex)
|
||||
{
|
||||
auto banner = GetBanner(w->number);
|
||||
int32_t x = banner->position.x << 5;
|
||||
int32_t y = banner->position.y << 5;
|
||||
auto tile_element = map_get_first_element_at(x / 32, y / 32);
|
||||
|
||||
switch (widgetIndex)
|
||||
{
|
||||
case WIDX_CLOSE:
|
||||
|
@ -470,6 +457,10 @@ static void window_sign_small_mouseup(rct_window* w, rct_widgetindex widgetIndex
|
|||
break;
|
||||
case WIDX_SIGN_DEMOLISH:
|
||||
{
|
||||
auto banner = GetBanner(w->number);
|
||||
int32_t x = banner->position.x << 5;
|
||||
int32_t y = banner->position.y << 5;
|
||||
auto tile_element = map_get_first_element_at(x / 32, y / 32);
|
||||
while (true)
|
||||
{
|
||||
if (tile_element->GetType() == TILE_ELEMENT_TYPE_WALL)
|
||||
|
@ -489,17 +480,8 @@ static void window_sign_small_mouseup(rct_window* w, rct_widgetindex widgetIndex
|
|||
break;
|
||||
}
|
||||
case WIDX_SIGN_TEXT:
|
||||
{
|
||||
auto stringId = banner->string_idx;
|
||||
if (banner->flags & BANNER_FLAG_LINKED_TO_RIDE)
|
||||
{
|
||||
Ride* ride = get_ride(banner->ride_index);
|
||||
set_format_arg(16, uint32_t, ride->name_arguments);
|
||||
stringId = ride->name;
|
||||
}
|
||||
window_text_input_open(w, WIDX_SIGN_TEXT, STR_SIGN_TEXT_TITLE, STR_SIGN_TEXT_PROMPT, stringId, 0, 32);
|
||||
window_sign_show_text_input(w);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -562,3 +544,22 @@ static void window_sign_small_invalidate(rct_window* w)
|
|||
main_colour_btn->image = SPRITE_ID_PALETTE_COLOUR_1(w->list_information_type) | IMAGE_TYPE_TRANSPARENT | SPR_PALETTE_BTN;
|
||||
text_colour_btn->image = SPRITE_ID_PALETTE_COLOUR_1(w->var_492) | IMAGE_TYPE_TRANSPARENT | SPR_PALETTE_BTN;
|
||||
}
|
||||
|
||||
static void window_sign_show_text_input(rct_window* w)
|
||||
{
|
||||
auto banner = GetBanner(w->number);
|
||||
std::string inputText;
|
||||
if (banner->flags & BANNER_FLAG_LINKED_TO_RIDE)
|
||||
{
|
||||
auto ride = get_ride(banner->ride_index);
|
||||
if (ride != nullptr)
|
||||
{
|
||||
inputText = ride->GetName();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
inputText = format_string(banner->string_idx, nullptr);
|
||||
}
|
||||
window_text_input_raw_open(w, WIDX_SIGN_TEXT, STR_SIGN_TEXT_TITLE, STR_SIGN_TEXT_PROMPT, inputText.c_str(), 32);
|
||||
}
|
||||
|
|
|
@ -953,7 +953,6 @@ void window_staff_overview_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
}
|
||||
|
||||
// Draw the centred label
|
||||
uint32_t argument1, argument2;
|
||||
Peep* peep = GET_PEEP(w->number);
|
||||
peep->FormatActionTo(gCommonFormatArgs);
|
||||
rct_widget* widget = &w->widgets[WIDX_BTM_LABEL];
|
||||
|
|
|
@ -660,7 +660,6 @@ static constexpr const uint32_t staffCostumeSprites[] = {
|
|||
void window_staff_list_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi, int32_t scrollIndex)
|
||||
{
|
||||
int32_t spriteIndex, y, i, staffOrderIcon_x, staffOrders, staffOrderSprite;
|
||||
uint32_t argument_1, argument_2;
|
||||
uint8_t selectedTab;
|
||||
Peep* peep;
|
||||
|
||||
|
|
|
@ -1876,8 +1876,7 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
rct_string_id rideType = RideNaming[ride->type].name;
|
||||
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_TRACK_RIDE_TYPE, &rideType, COLOUR_DARK_GREEN, x, y);
|
||||
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_TRACK_RIDE_ID, &rideId, COLOUR_DARK_GREEN, x, y + 11);
|
||||
set_format_arg(0, rct_string_id, ride->name);
|
||||
set_format_arg(0 + sizeof(rct_string_id), uint32_t, ride->name_arguments);
|
||||
ride->FormatNameTo(gCommonFormatArgs);
|
||||
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_TRACK_RIDE_NAME, gCommonFormatArgs, COLOUR_DARK_GREEN, x, y + 22);
|
||||
// Track
|
||||
int16_t trackType = trackElement->GetTrackType();
|
||||
|
|
|
@ -629,10 +629,17 @@ static void window_title_command_editor_tool_down(rct_window* w, rct_widgetindex
|
|||
else if (spriteIdentifier == SPRITE_IDENTIFIER_VEHICLE)
|
||||
{
|
||||
validSprite = true;
|
||||
rct_vehicle* vehicle = GET_VEHICLE(spriteIndex);
|
||||
Ride* ride = get_ride(vehicle->ride);
|
||||
set_format_arg(16, uint32_t, ride->name_arguments);
|
||||
format_string(command.SpriteName, USER_STRING_MAX_LENGTH, ride->name, &ride->name_arguments);
|
||||
auto vehicle = GET_VEHICLE(spriteIndex);
|
||||
if (vehicle != nullptr)
|
||||
{
|
||||
auto ride = get_ride(vehicle->ride);
|
||||
if (ride != nullptr)
|
||||
{
|
||||
uint8_t formatArgs[32]{};
|
||||
ride->FormatNameTo(formatArgs);
|
||||
format_string(command.SpriteName, USER_STRING_MAX_LENGTH, STR_STRINGID, formatArgs);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (spriteIdentifier == SPRITE_IDENTIFIER_LITTER)
|
||||
{
|
||||
|
|
|
@ -2005,7 +2005,7 @@ void Peep::FormatActionTo(void* argsV) const
|
|||
* argument_1 (esi & ebx)
|
||||
* argument_2 (esi+2)
|
||||
*/
|
||||
void peep_thought_set_format_args(rct_peep_thought* thought)
|
||||
void peep_thought_set_format_args(const rct_peep_thought* thought)
|
||||
{
|
||||
set_format_arg(0, rct_string_id, PeepThoughts[thought->type]);
|
||||
|
||||
|
|
|
@ -958,7 +958,7 @@ void peep_stop_crowd_noise();
|
|||
void peep_update_crowd_noise();
|
||||
void peep_update_days_in_queue();
|
||||
void peep_applause();
|
||||
void peep_thought_set_format_args(rct_peep_thought* thought);
|
||||
void peep_thought_set_format_args(const rct_peep_thought* thought);
|
||||
int32_t get_peep_face_sprite_small(Peep* peep);
|
||||
int32_t get_peep_face_sprite_large(Peep* peep);
|
||||
void game_command_pickup_guest(
|
||||
|
|
Loading…
Reference in New Issue