diff --git a/src/localisation/language.cpp b/src/localisation/language.cpp index 8c8ec69314..50ae63f0bc 100644 --- a/src/localisation/language.cpp +++ b/src/localisation/language.cpp @@ -147,7 +147,7 @@ const char *language_get_string(rct_string_id id) return openrctString != nullptr ? openrctString : "(undefined string)"; } else { const char *rct = _languageOriginal[id]; - const char *str = (openrctString == nullptr || strlen(openrctString) == 0 ? rct : openrctString); + const char *str = (id != STR_EMPTY && (openrctString == nullptr || strlen(openrctString)) == 0 ? rct : openrctString); return str == nullptr ? "" : str; } } diff --git a/src/localisation/localisation.c b/src/localisation/localisation.c index 408834d51d..f62af11aa9 100644 --- a/src/localisation/localisation.c +++ b/src/localisation/localisation.c @@ -905,7 +905,7 @@ static void format_realtime(char ** dest, uint16 value) static void format_string_code(unsigned int format_code, char **dest, char **args) { - int value; + intptr_t value; switch (format_code) { case FORMAT_COMMA32: @@ -975,8 +975,8 @@ static void format_string_code(unsigned int format_code, char **dest, char **arg break; case FORMAT_STRING: // Pop argument - value = *((uint32*)*args); - *args += 4; + value = *((uintptr_t*)*args); + *args += sizeof(uintptr_t); if (value != 0) { strcpy(*dest, (char*)value); @@ -1038,7 +1038,7 @@ static void format_string_code(unsigned int format_code, char **dest, char **arg *args += 4; *(*dest)++ = 23; - *((uint32*)(*dest)) = value; + *((intptr_t*)(*dest)) = value; *dest += 4; break; } diff --git a/src/localisation/string_ids.h b/src/localisation/string_ids.h index b0cfd4226b..8f784f0cff 100644 --- a/src/localisation/string_ids.h +++ b/src/localisation/string_ids.h @@ -22,6 +22,7 @@ #define STR_NONE ((rct_string_id)-1) enum { + STR_EMPTY = 0, // STR_0001 :{STRINGID} {COMMA16} STR_RIDE_NAME_SPIRAL_ROLLER_COASTER = 2, diff --git a/src/windows/loadsave.c b/src/windows/loadsave.c index f6ebb3d2f6..ae033c3b70 100644 --- a/src/windows/loadsave.c +++ b/src/windows/loadsave.c @@ -681,7 +681,7 @@ static void window_loadsave_select(rct_window *w, const char *path) if (_stricmp(extension, ".sv6") != 0 && _stricmp(extension, ".sc6") != 0) strcat(newName, ".sv6"); if (title_sequence_save_exists(gCurrentTitleSequence, newName)) { - set_format_arg(0, uint32, (intptr_t)&_listItems[w->selected_list_item].name); + set_format_arg(0, intptr_t, (intptr_t)&_listItems[w->selected_list_item].name); window_text_input_open(w, WIDX_SCROLL, STR_FILEBROWSER_RENAME_SAVE_TITLE, STR_ERROR_EXISTING_NAME, STR_STRING, (uintptr_t)_listItems[w->selected_list_item].name, TITLE_SEQUENCE_MAX_SAVE_LENGTH - 1); } else { diff --git a/src/windows/options.c b/src/windows/options.c index 3a341fbb9d..afea3fe31c 100644 --- a/src/windows/options.c +++ b/src/windows/options.c @@ -1008,7 +1008,7 @@ static void window_options_mousedown(int widgetIndex, rct_window*w, rct_widget* case WIDX_LANGUAGE_DROPDOWN: for (i = 1; i < LANGUAGE_COUNT; i++) { gDropdownItemsFormat[i - 1] = STR_OPTIONS_DROPDOWN_ITEM; - gDropdownItemsArgs[i - 1] = (sint32)LanguagesDescriptors[i].native_name; + gDropdownItemsArgs[i - 1] = (uintptr_t)LanguagesDescriptors[i].native_name; } window_options_show_dropdown(w, widget, LANGUAGE_COUNT - 1); dropdown_set_checked(gCurrentLanguage - 1, true); @@ -1061,7 +1061,7 @@ static void window_options_mousedown(int widgetIndex, rct_window*w, rct_widget* for (int i = 0; i < num_items; i++) { gDropdownItemsFormat[i] = STR_OPTIONS_DROPDOWN_ITEM; - gDropdownItemsArgs[i] = (uint32)theme_manager_get_available_theme_name(i); + gDropdownItemsArgs[i] = (uintptr_t)theme_manager_get_available_theme_name(i); } window_dropdown_show_text_custom_width( @@ -1117,7 +1117,7 @@ static void window_options_mousedown(int widgetIndex, rct_window*w, rct_widget* for (i = 0; i < num_items; i++) { gDropdownItemsFormat[i] = STR_OPTIONS_DROPDOWN_ITEM; - gDropdownItemsArgs[i] = (uint32)&gConfigTitleSequences.presets[i].name; + gDropdownItemsArgs[i] = (uintptr_t)&gConfigTitleSequences.presets[i].name; } window_dropdown_show_text( @@ -1772,7 +1772,7 @@ static void window_options_paint(rct_window *w, rct_drawpixelinfo *dpi) int activeAvailableThemeIndex = theme_manager_get_active_available_theme_index(); const utf8 * activeThemeName = theme_manager_get_available_theme_name(activeAvailableThemeIndex); - set_format_arg(0, uint32, (uint32)activeThemeName); + set_format_arg(0, uintptr_t, (uintptr_t)activeThemeName); gfx_draw_string_left(dpi, STR_THEMES_LABEL_CURRENT_THEME, NULL, w->colours[1], w->x + 10, w->y + window_options_controls_and_interface_widgets[WIDX_THEMES].top + 1); gfx_draw_string_left_clipped( @@ -1808,7 +1808,7 @@ static void window_options_paint(rct_window *w, rct_drawpixelinfo *dpi) w->y + window_options_misc_widgets[WIDX_AUTOSAVE].top ); - set_format_arg(0, uint32, (uint32)&gConfigTitleSequences.presets[gCurrentPreviewTitleSequence].name); + set_format_arg(0, uintptr_t, (uintptr_t)&gConfigTitleSequences.presets[gCurrentPreviewTitleSequence].name); gfx_draw_string_left(dpi, STR_TITLE_SEQUENCE, w, w->colours[1], w->x + 10, w->y + window_options_misc_widgets[WIDX_TITLE_SEQUENCE].top + 1); gfx_draw_string_left_clipped( dpi, diff --git a/src/windows/title_editor.c b/src/windows/title_editor.c index b2150aa60a..5d59104ea8 100644 --- a/src/windows/title_editor.c +++ b/src/windows/title_editor.c @@ -316,7 +316,7 @@ static void window_title_editor_mouseup(rct_window *w, int widgetIndex) case WIDX_TITLE_EDITOR_DUPLICATE_BUTTON: commandEditorOpen *= 2; if (!commandEditorOpen) - window_text_input_open(w, widgetIndex, STR_TITLE_EDITOR_ACTION_DUPLICATE, STR_TITLE_EDITOR_ENTER_NAME_FOR_SEQUENCE, STR_STRING, (uint32)&gConfigTitleSequences.presets[gCurrentTitleSequence].name, 64); + window_text_input_open(w, widgetIndex, STR_TITLE_EDITOR_ACTION_DUPLICATE, STR_TITLE_EDITOR_ENTER_NAME_FOR_SEQUENCE, STR_STRING, (uintptr_t)&gConfigTitleSequences.presets[gCurrentTitleSequence].name, 64); break; case WIDX_TITLE_EDITOR_DELETE_BUTTON: defaultPreset *= 2; commandEditorOpen *= 2; @@ -326,7 +326,7 @@ static void window_title_editor_mouseup(rct_window *w, int widgetIndex) case WIDX_TITLE_EDITOR_RENAME_BUTTON: defaultPreset *= 2; commandEditorOpen *= 2; if (!defaultPreset && !commandEditorOpen) - window_text_input_open(w, widgetIndex, STR_TRACK_MANAGE_RENAME, STR_TITLE_EDITOR_ENTER_NAME_FOR_SEQUENCE, STR_STRING, (uint32)&gConfigTitleSequences.presets[gCurrentTitleSequence].name, 64); + window_text_input_open(w, widgetIndex, STR_TRACK_MANAGE_RENAME, STR_TITLE_EDITOR_ENTER_NAME_FOR_SEQUENCE, STR_STRING, (uintptr_t)&gConfigTitleSequences.presets[gCurrentTitleSequence].name, 64); break; case WIDX_TITLE_EDITOR_ADD: defaultPreset *= 2; playing *= 2; commandEditorOpen *= 2; @@ -351,7 +351,7 @@ static void window_title_editor_mouseup(rct_window *w, int widgetIndex) defaultPreset *= 2; playing *= 2; commandEditorOpen *= 2; if (!defaultPreset && !playing && !commandEditorOpen) { if (w->selected_list_item != -1) - window_text_input_open(w, widgetIndex, STR_FILEBROWSER_RENAME_SAVE_TITLE, STR_TITLE_EDITOR_ENTER_NAME_FOR_SAVE, STR_STRING, (uint32)gConfigTitleSequences.presets[gCurrentTitleSequence].saves[w->selected_list_item], TITLE_SEQUENCE_MAX_SAVE_LENGTH - 1); + window_text_input_open(w, widgetIndex, STR_FILEBROWSER_RENAME_SAVE_TITLE, STR_TITLE_EDITOR_ENTER_NAME_FOR_SAVE, STR_STRING, (uintptr_t)gConfigTitleSequences.presets[gCurrentTitleSequence].saves[w->selected_list_item], TITLE_SEQUENCE_MAX_SAVE_LENGTH - 1); } break; case WIDX_TITLE_EDITOR_LOAD: @@ -857,7 +857,7 @@ void window_title_editor_paint(rct_window *w, rct_drawpixelinfo *dpi) switch (w->selected_tab) { case WINDOW_TITLE_EDITOR_TAB_PRESETS: - set_format_arg(0, uint32, (uint32)&gConfigTitleSequences.presets[gCurrentTitleSequence].name); + set_format_arg(0, uintptr_t, &gConfigTitleSequences.presets[gCurrentTitleSequence].name); gfx_draw_string_left(dpi, STR_TITLE_SEQUENCE, NULL, w->colours[1], w->x + 10, w->y + window_title_editor_widgets[WIDX_TITLE_EDITOR_PRESETS].top + 1); gfx_draw_string_left_clipped( dpi, @@ -909,7 +909,7 @@ void window_title_editor_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int gfx_fill_rect(dpi, x, y, x + SCROLL_WIDTH + 100, y + ROW_HEIGHT - 1, ColourMapA[w->colours[1]].lighter | 0x1000000); } - set_format_arg(0, uint32, (uint32)&title->saves[i]); + set_format_arg(0, uintptr_t, &title->saves[i]); if (selected || hover) { format_string(buffer, STR_STRING, gCommonFormatArgs); } @@ -917,7 +917,7 @@ void window_title_editor_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int format_string(buffer + 1, STR_STRING, gCommonFormatArgs); buffer[0] = FORMAT_BLACK; } - set_format_arg(0, uint32, (uint32)&buffer); + set_format_arg(0, uintptr_t, &buffer); gfx_draw_string_left(dpi, STR_STRING, gCommonFormatArgs, w->colours[1], x + 5, y); } } @@ -949,7 +949,7 @@ void window_title_editor_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int commandName = STR_TITLE_EDITOR_COMMAND_LOAD_NO_SAVE; error = true; } - set_format_arg(0, uint32, (uint32)&title->saves[command->saveIndex]); + set_format_arg(0, uintptr_t, &title->saves[command->saveIndex]); break; case TITLE_SCRIPT_LOADMM: commandName = STR_TITLE_EDITOR_COMMAND_LOAD_SFMM; @@ -994,7 +994,7 @@ void window_title_editor_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int format_string(buffer + 1, commandName, gCommonFormatArgs); buffer[0] = (error ? ((selected || hover) ? FORMAT_LIGHTPINK : FORMAT_RED) : FORMAT_BLACK); } - set_format_arg(0, uint32, (uint32)&buffer); + set_format_arg(0, uintptr_t, &buffer); gfx_draw_string_left(dpi, STR_STRING, gCommonFormatArgs, w->colours[1], x + 5, y); } } diff --git a/src/windows/top_toolbar.c b/src/windows/top_toolbar.c index 6763bdebb4..53f26ac7b6 100644 --- a/src/windows/top_toolbar.c +++ b/src/windows/top_toolbar.c @@ -372,7 +372,7 @@ static void window_top_toolbar_mousedown(int widgetIndex, rct_window*w, rct_widg gDropdownItemsFormat[1] = STR_OPTIONS; gDropdownItemsFormat[2] = STR_SCREENSHOT; gDropdownItemsFormat[3] = STR_GIANT_SCREENSHOT; - gDropdownItemsFormat[4] = 0; + gDropdownItemsFormat[4] = STR_EMPTY; gDropdownItemsFormat[5] = STR_QUIT_TRACK_DESIGNS_MANAGER; gDropdownItemsFormat[6] = STR_EXIT_OPENRCT2; @@ -383,12 +383,12 @@ static void window_top_toolbar_mousedown(int widgetIndex, rct_window*w, rct_widg } else if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) { gDropdownItemsFormat[0] = STR_LOAD_LANDSCAPE; gDropdownItemsFormat[1] = STR_SAVE_LANDSCAPE; - gDropdownItemsFormat[2] = 0; + gDropdownItemsFormat[2] = STR_EMPTY; gDropdownItemsFormat[3] = STR_ABOUT; gDropdownItemsFormat[4] = STR_OPTIONS; gDropdownItemsFormat[5] = STR_SCREENSHOT; gDropdownItemsFormat[6] = STR_GIANT_SCREENSHOT; - gDropdownItemsFormat[7] = 0; + gDropdownItemsFormat[7] = STR_EMPTY; gDropdownItemsFormat[8] = STR_QUIT_SCENARIO_EDITOR; gDropdownItemsFormat[9] = STR_EXIT_OPENRCT2; numItems = 10; @@ -397,12 +397,12 @@ static void window_top_toolbar_mousedown(int widgetIndex, rct_window*w, rct_widg gDropdownItemsFormat[1] = STR_LOAD_GAME; gDropdownItemsFormat[2] = STR_SAVE_GAME; gDropdownItemsFormat[3] = STR_SAVE_GAME_AS; - gDropdownItemsFormat[4] = 0; + gDropdownItemsFormat[4] = STR_EMPTY; gDropdownItemsFormat[5] = STR_ABOUT; gDropdownItemsFormat[6] = STR_OPTIONS; gDropdownItemsFormat[7] = STR_SCREENSHOT; gDropdownItemsFormat[8] = STR_GIANT_SCREENSHOT; - gDropdownItemsFormat[9] = 0; + gDropdownItemsFormat[9] = STR_EMPTY; gDropdownItemsFormat[10] = STR_QUIT_TO_MENU; gDropdownItemsFormat[11] = STR_EXIT_OPENRCT2; numItems = 12; @@ -410,7 +410,7 @@ static void window_top_toolbar_mousedown(int widgetIndex, rct_window*w, rct_widg #ifndef DISABLE_TWITCH if (gConfigTwitch.channel != NULL && gConfigTwitch.channel[0] != 0) { _menuDropdownIncludesTwitch = true; - gDropdownItemsFormat[12] = 0; + gDropdownItemsFormat[12] = STR_EMPTY; gDropdownItemsFormat[DDIDX_ENABLE_TWITCH] = STR_TOGGLE_OPTION; gDropdownItemsArgs[DDIDX_ENABLE_TWITCH] = STR_TWITCH_ENABLE; numItems = 14; @@ -434,7 +434,7 @@ static void window_top_toolbar_mousedown(int widgetIndex, rct_window*w, rct_widg break; case WIDX_CHEATS: gDropdownItemsFormat[0] = STR_TOGGLE_OPTION; - gDropdownItemsFormat[1] = 0; + gDropdownItemsFormat[1] = STR_EMPTY; gDropdownItemsFormat[2] = STR_TOGGLE_OPTION; gDropdownItemsFormat[3] = STR_TOGGLE_OPTION; gDropdownItemsFormat[4] = STR_TOGGLE_OPTION; @@ -2851,7 +2851,7 @@ void top_toolbar_init_fastforward_menu(rct_window* w, rct_widget* widget) { gDropdownItemsFormat[2] = STR_TOGGLE_OPTION; gDropdownItemsFormat[3] = STR_TOGGLE_OPTION; if (gConfigGeneral.debugging_tools) { - gDropdownItemsFormat[4] = 0; + gDropdownItemsFormat[4] = STR_EMPTY; gDropdownItemsFormat[5] = STR_TOGGLE_OPTION; gDropdownItemsArgs[5] = STR_SPEED_HYPER; num_items = 6; @@ -3031,12 +3031,12 @@ void top_toolbar_init_view_menu(rct_window* w, rct_widget* widget) { gDropdownItemsFormat[0] = STR_TOGGLE_OPTION; gDropdownItemsFormat[1] = STR_TOGGLE_OPTION; gDropdownItemsFormat[2] = STR_TOGGLE_OPTION; - gDropdownItemsFormat[3] = 0; + gDropdownItemsFormat[3] = STR_EMPTY; gDropdownItemsFormat[4] = STR_TOGGLE_OPTION; gDropdownItemsFormat[5] = STR_TOGGLE_OPTION; gDropdownItemsFormat[6] = STR_TOGGLE_OPTION; gDropdownItemsFormat[7] = STR_TOGGLE_OPTION; - gDropdownItemsFormat[8] = 0; + gDropdownItemsFormat[8] = STR_EMPTY; gDropdownItemsFormat[9] = STR_TOGGLE_OPTION; gDropdownItemsFormat[10] = STR_TOGGLE_OPTION; gDropdownItemsFormat[11] = STR_TOGGLE_OPTION; diff --git a/src/world/map.c b/src/world/map.c index 26b30315be..baa89faaba 100644 --- a/src/world/map.c +++ b/src/world/map.c @@ -3709,7 +3709,6 @@ void game_command_place_large_scenery(int* eax, int* ebx, int* ecx, int* edx, in RCT2_GLOBAL(0x00F43892, sint16) = curTile.x; RCT2_GLOBAL(0x00F43894, sint16) = curTile.y; - RCT2_GLOBAL(0x00F43896, uint32) = (uint32)(ebx - 3); // this is how ebx flags var is passed to 0x006B8D88 if (!gCheatsDisableClearanceChecks && !map_can_construct_with_clear_at(curTile.x, curTile.y, zLow, zHigh, &map_place_scenery_clear_func, bl, flags, RCT2_ADDRESS(0x00F4389A, money32))) { *ebx = MONEY32_UNDEFINED; return;