src/newgrf.cpp
changeset 7879 27da043a4f69
parent 7873 9bb5874c81df
child 7882 308cab08d2f3
equal deleted inserted replaced
7878:4ed1ca40b1f6 7879:27da043a4f69
   247  * @param str StringID that we want to have the equivalent in OoenTTD
   247  * @param str StringID that we want to have the equivalent in OoenTTD
   248  * @return the properly adjusted StringID
   248  * @return the properly adjusted StringID
   249  */
   249  */
   250 StringID MapGRFStringID(uint32 grfid, StringID str)
   250 StringID MapGRFStringID(uint32 grfid, StringID str)
   251 {
   251 {
       
   252 	/* StringID table for TextIDs 0x4E->0x6D */
       
   253 	static StringID units_volume[] = {
       
   254 		STR_NOTHING,    STR_PASSENGERS, STR_TONS,       STR_BAGS,
       
   255 		STR_LITERS,     STR_ITEMS,      STR_CRATES,     STR_TONS,
       
   256 		STR_TONS,       STR_TONS,       STR_TONS,       STR_BAGS,
       
   257 		STR_TONS,       STR_TONS,       STR_TONS,       STR_BAGS,
       
   258 		STR_TONS,       STR_TONS,       STR_BAGS,       STR_LITERS,
       
   259 		STR_TONS,       STR_LITERS,     STR_TONS,       STR_NOTHING,
       
   260 		STR_BAGS,       STR_LITERS,     STR_TONS,       STR_NOTHING,
       
   261 		STR_TONS,       STR_NOTHING,    STR_LITERS,     STR_NOTHING
       
   262 	};
   252 	/* 0xD0 and 0xDC stand for all the TextIDs in the range
   263 	/* 0xD0 and 0xDC stand for all the TextIDs in the range
   253 	 * of 0xD000 (misc graphics texts) and 0xDC00 (misc persistent texts).
   264 	 * of 0xD000 (misc graphics texts) and 0xDC00 (misc persistent texts).
   254 	 * These strings are unique to each grf file, and thus require to be used with the
   265 	 * These strings are unique to each grf file, and thus require to be used with the
   255 	 * grfid in which they are declared */
   266 	 * grfid in which they are declared */
   256 	if (GB(str, 8, 8) == 0xD0 || GB(str, 8, 8) == 0xDC) {
   267 	if (GB(str, 8, 8) == 0xD0 || GB(str, 8, 8) == 0xDC) {
   258 	}
   269 	}
   259 #define TEXID_TO_STRINGID(begin, end, stringid) if (str >= begin && str <= end) return str + (stringid - begin)
   270 #define TEXID_TO_STRINGID(begin, end, stringid) if (str >= begin && str <= end) return str + (stringid - begin)
   260 	/* We have some changes in our cargo strings, resulting in some missing. */
   271 	/* We have some changes in our cargo strings, resulting in some missing. */
   261 	TEXID_TO_STRINGID(0x000E, 0x002D, STR_000E);
   272 	TEXID_TO_STRINGID(0x000E, 0x002D, STR_000E);
   262 	TEXID_TO_STRINGID(0x002E, 0x004D, STR_002E);
   273 	TEXID_TO_STRINGID(0x002E, 0x004D, STR_002E);
   263 	TEXID_TO_STRINGID(0x004E, 0x006D, STR_QUANTITY_NOTHING);
   274 	if (str >= 0x004E && str <= 0x006D) str = units_volume[str - 0x004E];
   264 	TEXID_TO_STRINGID(0x006E, 0x008D, STR_QUANTITY_NOTHING);
   275 	TEXID_TO_STRINGID(0x006E, 0x008D, STR_QUANTITY_NOTHING);
   265 	TEXID_TO_STRINGID(0x008E, 0x00AD, STR_ABBREV_NOTHING);
   276 	TEXID_TO_STRINGID(0x008E, 0x00AD, STR_ABBREV_NOTHING);
   266 
   277 
   267 	/* Map building names according to our lang file changes
   278 	/* Map building names according to our lang file changes
   268 	 * 0x200F = Tall Office Block, first house name in the original data, the one that TTDPatch stil uses
   279 	 * 0x200F = Tall Office Block, first house name in the original data, the one that TTDPatch stil uses