1 /*****************************************************************************
2  * Copyright (c) 2014-2020 OpenRCT2 developers
3  *
4  * For a complete list of all authors, please refer to contributors.md
5  * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
6  *
7  * OpenRCT2 is licensed under the GNU General Public License version 3.
8  *****************************************************************************/
9 
10 #pragma once
11 
12 #include "../management/Marketing.h"
13 #include "Currency.h"
14 #include "Date.h"
15 #include "FormatCodes.h"
16 #include "Language.h"
17 #include "StringIds.h"
18 
19 #include <string>
20 
21 std::string format_string(rct_string_id format, const void* args);
22 void format_string(char* dest, size_t size, rct_string_id format, const void* args);
23 void format_string_to_upper(char* dest, size_t size, rct_string_id format, const void* args);
24 void generate_string_file();
25 
26 /**
27  * Formats sizeBytes into buf as a human readable text, e.x.: "1024 MB"
28  */
29 void format_readable_size(char* buf, size_t bufSize, uint64_t sizeBytes);
30 
31 /**
32  * Formats sizeBytesPerSec into buf as a human readable text, e.x.: "1024 MB/sec"
33  */
34 void format_readable_speed(char* buf, size_t bufSize, uint64_t sizeBytesPerSec);
35 
36 utf8* get_string_end(const utf8* text);
37 size_t get_string_size(const utf8* text);
38 
39 // The maximum number of characters allowed for string/money conversions (anything above will risk integer overflow issues)
40 #define MONEY_STRING_MAXLENGTH 14
41 money32 string_to_money(const char* string_to_monetise);
42 void money_to_string(money32 amount, char* buffer_to_put_value_to, size_t buffer_len, bool forceDecimals);
43 
44 bool is_user_string_id(rct_string_id stringId);
45 
46 #define MAX_USER_STRINGS 1024
47 #define USER_STRING_MAX_LENGTH 32
48 
49 #define USER_STRING_START 0x8000
50 #define USER_STRING_END 0x8FFF
51 #define REAL_NAME_START 0xA000
52 #define REAL_NAME_END 0xDFFF
53 
54 // Real name data
55 extern const char real_name_initials[16];
56 extern const char* real_names[1024];
57 
58 extern thread_local char gCommonStringFormatBuffer[512];
59 extern bool gDebugStringFormatting;
60 
61 extern const rct_string_id SpeedNames[5];
62 extern const rct_string_id ObjectiveNames[12];
63 extern const rct_string_id ResearchFundingLevelNames[4];
64 extern const rct_string_id MarketingCampaignNames[ADVERTISING_CAMPAIGN_COUNT][3];
65 extern const rct_string_id RideInspectionIntervalNames[];
66 extern const rct_string_id PeepThoughts[174];
67 extern const rct_string_id DateDayNames[31];
68 extern const rct_string_id DateGameMonthNames[MONTH_COUNT];
69 extern const rct_string_id DateGameShortMonthNames[MONTH_COUNT];
70