clang-format localisation

This commit is contained in:
clang-format 2018-06-22 23:01:56 +02:00 committed by Hielke Morsink
parent 17d2693422
commit 737d2c490c
19 changed files with 1232 additions and 947 deletions

View File

@ -7,12 +7,13 @@
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#include <cstdlib>
#include "ConversionTables.h"
#include "../core/Util.hpp"
#include "ConversionTables.h"
#include "FormatCodes.h"
#include <cstdlib>
// clang-format off
const encoding_convert_entry RCT2ToUnicodeTable[256] =
{

View File

@ -7,14 +7,15 @@
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#include <algorithm>
#include <limits>
#include <stdexcept>
#include "../core/String.hpp"
#include "../core/Util.hpp"
#include "ConversionTables.h"
#include "Language.h"
#include <algorithm>
#include <limits>
#include <stdexcept>
/**
* Decodes an RCT2 string to a wide char string still in the original code page.
* An RCT2 string is a multi-byte string where every two-byte code point is preceeded with a byte value of 255.
@ -23,7 +24,7 @@ static std::wstring DecodeToWideChar(const std::string_view& src)
{
std::wstring decoded;
decoded.reserve(src.size());
for (auto it = src.begin(); it != src.end(); )
for (auto it = src.begin(); it != src.end();)
{
uint8_t c = *it++;
if (c == 255)
@ -88,7 +89,7 @@ static std::string DecodeToMultiByte(const std::string_view& src)
static std::string Encode(const std::string_view& src)
{
std::string dst;
const utf8 * ch = src.data();
const utf8* ch = src.data();
int32_t codepoint;
while ((codepoint = utf8_get_next(ch, &ch)) != 0)
{
@ -129,8 +130,7 @@ static int32_t GetCodePageForRCT2Language(RCT2LanguageId languageId)
}
}
template<typename TConvertFunc>
static std::string DecodeConvertWithTable(const std::string_view& src, TConvertFunc func)
template<typename TConvertFunc> static std::string DecodeConvertWithTable(const std::string_view& src, TConvertFunc func)
{
auto decoded = DecodeToWideChar(src);
std::wstring u16;

View File

@ -7,9 +7,10 @@
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#include "Currency.h"
#include "../config/Config.h"
#include "../util/Util.h"
#include "Currency.h"
#include "StringIds.h"
// clang-format off
@ -40,6 +41,9 @@ void currency_load_custom_currency_config()
CurrencyDescriptors[CURRENCY_CUSTOM].affix_unicode = gConfigGeneral.custom_currency_affix;
if (gConfigGeneral.custom_currency_symbol != nullptr)
{
safe_strcpy(CurrencyDescriptors[CURRENCY_CUSTOM].symbol_unicode, gConfigGeneral.custom_currency_symbol, CURRENCY_SYMBOL_MAX_SIZE);
safe_strcpy(
CurrencyDescriptors[CURRENCY_CUSTOM].symbol_unicode,
gConfigGeneral.custom_currency_symbol,
CURRENCY_SYMBOL_MAX_SIZE);
}
}

View File

@ -13,7 +13,8 @@
#include "../common.h"
// List of currencies
enum CURRENCY_TYPE {
enum CURRENCY_TYPE
{
CURRENCY_POUNDS, // British Pound
CURRENCY_DOLLARS, // US Dollar
CURRENCY_FRANC, // French Franc
@ -36,7 +37,8 @@ enum CURRENCY_TYPE {
CURRENCY_END // Last item
};
enum CURRENCY_AFFIX {
enum CURRENCY_AFFIX
{
CURRENCY_PREFIX,
CURRENCY_SUFFIX
};
@ -45,7 +47,8 @@ enum CURRENCY_AFFIX {
#define CURRENCY_RATE_MAX_NUM_DIGITS 9
// Currency format specification - inspired by OpenTTD
struct currency_descriptor {
struct currency_descriptor
{
char isoCode[4];
// Rate is relative to 0.10 GBP
int32_t rate;

View File

@ -12,7 +12,8 @@
#include "../common.h"
enum {
enum
{
MONTH_MARCH,
MONTH_APRIL,
MONTH_MAY,
@ -25,14 +26,16 @@ enum {
MONTH_COUNT
};
enum {
enum
{
DATE_FORMAT_DAY_MONTH_YEAR,
DATE_FORMAT_MONTH_DAY_YEAR,
DATE_FORMAT_YEAR_MONTH_DAY,
DATE_FORMAT_YEAR_DAY_MONTH
};
struct openrct_timeofday {
struct openrct_timeofday
{
uint8_t second;
uint8_t minute;
uint8_t hour;

View File

@ -7,16 +7,18 @@
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#include "FormatCodes.h"
#include "../common.h"
#include "../core/Util.hpp"
#include "FormatCodes.h"
#include "Localisation.h"
#pragma region Format codes
struct format_code_token {
struct format_code_token
{
uint32_t code;
const char *token;
const char* token;
};
// clang-format off
@ -95,7 +97,7 @@ static constexpr const format_code_token format_code_tokens[] = {
};
// clang-format on
uint32_t format_get_code(const char *token)
uint32_t format_get_code(const char* token)
{
for (uint32_t i = 0; i < Util::CountOf(format_code_tokens); i++)
{
@ -105,7 +107,7 @@ uint32_t format_get_code(const char *token)
return 0;
}
const char *format_get_token(uint32_t code)
const char* format_get_token(uint32_t code)
{
for (uint32_t i = 0; i < Util::CountOf(format_code_tokens); i++)
{
@ -117,7 +119,8 @@ const char *format_get_token(uint32_t code)
bool utf8_should_use_sprite_for_codepoint(int32_t codepoint)
{
switch (codepoint) {
switch (codepoint)
{
case FORMAT_UP:
case FORMAT_DOWN:
case FORMAT_LEFTGUILLEMET:

View File

@ -12,10 +12,11 @@
#include "../common.h"
uint32_t format_get_code(const char *token);
const char *format_get_token(uint32_t code);
uint32_t format_get_code(const char* token);
const char* format_get_token(uint32_t code);
enum {
enum
{
// Font format codes
// The next byte specifies the X coordinate

View File

@ -7,18 +7,19 @@
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#include <stack>
#include "../Context.h"
#include "../core/Path.hpp"
#include "../core/String.hpp"
#include "../interface/Fonts.h"
#include "../interface/FontFamilies.h"
#include "../interface/Fonts.h"
#include "../object/ObjectManager.h"
#include "../platform/platform.h"
#include "LanguagePack.h"
#include "Localisation.h"
#include "LocalisationService.h"
#include <stack>
// clang-format off
const language_descriptor LanguagesDescriptors[LANGUAGE_COUNT] =
{
@ -56,10 +57,10 @@ const utf8 BlackRightArrowString[] = { (utf8)(uint8_t)0xC2, (utf8)(uint8_t)0x
const utf8 CheckBoxMarkString[] = { (utf8)(uint8_t)0xE2, (utf8)(uint8_t)0x9C, (utf8)(uint8_t)0x93, (utf8)(uint8_t)0x00 };
// clang-format on
void utf8_remove_format_codes(utf8 * text, bool allowcolours)
void utf8_remove_format_codes(utf8* text, bool allowcolours)
{
const utf8 * ch = text;
utf8 * dstCh = text;
const utf8* ch = text;
utf8* dstCh = text;
int32_t codepoint;
while ((codepoint = String::GetNextCodepoint(ch, &ch)) != 0)
{
@ -71,10 +72,10 @@ void utf8_remove_format_codes(utf8 * text, bool allowcolours)
*dstCh = 0;
}
uint8_t language_get_id_from_locale(const char * locale)
uint8_t language_get_id_from_locale(const char* locale)
{
uint8_t i = 0;
for (const auto &langDesc : LanguagesDescriptors)
for (const auto& langDesc : LanguagesDescriptors)
{
if (String::Equals(locale, langDesc.locale))
{
@ -85,7 +86,7 @@ uint8_t language_get_id_from_locale(const char * locale)
return LANGUAGE_UNDEFINED;
}
const char * language_get_string(rct_string_id id)
const char* language_get_string(rct_string_id id)
{
const auto& localisationService = OpenRCT2::GetContext()->GetLocalisationService();
return localisationService.GetString(id);
@ -107,17 +108,14 @@ bool language_open(int32_t id)
}
}
bool language_get_localised_scenario_strings(const utf8 *scenarioFilename, rct_string_id *outStringIds)
bool language_get_localised_scenario_strings(const utf8* scenarioFilename, rct_string_id* outStringIds)
{
const auto& localisationService = OpenRCT2::GetContext()->GetLocalisationService();
auto result = localisationService.GetLocalisedScenarioStrings(scenarioFilename);
outStringIds[0] = std::get<0>(result);
outStringIds[1] = std::get<1>(result);
outStringIds[2] = std::get<2>(result);
return
outStringIds[0] != STR_NONE ||
outStringIds[1] != STR_NONE ||
outStringIds[2] != STR_NONE;
return outStringIds[0] != STR_NONE || outStringIds[1] != STR_NONE || outStringIds[2] != STR_NONE;
}
void language_free_object_string(rct_string_id stringId)
@ -126,13 +124,13 @@ void language_free_object_string(rct_string_id stringId)
localisationService.FreeObjectString(stringId);
}
rct_string_id language_get_object_override_string_id(const char * identifier, uint8_t index)
rct_string_id language_get_object_override_string_id(const char* identifier, uint8_t index)
{
const auto& localisationService = OpenRCT2::GetContext()->GetLocalisationService();
return localisationService.GetObjectOverrideStringId(identifier, index);
}
rct_string_id language_allocate_object_string(const std::string &target)
rct_string_id language_allocate_object_string(const std::string& target)
{
auto& localisationService = OpenRCT2::GetContext()->GetLocalisationService();
return localisationService.AllocateObjectString(target);

View File

@ -10,12 +10,14 @@
#ifndef _LANGUAGE_H_
#define _LANGUAGE_H_
#include <string>
#include <string_view>
#include "../common.h"
#include "../drawing/Font.h"
enum {
#include <string>
#include <string_view>
enum
{
LANGUAGE_UNDEFINED,
LANGUAGE_ARABIC,
LANGUAGE_CATALAN,
@ -66,14 +68,15 @@ enum RCT2LanguageId
#include "../interface/FontFamilies.h"
struct language_descriptor {
const char *locale;
const utf8 *english_name;
const utf8 *native_name;
struct language_descriptor
{
const char* locale;
const utf8* english_name;
const utf8* native_name;
#if !defined(NO_TTF)
TTFontFamily const * font_family;
TTFontFamily const* font_family;
#else
void * font_family;
void* font_family;
#endif
RCT2LanguageId rct2_original_id;
};
@ -86,25 +89,25 @@ extern const utf8 BlackLeftArrowString[];
extern const utf8 BlackRightArrowString[];
extern const utf8 CheckBoxMarkString[];
uint8_t language_get_id_from_locale(const char * locale);
const char *language_get_string(rct_string_id id);
uint8_t language_get_id_from_locale(const char* locale);
const char* language_get_string(rct_string_id id);
bool language_open(int32_t id);
uint32_t utf8_get_next(const utf8 *char_ptr, const utf8 **nextchar_ptr);
utf8 *utf8_write_codepoint(utf8 *dst, uint32_t codepoint);
int32_t utf8_insert_codepoint(utf8 *dst, uint32_t codepoint);
bool utf8_is_codepoint_start(const utf8 *text);
void utf8_remove_format_codes(utf8 *text, bool allowcolours);
uint32_t utf8_get_next(const utf8* char_ptr, const utf8** nextchar_ptr);
utf8* utf8_write_codepoint(utf8* dst, uint32_t codepoint);
int32_t utf8_insert_codepoint(utf8* dst, uint32_t codepoint);
bool utf8_is_codepoint_start(const utf8* text);
void utf8_remove_format_codes(utf8* text, bool allowcolours);
int32_t utf8_get_codepoint_length(int32_t codepoint);
int32_t utf8_length(const utf8 *text);
wchar_t *utf8_to_widechar(const utf8 *src);
utf8 *widechar_to_utf8(const wchar_t *src);
int32_t utf8_length(const utf8* text);
wchar_t* utf8_to_widechar(const utf8* src);
utf8* widechar_to_utf8(const wchar_t* src);
std::string rct2_to_utf8(const std::string_view& src, RCT2LanguageId languageId);
std::string utf8_to_rct2(const std::string_view& src);
bool language_get_localised_scenario_strings(const utf8 *scenarioFilename, rct_string_id *outStringIds);
bool language_get_localised_scenario_strings(const utf8* scenarioFilename, rct_string_id* outStringIds);
void language_free_object_string(rct_string_id stringId);
rct_string_id language_get_object_override_string_id(const char * identifier, uint8_t index);
rct_string_id language_allocate_object_string(const std::string &target);
rct_string_id language_get_object_override_string_id(const char* identifier, uint8_t index);
rct_string_id language_allocate_object_string(const std::string& target);
#endif

View File

@ -7,20 +7,20 @@
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#include <algorithm>
#include <string>
#include <vector>
#include "LanguagePack.h"
#include "../common.h"
#include "Localisation.h"
#include "../core/FileStream.hpp"
#include "../core/Math.hpp"
#include "../core/Memory.hpp"
#include "../core/String.hpp"
#include "../core/StringBuilder.hpp"
#include "../core/StringReader.hpp"
#include "LanguagePack.h"
#include "Localisation.h"
#include <algorithm>
#include <string>
#include <vector>
// Don't try to load more than language files that exceed 64 MiB
constexpr uint64_t MAX_LANGUAGE_SIZE = 64 * 1024 * 1024;
@ -57,16 +57,16 @@ private:
// Parsing work data
///////////////////////////////////////////////////////////////////////////
std::string _currentGroup;
ObjectOverride * _currentObjectOverride = nullptr;
ScenarioOverride * _currentScenarioOverride = nullptr;
ObjectOverride* _currentObjectOverride = nullptr;
ScenarioOverride* _currentScenarioOverride = nullptr;
public:
static LanguagePack * FromFile(uint16_t id, const utf8 * path)
static LanguagePack* FromFile(uint16_t id, const utf8* path)
{
Guard::ArgumentNotNull(path);
// Load file directly into memory
utf8 * fileData = nullptr;
utf8* fileData = nullptr;
try
{
FileStream fs = FileStream(path, FILE_MODE_OPEN);
@ -81,7 +81,7 @@ public:
fs.Read(fileData, fileLength);
fileData[fileLength] = '\0';
}
catch (const std::exception &ex)
catch (const std::exception& ex)
{
Memory::Free(fileData);
log_error("Unable to open %s: %s", path, ex.what());
@ -89,18 +89,18 @@ public:
}
// Parse the memory as text
LanguagePack * result = FromText(id, fileData);
LanguagePack* result = FromText(id, fileData);
Memory::Free(fileData);
return result;
}
static LanguagePack * FromText(uint16_t id, const utf8 * text)
static LanguagePack* FromText(uint16_t id, const utf8* text)
{
return new LanguagePack(id, text);
}
LanguagePack(uint16_t id, const utf8 * text)
LanguagePack(uint16_t id, const utf8* text)
: _id(id)
{
Guard::ArgumentNotNull(text);
@ -135,7 +135,7 @@ public:
}
}
void SetString(rct_string_id stringId, const std::string &str) override
void SetString(rct_string_id stringId, const std::string& str) override
{
if (_strings.size() >= (size_t)stringId)
{
@ -143,7 +143,7 @@ public:
}
}
const utf8 * GetString(rct_string_id stringId) const override
const utf8* GetString(rct_string_id stringId) const override
{
if (stringId >= ScenarioOverrideBase)
{
@ -188,13 +188,13 @@ public:
}
}
rct_string_id GetObjectOverrideStringId(const char * objectIdentifier, uint8_t index) override
rct_string_id GetObjectOverrideStringId(const char* objectIdentifier, uint8_t index) override
{
Guard::ArgumentNotNull(objectIdentifier);
Guard::Assert(index < ObjectOverrideMaxStringCount);
int32_t ooIndex = 0;
for (const ObjectOverride &objectOverride : _objectOverrides)
for (const ObjectOverride& objectOverride : _objectOverrides)
{
if (strncmp(objectOverride.name, objectIdentifier, 8) == 0)
{
@ -210,13 +210,13 @@ public:
return STR_NONE;
}
rct_string_id GetScenarioOverrideStringId(const utf8 * scenarioFilename, uint8_t index) override
rct_string_id GetScenarioOverrideStringId(const utf8* scenarioFilename, uint8_t index) override
{
Guard::ArgumentNotNull(scenarioFilename);
Guard::Assert(index < ScenarioOverrideMaxStringCount);
int32_t ooIndex = 0;
for (const ScenarioOverride &scenarioOverride : _scenarioOverrides)
for (const ScenarioOverride& scenarioOverride : _scenarioOverrides)
{
if (String::Equals(scenarioOverride.filename.c_str(), scenarioFilename, true))
{
@ -233,9 +233,9 @@ public:
}
private:
ObjectOverride * GetObjectOverride(const std::string &objectIdentifier)
ObjectOverride* GetObjectOverride(const std::string& objectIdentifier)
{
for (auto &oo : _objectOverrides)
for (auto& oo : _objectOverrides)
{
if (strncmp(oo.name, objectIdentifier.c_str(), 8) == 0)
{
@ -245,9 +245,9 @@ private:
return nullptr;
}
ScenarioOverride * GetScenarioOverride(const std::string &scenarioIdentifier)
ScenarioOverride* GetScenarioOverride(const std::string& scenarioIdentifier)
{
for (auto &so : _scenarioOverrides)
for (auto& so : _scenarioOverrides)
{
if (String::Equals(so.strings[0], scenarioIdentifier.c_str(), true))
{
@ -267,9 +267,9 @@ private:
// Unsure at how the original game decides which entries to write resource strings to, but this could affect adding new
// strings for the time being. Further investigation is required.
//
// When reading the language files, the STR_XXXX part is read and XXXX becomes the string id number. Everything after the colon
// and before the new line will be saved as the string. Tokens are written with inside curly braces {TOKEN}.
// Use # at the beginning of a line to leave a comment.
// When reading the language files, the STR_XXXX part is read and XXXX becomes the string id number. Everything after the
// colon and before the new line will be saved as the string. Tokens are written with inside curly braces {TOKEN}. Use # at
// the beginning of a line to leave a comment.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static bool IsWhitespace(codepoint_t codepoint)
@ -282,7 +282,7 @@ private:
return codepoint == '\r' || codepoint == '\n';
}
static void SkipWhitespace(IStringReader * reader)
static void SkipWhitespace(IStringReader* reader)
{
codepoint_t codepoint;
while (reader->TryPeek(&codepoint))
@ -298,7 +298,7 @@ private:
}
}
static void SkipNewLine(IStringReader * reader)
static void SkipNewLine(IStringReader* reader)
{
codepoint_t codepoint;
while (reader->TryPeek(&codepoint))
@ -314,10 +314,11 @@ private:
}
}
static void SkipToEndOfLine(IStringReader * reader)
static void SkipToEndOfLine(IStringReader* reader)
{
codepoint_t codepoint;
while (reader->TryPeek(&codepoint)) {
while (reader->TryPeek(&codepoint))
{
if (codepoint != '\r' && codepoint != '\n')
{
reader->Skip();
@ -329,14 +330,15 @@ private:
}
}
void ParseLine(IStringReader *reader)
void ParseLine(IStringReader* reader)
{
SkipWhitespace(reader);
codepoint_t codepoint;
if (reader->TryPeek(&codepoint))
{
switch (codepoint) {
switch (codepoint)
{
case '#':
SkipToEndOfLine(reader);
break;
@ -358,7 +360,7 @@ private:
}
}
void ParseGroupObject(IStringReader * reader)
void ParseGroupObject(IStringReader* reader)
{
auto sb = StringBuilder();
codepoint_t codepoint;
@ -370,7 +372,8 @@ private:
bool closedCorrectly = false;
while (reader->TryPeek(&codepoint))
{
if (IsNewLine(codepoint)) break;
if (IsNewLine(codepoint))
break;
reader->Skip();
if (codepoint == ']')
@ -407,7 +410,7 @@ private:
}
}
void ParseGroupScenario(IStringReader * reader)
void ParseGroupScenario(IStringReader* reader)
{
auto sb = StringBuilder();
codepoint_t codepoint;
@ -419,7 +422,8 @@ private:
bool closedCorrectly = false;
while (reader->TryPeek(&codepoint))
{
if (IsNewLine(codepoint)) break;
if (IsNewLine(codepoint))
break;
reader->Skip();
if (codepoint == '>')
@ -449,7 +453,7 @@ private:
}
}
void ParseString(IStringReader *reader)
void ParseString(IStringReader* reader)
{
auto sb = StringBuilder();
codepoint_t codepoint;
@ -484,7 +488,7 @@ private:
reader->Skip();
// Validate identifier
const utf8 * identifier = sb.GetBuffer();
const utf8* identifier = sb.GetBuffer();
int32_t stringId;
if (_currentGroup.empty())
@ -497,14 +501,33 @@ private:
}
else
{
if (String::Equals(identifier, "STR_NAME")) { stringId = 0; }
else if (String::Equals(identifier, "STR_DESC")) { stringId = 1; }
else if (String::Equals(identifier, "STR_CPTY")) { stringId = 2; }
if (String::Equals(identifier, "STR_NAME"))
{
stringId = 0;
}
else if (String::Equals(identifier, "STR_DESC"))
{
stringId = 1;
}
else if (String::Equals(identifier, "STR_CPTY"))
{
stringId = 2;
}
else if (String::Equals(identifier, "STR_SCNR")) { stringId = 0; }
else if (String::Equals(identifier, "STR_PARK")) { stringId = 1; }
else if (String::Equals(identifier, "STR_DTLS")) { stringId = 2; }
else {
else if (String::Equals(identifier, "STR_SCNR"))
{
stringId = 0;
}
else if (String::Equals(identifier, "STR_PARK"))
{
stringId = 1;
}
else if (String::Equals(identifier, "STR_DTLS"))
{
stringId = 2;
}
else
{
// Ignore line entirely
return;
}
@ -565,7 +588,7 @@ private:
}
}
bool ParseToken(IStringReader * reader, uint32_t * token, bool * isByte)
bool ParseToken(IStringReader* reader, uint32_t* token, bool* isByte)
{
auto sb = StringBuilder();
codepoint_t codepoint;
@ -575,17 +598,20 @@ private:
while (reader->TryPeek(&codepoint))
{
if (IsNewLine(codepoint)) return false;
if (IsWhitespace(codepoint)) return false;
if (IsNewLine(codepoint))
return false;
if (IsWhitespace(codepoint))
return false;
reader->Skip();
if (codepoint == '}') break;
if (codepoint == '}')
break;
sb.Append(codepoint);
}
const utf8 * tokenName = sb.GetBuffer();
const utf8* tokenName = sb.GetBuffer();
*token = format_get_code(tokenName);
*isByte = false;
@ -606,13 +632,13 @@ private:
namespace LanguagePackFactory
{
ILanguagePack * FromFile(uint16_t id, const utf8 * path)
ILanguagePack* FromFile(uint16_t id, const utf8* path)
{
auto languagePack = LanguagePack::FromFile(id, path);
return languagePack;
}
ILanguagePack * FromText(uint16_t id, const utf8 * text)
ILanguagePack* FromText(uint16_t id, const utf8* text)
{
auto languagePack = LanguagePack::FromText(id, text);
return languagePack;

View File

@ -9,9 +9,10 @@
#pragma once
#include <string>
#include "../common.h"
#include <string>
interface ILanguagePack
{
virtual ~ILanguagePack() = default;
@ -20,14 +21,14 @@ interface ILanguagePack
virtual uint32_t GetCount() const abstract;
virtual void RemoveString(rct_string_id stringId) abstract;
virtual void SetString(rct_string_id stringId, const std::string &str) abstract;
virtual const utf8 * GetString(rct_string_id stringId) const abstract;
virtual rct_string_id GetObjectOverrideStringId(const char * objectIdentifier, uint8_t index) abstract;
virtual rct_string_id GetScenarioOverrideStringId(const utf8 * scenarioFilename, uint8_t index) abstract;
virtual void SetString(rct_string_id stringId, const std::string& str) abstract;
virtual const utf8* GetString(rct_string_id stringId) const abstract;
virtual rct_string_id GetObjectOverrideStringId(const char* objectIdentifier, uint8_t index) abstract;
virtual rct_string_id GetScenarioOverrideStringId(const utf8* scenarioFilename, uint8_t index) abstract;
};
namespace LanguagePackFactory
{
ILanguagePack * FromFile(uint16_t id, const utf8 * path);
ILanguagePack * FromText(uint16_t id, const utf8 * text);
}
ILanguagePack* FromFile(uint16_t id, const utf8* path);
ILanguagePack* FromText(uint16_t id, const utf8* text);
} // namespace LanguagePackFactory

View File

@ -7,12 +7,13 @@
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#include <time.h>
#include "../Game.h"
#include "../core/Math.hpp"
#include "Date.h"
#include "StringIds.h"
#include <time.h>
uint16_t gDateMonthTicks;
uint16_t gDateMonthsElapsed;
@ -89,7 +90,7 @@ void date_update()
void date_update_real_time_of_day()
{
time_t timestamp = time(nullptr);
struct tm *now = localtime(&timestamp);
struct tm* now = localtime(&timestamp);
gRealTimeOfDay.second = now->tm_sec;
gRealTimeOfDay.minute = now->tm_min;

File diff suppressed because it is too large Load Diff

View File

@ -10,14 +10,14 @@
#ifndef LOCALISATION_H
#define LOCALISATION_H
#include <cstring>
#include "../management/Marketing.h"
#include "Currency.h"
#include "Date.h"
#include "FormatCodes.h"
#include "Language.h"
#include "StringIds.h"
#include "../management/Marketing.h"
#include <cstring>
bool utf8_is_format_code(int32_t codepoint);
bool utf8_is_colour_code(int32_t codepoint);
@ -25,21 +25,21 @@ bool utf8_should_use_sprite_for_codepoint(int32_t codepoint);
int32_t utf8_get_format_code_arg_length(int32_t codepoint);
void utf8_remove_formatting(utf8* string, bool allowColours);
void format_string(char *dest, size_t size, rct_string_id format, void *args);
void format_string_raw(char *dest, size_t size, char *src, void *args);
void format_string_to_upper(char *dest, size_t size, rct_string_id format, void *args);
void format_string(char* dest, size_t size, rct_string_id format, void* args);
void format_string_raw(char* dest, size_t size, char* src, void* args);
void format_string_to_upper(char* dest, size_t size, rct_string_id format, void* args);
void generate_string_file();
utf8 *get_string_end(const utf8 *text);
size_t get_string_size(const utf8 *text);
int32_t get_string_length(const utf8 *text);
utf8* get_string_end(const utf8* text);
size_t get_string_size(const utf8* text);
int32_t get_string_length(const utf8* text);
// The maximum number of characters allowed for string/money conversions (anything above will risk integer overflow issues)
#define MONEY_STRING_MAXLENGTH 14
money32 string_to_money(const char* string_to_monetise);
void money_to_string(money32 amount, char * buffer_to_put_value_to, size_t buffer_len, bool forceDecimals);
void money_to_string(money32 amount, char* buffer_to_put_value_to, size_t buffer_len, bool forceDecimals);
void user_string_clear_all();
rct_string_id user_string_allocate(int32_t base, const utf8 *text);
rct_string_id user_string_allocate(int32_t base, const utf8* text);
void user_string_free(rct_string_id id);
bool is_user_string_id(rct_string_id stringId);
@ -52,14 +52,15 @@ bool is_user_string_id(rct_string_id stringId);
#define REAL_NAME_END 0xDFFF
// Constants used by user_string_allocate
enum {
enum
{
USER_STRING_HIGH_ID_NUMBER = 1 << 2,
USER_STRING_DUPLICATION_PERMITTED = 1 << 7
};
// Real name data
extern const char real_name_initials[16];
extern const char *real_names[1024];
extern const char* real_names[1024];
extern utf8 gUserStrings[MAX_USER_STRINGS][USER_STRING_MAX_LENGTH];
extern char gCommonStringFormatBuffer[256];
@ -77,20 +78,25 @@ extern const rct_string_id DateDayNames[31];
extern const rct_string_id DateGameMonthNames[MONTH_COUNT];
extern const rct_string_id DateGameShortMonthNames[MONTH_COUNT];
[[maybe_unused]] static inline void set_format_arg_body(uint8_t *args, size_t offset, uintptr_t value, size_t size)
[[maybe_unused]] static inline void set_format_arg_body(uint8_t* args, size_t offset, uintptr_t value, size_t size)
{
memcpy(args + offset, &value, size);
}
#define set_format_arg(offset, type, value) \
do { static_assert(sizeof(type) <= sizeof(uintptr_t), "Type too large"); \
set_format_arg_body(gCommonFormatArgs, offset, (uintptr_t)(value), sizeof(type)); } while (false)
do \
{ \
static_assert(sizeof(type) <= sizeof(uintptr_t), "Type too large"); \
set_format_arg_body(gCommonFormatArgs, offset, (uintptr_t)(value), sizeof(type)); \
} while (false)
#define set_format_arg_on(args, offset, type, value) \
set_format_arg_body(args, offset, (uintptr_t)(value), sizeof(type))
#define set_format_arg_on(args, offset, type, value) set_format_arg_body(args, offset, (uintptr_t)(value), sizeof(type))
#define set_map_tooltip_format_arg(offset, type, value) \
do { static_assert(sizeof(type) <= sizeof(uintptr_t), "Type too large"); \
set_format_arg_body(gMapTooltipFormatArgs, offset, (uintptr_t)(value), sizeof(type)); } while (false)
do \
{ \
static_assert(sizeof(type) <= sizeof(uintptr_t), "Type too large"); \
set_format_arg_body(gMapTooltipFormatArgs, offset, (uintptr_t)(value), sizeof(type)); \
} while (false)
#endif

View File

@ -7,17 +7,19 @@
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#include <stdexcept>
#include "LocalisationService.h"
#include "../Context.h"
#include "../PlatformEnvironment.h"
#include "../core/Path.hpp"
#include "../interface/Fonts.h"
#include "../object/ObjectManager.h"
#include "../PlatformEnvironment.h"
#include "Language.h"
#include "LanguagePack.h"
#include "LocalisationService.h"
#include "StringIds.h"
#include <stdexcept>
using namespace OpenRCT2;
using namespace OpenRCT2::Localisation;
@ -27,7 +29,8 @@ static constexpr uint16_t MAX_OBJECT_CACHED_STRINGS = 2048;
LocalisationService::LocalisationService(const std::shared_ptr<IPlatformEnvironment>& env)
: _env(env)
{
for (rct_string_id stringId = NONSTEX_BASE_STRING_ID + MAX_OBJECT_CACHED_STRINGS; stringId >= NONSTEX_BASE_STRING_ID; stringId--)
for (rct_string_id stringId = NONSTEX_BASE_STRING_ID + MAX_OBJECT_CACHED_STRINGS; stringId >= NONSTEX_BASE_STRING_ID;
stringId--)
{
_availableObjectStringIds.push(stringId);
}
@ -38,9 +41,9 @@ LocalisationService::~LocalisationService()
{
}
const char * LocalisationService::GetString(rct_string_id id) const
const char* LocalisationService::GetString(rct_string_id id) const
{
const char * result = nullptr;
const char* result = nullptr;
if (id == STR_EMPTY)
{
result = "";
@ -83,7 +86,8 @@ void LocalisationService::OpenLanguage(int32_t id, IObjectManager& objectManager
if (id != LANGUAGE_ENGLISH_UK)
{
filename = GetLanguagePath(LANGUAGE_ENGLISH_UK);
_languageFallback = std::unique_ptr<ILanguagePack>(LanguagePackFactory::FromFile(LANGUAGE_ENGLISH_UK, filename.c_str()));
_languageFallback
= std::unique_ptr<ILanguagePack>(LanguagePackFactory::FromFile(LANGUAGE_ENGLISH_UK, filename.c_str()));
}
filename = GetLanguagePath(id);
@ -109,7 +113,8 @@ void LocalisationService::CloseLanguages()
_currentLanguage = LANGUAGE_UNDEFINED;
}
std::tuple<rct_string_id, rct_string_id, rct_string_id> LocalisationService::GetLocalisedScenarioStrings(const std::string& scenarioFilename) const
std::tuple<rct_string_id, rct_string_id, rct_string_id>
LocalisationService::GetLocalisedScenarioStrings(const std::string& scenarioFilename) const
{
auto result0 = _languageCurrent->GetScenarioOverrideStringId(scenarioFilename.c_str(), 0);
auto result1 = _languageCurrent->GetScenarioOverrideStringId(scenarioFilename.c_str(), 1);
@ -117,7 +122,7 @@ std::tuple<rct_string_id, rct_string_id, rct_string_id> LocalisationService::Get
return std::make_tuple(result0, result1, result2);
}
rct_string_id LocalisationService::GetObjectOverrideStringId(const char * identifier, uint8_t index) const
rct_string_id LocalisationService::GetObjectOverrideStringId(const char* identifier, uint8_t index) const
{
if (_languageCurrent == nullptr)
{

View File

@ -9,11 +9,12 @@
#pragma once
#include "../common.h"
#include <memory>
#include <stack>
#include <string>
#include <tuple>
#include "../common.h"
interface ILanguagePack;
interface IObjectManager;
@ -36,16 +37,26 @@ namespace OpenRCT2::Localisation
std::stack<rct_string_id> _availableObjectStringIds;
public:
int32_t GetCurrentLanguage() const { return _currentLanguage; }
bool UseTrueTypeFont() const { return _useTrueTypeFont; }
void UseTrueTypeFont(bool value) { _useTrueTypeFont = value; }
int32_t GetCurrentLanguage() const
{
return _currentLanguage;
}
bool UseTrueTypeFont() const
{
return _useTrueTypeFont;
}
void UseTrueTypeFont(bool value)
{
_useTrueTypeFont = value;
}
LocalisationService(const std::shared_ptr<IPlatformEnvironment>& env);
~LocalisationService();
const char * GetString(rct_string_id id) const;
std::tuple<rct_string_id, rct_string_id, rct_string_id> GetLocalisedScenarioStrings(const std::string& scenarioFilename) const;
rct_string_id GetObjectOverrideStringId(const char * identifier, uint8_t index) const;
const char* GetString(rct_string_id id) const;
std::tuple<rct_string_id, rct_string_id, rct_string_id>
GetLocalisedScenarioStrings(const std::string& scenarioFilename) const;
rct_string_id GetObjectOverrideStringId(const char* identifier, uint8_t index) const;
std::string GetLanguagePath(uint32_t languageId) const;
void OpenLanguage(int32_t id, IObjectManager& objectManager);
@ -53,7 +64,7 @@ namespace OpenRCT2::Localisation
rct_string_id AllocateObjectString(const std::string& target);
void FreeObjectString(rct_string_id stringId);
};
}
} // namespace OpenRCT2::Localisation
// Legacy getters
// TODO Remove usages of these and instead call via shared reference

View File

@ -15,7 +15,8 @@
#define STR_NONE ((rct_string_id)-1)
#define STR_VIEWPORT ((rct_string_id)-2)
enum {
enum
{
STR_EMPTY = 0,
// STR_0001 :{STRINGID} {COMMA16}
STR_RIDE_NAME_SPIRAL_ROLLER_COASTER = 2,
@ -250,8 +251,8 @@ enum {
STR_MONTH_SHORT_OCT = 819,
STR_MONTH_SHORT_NOV = 820, // Unused
STR_MONTH_SHORT_DEC = 821, // Unused
// STR_0822 :Unable to access graphic data file
// STR_0823 :Missing or inaccessible data file
// STR_0822 :Unable to access graphic data file
// STR_0823 :Missing or inaccessible data file
STR_CLOSE_X = 824,
STR_CHOSEN_NAME_IN_USE_ALREADY = 825,
STR_TOO_MANY_NAMES_DEFINED = 826,
@ -264,21 +265,21 @@ enum {
STR_PAUSE_GAME_TIP = 833,
STR_DISC_AND_GAME_OPTIONS_TIP = 834,
STR_ERR_GAME_INITIALISATION_FAILED = 835,
// STR_0835 :Game initialisation failed
// STR_0836 :Unable to start game in a minimised state
// STR_0837 :Unable to initialise graphics system
// STR_0838 :<removed string - do not use>
// STR_0835 :Game initialisation failed
// STR_0836 :Unable to start game in a minimised state
// STR_0837 :Unable to initialise graphics system
// STR_0838 :<removed string - do not use>
STR_RESOLUTION_X_BY_Y = 839,
STR_ARG_16_RESOLUTION_X_BY_Y = 840,
// STR_0841 :<removed string - do not use>
// STR_0842 :<removed string - do not use>
// STR_0843 :<removed string - do not use>
// STR_0844 :<removed string - do not use>
// STR_0845 :<removed string - do not use>
// STR_0846 :<removed string - do not use>
// STR_0841 :<removed string - do not use>
// STR_0842 :<removed string - do not use>
// STR_0843 :<removed string - do not use>
// STR_0844 :<removed string - do not use>
// STR_0845 :<removed string - do not use>
// STR_0846 :<removed string - do not use>
STR_ABOUT = 847,
STR_ROLLERCOASTER_TYCOON_2 = 848,
//STR_VERSION_X = 849,
// STR_VERSION_X = 849,
STR_COPYRIGHT_CS = 850,
STR_DESIGNED_AND_PROGRAMMED_BY_CS = 851,
STR_GRAPHICS_BY_SF = 852,
@ -287,7 +288,7 @@ enum {
STR_REPRESENTATION_BY_JL = 855,
STR_THANKS_TO = 856,
STR_THANKS_TO_PEOPLE = 857,
// STR_0858 to 0864 are removed.
// STR_0858 to 0864 are removed.
STR_STRINGID = 865,
STR_ARG_2_STRINGID = 866, // Unused
STR_ARG_4_STRINGID = 867, // Unused
@ -313,7 +314,7 @@ enum {
STR_QUIT_SCENARIO_EDITOR = 887,
STR_QUIT_ROLLERCOASTER_DESIGNER = 888,
STR_QUIT_TRACK_DESIGNS_MANAGER = 889,
// STR_0890 :<removed string - do not use>
// STR_0890 :<removed string - do not use>
STR_SCREENSHOT = 891,
STR_SCREENSHOT_SAVED_AS = 892,
STR_SCREENSHOT_FAILED = 893,
@ -447,8 +448,8 @@ enum {
STR_RIDE_VEHICLE_COUNT = 1021,
STR_1_CAR_PER_TRAIN = 1022,
STR_X_CARS_PER_TRAIN = 1023,
// STR_1024 :{COMMA16} car per train
// STR_1025 :{COMMA16} cars per train
// STR_1024 :{COMMA16} car per train
// STR_1025 :{COMMA16} cars per train
STR_STATION_PLATFORM_TOO_LONG = 1026,
STR_LOCATE_SUBJECT_TIP = 1027,
STR_OFF_EDGE_OF_MAP = 1028,
@ -566,7 +567,7 @@ enum {
STR_SELECT_VEHICLE_COLOUR_SCHEME_TIP = 1140,
STR_SELECT_VEHICLE_TO_MODIFY_TIP = 1141,
STR_DROPDOWN_MENU_LABEL = 1142,
// STR_1143 :{RIGHTGUILLEMET}{MOVE_X}{SMALLFONT}{STRINGID}
// STR_1143 :{RIGHTGUILLEMET}{MOVE_X}{SMALLFONT}{STRINGID}
STR_CANT_BUILD_MOVE_ENTRANCE_FOR_THIS_RIDE_ATTRACTION = 1144,
STR_CANT_BUILD_MOVE_EXIT_FOR_THIS_RIDE_ATTRACTION = 1145,
STR_ENTRANCE_NOT_YET_BUILT = 1146,
@ -755,7 +756,7 @@ enum {
STR_LAUNCH_SPEED = 1329,
STR_LAUNCH_SPEED_TIP = 1330,
STR_RIDE_MODE_SPEED_VALUE = 1331,
// 1332 not used. Likely ride_mode_speed value
// 1332 not used. Likely ride_mode_speed value
STR_RIDE_STATION = 1333,
STR_RIDE_STATION_X = 1334,
STR_RIDE_ENTRANCE = 1335,
@ -951,11 +952,11 @@ enum {
STR_PEEP_THOUGHT_TYPE_CHIPS = 1525,
STR_PEEP_THOUGHT_TYPE_ICE_CREAM = 1526,
STR_PEEP_THOUGHT_TYPE_CANDYFLOSS = 1527,
// STR_1528 :
// STR_1529 :
// STR_1530 :
// STR_1528 :
// STR_1529 :
// STR_1530 :
STR_PEEP_THOUGHT_TYPE_PIZZA = 1531,
// STR_1532 :
// STR_1532 :
STR_PEEP_THOUGHT_TYPE_POPCORN = 1533,
STR_PEEP_THOUGHT_TYPE_HOT_DOG = 1534,
STR_PEEP_THOUGHT_TYPE_TENTACLE = 1535,
@ -964,15 +965,15 @@ enum {
STR_PEEP_THOUGHT_TYPE_TSHIRT = 1538,
STR_PEEP_THOUGHT_TYPE_DOUGHNUT = 1539,
STR_PEEP_THOUGHT_TYPE_COFFEE = 1540,
// STR_1541 :
// STR_1541 :
STR_PEEP_THOUGHT_TYPE_CHICKEN = 1542,
STR_PEEP_THOUGHT_TYPE_LEMONADE = 1543,
// STR_1544 :
// STR_1545 :
// STR_1546 :
// STR_1544 :
// STR_1545 :
// STR_1546 :
STR_PEEP_THOUGHT_TYPE_WOW = 1547, // This string is empty! STR_1547 :
// STR_1548 :
// STR_1549 :
// STR_1548 :
// STR_1549 :
STR_PEEP_THOUGHT_TYPE_WOW2 = 1550,
STR_PEEP_THOUGHT_TYPE_WATCHED = 1551,
STR_PEEP_THOUGHT_TYPE_BALLOON_MUCH = 1552,
@ -985,11 +986,11 @@ enum {
STR_PEEP_THOUGHT_TYPE_CHIPS_MUCH = 1559,
STR_PEEP_THOUGHT_TYPE_ICE_CREAM_MUCH = 1560,
STR_PEEP_THOUGHT_TYPE_CANDYFLOSS_MUCH = 1561,
// STR_1562 :
// STR_1563 :
// STR_1564 :
// STR_1562 :
// STR_1563 :
// STR_1564 :
STR_PEEP_THOUGHT_TYPE_PIZZA_MUCH = 1565,
// STR_1566 :
// STR_1566 :
STR_PEEP_THOUGHT_TYPE_POPCORN_MUCH = 1567,
STR_PEEP_THOUGHT_TYPE_HOT_DOG_MUCH = 1568,
STR_PEEP_THOUGHT_TYPE_TENTACLE_MUCH = 1569,
@ -998,15 +999,15 @@ enum {
STR_PEEP_THOUGHT_TYPE_TSHIRT_MUCH = 1572,
STR_PEEP_THOUGHT_TYPE_DOUGHNUT_MUCH = 1573,
STR_PEEP_THOUGHT_TYPE_COFFEE_MUCH = 1574,
// STR_1575 :
// STR_1575 :
STR_PEEP_THOUGHT_TYPE_CHICKEN_MUCH = 1576,
STR_PEEP_THOUGHT_TYPE_LEMONADE_MUCH = 1577,
// STR_1578 :
// STR_1579 :
// STR_1580 :
// STR_1581 :
// STR_1582 :
// STR_1583 :
// STR_1578 :
// STR_1579 :
// STR_1580 :
// STR_1581 :
// STR_1582 :
// STR_1583 :
STR_PEEP_THOUGHT_TYPE_PHOTO2 = 1584,
STR_PEEP_THOUGHT_TYPE_PHOTO3 = 1585,
STR_PEEP_THOUGHT_TYPE_PHOTO4 = 1586,
@ -1024,21 +1025,21 @@ enum {
STR_PEEP_THOUGHT_TYPE_SU_JONGKWA = 1598,
STR_PEEP_THOUGHT_TYPE_SUB_SANDWICH = 1599,
STR_PEEP_THOUGHT_TYPE_COOKIE = 1600,
// STR_1601 :
// STR_1602 :
// STR_1603 :
// STR_1601 :
// STR_1602 :
// STR_1603 :
STR_PEEP_THOUGHT_TYPE_ROAST_SAUSAGE = 1604,
// STR_1605 :
// STR_1606 :
// STR_1607 :
// STR_1608 :
// STR_1609 :
// STR_1610 :
// STR_1611 :
// STR_1612 :
// STR_1613 :
// STR_1614 :
// STR_1615 :
// STR_1605 :
// STR_1606 :
// STR_1607 :
// STR_1608 :
// STR_1609 :
// STR_1610 :
// STR_1611 :
// STR_1612 :
// STR_1613 :
// STR_1614 :
// STR_1615 :
STR_PEEP_THOUGHT_TYPE_PHOTO2_MUCH = 1616,
STR_PEEP_THOUGHT_TYPE_PHOTO3_MUCH = 1617,
STR_PEEP_THOUGHT_TYPE_PHOTO4_MUCH = 1618,
@ -1056,21 +1057,21 @@ enum {
STR_PEEP_THOUGHT_TYPE_SU_JONGKWA_MUCH = 1630,
STR_PEEP_THOUGHT_TYPE_SUB_SANDWICH_MUCH = 1631,
STR_PEEP_THOUGHT_TYPE_COOKIE_MUCH = 1632,
// STR_1633 :
// STR_1634 :
// STR_1635 :
// STR_1633 :
// STR_1634 :
// STR_1635 :
STR_PEEP_THOUGHT_TYPE_ROAST_SAUSAGE_MUCH = 1636,
// STR_1637 :
// STR_1638 :
// STR_1639 :
// STR_1640 :
// STR_1641 :
// STR_1642 :
// STR_1643 :
// STR_1644 :
// STR_1645 :
// STR_1646 :
// STR_1647 :
// STR_1637 :
// STR_1638 :
// STR_1639 :
// STR_1640 :
// STR_1641 :
// STR_1642 :
// STR_1643 :
// STR_1644 :
// STR_1645 :
// STR_1646 :
// STR_1647 :
STR_PEEP_THOUGHT_TYPE_HELP = 1648,
STR_PEEP_THOUGHT_TYPE_RUNNING_OUT = 1649,
STR_PEEP_THOUGHT_TYPE_NEW_RIDE = 1650,
@ -1160,7 +1161,7 @@ enum {
STR_NUMBER_OF_LAPS = 1734,
STR_NUMBER_OF_LAPS_TIP = 1735,
STR_NUMBER_OF_LAPS_VALUE = 1736,
// STR_1737 :{COMMA16}
// STR_1737 :{COMMA16}
STR_CANT_CHANGE_NUMBER_OF_LAPS = 1738,
STR_RACE_WON_BY_GUEST = 1739,
STR_RACE_WON_BY = 1740,
@ -1168,12 +1169,12 @@ enum {
STR_MAX_PEOPLE_ON_RIDE = 1742,
STR_MAX_PEOPLE_ON_RIDE_TIP = 1743,
STR_MAX_PEOPLE_ON_RIDE_VALUE = 1744,
// STR_1745 :{COMMA16}
// STR_1745 :{COMMA16}
STR_CANT_CHANGE_THIS = 1746,
STR_TIME_LIMIT = 1747,
STR_TIME_LIMIT_TIP = 1748,
STR_RIDE_MODE_TIME_LIMIT_VALUE = 1749,
// STR_1750 :{DURATION}
// STR_1750 :{DURATION}
STR_CANT_CHANGE_TIME_LIMIT = 1751,
STR_INDIVIDUAL_GUESTS_TIP = 1752,
STR_SUMMARISED_GUESTS_TIP = 1753,
@ -1195,11 +1196,11 @@ enum {
STR_NUMBER_OF_SWINGS = 1769,
STR_NUMBER_OF_SWINGS_TIP = 1770,
STR_RIDE_MODE_NUMBER_OF_SWINGS_VALUE = 1771,
// STR_1772 :{COMMA16}
// STR_1772 :{COMMA16}
STR_ONLY_ONE_ON_RIDE_PHOTO_PER_RIDE = 1773,
STR_ONLY_ONE_CABLE_LIFT_HILL_PER_RIDE = 1774,
// STR_OPTIONS_RIDE_MUSIC_OFF = 1775,
// STR_OPTIONS_RIDE_MUSIC_ON = 1776,
// STR_OPTIONS_RIDE_MUSIC_OFF = 1775,
// STR_OPTIONS_RIDE_MUSIC_ON = 1776,
STR_RIDE_MUSIC = 1777,
STR_SCROLLING_SIGN_TEXT = 1778,
STR_STAFF_OPTION_COSTUME_PANDA = 1779,
@ -1220,7 +1221,7 @@ enum {
STR_FIXING_RIDE = 1794,
STR_ANSWERING_RADIO_CALL = 1795,
STR_HAS_BROKEN_DOWN_AND_REQUIRES_FIXING = 1796,
// STR_1797 :This option cannot be changed for this ride
// STR_1797 :This option cannot be changed for this ride
STR_WHIRLPOOL = 1798,
STR_RIDE_SECONDARY_PRICE_VALUE = 1799,
STR_RIDE_BREAKDOWN_SAFETY_CUT_OUT = 1800,
@ -1268,7 +1269,7 @@ enum {
STR_GUESTS_FAVOURITE_LABEL = 1842,
STR_GUESTS_FAVOURITE_PLURAL_LABEL = 1843,
STR_RIDE_LIST_INFORMATION_TYPE_TIP = 1844,
// STR_1845 :{MONTHYEAR} // Used in window_game_bottom_toolbar_onpaint
// STR_1845 :{MONTHYEAR} // Used in window_game_bottom_toolbar_onpaint
STR_BOTTOM_TOOLBAR_NUM_GUESTS_STABLE = 1846,
STR_BOTTOM_TOOLBAR_NUM_GUESTS_DECREASE = 1847,
STR_BOTTOM_TOOLBAR_NUM_GUESTS_INCREASE = 1848,
@ -1295,7 +1296,7 @@ enum {
STR_NUMBER_OF_ROTATIONS = 1869,
STR_NUMBER_OF_ROTATIONS_TIP = 1870,
STR_NUMBER_OF_ROTATIONS_VALUE = 1871,
// STR_1872 :{COMMA16}
// STR_1872 :{COMMA16}
STR_INCOME_PER_HOUR = 1873,
STR_PROFIT_PER_HOUR = 1874,
STR_GUEST_ITEM_FORMAT = 1875,
@ -1315,8 +1316,8 @@ enum {
STR_DOWN_TIME_LABEL_1889 = 1889,
STR_SELECT_HOW_OFTEN_A_MECHANIC_SHOULD_CHECK_THIS_RIDE = 1890,
STR_NO_THING_IN_PARK_YET = 1891,
// STR_1892 :<removed string - do not use>
// STR_1893 :<removed string - do not use>
// STR_1892 :<removed string - do not use>
// STR_1893 :<removed string - do not use>
STR_ITEMS_SOLD = 1894,
STR_BUILD_RIDE_TIP = 1895,
STR_FINANCES_SUMMARY_EXPENDITURE_INCOME = 1896,
@ -1348,7 +1349,7 @@ enum {
STR_CONTINUE_SAVED_GAME_TIP = 1922,
STR_EXIT = 1924,
STR_ERR_CANT_PLACE_PERSON_HERE = 1925,
// STR_1926 :{SMALLFONT} // Used in window_game_bottom_toolbar_onpaint and window_news_onscrollpaint
// STR_1926 :{SMALLFONT} // Used in window_game_bottom_toolbar_onpaint and window_news_onscrollpaint
STR_RIDE_IS_BROKEN_DOWN = 1927,
STR_RIDE_HAS_CRASHED = 1928,
STR_RIDE_IS_STILL_NOT_FIXED = 1929,
@ -1380,8 +1381,8 @@ enum {
STR_NUMBER_OF_CIRCUITS = 1955,
STR_NUMBER_OF_CIRCUITS_TIP = 1956,
STR_NUMBER_OF_CIRCUITS_VALUE = 1957,
// STR_1958 :{COMMA16}
// STR_1959 :Can't change number of circuits...
// STR_1958 :{COMMA16}
// STR_1959 :Can't change number of circuits...
STR_SHOP_ITEM_PRICE_LABEL_BALLOON = 1960,
STR_SHOP_ITEM_PRICE_LABEL_CUDDLY_TOY = 1961,
STR_SHOP_ITEM_PRICE_LABEL_PARK_MAP = 1962,
@ -1673,7 +1674,7 @@ enum {
STR_CANT_DEMOLISH_RIDE = 2248,
STR_NEWS_ITEM_RESEARCH_NEW_RIDE_AVAILABLE = 2249,
STR_NEWS_ITEM_RESEARCH_NEW_SCENERY_SET_AVAILABLE = 2250,
// STR_2251 :Can only be built on paths!
// STR_2251 :Can only be built on paths!
STR_CAN_ONLY_BE_BUILT_ACROSS_PATHS = 2252,
STR_RESEARCH_NEW_TRANSPORT_RIDES = 2253,
STR_RESEARCH_NEW_GENTLE_RIDES = 2254,
@ -1712,7 +1713,7 @@ enum {
STR_RESEARCH_STAGE_COMPLETING_DESIGN = 2287,
STR_RESEARCH_STAGE_UNKNOWN = 2288,
STR_RESEARCH_EXPECTED_FORMAT = 2289,
// STR_2290 :<removed string - do not use>
// STR_2290 :<removed string - do not use>
STR_SELECT_SCENARIO = 2291,
STR_GUEST_LABEL_RIDES_BEEN_ON = 2292,
STR_NOTHING = 2293,
@ -1727,8 +1728,8 @@ enum {
STR_GUEST_EXPENSES_DRINK_PLURAL = 2302,
STR_GUEST_EXPENSES_SOUVENIR = 2303,
STR_GUEST_EXPENSES_SOUVENIR_PLURAL = 2304,
// STR_2305 :Track design files
// STR_2306 :Save track design
// STR_2305 :Track design files
// STR_2306 :Save track design
STR_SELECT_DESIGN = 2307,
STR_TRACK_DESIGNS = 2308,
STR_TRACK_DESIGN_INSTALL_WINDOW_TITLE = 2309,
@ -1739,10 +1740,10 @@ enum {
STR_TRACK_LIST_RIDE_LENGTH = 2314,
STR_TRACK_LIST_COST_AROUND = 2315,
STR_TRACK_LIST_SPACE_REQUIRED = 2316,
// STR_2317 :<removed string - do not use>
// STR_2318 :<removed string - do not use>
// STR_2319 :<removed string - do not use>
// STR_2320 :<removed string - do not use>
// STR_2317 :<removed string - do not use>
// STR_2318 :<removed string - do not use>
// STR_2319 :<removed string - do not use>
// STR_2320 :<removed string - do not use>
STR_NUMBER_OF_RIDES_LABEL = 2321,
STR_STAFF_LABEL = 2322,
STR_PARK_SIZE_METRIC_LABEL = 2323,
@ -1779,9 +1780,9 @@ enum {
STR_STAFF_STAT_BINS_EMPTIED = 2354,
STR_STAFF_STAT_RIDES_FIXED = 2355,
STR_STAFF_STAT_RIDES_INSPECTED = 2356,
// STR_2357 :House
// STR_2358 :Units
//STR_UNITS = 2358,
// STR_2357 :House
// STR_2358 :Units
// STR_UNITS = 2358,
STR_REAL_VALUES = 2359,
STR_DISPLAY_RESOLUTION = 2360,
STR_TILE_SMOOTHING = 2361,
@ -1845,8 +1846,8 @@ enum {
STR_PEEP_INVENTORY_VOUCHER_RIDE_FREE = 2419,
STR_PEEP_INVENTORY_VOUCHER_PARK_ENTRY_HALF_PRICE = 2420,
STR_PEEP_INVENTORY_VOUCHER_FOOD_OR_DRINK_FREE = 2421,
// STR_2422 :Advertising campaign for {STRINGID}
// STR_2423 :Advertising campaign for {STRINGID}
// STR_2422 :Advertising campaign for {STRINGID}
// STR_2423 :Advertising campaign for {STRINGID}
STR_MARKETING_VOUCHERS_FOR_FREE_ENTRY_TO_THE_PARK = 2424,
STR_MARKETING_VOUCHERS_FOR_FREE_RIDES_ON_A_PARTICULAR_RIDE = 2425,
STR_MARKETING_VOUCHERS_FOR_HALF_PRICE_ENTRY_TO_THE_PARK = 2426,
@ -1860,12 +1861,12 @@ enum {
STR_ADVERTISING_CAMPAIGN_FOR_1 = 2434,
STR_ADVERTISING_CAMPAIGN_FOR_2 = 2435,
STR_MARKETING_1_WEEK = 2436,
// STR_2437 :<removed string - do not use>
// STR_2438 :<removed string - do not use>
// STR_2439 :<removed string - do not use>
// STR_2440 :<removed string - do not use>
// STR_2441 :<removed string - do not use>
// STR_2442 :<removed string - do not use>
// STR_2437 :<removed string - do not use>
// STR_2438 :<removed string - do not use>
// STR_2439 :<removed string - do not use>
// STR_2440 :<removed string - do not use>
// STR_2441 :<removed string - do not use>
// STR_2442 :<removed string - do not use>
STR_MARKETING_COST_PER_WEEK = 2443,
STR_MARKETING_TOTAL_COST = 2444,
STR_MARKETING_START_THIS_MARKETING_CAMPAIGN = 2445,
@ -1950,165 +1951,165 @@ enum {
STR_SHORTCUT_SCREENSHOT = 2524,
STR_SHORTCUT_KEY_UNKNOWN = 2525,
// STR_2525 :???
// STR_2526 :???
// STR_2527 :???
// STR_2528 :???
// STR_2529 :???
// STR_2530 :???
// STR_2531 :???
// STR_2532 :???
// STR_2533 :Backspace
// STR_2534 :Tab
// STR_2535 :???
// STR_2536 :???
// STR_2537 :Clear
// STR_2538 :Return
// STR_2539 :???
// STR_2540 :???
// STR_2541 :???
// STR_2542 :???
// STR_2543 :Alt/Menu
// STR_2544 :Pause
// STR_2545 :Caps
// STR_2546 :???
// STR_2547 :???
// STR_2548 :???
// STR_2549 :???
// STR_2550 :???
// STR_2551 :???
// STR_2552 :Escape
// STR_2553 :???
// STR_2554 :???
// STR_2555 :???
// STR_2556 :???
// STR_2557 :Spacebar
// STR_2558 :PgUp
// STR_2559 :PgDn
// STR_2560 :End
// STR_2561 :Home
// STR_2562 :Left
// STR_2563 :Up
// STR_2564 :Right
// STR_2565 :Down
// STR_2566 :Select
// STR_2567 :Print
// STR_2568 :Execute
// STR_2569 :Snapshot
// STR_2570 :Insert
// STR_2571 :Delete
// STR_2572 :Help
// STR_2573 :0
// STR_2574 :1
// STR_2575 :2
// STR_2576 :3
// STR_2577 :4
// STR_2578 :5
// STR_2579 :6
// STR_2580 :7
// STR_2581 :8
// STR_2582 :9
// STR_2583 :???
// STR_2584 :???
// STR_2585 :???
// STR_2586 :???
// STR_2587 :???
// STR_2588 :???
// STR_2589 :???
// STR_2590 :A
// STR_2591 :B
// STR_2592 :C
// STR_2593 :D
// STR_2594 :E
// STR_2595 :F
// STR_2596 :G
// STR_2597 :H
// STR_2598 :I
// STR_2599 :J
// STR_2600 :K
// STR_2601 :L
// STR_2602 :M
// STR_2603 :N
// STR_2604 :O
// STR_2605 :P
// STR_2606 :Q
// STR_2607 :R
// STR_2608 :S
// STR_2609 :T
// STR_2610 :U
// STR_2611 :V
// STR_2612 :W
// STR_2613 :X
// STR_2614 :Y
// STR_2615 :Z
// STR_2616 :???
// STR_2617 :???
// STR_2618 :Menu
// STR_2619 :???
// STR_2620 :???
// STR_2621 :NumPad 0
// STR_2622 :NumPad 1
// STR_2623 :NumPad 2
// STR_2624 :NumPad 3
// STR_2625 :NumPad 4
// STR_2626 :NumPad 5
// STR_2627 :NumPad 6
// STR_2628 :NumPad 7
// STR_2629 :NumPad 8
// STR_2630 :NumPad 9
// STR_2631 :NumPad *
// STR_2632 :NumPad +
// STR_2633 :???
// STR_2634 :NumPad -
// STR_2635 :NumPad .
// STR_2636 :NumPad /
// STR_2637 :F1
// STR_2638 :F2
// STR_2639 :F3
// STR_2640 :F4
// STR_2641 :F5
// STR_2642 :F6
// STR_2643 :F7
// STR_2644 :F8
// STR_2645 :F9
// STR_2646 :F10
// STR_2647 :F11
// STR_2648 :F12
// STR_2649 :F13
// STR_2650 :F14
// STR_2651 :F15
// STR_2652 :F16
// STR_2653 :F17
// STR_2654 :F18
// STR_2655 :F19
// STR_2656 :F20
// STR_2657 :F21
// STR_2658 :F22
// STR_2659 :F23
// STR_2660 :F24
// STR_2661 :???
// STR_2662 :???
// STR_2663 :???
// STR_2664 :???
// STR_2665 :???
// STR_2666 :???
// STR_2667 :???
// STR_2668 :???
// STR_2669 :NumLock
// STR_2670 :Scroll
// STR_2671 :???
// STR_2672 :???
// STR_2673 :???
// STR_2674 :???
// STR_2675 :???
// STR_2676 :???
// STR_2677 :???
// STR_2678 :???
// STR_2679 :???
// STR_2525 :???
// STR_2526 :???
// STR_2527 :???
// STR_2528 :???
// STR_2529 :???
// STR_2530 :???
// STR_2531 :???
// STR_2532 :???
// STR_2533 :Backspace
// STR_2534 :Tab
// STR_2535 :???
// STR_2536 :???
// STR_2537 :Clear
// STR_2538 :Return
// STR_2539 :???
// STR_2540 :???
// STR_2541 :???
// STR_2542 :???
// STR_2543 :Alt/Menu
// STR_2544 :Pause
// STR_2545 :Caps
// STR_2546 :???
// STR_2547 :???
// STR_2548 :???
// STR_2549 :???
// STR_2550 :???
// STR_2551 :???
// STR_2552 :Escape
// STR_2553 :???
// STR_2554 :???
// STR_2555 :???
// STR_2556 :???
// STR_2557 :Spacebar
// STR_2558 :PgUp
// STR_2559 :PgDn
// STR_2560 :End
// STR_2561 :Home
// STR_2562 :Left
// STR_2563 :Up
// STR_2564 :Right
// STR_2565 :Down
// STR_2566 :Select
// STR_2567 :Print
// STR_2568 :Execute
// STR_2569 :Snapshot
// STR_2570 :Insert
// STR_2571 :Delete
// STR_2572 :Help
// STR_2573 :0
// STR_2574 :1
// STR_2575 :2
// STR_2576 :3
// STR_2577 :4
// STR_2578 :5
// STR_2579 :6
// STR_2580 :7
// STR_2581 :8
// STR_2582 :9
// STR_2583 :???
// STR_2584 :???
// STR_2585 :???
// STR_2586 :???
// STR_2587 :???
// STR_2588 :???
// STR_2589 :???
// STR_2590 :A
// STR_2591 :B
// STR_2592 :C
// STR_2593 :D
// STR_2594 :E
// STR_2595 :F
// STR_2596 :G
// STR_2597 :H
// STR_2598 :I
// STR_2599 :J
// STR_2600 :K
// STR_2601 :L
// STR_2602 :M
// STR_2603 :N
// STR_2604 :O
// STR_2605 :P
// STR_2606 :Q
// STR_2607 :R
// STR_2608 :S
// STR_2609 :T
// STR_2610 :U
// STR_2611 :V
// STR_2612 :W
// STR_2613 :X
// STR_2614 :Y
// STR_2615 :Z
// STR_2616 :???
// STR_2617 :???
// STR_2618 :Menu
// STR_2619 :???
// STR_2620 :???
// STR_2621 :NumPad 0
// STR_2622 :NumPad 1
// STR_2623 :NumPad 2
// STR_2624 :NumPad 3
// STR_2625 :NumPad 4
// STR_2626 :NumPad 5
// STR_2627 :NumPad 6
// STR_2628 :NumPad 7
// STR_2629 :NumPad 8
// STR_2630 :NumPad 9
// STR_2631 :NumPad *
// STR_2632 :NumPad +
// STR_2633 :???
// STR_2634 :NumPad -
// STR_2635 :NumPad .
// STR_2636 :NumPad /
// STR_2637 :F1
// STR_2638 :F2
// STR_2639 :F3
// STR_2640 :F4
// STR_2641 :F5
// STR_2642 :F6
// STR_2643 :F7
// STR_2644 :F8
// STR_2645 :F9
// STR_2646 :F10
// STR_2647 :F11
// STR_2648 :F12
// STR_2649 :F13
// STR_2650 :F14
// STR_2651 :F15
// STR_2652 :F16
// STR_2653 :F17
// STR_2654 :F18
// STR_2655 :F19
// STR_2656 :F20
// STR_2657 :F21
// STR_2658 :F22
// STR_2659 :F23
// STR_2660 :F24
// STR_2661 :???
// STR_2662 :???
// STR_2663 :???
// STR_2664 :???
// STR_2665 :???
// STR_2666 :???
// STR_2667 :???
// STR_2668 :???
// STR_2669 :NumLock
// STR_2670 :Scroll
// STR_2671 :???
// STR_2672 :???
// STR_2673 :???
// STR_2674 :???
// STR_2675 :???
// STR_2676 :???
// STR_2677 :???
// STR_2678 :???
// STR_2679 :???
STR_RESEARCH_COMPLETED_AL = 2680,
STR_CHEAT_5K_MONEY_TIP = 2681,
// STR_2682 :<removed string - do not use>
// STR_2683 :<removed string - do not use>
// STR_2682 :<removed string - do not use>
// STR_2683 :<removed string - do not use>
STR_CHEAT_LARGE_TRAM_GUESTS_TIP = 2684,
STR_MAPGEN_SIMPLEX_NOISE = 2685,
STR_MAPGEN_SIMPLEX_NOISE_LOW_ = 2686,
@ -2122,9 +2123,9 @@ enum {
STR_MAPGEN_ACTION_GENERATE = 2694,
STR_MAPGEN_OPTION_RANDOM_TERRAIN = 2695,
STR_MAPGEN_OPTION_PLACE_TREES = 2696,
// STR_2697 :???
// STR_2698 :???
// STR_2699 :???
// STR_2697 :???
// STR_2698 :???
// STR_2699 :???
STR_OPTIONS_AUTOSAVE_FREQUENCY_LABEL = 2700,
STR_SAVE_EVERY_MINUTE = 2701,
STR_SAVE_EVERY_5MINUTES = 2702,
@ -2136,13 +2137,13 @@ enum {
STR_FILEBROWSER_OVERWRITE_PROMPT = 2708,
STR_FILEBROWSER_OVERWRITE_TITLE = 2709,
STR_FILEBROWSER_FILE_NAME_PROMPT = 2710,
// STR_2711 :;
// STR_2712 :=
// STR_2713 :,
// STR_2714 :-
// STR_2715 :.
// STR_2716 :/
// STR_2717 :'
// STR_2711 :;
// STR_2712 :=
// STR_2713 :,
// STR_2714 :-
// STR_2715 :.
// STR_2716 :/
// STR_2717 :'
STR_FILEBROWSER_ACTION_UP = 2718,
STR_FILEBROWSER_ACTION_NEW_FILE = 2719,
STR_DURATION_SEC = 2720,
@ -2169,11 +2170,11 @@ enum {
STR_ROLLERCOASTER_TYCOON_2_DROPDOWN = 2741,
STR_OPTIONS_MUSIC_ERR_CSS50_NOT_FOUND = 2742,
STR_OPTIONS_MUSIC_ERR_CSS50_NOT_FOUND_HINT = 2743,
// STR_2744 :[
// STR_2745 :\
// STR_2744 :[
// STR_2745 :\
// STR_2746 :]
// STR_2747 :{ENDQUOTES}
// STR_2748 :Bar
// STR_2747 :{ENDQUOTES}
// STR_2748 :Bar
STR_MY_NEW_SCENARIO = 2749,
STR_MOVE_ALL_TOP = 2750,
STR_MOVE_ALL_BOTTOM = 2751,
@ -2186,18 +2187,18 @@ enum {
STR_CHEAT_FORCE_THUNDER = 2758, // <removed string - do not use>
STR_CHEAT_ZERO_CLEARANCE = 2759, // <removed string - do not use>
STR_CHEAT_5K_MONEY = 2760,
// STR_2761 :<removed string - do not use>
// STR_2762 :<removed string - do not use>
// STR_2763 :???
// STR_2764 :<removed string - do not use>
// STR_2761 :<removed string - do not use>
// STR_2762 :<removed string - do not use>
// STR_2763 :???
// STR_2764 :<removed string - do not use>
STR_CHEAT_LARGE_TRAM_GUESTS = 2765,
STR_CHEAT_WIN_SCENARIO = 2766,
STR_CHEAT_FREEZE_CLIMATE = 2767,
STR_CHEAT_UNFREEZE_CLIMATE = 2768,
STR_CHEAT_OPEN_PARK = 2769,
STR_CHEAT_CLOSE_PARK = 2770,
// STR_2771 :Slower Gamespeed
// STR_2772 :Faster Gamespeed
// STR_2771 :Slower Gamespeed
// STR_2772 :Faster Gamespeed
STR_OPTIONS_DISPLAY_WINDOWED = 2773,
STR_OPTIONS_DISPLAY_FULLSCREEN = 2774,
STR_OPTIONS_DISPLAY_FULLSCREEN_BORDERLESS = 2775,
@ -2274,15 +2275,15 @@ enum {
STR_NEWS_ITEM_MOST_CONFUSING_LAYOUT = STR_NEWS_ITEM_AWARD_MOST_UNTIDY + 15,
STR_NEWS_ITEM_BEST_GENTLE_RIDES = STR_NEWS_ITEM_AWARD_MOST_UNTIDY + 16,
STR_NO_RECENT_AWARDS = 2848,
// STR_2849 :New scenario installed successfully
// STR_2850 :New track design installed successfully
// STR_2851 :Scenario already installed
// STR_2852 :Track design already installed
// STR_2849 :New scenario installed successfully
// STR_2850 :New track design installed successfully
// STR_2851 :Scenario already installed
// STR_2852 :Track design already installed
STR_FORBIDDEN_BY_THE_LOCAL_AUTHORITY = 2853,
STR_ENTRANCE_NOT_CONNECTED = 2854,
STR_EXIT_NOT_CONNECTED = 2855,
STR_CANT_START_MARKETING_CAMPAIGN = 2858,
// STR_2859 :Another instance of OpenRCT2 is already running
// STR_2859 :Another instance of OpenRCT2 is already running
STR_LICENSED_TO_INFOGRAMES_INTERACTIVE_INC = 2861,
STR_MUSIC_ACKNOWLEDGEMENTS_ELLIPSIS = 2862,
STR_MUSIC_ACKNOWLEDGEMENTS = 2863,
@ -2454,7 +2455,7 @@ enum {
STR_LIFT_HILL_CHAIN_SPEED = 3095,
STR_LIFT_HILL_CHAIN_SPEED_VALUE = 3096,
STR_SELECT_LIFT_HILL_CHAIN_SPEED_TIP = 3097,
// STR_3098 :Can't change lift hill speed...
// STR_3098 :Can't change lift hill speed...
STR_SELECT_COLOUR = 3099,
STR_SELECT_SECONDARY_COLOUR = 3100,
STR_SELECT_TERNARY_COLOUR = 3101,
@ -2511,19 +2512,19 @@ enum {
STR_SCROLL_UP_FAST_TIP = STR_SCROLL_LEFT_TIP + 7, // Unused
STR_SCROLL_DOWN_FAST_TIP = STR_SCROLL_LEFT_TIP + 8, // Unused
STR_SCROLL_UP_DOWN_TIP = STR_SCROLL_LEFT_TIP + 9, // Unused
// STR_3155 :
// STR_3156 :
// STR_3155 :
// STR_3156 :
STR_MAP = 3157,
STR_GRAPH = 3158,
STR_LIST = 3159,
STR_SELECT_NUMBER_OF_CIRCUITS_TIP = 3160,
// STR_3161 :<removed string - do not use>
// STR_3161 :<removed string - do not use>
STR_ERR_REASON_NOT_ENOUGH_MEMORY = 3162,
// STR_3163 :Installing new data:
// STR_3163 :Installing new data:
STR_OBJECT_SELECTION_SELECTION_SIZE = 3164,
// STR_PLACEHOLDER = 3165, <placeholder strings are unsafe>
// STR_3166 :{BLACK}(ID:
// STR_3167 :{WINDOW_COLOUR_2}Includes: {BLACK}{COMMA16} objects
// STR_PLACEHOLDER = 3165, <placeholder strings are unsafe>
// STR_3166 :{BLACK}(ID:
// STR_3167 :{WINDOW_COLOUR_2}Includes: {BLACK}{COMMA16} objects
STR_OBJECT_SELECTION_DESCRIPTION_SCENARIO_TEXT = 3168,
STR_OBJECT_SELECTION_ERR_OBJECT_DATA_NOT_FOUND = 3169,
STR_OBJECT_SELECTION_ERR_NOT_ENOUGH_SPACE_FOR_GRAPHICS = 3170,
@ -2677,7 +2678,7 @@ enum {
STR_SELECT_WHICH_GROUP_THIS_SCENARIO_APPEARS_IN = 3318,
STR_WINDOW_SCENARIO_GROUP = 3319,
STR_UNABLE_TO_SAVE_SCENARIO_FILE = 3320,
// STR_3321 :New objects installed successfully
// STR_3321 :New objects installed successfully
STR_OBJECTIVE = 3322,
STR_MISSING_OBJECT_DATA_ID = 3323,
STR_REQUIRES_THE_FOLLOWING_ADDON_PACK = 3324,
@ -2693,7 +2694,7 @@ enum {
STR_SAVE_PLUGIN_DATA_TIP = 3334,
STR_ROLLER_COASTER_DESIGNER_SELECT_RIDE_TYPES_VEHICLES = 3335,
STR_TRACK_DESIGNS_MANAGER_SELECT_RIDE_TYPE = 3336,
// STR_3337 :<removed string - do not use>
// STR_3337 :<removed string - do not use>
STR_CUSTOM_DESIGNED_LAYOUT = 3338,
STR_1_DESIGN_AVAILABLE = 3339,
STR_X_DESIGNS_AVAILABLE = 3340,
@ -2718,8 +2719,8 @@ enum {
STR_NO_TRACK_DESIGNS_OF_THIS_TYPE = 3359,
STR_WARNING = 3360,
STR_TOO_MANY_TRACK_DESIGNS_OF_THIS_TYPE = 3361,
// STR_3362 :<removed string - do not use>
// STR_3363 :<removed string - do not use>
// STR_3362 :<removed string - do not use>
// STR_3363 :<removed string - do not use>
STR_OBJECT_SELECTION_ADVANCED = 3364,
STR_OBJECT_SELECTION_ADVANCED_TIP = 3365,
STR_MAP_RIDE = 3366,
@ -2737,14 +2738,14 @@ enum {
STR_INSTALL_NEW_TRACK_DESIGN_INSTALL = 3378,
STR_INSTALL_NEW_TRACK_DESIGN_CANCEL = 3379,
STR_UNABLE_TO_INSTALL_THIS_TRACK_DESIGN = 3380,
// STR_3381 :File is not compatible or contains invalid data
// STR_3382 :File copy failed
// STR_3381 :File is not compatible or contains invalid data
// STR_3382 :File copy failed
STR_SELECT_NEW_NAME_FOR_TRACK_DESIGN = 3383,
STR_AN_EXISTING_TRACK_DESIGN_ALREADY_HAS_THIS_NAME = 3384,
// STR_3388 :Unable to switch to selected mode
// STR_3388 :Unable to switch to selected mode
STR_SAVE_TRACK_SCENERY_UNABLE_TO_SELECT_ADDITIONAL_ITEM_OF_SCENERY = 3389,
STR_SAVE_TRACK_SCENERY_TOO_MANY_ITEMS_SELECTED = 3390,
// TUTORIAL
// TUTORIAL
STR_CLEAR_SCENERY_TIP = 3437,
STR_UNABLE_TO_REMOVE_ALL_SCENERY_FROM_HERE = 3438,
STR_CLEAR_SCENERY = 3439,
@ -2762,7 +2763,7 @@ enum {
STR_RESEARCH_BUTTON_ON_TOOLBAR = 5121,
STR_CHEAT_RENEW_RIDES = 5123,
// STR_5124 :<not used anymore>
// STR_5124 :<not used anymore>
STR_CHEAT_MAKE_DESTRUCTABLE = 5125,
STR_OPTIONS_MUSIC_VALUE_RANDOM = 5126,
STR_DISABLE_ELEVATION = 5127,
@ -3033,13 +3034,13 @@ enum {
STR_TITLE_EDITOR_ACTION_RENAME_TIP = 5394,
STR_TITLE_EDITOR_ACTION_LOAD_TIP = 5395,
STR_TITLE_EDITOR_ACTION_RELOAD_TIP = 5396,
// STR_5397 :Can only be used on the title screen
// STR_5397 :Can only be used on the title screen
STR_TITLE_EDITOR_ERR_CANT_EDIT_WHILE_PLAYING = 5398,
STR_TITLE_EDITOR_PRESS_STOP_TO_CONTINUE_EDITING = 5399,
STR_ERROR_CANT_CHANGE_TITLE_SEQUENCE = 5400,
// STR_5401 :Create a new title sequence to make changes to
// STR_5401 :Create a new title sequence to make changes to
STR_ERR_FAILED_TO_LOAD_TITLE_SEQUENCE = 5402,
// STR_5403 :There may be no Load or Wait command or a save may be invalid
// STR_5403 :There may be no Load or Wait command or a save may be invalid
STR_ERROR_EXISTING_NAME = 5404,
STR_TITLE_EDITOR_ENTER_NAME_FOR_SAVE = 5405,
STR_TITLE_EDITOR_ENTER_NAME_FOR_SEQUENCE = 5406,
@ -3130,7 +3131,7 @@ enum {
STR_DEBUG_DROPDOWN_INVENTIONS_LIST = 5491,
STR_DEBUG_DROPDOWN_SCENARIO_OPTIONS = 5492,
STR_SEND_MESSAGE = 5493,
// STR_5494 :<not used anymore>
// STR_5494 :<not used anymore>
STR_PLAYER_LIST = 5495, // Unused
STR_PLAYER = 5496,
STR_PING = 5497,
@ -3244,7 +3245,8 @@ enum {
STR_NOTIFICATION_GUEST_DIED = 5606,
STR_TILE_INSPECTOR_BASE_HEIGHT_SHORT = 5608,
STR_TILE_INSPECTOR_CLEARANGE_HEIGHT_SHORT = 5609,
// STR_5610 :{SMALLFONT}{BLACK}Remove the currently selected map element. This will forcefully remove it, so no cash will be used/gained. Use with caution.
// STR_5610 :{SMALLFONT}{BLACK}Remove the currently selected map element. This will forcefully remove it, so no cash will
// be used/gained. Use with caution.
STR_REMOVE_SELECTED_ELEMENT_TIP = 5610,
STR_TILE_INSPECTOR_FLAG_GHOST_SHORT = 5611,
STR_TILE_INSPECTOR_FLAG_GHOST = 5612,
@ -3302,7 +3304,7 @@ enum {
STR_ACTION_CHEAT = 5664,
STR_ACTION_TOGGLE_SCENERY_CLUSTER = 5665,
STR_ACTION_PASSWORDLESS_LOGIN = 5666,
// Empty block
// Empty block
STR_LAST_ACTION_RAN = 5701,
STR_LOCATE_PLAYER_TIP = 5702,
STR_CANT_KICK_THE_HOST = 5703,
@ -3315,7 +3317,7 @@ enum {
STR_GROUP_NAME = 5710,
STR_ENTER_NEW_NAME_FOR_THIS_GROUP = 5711,
STR_CANT_MODIFY_PERMISSION_THAT_YOU_DO_NOT_HAVE_YOURSELF = 5712,
// STR_5713 :Kick Player (unused)
// STR_5713 :Kick Player (unused)
STR_SHORTCUT_SHOW_OPTIONS = 5714,
STR_NEW_GAME = 5715,
STR_NOT_ALLOWED_IN_MULTIPLAYER = 5716, // Unused
@ -3365,7 +3367,7 @@ enum {
STR_ALL_FILES = 5763,
STR_INVALID_RIDE_TYPE = 5764,
STR_CANT_EDIT_INVALID_RIDE_TYPE = 5765,
// 5766 is unused
// 5766 is unused
STR_RIDE_LIST_INCOME = 5767,
STR_RIDE_LIST_TOTAL_CUSTOMERS = 5768,
STR_RIDE_LIST_TOTAL_PROFIT = 5769,

View File

@ -8,26 +8,37 @@
*****************************************************************************/
#include "Localisation.h"
#include <wchar.h>
uint32_t utf8_get_next(const utf8 *char_ptr, const utf8 **nextchar_ptr)
uint32_t utf8_get_next(const utf8* char_ptr, const utf8** nextchar_ptr)
{
int32_t result;
int32_t numBytes;
if (!(char_ptr[0] & 0x80)) {
if (!(char_ptr[0] & 0x80))
{
result = char_ptr[0];
numBytes = 1;
} else if ((char_ptr[0] & 0xE0) == 0xC0) {
}
else if ((char_ptr[0] & 0xE0) == 0xC0)
{
result = ((char_ptr[0] & 0x1F) << 6) | (char_ptr[1] & 0x3F);
numBytes = 2;
} else if ((char_ptr[0] & 0xF0) == 0xE0) {
}
else if ((char_ptr[0] & 0xF0) == 0xE0)
{
result = ((char_ptr[0] & 0x0F) << 12) | ((char_ptr[1] & 0x3F) << 6) | (char_ptr[2] & 0x3F);
numBytes = 3;
} else if ((char_ptr[0] & 0xF8) == 0xF0) {
result = ((char_ptr[0] & 0x07) << 18) | ((char_ptr[1] & 0x3F) << 12) | ((char_ptr[1] & 0x3F) << 6) | (char_ptr[2] & 0x3F);
}
else if ((char_ptr[0] & 0xF8) == 0xF0)
{
result
= ((char_ptr[0] & 0x07) << 18) | ((char_ptr[1] & 0x3F) << 12) | ((char_ptr[1] & 0x3F) << 6) | (char_ptr[2] & 0x3F);
numBytes = 4;
} else {
}
else
{
// TODO 4 bytes
result = ' ';
numBytes = 1;
@ -38,21 +49,28 @@ uint32_t utf8_get_next(const utf8 *char_ptr, const utf8 **nextchar_ptr)
return result;
}
utf8 *utf8_write_codepoint(utf8 *dst, uint32_t codepoint)
utf8* utf8_write_codepoint(utf8* dst, uint32_t codepoint)
{
if (codepoint <= 0x7F) {
if (codepoint <= 0x7F)
{
dst[0] = (utf8)codepoint;
return dst + 1;
} else if (codepoint <= 0x7FF) {
}
else if (codepoint <= 0x7FF)
{
dst[0] = 0xC0 | ((codepoint >> 6) & 0x1F);
dst[1] = 0x80 | (codepoint & 0x3F);
return dst + 2;
} else if (codepoint <= 0xFFFF) {
}
else if (codepoint <= 0xFFFF)
{
dst[0] = 0xE0 | ((codepoint >> 12) & 0x0F);
dst[1] = 0x80 | ((codepoint >> 6) & 0x3F);
dst[2] = 0x80 | (codepoint & 0x3F);
return dst + 3;
} else {
}
else
{
dst[0] = 0xF0 | ((codepoint >> 18) & 0x07);
dst[1] = 0x80 | ((codepoint >> 12) & 0x3F);
dst[2] = 0x80 | ((codepoint >> 6) & 0x3F);
@ -65,31 +83,40 @@ utf8 *utf8_write_codepoint(utf8 *dst, uint32_t codepoint)
* Inserts the given codepoint at the given address, shifting all characters after along.
* @returns the size of the inserted codepoint.
*/
int32_t utf8_insert_codepoint(utf8 *dst, uint32_t codepoint)
int32_t utf8_insert_codepoint(utf8* dst, uint32_t codepoint)
{
int32_t shift = utf8_get_codepoint_length(codepoint);
utf8 *endPoint = get_string_end(dst);
utf8* endPoint = get_string_end(dst);
memmove(dst + shift, dst, endPoint - dst + 1);
utf8_write_codepoint(dst, codepoint);
return shift;
}
bool utf8_is_codepoint_start(const utf8 *text)
bool utf8_is_codepoint_start(const utf8* text)
{
if ((text[0] & 0x80) == 0) return true;
if ((text[0] & 0xC0) == 0xC0) return true;
if ((text[0] & 0x80) == 0)
return true;
if ((text[0] & 0xC0) == 0xC0)
return true;
return false;
}
int32_t utf8_get_codepoint_length(int32_t codepoint)
{
if (codepoint <= 0x7F) {
if (codepoint <= 0x7F)
{
return 1;
} else if (codepoint <= 0x7FF) {
}
else if (codepoint <= 0x7FF)
{
return 2;
} else if (codepoint <= 0xFFFF) {
}
else if (codepoint <= 0xFFFF)
{
return 3;
} else {
}
else
{
return 4;
}
}
@ -98,28 +125,33 @@ int32_t utf8_get_codepoint_length(int32_t codepoint)
* Gets the number of characters / codepoints in a UTF-8 string (not necessarily 1:1 with bytes and not including null
* terminator).
*/
int32_t utf8_length(const utf8 *text)
int32_t utf8_length(const utf8* text)
{
const utf8 *ch = text;
const utf8* ch = text;
int32_t count = 0;
while (utf8_get_next(ch, &ch) != 0) {
while (utf8_get_next(ch, &ch) != 0)
{
count++;
}
return count;
}
wchar_t *utf8_to_widechar(const utf8 *src)
wchar_t* utf8_to_widechar(const utf8* src)
{
wchar_t * result = (wchar_t *)malloc((utf8_length(src) + 1) * sizeof(wchar_t));
wchar_t *dst = result;
wchar_t* result = (wchar_t*)malloc((utf8_length(src) + 1) * sizeof(wchar_t));
wchar_t* dst = result;
const utf8 *ch = src;
const utf8* ch = src;
int32_t codepoint;
while ((codepoint = utf8_get_next(ch, &ch)) != 0) {
if ((uint32_t)codepoint > 0xFFFF) {
while ((codepoint = utf8_get_next(ch, &ch)) != 0)
{
if ((uint32_t)codepoint > 0xFFFF)
{
*dst++ = '?';
} else {
}
else
{
*dst++ = codepoint;
}
}
@ -128,30 +160,31 @@ wchar_t *utf8_to_widechar(const utf8 *src)
return result;
}
utf8 *widechar_to_utf8(const wchar_t *src)
utf8* widechar_to_utf8(const wchar_t* src)
{
utf8 *result = (utf8 *)malloc((wcslen(src) * 4) + 1);
utf8 *dst = result;
utf8* result = (utf8*)malloc((wcslen(src) * 4) + 1);
utf8* dst = result;
for (; *src != 0; src++) {
for (; *src != 0; src++)
{
dst = utf8_write_codepoint(dst, *src);
}
*dst++ = 0;
size_t size = (size_t)(dst - result);
return (utf8 *)realloc(result, size);
return (utf8*)realloc(result, size);
}
/**
* Returns a pointer to the null terminator of the given UTF-8 string.
*/
utf8 *get_string_end(const utf8 *text)
utf8* get_string_end(const utf8* text)
{
int32_t codepoint;
const utf8 *ch = text;
const utf8* ch = text;
while ((codepoint = utf8_get_next(ch, &ch)) != 0) {
while ((codepoint = utf8_get_next(ch, &ch)) != 0)
{
int32_t argLength = utf8_get_format_code_arg_length(codepoint);
ch += argLength;
}
@ -161,7 +194,7 @@ utf8 *get_string_end(const utf8 *text)
/**
* Return the number of bytes (including the null terminator) in the given UTF-8 string.
*/
size_t get_string_size(const utf8 *text)
size_t get_string_size(const utf8* text)
{
return get_string_end(text) - text + 1;
}
@ -169,16 +202,20 @@ size_t get_string_size(const utf8 *text)
/**
* Return the number of visible characters (excludes format codes) in the given UTF-8 string.
*/
int32_t get_string_length(const utf8 *text)
int32_t get_string_length(const utf8* text)
{
int32_t codepoint;
const utf8 *ch = text;
const utf8* ch = text;
int32_t count = 0;
while ((codepoint = utf8_get_next(ch, &ch)) != 0) {
if (utf8_is_format_code(codepoint)) {
while ((codepoint = utf8_get_next(ch, &ch)) != 0)
{
if (utf8_is_format_code(codepoint))
{
ch += utf8_get_format_code_arg_length(codepoint);
} else {
}
else
{
count++;
}
}
@ -187,7 +224,8 @@ int32_t get_string_length(const utf8 *text)
int32_t utf8_get_format_code_arg_length(int32_t codepoint)
{
switch (codepoint) {
switch (codepoint)
{
case FORMAT_MOVE_X:
case FORMAT_ADJUST_PALETTE:
case 3:
@ -202,17 +240,22 @@ int32_t utf8_get_format_code_arg_length(int32_t codepoint)
}
}
void utf8_remove_formatting(utf8* string, bool allowColours) {
void utf8_remove_formatting(utf8* string, bool allowColours)
{
utf8* readPtr = string;
utf8* writePtr = string;
while (true) {
while (true)
{
uint32_t code = utf8_get_next(readPtr, (const utf8**)&readPtr);
if (code == 0) {
if (code == 0)
{
*writePtr = 0;
break;
} else if (!utf8_is_format_code(code) || (allowColours && utf8_is_colour_code(code))) {
}
else if (!utf8_is_format_code(code) || (allowColours && utf8_is_colour_code(code)))
{
writePtr = utf8_write_codepoint(writePtr, code);
}
}
@ -220,15 +263,20 @@ void utf8_remove_formatting(utf8* string, bool allowColours) {
bool utf8_is_format_code(int32_t codepoint)
{
if (codepoint < 32) return true;
if (codepoint >= FORMAT_ARGUMENT_CODE_START && codepoint <= FORMAT_ARGUMENT_CODE_END) return true;
if (codepoint >= FORMAT_COLOUR_CODE_START && codepoint <= FORMAT_COLOUR_CODE_END) return true;
if (codepoint == FORMAT_COMMA1DP16) return true;
if (codepoint < 32)
return true;
if (codepoint >= FORMAT_ARGUMENT_CODE_START && codepoint <= FORMAT_ARGUMENT_CODE_END)
return true;
if (codepoint >= FORMAT_COLOUR_CODE_START && codepoint <= FORMAT_COLOUR_CODE_END)
return true;
if (codepoint == FORMAT_COMMA1DP16)
return true;
return false;
}
bool utf8_is_colour_code(int32_t codepoint)
{
if (codepoint >= FORMAT_COLOUR_CODE_START && codepoint <= FORMAT_COLOUR_CODE_END) return true;
if (codepoint >= FORMAT_COLOUR_CODE_START && codepoint <= FORMAT_COLOUR_CODE_END)
return true;
return false;
}

View File

@ -7,15 +7,16 @@
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#include "User.h"
#include "../Game.h"
#include "../ride/Ride.h"
#include "../util/Util.h"
#include "Localisation.h"
#include "User.h"
utf8 gUserStrings[MAX_USER_STRINGS][USER_STRING_MAX_LENGTH];
static bool user_string_exists(const utf8 *text);
static bool user_string_exists(const utf8* text);
/**
*
@ -30,19 +31,20 @@ void user_string_clear_all()
*
* rct2: 0x006C421D
*/
rct_string_id user_string_allocate(int32_t base, const utf8 *text)
rct_string_id user_string_allocate(int32_t base, const utf8* text)
{
int32_t highBits = (base & 0x7F) << 9;
bool allowDuplicates = base & USER_STRING_DUPLICATION_PERMITTED;
if (!allowDuplicates && user_string_exists(text)) {
if (!allowDuplicates && user_string_exists(text))
{
gGameCommandErrorText = STR_CHOSEN_NAME_IN_USE_ALREADY;
return 0;
}
for (int32_t i = 0; i < MAX_USER_STRINGS; i++)
{
char * userString = gUserStrings[i];
char* userString = gUserStrings[i];
if (userString[0] != 0)
continue;
@ -67,9 +69,9 @@ void user_string_free(rct_string_id id)
gUserStrings[id][0] = 0;
}
static bool user_string_exists(const utf8 *text)
static bool user_string_exists(const utf8* text)
{
char * userString;
char* userString;
for (int32_t i = 0; i < MAX_USER_STRINGS; i++)
{
userString = gUserStrings[i];