From 305cef2f7594cb6ab3bf4872bd0e387464aa6655 Mon Sep 17 00:00:00 2001 From: anyc Date: Thu, 31 Jul 2014 00:11:01 +0200 Subject: [PATCH] fix errors and warnings with mingw --- src/game.c | 4 ++-- src/gfx.c | 9 +++++---- src/park.c | 2 +- src/park.h | 2 +- src/string_ids.c | 4 ++-- src/window_guest_list.c | 4 ++-- 6 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/game.c b/src/game.c index 9110504e86..2d2dc996eb 100644 --- a/src/game.c +++ b/src/game.c @@ -137,7 +137,7 @@ void process_mouse_over(int x, int y) } ebx = ebx & 0xFFFFFF00; edi = cursorId; - esi = subWindow; + esi = (int) subWindow; RCT2_CALLFUNC_X(subWindow->event_handlers[WE_UNKNOWN_0E], &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp); cursorId = edi; if ((ebx & 0xFF) != 0) @@ -2093,7 +2093,7 @@ int game_do_command(int eax, int ebx, int ecx, int edx, int esi, int edi, int eb * * rct2: 0x00667C15 */ -static void game_pause_toggle() +void game_pause_toggle() { char input_bl; diff --git a/src/gfx.c b/src/gfx.c index 64e12cfa05..63acdd4d5f 100644 --- a/src/gfx.c +++ b/src/gfx.c @@ -1414,7 +1414,7 @@ int gfx_get_string_width(char* buffer) current_font_sprite_base = RCT2_ADDRESS(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16); width = 0; - for (uint8* curr_char = (uint8*)buffer; *curr_char != (uint8)NULL; curr_char++) { + for (uint8* curr_char = (uint8*)buffer; *curr_char != (uint8)0; curr_char++) { if (*curr_char >= 0x20) { width += RCT2_ADDRESS(RCT2_ADDRESS_FONT_CHAR_WIDTH, uint8)[*current_font_sprite_base + (*curr_char - 0x20)]; @@ -1501,7 +1501,7 @@ int gfx_clip_string(char* buffer, int width) clipped_width = 0; last_char = buffer; - for (unsigned char* curr_char = buffer; *curr_char != (uint8)NULL; curr_char++) { + for (unsigned char* curr_char = buffer; *curr_char != (uint8)0; curr_char++) { if (*curr_char < 0x20) { switch (*curr_char) { case FORMAT_MOVE_X: @@ -1554,7 +1554,8 @@ int gfx_clip_string(char* buffer, int width) clipped_width += RCT2_ADDRESS(RCT2_ADDRESS_FONT_CHAR_WIDTH, uint8)[current_font_sprite_base + (*curr_char - 0x20)]; if ((int)clipped_width > width) { - *((uint32*)last_char) = '...'; +// *((uint32*)last_char) = '...'; + strcpy(last_char-3, "..."); clipped_width = width; return clipped_width; } @@ -1593,7 +1594,7 @@ int gfx_wrap_string(char* buffer, int width, int* num_lines, int* font_height) // Width of line up to current word unsigned int curr_width; - for (unsigned char* curr_char = buffer; *curr_char != (uint8)NULL; curr_char++) { + for (unsigned char* curr_char = buffer; *curr_char != (uint8)0; curr_char++) { // Remember start of current word and line width up to this word if (*curr_char == ' ') { diff --git a/src/park.c b/src/park.c index f2b0b71ae2..4adfba5abf 100644 --- a/src/park.c +++ b/src/park.c @@ -550,7 +550,7 @@ void park_update() park_generate_new_guests(); } -static uint8 calculate_guest_initial_happiness(uint8 percentage) { +uint8 calculate_guest_initial_happiness(uint8 percentage) { if (percentage < 15) { // There is a minimum of 15% happiness percentage = 15; diff --git a/src/park.h b/src/park.h index 777b4af8ca..b12fcbad51 100644 --- a/src/park.h +++ b/src/park.h @@ -57,6 +57,6 @@ void generate_new_guest(); void park_update(); void park_update_histories(); -uint8 calculate_guest_initial_happiness(); +uint8 calculate_guest_initial_happiness(uint8 percentage); #endif diff --git a/src/string_ids.c b/src/string_ids.c index 32a1697ef1..6e2f0383c6 100644 --- a/src/string_ids.c +++ b/src/string_ids.c @@ -1230,7 +1230,7 @@ void format_currency(char **dest, int value) } // Currency symbol - char *symbol = &(g_currency_specs[gGeneral_config.currency_format].symbol); + const char *symbol = g_currency_specs[gGeneral_config.currency_format].symbol; // Prefix if (g_currency_specs[gGeneral_config.currency_format].prefix) { strcpy(*dest, symbol); @@ -1259,7 +1259,7 @@ void format_currency_2dp(char **dest, int value) } // Currency symbol - char *symbol = &(g_currency_specs[gGeneral_config.currency_format].symbol); + const char *symbol = g_currency_specs[gGeneral_config.currency_format].symbol; // Prefix if (g_currency_specs[gGeneral_config.currency_format].prefix) { strcpy(*dest, symbol); diff --git a/src/window_guest_list.c b/src/window_guest_list.c index 3bfa1befa9..fa8a4a0dd1 100644 --- a/src/window_guest_list.c +++ b/src/window_guest_list.c @@ -805,7 +805,7 @@ static int window_guest_list_is_peep_in_filter(rct_peep* peep) temp = _window_guest_list_selected_view; _window_guest_list_selected_view = _window_guest_list_selected_filter; - int argument1, argument2; + uint32 argument1, argument2; get_arguments_from_peep(peep, &argument1, &argument2); _window_guest_list_selected_view = temp; @@ -1068,7 +1068,7 @@ static void window_guest_list_find_groups() if (peep2->var_2A != 0 || !(peep2->var_0C & (1 << 8))) continue; - int argument1, argument2; + uint32 argument1, argument2; // Get and check if in same group get_arguments_from_peep(peep2, &argument1, &argument2); if (argument1 != _window_guest_list_groups_argument_1[groupIndex] || argument2 != _window_guest_list_groups_argument_2[groupIndex] )