src/strings.cpp
changeset 6248 e4a2ed7e5613
parent 6247 7d81e3a5d803
child 6320 32d0f299e2fd
equal deleted inserted replaced
6247:7d81e3a5d803 6248:e4a2ed7e5613
    33 static char *GetSpecialTownNameString(char *buff, int ind, uint32 seed, const char* last);
    33 static char *GetSpecialTownNameString(char *buff, int ind, uint32 seed, const char* last);
    34 static char *GetSpecialPlayerNameString(char *buff, int ind, const int32 *argv, const char* last);
    34 static char *GetSpecialPlayerNameString(char *buff, int ind, const int32 *argv, const char* last);
    35 
    35 
    36 static char *FormatString(char *buff, const char *str, const int32 *argv, uint casei, const char* last);
    36 static char *FormatString(char *buff, const char *str, const int32 *argv, uint casei, const char* last);
    37 
    37 
    38 typedef struct LanguagePack {
    38 struct LanguagePack {
    39 	uint32 ident;
    39 	uint32 ident;
    40 	uint32 version;     // 32-bits of auto generated version info which is basically a hash of strings.h
    40 	uint32 version;     // 32-bits of auto generated version info which is basically a hash of strings.h
    41 	char name[32];      // the international name of this language
    41 	char name[32];      // the international name of this language
    42 	char own_name[32];  // the localized name of this language
    42 	char own_name[32];  // the localized name of this language
    43 	char isocode[16];   // the ISO code for the language (not country code)
    43 	char isocode[16];   // the ISO code for the language (not country code)
    44 	uint16 offsets[32]; // the offsets
    44 	uint16 offsets[32]; // the offsets
    45 	byte plural_form;   // how to compute plural forms
    45 	byte plural_form;   // how to compute plural forms
    46 	byte pad[3];        // pad header to be a multiple of 4
    46 	byte pad[3];        // pad header to be a multiple of 4
    47 	char data[VARARRAY_SIZE];
    47 	char data[VARARRAY_SIZE];
    48 } LanguagePack;
    48 };
    49 
    49 
    50 static char **_langpack_offs;
    50 static char **_langpack_offs;
    51 static LanguagePack *_langpack;
    51 static LanguagePack *_langpack;
    52 static uint _langtab_num[32]; // Offset into langpack offs
    52 static uint _langtab_num[32]; // Offset into langpack offs
    53 static uint _langtab_start[32]; // Offset into langpack offs
    53 static uint _langtab_start[32]; // Offset into langpack offs
   459 	*dstlen = mylen;
   459 	*dstlen = mylen;
   460 	memcpy(dst, b + mypos, mylen);
   460 	memcpy(dst, b + mypos, mylen);
   461 	return b + pos;
   461 	return b + pos;
   462 }
   462 }
   463 
   463 
   464 typedef struct Units {
   464 struct Units {
   465 	int s_m;           ///< Multiplier for velocity
   465 	int s_m;           ///< Multiplier for velocity
   466 	int s_s;           ///< Shift for velocity
   466 	int s_s;           ///< Shift for velocity
   467 	StringID velocity; ///< String for velocity
   467 	StringID velocity; ///< String for velocity
   468 	int p_m;           ///< Multiplier for power
   468 	int p_m;           ///< Multiplier for power
   469 	int p_s;           ///< Shift for power
   469 	int p_s;           ///< Shift for power
   477 	StringID s_volume; ///< Short string for volume
   477 	StringID s_volume; ///< Short string for volume
   478 	StringID l_volume; ///< Long string for volume
   478 	StringID l_volume; ///< Long string for volume
   479 	int f_m;           ///< Multiplier for force
   479 	int f_m;           ///< Multiplier for force
   480 	int f_s;           ///< Shift for force
   480 	int f_s;           ///< Shift for force
   481 	StringID force;    ///< String for force
   481 	StringID force;    ///< String for force
   482 } Units;
   482 };
   483 
   483 
   484 /* Unit conversions */
   484 /* Unit conversions */
   485 static const Units units[] = {
   485 static const Units units[] = {
   486 	{ // Imperial (Original, mph, hp, metric ton, litre, kN)
   486 	{ // Imperial (Original, mph, hp, metric ton, litre, kN)
   487 		   1,  0, STR_UNITS_VELOCITY_IMPERIAL,
   487 		   1,  0, STR_UNITS_VELOCITY_IMPERIAL,