diff options
author | frosch <frosch@openttd.org> | 2011-09-23 19:27:08 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2011-09-23 19:27:08 +0000 |
commit | 514fa060a21f58298cb7fda01b925d865ecce094 (patch) | |
tree | 397c62100c6b944b160864dede3c48651d186f76 | |
parent | 1f266ec97735ab7d917f6161cbe14420cd9affd2 (diff) | |
download | openttd-514fa060a21f58298cb7fda01b925d865ecce094.tar.xz |
(svn r22956) -Codechange: Enhance TEXTID_TO_STRINGID() with an assert_compile().
-rw-r--r-- | src/newgrf_text.cpp | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/src/newgrf_text.cpp b/src/newgrf_text.cpp index bd820e0c6..d3b2e1372 100644 --- a/src/newgrf_text.cpp +++ b/src/newgrf_text.cpp @@ -59,28 +59,31 @@ StringID TTDPStringIDToOTTDStringIDMapping(StringID str) /* A string straight from a NewGRF; no need to remap this as it's already mapped. */ if (IsInsideMM(str, 0xD000, 0xD7FF)) return str; -#define TEXTID_TO_STRINGID(begin, end, stringid) if (str >= begin && str <= end) return str + (stringid - begin) +#define TEXTID_TO_STRINGID(begin, end, stringid, stringend) \ + assert_compile(stringend - stringid == end - begin); \ + if (str >= begin && str <= end) return str + (stringid - begin) + /* We have some changes in our cargo strings, resulting in some missing. */ - TEXTID_TO_STRINGID(0x000E, 0x002D, STR_CARGO_PLURAL_NOTHING); - TEXTID_TO_STRINGID(0x002E, 0x004D, STR_CARGO_SINGULAR_NOTHING); + TEXTID_TO_STRINGID(0x000E, 0x002D, STR_CARGO_PLURAL_NOTHING, STR_CARGO_PLURAL_FIZZY_DRINKS); + TEXTID_TO_STRINGID(0x002E, 0x004D, STR_CARGO_SINGULAR_NOTHING, STR_CARGO_SINGULAR_FIZZY_DRINK); if (str >= 0x004E && str <= 0x006D) return units_volume[str - 0x004E]; - TEXTID_TO_STRINGID(0x006E, 0x008D, STR_QUANTITY_NOTHING); - TEXTID_TO_STRINGID(0x008E, 0x00AD, STR_ABBREV_NOTHING); - TEXTID_TO_STRINGID(0x00D1, 0x00E0, STR_COLOUR_DARK_BLUE); + TEXTID_TO_STRINGID(0x006E, 0x008D, STR_QUANTITY_NOTHING, STR_QUANTITY_FIZZY_DRINKS); + TEXTID_TO_STRINGID(0x008E, 0x00AD, STR_ABBREV_NOTHING, STR_ABBREV_FIZZY_DRINKS); + TEXTID_TO_STRINGID(0x00D1, 0x00E0, STR_COLOUR_DARK_BLUE, STR_COLOUR_WHITE); /* Map building names according to our lang file changes. There are several * ranges of house ids, all of which need to be remapped to allow newgrfs * to use original house names. */ - TEXTID_TO_STRINGID(0x200F, 0x201F, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1); - TEXTID_TO_STRINGID(0x2036, 0x2041, STR_TOWN_BUILDING_NAME_COTTAGES_1); - TEXTID_TO_STRINGID(0x2059, 0x205C, STR_TOWN_BUILDING_NAME_IGLOO_1); + TEXTID_TO_STRINGID(0x200F, 0x201F, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, STR_TOWN_BUILDING_NAME_OLD_HOUSES_1); + TEXTID_TO_STRINGID(0x2036, 0x2041, STR_TOWN_BUILDING_NAME_COTTAGES_1, STR_TOWN_BUILDING_NAME_SHOPPING_MALL_1); + TEXTID_TO_STRINGID(0x2059, 0x205C, STR_TOWN_BUILDING_NAME_IGLOO_1, STR_TOWN_BUILDING_NAME_PIGGY_BANK_1); /* Same thing for industries */ - TEXTID_TO_STRINGID(0x4802, 0x4826, STR_INDUSTRY_NAME_COAL_MINE); - TEXTID_TO_STRINGID(0x482D, 0x482E, STR_NEWS_INDUSTRY_CONSTRUCTION); - TEXTID_TO_STRINGID(0x4832, 0x4834, STR_NEWS_INDUSTRY_CLOSURE_GENERAL); - TEXTID_TO_STRINGID(0x4835, 0x4838, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_GENERAL); - TEXTID_TO_STRINGID(0x4839, 0x483A, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL); + TEXTID_TO_STRINGID(0x4802, 0x4826, STR_INDUSTRY_NAME_COAL_MINE, STR_INDUSTRY_NAME_SUGAR_MINE); + TEXTID_TO_STRINGID(0x482D, 0x482E, STR_NEWS_INDUSTRY_CONSTRUCTION, STR_NEWS_INDUSTRY_PLANTED); + TEXTID_TO_STRINGID(0x4832, 0x4834, STR_NEWS_INDUSTRY_CLOSURE_GENERAL, STR_NEWS_INDUSTRY_CLOSURE_LACK_OF_TREES); + TEXTID_TO_STRINGID(0x4835, 0x4838, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_FARM); + TEXTID_TO_STRINGID(0x4839, 0x483A, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_FARM); switch (str) { case 0x4830: return STR_ERROR_CAN_T_CONSTRUCT_THIS_INDUSTRY; |