mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-15 11:03:00 +01:00
Use callback mechanism in case server rejects command
This commit is contained in:
committed by
Michael Steenbeek
parent
2bb3a297b4
commit
f9acdcb02d
@@ -86,6 +86,7 @@ GAME_COMMAND_CALLBACK_POINTER* game_command_callback_table[] = {
|
||||
game_command_callback_hire_new_staff_member,
|
||||
game_command_callback_pickup_guest,
|
||||
game_command_callback_pickup_staff,
|
||||
game_command_callback_marketing_start_campaign,
|
||||
};
|
||||
sint32 game_command_playerid = -1;
|
||||
|
||||
|
||||
@@ -138,16 +138,19 @@ void marketing_set_guest_campaign(rct_peep *peep, sint32 campaign)
|
||||
}
|
||||
}
|
||||
|
||||
bool marketing_start_campaign(sint32 type, sint32 rideOrItem, sint32 numWeeks)
|
||||
void game_command_callback_marketing_start_campaign(sint32 eax, sint32 ebx, sint32 ecx, sint32 edx, sint32 esi, sint32 edi, sint32 ebp)
|
||||
{
|
||||
if (ebx != MONEY32_UNDEFINED)
|
||||
{
|
||||
window_close_by_class(WC_NEW_CAMPAIGN);
|
||||
}
|
||||
}
|
||||
|
||||
void marketing_start_campaign(sint32 type, sint32 rideOrItem, sint32 numWeeks)
|
||||
{
|
||||
gGameCommandErrorTitle = STR_CANT_START_MARKETING_CAMPAIGN;
|
||||
sint32 retVal = game_do_command(0, (numWeeks << 8) | GAME_COMMAND_FLAG_APPLY, 0, (rideOrItem << 8) | type, GAME_COMMAND_START_MARKETING_CAMPAIGN, 0, 0);
|
||||
if (retVal == MONEY32_UNDEFINED) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
game_command_callback = game_command_callback_marketing_start_campaign;
|
||||
game_do_command(0, (numWeeks << 8) | GAME_COMMAND_FLAG_APPLY, 0, (rideOrItem << 8) | type, GAME_COMMAND_START_MARKETING_CAMPAIGN, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -47,7 +47,8 @@ extern uint8 gMarketingCampaignRideIndex[22];
|
||||
sint32 marketing_get_campaign_guest_generation_probability(sint32 campaign);
|
||||
void marketing_update();
|
||||
void marketing_set_guest_campaign(rct_peep *peep, sint32 campaign);
|
||||
bool marketing_start_campaign(sint32 type, sint32 rideOrItem, sint32 numWeeks);
|
||||
void game_command_callback_marketing_start_campaign(sint32 eax, sint32 ebx, sint32 ecx, sint32 edx, sint32 esi, sint32 edi, sint32 ebp);
|
||||
void marketing_start_campaign(sint32 type, sint32 rideOrItem, sint32 numWeeks);
|
||||
void game_command_start_campaign(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp);
|
||||
bool marketing_is_campaign_type_applicable(sint32 campaignType);
|
||||
|
||||
|
||||
@@ -225,10 +225,7 @@ static void window_new_campaign_mouseup(rct_window *w, rct_widgetindex widgetInd
|
||||
window_close(w);
|
||||
break;
|
||||
case WIDX_START_BUTTON:
|
||||
if (marketing_start_campaign(w->campaign.campaign_type, w->campaign.ride_id, w->campaign.no_weeks))
|
||||
{
|
||||
window_close(w);
|
||||
}
|
||||
marketing_start_campaign(w->campaign.campaign_type, w->campaign.ride_id, w->campaign.no_weeks);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user