1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

Limit valid sprite indices when renaming peeps

This commit is contained in:
Michał Janiszewski
2016-07-18 19:11:52 +02:00
parent f6c8993da6
commit bb2ae29699
2 changed files with 8 additions and 0 deletions

View File

@@ -10893,6 +10893,10 @@ money32 set_peep_name(int flags, int state, uint16 sprite_index, uint8* text_1,
void game_command_set_guest_name(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp) {
uint16 sprite_index = *ecx & 0xFFFF;
if (sprite_index >= MAX_SPRITES) {
*ebx = MONEY32_UNDEFINED;
return;
}
rct_peep *peep = GET_PEEP(sprite_index);
if (peep->type != PEEP_TYPE_GUEST) {
*ebx = MONEY32_UNDEFINED;

View File

@@ -1236,6 +1236,10 @@ int staff_path_finding(rct_peep* peep) {
void game_command_set_staff_name(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp) {
uint16 sprite_index = *ecx & 0xFFFF;
if (sprite_index >= MAX_SPRITES) {
*ebx = MONEY32_UNDEFINED;
return;
}
rct_peep *peep = GET_PEEP(sprite_index);
if (peep->type != PEEP_TYPE_STAFF) {
*ebx = MONEY32_UNDEFINED;