Files
@ r24498:e9114d9ab04a
Branch filter:
Location: cpp/openttd-patchpack/source/src/strings_type.h - annotation
r24498:e9114d9ab04a
3.7 KiB
text/x-c
Fix #6468: don't store version of AIs-started-via-console in name
You can do: "startai myai.3", which starts version 3 of "myai".
This is very useful for testing save/load code between different
versions of your AI.
However, when using this syntax, the AI got saved as "myai.3" as
name of the AI, instead of "myai". This caused several problems,
like indicating to the user the AI could not be found, but still
load the AI. But in all cases, the AI never got the chance to
load the saved data, making the whole reason this exists pointless.
By splitting the name and version already in the console command,
the code becomes simpler and AIs started this way now follow the
normal flow after initialization.
You can do: "startai myai.3", which starts version 3 of "myai".
This is very useful for testing save/load code between different
versions of your AI.
However, when using this syntax, the AI got saved as "myai.3" as
name of the AI, instead of "myai". This caused several problems,
like indicating to the user the AI could not be found, but still
load the AI. But in all cases, the AI never got the chance to
load the saved data, making the whole reason this exists pointless.
By splitting the name and version already in the console command,
the code becomes simpler and AIs started this way now follow the
normal flow after initialization.
r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r9773:820f87546490 r9773:820f87546490 r9773:820f87546490 r22550:5a1c0341c400 r22550:5a1c0341c400 r15173:a59afd6301a6 r16400:9ccc094247b7 r8114:866ed489ed98 r10249:a19adec3c686 r10249:a19adec3c686 r10249:a19adec3c686 r10249:a19adec3c686 r10249:a19adec3c686 r10249:a19adec3c686 r22549:21c2f1153122 r22549:21c2f1153122 r22549:21c2f1153122 r22549:21c2f1153122 r22549:21c2f1153122 r22549:21c2f1153122 r22549:21c2f1153122 r22549:21c2f1153122 r22549:21c2f1153122 r22549:21c2f1153122 r22549:21c2f1153122 r22551:c6bc232b7c99 r22551:c6bc232b7c99 r22551:c6bc232b7c99 r22549:21c2f1153122 r22549:21c2f1153122 r22548:e350bbe3b5af r22548:e350bbe3b5af r22548:e350bbe3b5af r22548:e350bbe3b5af r22548:e350bbe3b5af r22551:c6bc232b7c99 r22551:c6bc232b7c99 r22551:c6bc232b7c99 r22551:c6bc232b7c99 r22551:c6bc232b7c99 r22551:c6bc232b7c99 r9773:820f87546490 r8114:866ed489ed98 r8114:866ed489ed98 r11363:6906c490a00e r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r11699:bed6147a152d r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r18122:623505749ded r18122:623505749ded r18122:623505749ded r8114:866ed489ed98 r18122:623505749ded r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r11363:6906c490a00e r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r23790:75606400a38f r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 | /*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file strings_type.h Types related to strings. */
#ifndef STRINGS_TYPE_H
#define STRINGS_TYPE_H
/**
* Numeric value that represents a string, independent of the selected language.
*/
typedef uint32 StringID;
static const StringID INVALID_STRING_ID = 0xFFFF; ///< Constant representing an invalid string (16bit in case it is used in savegames)
static const int MAX_CHAR_LENGTH = 4; ///< Max. length of UTF-8 encoded unicode character
static const uint MAX_LANG = 0x7F; ///< Maximum number of languages supported by the game, and the NewGRF specs
/** Directions a text can go to */
enum TextDirection {
TD_LTR, ///< Text is written left-to-right by default
TD_RTL, ///< Text is written right-to-left by default
};
/** StringTabs to group StringIDs */
enum StringTab {
/* Tabs 0..1 for regular strings */
TEXT_TAB_TOWN = 4,
TEXT_TAB_INDUSTRY = 9,
TEXT_TAB_STATION = 12,
TEXT_TAB_SPECIAL = 14,
TEXT_TAB_OLD_CUSTOM = 15,
TEXT_TAB_VEHICLE = 16,
/* Tab 17 for regular strings */
TEXT_TAB_OLD_NEWGRF = 26,
TEXT_TAB_END = 32, ///< End of language files.
TEXT_TAB_GAMESCRIPT_START = 32, ///< Start of GameScript supplied strings.
TEXT_TAB_NEWGRF_START = 64, ///< Start of NewGRF supplied strings.
};
/** Number of bits for the StringIndex within a StringTab */
static const uint TAB_SIZE_BITS = 11;
/** Number of strings per StringTab */
static const uint TAB_SIZE = 1 << TAB_SIZE_BITS;
/** Number of strings for GameScripts */
static const uint TAB_SIZE_GAMESCRIPT = TAB_SIZE * 32;
/** Number of strings for NewGRFs */
static const uint TAB_SIZE_NEWGRF = TAB_SIZE * 256;
/** Special string constants */
enum SpecialStrings {
/* special strings for town names. the town name is generated dynamically on request. */
SPECSTR_TOWNNAME_START = 0x20C0,
SPECSTR_TOWNNAME_ENGLISH = SPECSTR_TOWNNAME_START,
SPECSTR_TOWNNAME_FRENCH,
SPECSTR_TOWNNAME_GERMAN,
SPECSTR_TOWNNAME_AMERICAN,
SPECSTR_TOWNNAME_LATIN,
SPECSTR_TOWNNAME_SILLY,
SPECSTR_TOWNNAME_SWEDISH,
SPECSTR_TOWNNAME_DUTCH,
SPECSTR_TOWNNAME_FINNISH,
SPECSTR_TOWNNAME_POLISH,
SPECSTR_TOWNNAME_SLOVAK,
SPECSTR_TOWNNAME_NORWEGIAN,
SPECSTR_TOWNNAME_HUNGARIAN,
SPECSTR_TOWNNAME_AUSTRIAN,
SPECSTR_TOWNNAME_ROMANIAN,
SPECSTR_TOWNNAME_CZECH,
SPECSTR_TOWNNAME_SWISS,
SPECSTR_TOWNNAME_DANISH,
SPECSTR_TOWNNAME_TURKISH,
SPECSTR_TOWNNAME_ITALIAN,
SPECSTR_TOWNNAME_CATALAN,
SPECSTR_TOWNNAME_LAST = SPECSTR_TOWNNAME_CATALAN,
/* special strings for company names on the form "TownName transport". */
SPECSTR_COMPANY_NAME_START = 0x70EA,
SPECSTR_COMPANY_NAME_LAST = SPECSTR_COMPANY_NAME_START + SPECSTR_TOWNNAME_LAST - SPECSTR_TOWNNAME_START,
SPECSTR_SILLY_NAME = 0x70E5,
SPECSTR_ANDCO_NAME = 0x70E6,
SPECSTR_PRESIDENT_NAME = 0x70E7,
/* reserve MAX_LANG strings for the *.lng files */
SPECSTR_LANGUAGE_START = 0x7100,
SPECSTR_LANGUAGE_END = SPECSTR_LANGUAGE_START + MAX_LANG - 1,
/* reserve strings for various screen resolutions MUST BE THE LAST VALUE IN THIS ENUM */
SPECSTR_RESOLUTION_START = SPECSTR_LANGUAGE_END + 1,
};
#endif /* STRINGS_TYPE_H */
|