From bd732b99c7635c7737848d94bd56537f91454eef Mon Sep 17 00:00:00 2001 From: Ted John Date: Thu, 12 Jan 2017 12:41:47 +0000 Subject: [PATCH] Fix cast warnings --- src/openrct2/editor.c | 4 ++-- src/openrct2/game.c | 2 +- src/openrct2/peep/peep.h | 2 +- src/openrct2/world/map.h | 1 + src/openrct2/world/sprite.h | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/openrct2/editor.c b/src/openrct2/editor.c index ef9e05ea19..a2279770c5 100644 --- a/src/openrct2/editor.c +++ b/src/openrct2/editor.c @@ -545,7 +545,7 @@ bool editor_check_park() } for (int i = 0; i < 4; i++) { - if (gParkEntranceX[i] != (sint16)0x8000) + if (gParkEntranceX[i] != MAP_LOCATION_NULL) break; if (i == 3) { @@ -555,7 +555,7 @@ bool editor_check_park() } for (int i = 0; i < 4; i++) { - if (gParkEntranceX[i] == (sint16)0x8000) + if (gParkEntranceX[i] == MAP_LOCATION_NULL) continue; int x = gParkEntranceX[i]; diff --git a/src/openrct2/game.c b/src/openrct2/game.c index 03d90704a4..2fbd75a583 100644 --- a/src/openrct2/game.c +++ b/src/openrct2/game.c @@ -680,7 +680,7 @@ static void utf8_to_rct2_self(char *buffer, size_t length) const char *src = tempBuffer; char *dst = buffer; while (*src != 0 && i < length - 1) { - if (*src == (char)0xFF) { + if (*src == (char)(uint8)0xFF) { if (i < length - 3) { *dst++ = *src++; *dst++ = *src++; diff --git a/src/openrct2/peep/peep.h b/src/openrct2/peep/peep.h index 79097ae67f..4d4ab61a6e 100644 --- a/src/openrct2/peep/peep.h +++ b/src/openrct2/peep/peep.h @@ -607,7 +607,7 @@ enum { */ #define FOR_ALL_PEEPS(sprite_index, peep) \ for (sprite_index = gSpriteListHead[SPRITE_LIST_PEEP]; sprite_index != SPRITE_INDEX_NULL; sprite_index = peep->next) \ - if ((peep = GET_PEEP(sprite_index)) || 1) + if ((peep = GET_PEEP(sprite_index)) != NULL || 1) #define FOR_ALL_GUESTS(sprite_index, peep) \ FOR_ALL_PEEPS(sprite_index, peep) \ diff --git a/src/openrct2/world/map.h b/src/openrct2/world/map.h index 4044779848..9f2eb1a645 100644 --- a/src/openrct2/world/map.h +++ b/src/openrct2/world/map.h @@ -234,6 +234,7 @@ enum { #define MAP_ELEMENT_SURFACE_TERRAIN_MASK 0xE0 #define MAP_MINIMUM_X_Y -256 +#define MAP_LOCATION_NULL ((sint16)(uint16)0x8000) #define MAX_MAP_ELEMENTS 196096 #define MAX_TILE_MAP_ELEMENT_POINTERS (256 * 256) diff --git a/src/openrct2/world/sprite.h b/src/openrct2/world/sprite.h index ef5e9faa73..3032b4b54c 100644 --- a/src/openrct2/world/sprite.h +++ b/src/openrct2/world/sprite.h @@ -22,7 +22,7 @@ #include "../ride/vehicle.h" #define SPRITE_INDEX_NULL 0xFFFF -#define SPRITE_LOCATION_NULL ((sint16)0x8000) +#define SPRITE_LOCATION_NULL ((sint16)(uint16)0x8000) #define MAX_SPRITES 10000 #define NUM_SPRITE_LISTS 6