mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-28 09:14:58 +01:00
Remove most usages of 'new Intent'
This commit is contained in:
committed by
Michael Steenbeek
parent
e3c0f6606d
commit
cc4f7e144a
@@ -592,11 +592,10 @@ static void shortcut_quick_save_game()
|
||||
}
|
||||
else if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR)
|
||||
{
|
||||
Intent * intent = new Intent(WC_LOADSAVE);
|
||||
intent->putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE);
|
||||
intent->putExtra(INTENT_EXTRA_PATH, gS6Info.name);
|
||||
context_open_intent(intent);
|
||||
delete intent;
|
||||
auto intent = Intent(WC_LOADSAVE);
|
||||
intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE);
|
||||
intent.putExtra(INTENT_EXTRA_PATH, gS6Info.name);
|
||||
context_open_intent(&intent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1072,10 +1072,9 @@ static void game_load_or_quit(sint32 * eax, sint32 * ebx, sint32 * ecx, sint32 *
|
||||
*/
|
||||
static void load_landscape()
|
||||
{
|
||||
Intent * intent = new Intent(WC_LOADSAVE);
|
||||
intent->putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_LANDSCAPE);
|
||||
context_open_intent(intent);
|
||||
delete intent;
|
||||
auto intent = Intent(WC_LOADSAVE);
|
||||
intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_LANDSCAPE);
|
||||
context_open_intent(&intent);
|
||||
}
|
||||
|
||||
static void utf8_to_rct2_self(char * buffer, size_t length)
|
||||
@@ -1268,12 +1267,11 @@ void handle_park_load_failure_with_title_opt(const ParkLoadResult * result, cons
|
||||
}
|
||||
// The path needs to be duplicated as it's a const here
|
||||
// which the window function doesn't like
|
||||
Intent * intent = new Intent(WC_OBJECT_LOAD_ERROR);
|
||||
intent->putExtra(INTENT_EXTRA_PATH, strndup(path, strnlen(path, MAX_PATH)));
|
||||
intent->putExtra(INTENT_EXTRA_LIST, (void *) ParkLoadResult_GetMissingObjects(result));
|
||||
intent->putExtra(INTENT_EXTRA_LIST_COUNT, (uint32) ParkLoadResult_GetMissingObjectsCount(result));
|
||||
context_open_intent(intent);
|
||||
delete intent;
|
||||
auto intent = Intent(WC_OBJECT_LOAD_ERROR);
|
||||
intent.putExtra(INTENT_EXTRA_PATH, strndup(path, strnlen(path, MAX_PATH)));
|
||||
intent.putExtra(INTENT_EXTRA_LIST, (void *) ParkLoadResult_GetMissingObjects(result));
|
||||
intent.putExtra(INTENT_EXTRA_LIST_COUNT, (uint32) ParkLoadResult_GetMissingObjectsCount(result));
|
||||
context_open_intent(&intent);
|
||||
}
|
||||
else if (ParkLoadResult_GetError(result) == PARK_LOAD_ERROR_UNSUPPORTED_RCTC_FLAG)
|
||||
{
|
||||
@@ -1349,9 +1347,8 @@ void game_load_init()
|
||||
reset_all_sprite_quadrant_placements();
|
||||
scenery_set_default_placement_configuration();
|
||||
|
||||
Intent * intent = new Intent(INTENT_ACTION_REFRESH_NEW_RIDES);
|
||||
context_broadcast_intent(intent);
|
||||
delete intent;
|
||||
auto intent = Intent(INTENT_ACTION_REFRESH_NEW_RIDES);
|
||||
context_broadcast_intent(&intent);
|
||||
|
||||
gWindowUpdateTicks = 0;
|
||||
|
||||
@@ -1359,9 +1356,8 @@ void game_load_init()
|
||||
|
||||
if (!gOpenRCT2Headless)
|
||||
{
|
||||
intent = new Intent(INTENT_ACTION_CLEAR_TILE_INSPECTOR_CLIPBOARD);
|
||||
context_broadcast_intent(intent);
|
||||
delete intent;
|
||||
intent = Intent(INTENT_ACTION_CLEAR_TILE_INSPECTOR_CLIPBOARD);
|
||||
context_broadcast_intent(&intent);
|
||||
window_update_all();
|
||||
}
|
||||
|
||||
@@ -1422,7 +1418,7 @@ void * create_save_game_as_intent()
|
||||
|
||||
void save_game_as()
|
||||
{
|
||||
Intent * intent = (Intent *) create_save_game_as_intent();
|
||||
auto * intent = (Intent *) create_save_game_as_intent();
|
||||
context_open_intent(intent);
|
||||
delete intent;
|
||||
}
|
||||
@@ -1582,11 +1578,10 @@ void game_load_or_quit_no_save_prompt()
|
||||
}
|
||||
else
|
||||
{
|
||||
Intent * intent = new Intent(WC_LOADSAVE);
|
||||
intent->putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME);
|
||||
intent->putExtra(INTENT_EXTRA_CALLBACK, (void *) game_load_or_quit_no_save_prompt_callback);
|
||||
context_open_intent(intent);
|
||||
delete intent;
|
||||
auto intent = Intent(WC_LOADSAVE);
|
||||
intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME);
|
||||
intent.putExtra(INTENT_EXTRA_CALLBACK, (void *) game_load_or_quit_no_save_prompt_callback);
|
||||
context_open_intent(&intent);
|
||||
}
|
||||
break;
|
||||
case PM_SAVE_BEFORE_QUIT:
|
||||
@@ -1633,9 +1628,8 @@ void game_init_all(sint32 mapSize)
|
||||
context_init();
|
||||
scenery_set_default_placement_configuration();
|
||||
|
||||
Intent * intent = new Intent(INTENT_ACTION_CLEAR_TILE_INSPECTOR_CLIPBOARD);
|
||||
context_broadcast_intent(intent);
|
||||
delete intent;
|
||||
auto intent = Intent(INTENT_ACTION_CLEAR_TILE_INSPECTOR_CLIPBOARD);
|
||||
context_broadcast_intent(&intent);
|
||||
|
||||
load_palette();
|
||||
}
|
||||
|
||||
@@ -1177,9 +1177,8 @@ static sint32 cc_load_object(const utf8 **argv, sint32 argc) {
|
||||
}
|
||||
scenery_set_default_placement_configuration();
|
||||
|
||||
Intent * intent = new Intent(INTENT_ACTION_REFRESH_NEW_RIDES);
|
||||
context_broadcast_intent(intent);
|
||||
delete intent;
|
||||
auto intent = Intent(INTENT_ACTION_REFRESH_NEW_RIDES);
|
||||
context_broadcast_intent(&intent);
|
||||
|
||||
gWindowUpdateTicks = 0;
|
||||
gfx_invalidate_screen();
|
||||
|
||||
@@ -133,18 +133,16 @@ sint32 viewport_interaction_left_click(sint32 x, sint32 y)
|
||||
switch (info.sprite->unknown.sprite_identifier) {
|
||||
case SPRITE_IDENTIFIER_VEHICLE:
|
||||
{
|
||||
Intent * intent = new Intent(WD_VEHICLE);
|
||||
intent->putExtra(INTENT_EXTRA_VEHICLE, info.vehicle);
|
||||
context_open_intent(intent);
|
||||
delete intent;
|
||||
auto intent = Intent(WD_VEHICLE);
|
||||
intent.putExtra(INTENT_EXTRA_VEHICLE, info.vehicle);
|
||||
context_open_intent(&intent);
|
||||
break;
|
||||
}
|
||||
case SPRITE_IDENTIFIER_PEEP:
|
||||
{
|
||||
Intent * intent = new Intent(WC_PEEP);
|
||||
intent->putExtra(INTENT_EXTRA_PEEP, info.peep);
|
||||
context_open_intent(intent);
|
||||
delete intent;
|
||||
auto intent = Intent(WC_PEEP);
|
||||
intent.putExtra(INTENT_EXTRA_PEEP, info.peep);
|
||||
context_open_intent(&intent);
|
||||
break;
|
||||
}
|
||||
case SPRITE_IDENTIFIER_MISC:
|
||||
@@ -163,10 +161,9 @@ sint32 viewport_interaction_left_click(sint32 x, sint32 y)
|
||||
return 1;
|
||||
case VIEWPORT_INTERACTION_ITEM_RIDE:
|
||||
{
|
||||
Intent * intent = new Intent(WD_TRACK);
|
||||
intent->putExtra(INTENT_EXTRA_TILE_ELEMENT, info.tileElement);
|
||||
context_open_intent(intent);
|
||||
delete intent;
|
||||
auto intent = Intent(WD_TRACK);
|
||||
intent.putExtra(INTENT_EXTRA_TILE_ELEMENT, info.tileElement);
|
||||
context_open_intent(&intent);
|
||||
return true;
|
||||
}
|
||||
case VIEWPORT_INTERACTION_ITEM_PARK:
|
||||
|
||||
@@ -363,10 +363,9 @@ void news_item_open_subject(sint32 type, sint32 subject)
|
||||
{
|
||||
peep = GET_PEEP(subject);
|
||||
|
||||
Intent * intent = new Intent(WC_PEEP);
|
||||
intent->putExtra(INTENT_EXTRA_PEEP, peep);
|
||||
context_open_intent(intent);
|
||||
delete intent;
|
||||
auto intent = Intent(WC_PEEP);
|
||||
intent.putExtra(INTENT_EXTRA_PEEP, peep);
|
||||
context_open_intent(&intent);
|
||||
break;
|
||||
}
|
||||
case NEWS_ITEM_MONEY:
|
||||
@@ -375,11 +374,10 @@ void news_item_open_subject(sint32 type, sint32 subject)
|
||||
case NEWS_ITEM_RESEARCH:
|
||||
if (subject >= RESEARCH_ENTRY_RIDE_MASK)
|
||||
{
|
||||
Intent * intent = new Intent(INTENT_ACTION_NEW_RIDE_OF_TYPE);
|
||||
intent->putExtra(INTENT_EXTRA_RIDE_TYPE, subject >> 8);
|
||||
intent->putExtra(INTENT_EXTRA_RIDE_ENTRY_INDEX, subject & 0xFF);
|
||||
context_open_intent(intent);
|
||||
delete intent;
|
||||
auto intent = Intent(INTENT_ACTION_NEW_RIDE_OF_TYPE);
|
||||
intent.putExtra(INTENT_EXTRA_RIDE_TYPE, subject >> 8);
|
||||
intent.putExtra(INTENT_EXTRA_RIDE_ENTRY_INDEX, subject & 0xFF);
|
||||
context_open_intent(&intent);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -406,11 +404,10 @@ void news_item_open_subject(sint32 type, sint32 subject)
|
||||
break;
|
||||
case NEWS_ITEM_PEEPS:
|
||||
{
|
||||
Intent * intent = new Intent(WC_GUEST_LIST);
|
||||
intent->putExtra(INTENT_EXTRA_GUEST_LIST_FILTER, GLFT_GUESTS_THINKING_X);
|
||||
intent->putExtra(INTENT_EXTRA_RIDE_ID, subject);
|
||||
context_open_intent(intent);
|
||||
delete intent;
|
||||
auto intent = Intent(WC_GUEST_LIST);
|
||||
intent.putExtra(INTENT_EXTRA_GUEST_LIST_FILTER, GLFT_GUESTS_THINKING_X);
|
||||
intent.putExtra(INTENT_EXTRA_RIDE_ID, subject);
|
||||
context_open_intent(&intent);
|
||||
break;
|
||||
}
|
||||
case NEWS_ITEM_AWARD:
|
||||
|
||||
@@ -1822,9 +1822,8 @@ static sint32 ride_modify_maze(rct_tile_element *tileElement, sint32 x, sint32 y
|
||||
_currentTrackSelectionFlags = 0;
|
||||
_rideConstructionArrowPulseTime = 0;
|
||||
|
||||
Intent * intent = new Intent(INTENT_ACTION_UPDATE_MAZE_CONSTRUCTION);
|
||||
context_broadcast_intent(intent);
|
||||
delete intent;
|
||||
auto intent = Intent(INTENT_ACTION_UPDATE_MAZE_CONSTRUCTION);
|
||||
context_broadcast_intent(&intent);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -7603,10 +7602,9 @@ void ride_crash(uint8 rideIndex, uint8 vehicleIndex)
|
||||
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)) {
|
||||
// Open ride window for crashed vehicle
|
||||
Intent * intent = new Intent(WD_VEHICLE);
|
||||
intent->putExtra(INTENT_EXTRA_VEHICLE, vehicle);
|
||||
rct_window * w = context_open_intent(intent);
|
||||
delete intent;
|
||||
auto intent = Intent(WD_VEHICLE);
|
||||
intent.putExtra(INTENT_EXTRA_VEHICLE, vehicle);
|
||||
rct_window * w = context_open_intent(&intent);
|
||||
|
||||
rct_viewport * viewport = window_get_viewport(w);
|
||||
if (w != nullptr && viewport != nullptr) {
|
||||
|
||||
@@ -178,12 +178,11 @@ bool track_design_save(uint8 rideIndex)
|
||||
utf8 track_name[256];
|
||||
format_string(track_name, sizeof(track_name), ride->name, &ride->name_arguments);
|
||||
|
||||
Intent * intent = new Intent(WC_LOADSAVE);
|
||||
intent->putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_TRACK);
|
||||
intent->putExtra(INTENT_EXTRA_PATH, track_name);
|
||||
intent->putExtra(INTENT_EXTRA_CALLBACK, (void *) track_design_save_callback);
|
||||
context_open_intent(intent);
|
||||
delete intent;
|
||||
auto intent = Intent(WC_LOADSAVE);
|
||||
intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_TRACK);
|
||||
intent.putExtra(INTENT_EXTRA_PATH, track_name);
|
||||
intent.putExtra(INTENT_EXTRA_CALLBACK, (void *) track_design_save_callback);
|
||||
context_open_intent(&intent);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -64,10 +64,9 @@ void game_command_callback_hire_new_staff_member(sint32 eax, sint32 ebx, sint32
|
||||
else
|
||||
{
|
||||
rct_peep * peep = &get_sprite(sprite_index)->peep;
|
||||
Intent * intent = new Intent(WC_PEEP);
|
||||
intent->putExtra(INTENT_EXTRA_PEEP, peep);
|
||||
context_open_intent(intent);
|
||||
delete intent;
|
||||
auto intent = Intent(WC_PEEP);
|
||||
intent.putExtra(INTENT_EXTRA_PEEP, peep);
|
||||
context_open_intent(&intent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,9 +201,8 @@ money32 place_provisional_track_piece(sint32 rideIndex, sint32 trackType, sint32
|
||||
}
|
||||
|
||||
static bool sub_6CA2DF_get_track_element(uint8 *trackElement) {
|
||||
Intent * intent = new Intent(INTENT_ACTION_RIDE_CONSTRUCTION_UPDATE_PIECES);
|
||||
context_broadcast_intent(intent);
|
||||
delete intent;
|
||||
auto intent = Intent(INTENT_ACTION_RIDE_CONSTRUCTION_UPDATE_PIECES);
|
||||
context_broadcast_intent(&intent);
|
||||
|
||||
uint8 startSlope = _previousTrackSlopeEnd;
|
||||
uint8 endSlope = _currentTrackSlopeEnd;
|
||||
@@ -543,9 +541,8 @@ void window_ride_construction_mouseup_demolish_next_piece(sint32 x, sint32 y, si
|
||||
*/
|
||||
void window_ride_construction_update_active_elements()
|
||||
{
|
||||
Intent * intent = new Intent(INTENT_ACTION_RIDE_CONSTRUCTION_UPDATE_ACTIVE_ELEMENTS);
|
||||
context_broadcast_intent(intent);
|
||||
delete intent;
|
||||
auto intent = Intent(INTENT_ACTION_RIDE_CONSTRUCTION_UPDATE_ACTIVE_ELEMENTS);
|
||||
context_broadcast_intent(&intent);
|
||||
}
|
||||
|
||||
void game_command_callback_place_banner(sint32 eax, sint32 ebx, sint32 ecx, sint32 edx, sint32 esi, sint32 edi, sint32 ebp)
|
||||
@@ -575,14 +572,12 @@ bool scenery_tool_is_active()
|
||||
|
||||
void init_scenery()
|
||||
{
|
||||
Intent * intent = new Intent(INTENT_ACTION_INIT_SCENERY);
|
||||
context_broadcast_intent(intent);
|
||||
delete intent;
|
||||
auto intent = Intent(INTENT_ACTION_INIT_SCENERY);
|
||||
context_broadcast_intent(&intent);
|
||||
}
|
||||
|
||||
void scenery_set_default_placement_configuration()
|
||||
{
|
||||
Intent * intent = new Intent(INTENT_ACTION_SET_DEFAULT_SCENERY_CONFIG);
|
||||
context_broadcast_intent(intent);
|
||||
delete intent;
|
||||
auto intent = Intent(INTENT_ACTION_SET_DEFAULT_SCENERY_CONFIG);
|
||||
context_broadcast_intent(&intent);
|
||||
}
|
||||
|
||||
@@ -430,9 +430,8 @@ void map_init(sint32 size)
|
||||
map_remove_out_of_range_elements();
|
||||
|
||||
|
||||
Intent * intent = new Intent(INTENT_ACTION_MAP);
|
||||
context_broadcast_intent(intent);
|
||||
delete intent;
|
||||
auto intent = Intent(INTENT_ACTION_MAP);
|
||||
context_broadcast_intent(&intent);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user