1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-26 16:24:35 +01:00

Implement update for ride favourited numbers

This commit is contained in:
lnz
2014-05-11 23:21:26 +02:00
parent 19a475f05a
commit bb12fc1a42
4 changed files with 40 additions and 6 deletions

View File

@@ -110,7 +110,7 @@ void finance_pay_interest()
void finance_pay_ride_upkeep()
{
rct_ride* ride;
for (int i = 0; i < 255; i++) {
for (int i = 0; i < MAX_RIDES; i++) {
ride = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[i]);
if (ride->type == RIDE_TYPE_NULL)
continue;

View File

@@ -20,6 +20,9 @@
#include "addresses.h"
#include "ride.h"
#include "sprite.h"
#include "peep.h"
#include "window.h"
#define GET_RIDE(x) (&(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[x]))
#define GET_RIDE_MEASUREMENT(x) (&(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_MEASUREMENTS, rct_ride_measurement)[x]))
@@ -166,4 +169,34 @@ void reset_all_ride_build_dates() {
ride->build_date -= RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16);
}
}
}
}
/**
* rct2: 0x006AC916
*/
void ride_update_favourited_stat()
{
rct_ride *ride;
rct_peep* peep;
for (int i = 0; i < MAX_RIDES; i++) {
ride = GET_RIDE(i);
if (ride->type != RIDE_TYPE_NULL)
ride->guests_favourite = 0;
}
for (int sprite_idx = RCT2_GLOBAL(RCT2_ADDRESS_SPRITES_START_PEEP, uint16); sprite_idx != SPRITE_INDEX_NULL; sprite_idx = peep->next) {
peep = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[sprite_idx].peep);
if (peep->var_08 != 4)
return;
if (peep->favourite_ride != 0xff) {
ride = GET_RIDE(peep->favourite_ride);
ride->guests_favourite++;
ride->var_14D |= 1;
}
}
window_invalidate_by_id(WC_RIDE_LIST, 0);
}

View File

@@ -261,5 +261,6 @@ int ride_get_total_queue_length(rct_ride *ride);
int ride_get_max_queue_time(rct_ride *ride);
void ride_init_all();
void reset_all_ride_build_dates();
void ride_update_favourited_stat();
#endif

View File

@@ -604,7 +604,7 @@ void scenario_objective5_check()
memset(type_already_counted, 0, 256);
for (int i = 0; i < 255; i++) {
for (int i = 0; i < MAX_RIDES; i++) {
uint8 subtype_id;
uint32 subtype_p;
ride = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[i]);
@@ -640,7 +640,7 @@ void scenario_objective8_check()
memset(type_already_counted, 0, 256);
for (int i = 0; i < 255; i++) {
for (int i = 0; i < MAX_RIDES; i++) {
uint8 subtype_id;
uint32 subtype_p;
ride = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[i]);
@@ -741,7 +741,7 @@ void scenario_objectives_check()
{
rct_ride* ride;
int rcs = 0;
for (int i = 0; i < 255; i++) {
for (int i = 0; i < MAX_RIDES; i++) {
ride = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[i]);
if (ride->status && ride->excitement > objective_currency)
rcs++;
@@ -875,7 +875,7 @@ void scenario_update()
scenario_marketing_update();
peep_problem_warnings_update();
RCT2_CALLPROC_EBPSAFE(0x006B7A5E); // check ride reachability
RCT2_CALLPROC_EBPSAFE(0x006AC916); // ride update favourited
ride_update_favourited_stat();
if (month <= 1 && RCT2_GLOBAL(0x009ADAE0, sint32) != -1 && RCT2_GLOBAL(0x009ADAE0 + 14, uint16) & 1) {
for (int i = 0; i < 100; ++i) {