1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-24 00:03:11 +01:00

Fix finding peep on ride news items

Peep's current_* variables were offset by 1. Also fixed comparison
between 32-bit and 16-bit ints.
This commit is contained in:
ZedThree
2014-05-01 13:16:41 +02:00
parent 1255d24be6
commit ecc51e2f4b
3 changed files with 10 additions and 6 deletions

View File

@@ -200,7 +200,7 @@ void news_item_get_subject_location(int type, int subject, int *x, int *y, int *
*x = sprite->unknown.x;
*y = sprite->unknown.y;
*z = sprite->unknown.z;
if (*x != SPRITE_LOCATION_NULL)
if (*((uint16*)x) != SPRITE_LOCATION_NULL)
break;
if (sprite->peep.state != 3 && sprite->peep.state != 7) {
@@ -208,8 +208,10 @@ void news_item_get_subject_location(int type, int subject, int *x, int *y, int *
break;
}
// Find which ride peep is on
ride = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[sprite->peep.current_ride]);
if (ride->var_1D0 & 1) {
// Check if there are trains on the track (first bit of var_1D0)
if (!(ride->var_1D0 & 1)) {
*x = SPRITE_LOCATION_NULL;
break;
}

View File

@@ -72,9 +72,11 @@ typedef struct {
uint8 happiness; // 0x3A
uint8 pad_03B[0x2D];
uint8 current_ride; // 0x68
uint8 current_train; // 0x6A
uint8 current_car; // 0x6B
uint8 pad_6C[0x30];
uint8 pad_6a; // 0x6A Part of current_ride?
uint8 current_train; // 0x6B
uint8 current_car; // 0x6c
uint8 current_seat; // 0x6d
uint8 pad_6C[0x2e];
uint32 id; // 0x9C
uint8 pad_A0[0x10];
rct_peep_thought thoughts[PEEP_MAX_THOUGHTS]; // 0xB0

View File

@@ -185,7 +185,7 @@ static void window_game_bottom_toolbar_mouseup()
news_item_get_subject_location(newsItem->type, subject, &x, &y, &z);
if (x == SPRITE_LOCATION_NULL)
if ((uint16)x == SPRITE_LOCATION_NULL)
break;
if ((mainWindow = window_get_main()) != NULL)