Commit d12b75ac authored by Maikel Stuivenberg's avatar Maikel Stuivenberg Committed by IntelOrca
Browse files

hide non-applicable marketing campaigns, closes #1516, closes #1454, fixes #1510

parent 6b72f9a5
Showing with 90 additions and 24 deletions
+90 -24
......@@ -167,4 +167,49 @@ void game_command_start_campaign(int* eax, int* ebx, int* ecx, int* edx, int* es
}
*ebx = numWeeks * AdvertisingCampaignPricePerWeek[type];
}
\ No newline at end of file
}
bool marketing_is_campaign_type_applicable(int campaignType)
{
int i;
rct_ride *ride;
rct_ride_type *rideEntry;
switch (campaignType) {
case ADVERTISING_CAMPAIGN_PARK_ENTRY_FREE:
case ADVERTISING_CAMPAIGN_PARK_ENTRY_HALF_PRICE:
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_PARK_FREE_ENTRY)
return false;
return true;
case ADVERTISING_CAMPAIGN_RIDE_FREE:
if (!(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_PARK_FREE_ENTRY))
return false;
// fall-through
case ADVERTISING_CAMPAIGN_RIDE:
// Check if any rides exist
FOR_ALL_RIDES(i, ride) {
if (gRideClassifications[ride->type] == RIDE_CLASS_RIDE) {
return true;
}
}
return false;
case ADVERTISING_CAMPAIGN_FOOD_OR_DRINK_FREE:
// Check if any food or drink stalls exist
FOR_ALL_RIDES(i, ride) {
rideEntry = GET_RIDE_ENTRY(ride->subtype);
if (
shop_item_is_food_or_drink(rideEntry->shop_item) ||
shop_item_is_food_or_drink(rideEntry->shop_item_secondary)
) {
return true;
}
}
return false;
default:
return true;
}
}
......@@ -52,5 +52,6 @@ void marketing_update();
void marketing_set_guest_campaign(rct_peep *peep, int campaign);
void marketing_start_campaign(int type, int rideOrItem, int numWeeks);
void game_command_start_campaign(int* eax, int* ebx, int* ecx, int* edx, int* esi, int* edi, int* ebp);
bool marketing_is_campaign_type_applicable(int campaignType);
#endif
\ No newline at end of file
......@@ -6594,3 +6594,41 @@ bool ride_type_is_intamin(int rideType)
rideType == RIDE_TYPE_GIGA_COASTER ||
rideType == RIDE_TYPE_INVERTED_IMPULSE_COASTER;
}
bool shop_item_is_food_or_drink(int shopItem)
{
switch (shopItem) {
case SHOP_ITEM_DRINK:
case SHOP_ITEM_BURGER:
case SHOP_ITEM_FRIES:
case SHOP_ITEM_ICE_CREAM:
case SHOP_ITEM_COTTON_CANDY:
case SHOP_ITEM_PIZZA:
case SHOP_ITEM_POPCORN:
case SHOP_ITEM_HOT_DOG:
case SHOP_ITEM_TENTACLE:
case SHOP_ITEM_CANDY_APPLE:
case SHOP_ITEM_DONUT:
case SHOP_ITEM_COFFEE:
case SHOP_ITEM_CHICKEN:
case SHOP_ITEM_LEMONADE:
case SHOP_ITEM_PRETZEL:
case SHOP_ITEM_CHOCOLATE:
case SHOP_ITEM_ICED_TEA:
case SHOP_ITEM_FUNNEL_CAKE:
case SHOP_ITEM_SUNGLASSES:
case SHOP_ITEM_BEEF_NOODLES:
case SHOP_ITEM_FRIED_RICE_NOODLES:
case SHOP_ITEM_WONTON_SOUP:
case SHOP_ITEM_MEATBALL_SOUP:
case SHOP_ITEM_FRUIT_JUICE:
case SHOP_ITEM_SOYBEAN_MILK:
case SHOP_ITEM_SU_JONGKWA:
case SHOP_ITEM_SUB_SANDWICH:
case SHOP_ITEM_COOKIE:
case SHOP_ITEM_ROAST_SAUSAGE:
return true;
default:
return false;
}
}
......@@ -1032,4 +1032,6 @@ void ride_crash(int rideIndex, int vehicleIndex);
bool ride_type_is_intamin(int rideType);
void sub_6C94D8();
bool shop_item_is_food_or_drink(int shopItem);
#endif
......@@ -1148,17 +1148,10 @@ static void window_finances_marketing_invalidate(rct_window *w)
campaginButton->type = 0;
// Do not allow park entry campaigns if park entry is free
if (
(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_PARK_FREE_ENTRY) && (
i == ADVERTISING_CAMPAIGN_PARK_ENTRY_FREE ||
i == ADVERTISING_CAMPAIGN_PARK_ENTRY_HALF_PRICE
)
) {
if (gMarketingCampaignDaysLeft[i] != 0)
continue;
}
if (gMarketingCampaignDaysLeft[i] != 0)
if (!marketing_is_campaign_type_applicable(i))
continue;
campaginButton->type = WWT_DROPDOWN_BUTTON;
......@@ -1176,7 +1169,6 @@ static void window_finances_marketing_paint(rct_window *w, rct_drawpixelinfo *dp
{
int i, x, y, weeksRemaining;
rct_ride *ride;
rct_string_id shopString;
window_draw_widgets(w, dpi);
window_finances_draw_tab_images(dpi, w);
......@@ -1226,19 +1218,7 @@ static void window_finances_marketing_paint(rct_window *w, rct_drawpixelinfo *dp
for (i = 0; i < ADVERTISING_CAMPAIGN_COUNT; i++) {
rct_widget *campaginButton = &window_finances_marketing_widgets[WIDX_CAMPAIGN_1 + i];
campaginButton->type = 0;
// Do not allow park entry campaigns if park entry is free
if (
(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_PARK_FREE_ENTRY) && (
i == ADVERTISING_CAMPAIGN_PARK_ENTRY_FREE ||
i == ADVERTISING_CAMPAIGN_PARK_ENTRY_HALF_PRICE
)
) {
continue;
}
if (gMarketingCampaignDaysLeft[i] != 0)
if (campaginButton->type == WWT_EMPTY)
continue;
money32 pricePerWeek = AdvertisingCampaignPricePerWeek[i];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment