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

define STR_NONE as a rct_string_id

This commit is contained in:
IntelOrca
2016-01-07 22:14:53 +00:00
parent 5e071ed032
commit 43a5cc92cc
12 changed files with 23 additions and 21 deletions

View File

@@ -2443,7 +2443,7 @@ void window_start_textbox(rct_window *call_w, int call_widget, rct_string_id exi
// Enter in the the text input buffer any existing
// text.
if (existing_text != (rct_string_id)STR_NONE)
if (existing_text != STR_NONE)
format_string(gTextBoxInput, existing_text, &existing_args);
// In order to prevent strings that exceed the maxLength

View File

@@ -135,7 +135,7 @@ const char *language_get_string(rct_string_id id)
{
const char *openrctString = nullptr;
if (id == (rct_string_id)STR_NONE)
if (id == STR_NONE)
return nullptr;
if (_languageCurrent != nullptr)
@@ -356,7 +356,7 @@ rct_string_id object_get_localised_text(uint8_t** pStringTable/*ebp*/, int type/
name[8] = 0;
rct_string_id stringId = _languageCurrent->GetObjectOverrideStringId(name, tableindex);
if (stringId != (rct_string_id)STR_NONE) {
if (stringId != STR_NONE) {
return stringId;
}
@@ -423,9 +423,9 @@ bool language_get_localised_scenario_strings(const utf8 *scenarioFilename, rct_s
outStringIds[1] = _languageCurrent->GetScenarioOverrideStringId(scenarioFilename, 1);
outStringIds[2] = _languageCurrent->GetScenarioOverrideStringId(scenarioFilename, 2);
return
outStringIds[0] != (rct_string_id)STR_NONE ||
outStringIds[1] != (rct_string_id)STR_NONE ||
outStringIds[2] != (rct_string_id)STR_NONE;
outStringIds[0] != STR_NONE ||
outStringIds[1] != STR_NONE ||
outStringIds[2] != STR_NONE;
}
}

View File

@@ -760,7 +760,7 @@ void format_string_part_from_raw(utf8 **dest, const utf8 *src, char **args)
void format_string_part(utf8 **dest, rct_string_id format, char **args)
{
if (format == (rct_string_id)STR_NONE) {
if (format == STR_NONE) {
**dest = 0;
} else if (format < 0x8000) {
// Language string

View File

@@ -21,9 +21,11 @@
#ifndef _STRING_IDS_H_
#define _STRING_IDS_H_
enum {
STR_NONE = -1,
#include "../common.h"
#define STR_NONE ((rct_string_id)-1)
enum {
STR_GUEST = 767,
STR_DATE_DAY_1 = 779,

View File

@@ -773,7 +773,7 @@ static uint32 install_object_entry(rct_object_entry* entry, rct_object_entry* in
// Always extract only the vehicle type, since the track type is always displayed in the left column, to prevent duplicate track names.
rct_string_id nameStringId = object_get_name_string_id(entry, chunk);
if (nameStringId == (rct_string_id)STR_NONE) {
if (nameStringId == STR_NONE) {
nameStringId = (rct_string_id)RCT2_GLOBAL(RCT2_ADDRESS_CURR_OBJECT_BASE_STRING_ID, uint32);
}

View File

@@ -285,13 +285,13 @@ void scenario_begin()
rct_string_id localisedStringIds[3];
if (language_get_localised_scenario_strings(normalisedName, localisedStringIds)) {
if (localisedStringIds[0] != (rct_string_id)STR_NONE) {
if (localisedStringIds[0] != STR_NONE) {
safe_strncpy((char*)RCT2_ADDRESS_SCENARIO_NAME, language_get_string(localisedStringIds[0]), 32);
}
if (localisedStringIds[1] != (rct_string_id)STR_NONE) {
if (localisedStringIds[1] != STR_NONE) {
park_set_name(language_get_string(localisedStringIds[1]));
}
if (localisedStringIds[2] != (rct_string_id)STR_NONE) {
if (localisedStringIds[2] != STR_NONE) {
safe_strncpy((char*)RCT2_ADDRESS_SCENARIO_DETAILS, language_get_string(localisedStringIds[2]), 256);
}
} else {

View File

@@ -190,10 +190,10 @@ static void scenario_translate(scenario_index_entry *scenarioEntry, const rct_ob
{
rct_string_id localisedStringIds[3];
if (language_get_localised_scenario_strings(scenarioEntry->name, localisedStringIds)) {
if (localisedStringIds[0] != (rct_string_id)STR_NONE) {
if (localisedStringIds[0] != STR_NONE) {
safe_strncpy(scenarioEntry->name, language_get_string(localisedStringIds[0]), 64);
}
if (localisedStringIds[2] != (rct_string_id)STR_NONE) {
if (localisedStringIds[2] != STR_NONE) {
safe_strncpy(scenarioEntry->details, language_get_string(localisedStringIds[2]), 256);
}
} else {

View File

@@ -91,13 +91,13 @@ void window_error_open(rct_string_id title, rct_string_id message)
// Format the title
dst = utf8_write_codepoint(dst, FORMAT_BLACK);
if (title != (rct_string_id)STR_NONE) {
if (title != STR_NONE) {
format_string(dst, title, args);
dst = get_string_end(dst);
}
// Format the message
if (message != (rct_string_id)STR_NONE) {
if (message != STR_NONE) {
dst = utf8_write_codepoint(dst, FORMAT_NEWLINE);
format_string(dst, message, args);
dst = get_string_end(dst);

View File

@@ -148,7 +148,7 @@ static void window_map_tooltip_update(rct_window *w)
*/
static void window_map_tooltip_paint(rct_window *w, rct_drawpixelinfo *dpi)
{
if (RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS, rct_string_id) == (rct_string_id)STR_NONE)
if (RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS, rct_string_id) == STR_NONE)
return;
gfx_draw_string_centred_wrapped(dpi, (void*)RCT2_ADDRESS_MAP_TOOLTIP_ARGS, w->x + (w->width / 2), w->y + (w->height / 2), w->width, 1162, 0);

View File

@@ -111,7 +111,7 @@ void window_text_input_open(rct_window* call_w, int call_widget, rct_string_id t
// Enter in the the text input buffer any existing
// text.
if (existing_text != (rct_string_id)STR_NONE)
if (existing_text != STR_NONE)
format_string(text_input, existing_text, &existing_args);
// In order to prevent strings that exceed the maxLength

View File

@@ -556,7 +556,7 @@ static void initialise_list_items(rct_window *w)
}
}
}
if (headingStringId != (rct_string_id)STR_NONE) {
if (headingStringId != STR_NONE) {
// Ensure list capacity
if (length == capacity) {
capacity += 32;

View File

@@ -158,7 +158,7 @@ void window_tooltip_open(rct_window *widgetWindow, int widgetIndex, int x, int y
gTooltipWidget.window_number = widgetWindow->number;
gTooltipWidget.widget_index = widgetIndex;
if (window_event_tooltip_call(widgetWindow, widgetIndex) == (rct_string_id)STR_NONE)
if (window_event_tooltip_call(widgetWindow, widgetIndex) == STR_NONE)
return;
window_tooltip_show(widget->tooltip, x, y);