summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2007-06-01 23:06:01 +0000
committerglx <glx@openttd.org>2007-06-01 23:06:01 +0000
commit6e653cd1ab968238bb6856a1d9d5c05d34c23428 (patch)
treee873ef3279f18af2cd30a661c6f56ea867c073c0 /src
parentecd36dd34f5cf66a3bfc1c221796bb2e32a4ce73 (diff)
downloadopenttd-6e653cd1ab968238bb6856a1d9d5c05d34c23428.tar.xz
(svn r10017) -Add (FS#790): more languages flags for servers
Diffstat (limited to 'src')
-rw-r--r--src/gfxinit.cpp3
-rw-r--r--src/lang/english.txt25
-rw-r--r--src/network/core/config.h2
-rw-r--r--src/network/network_gui.cpp76
-rw-r--r--src/settings.cpp2
-rw-r--r--src/table/files.h3
-rw-r--r--src/table/sprites.h70
7 files changed, 138 insertions, 43 deletions
diff --git a/src/gfxinit.cpp b/src/gfxinit.cpp
index 9abdd1679..2fe58ca0b 100644
--- a/src/gfxinit.cpp
+++ b/src/gfxinit.cpp
@@ -402,6 +402,9 @@ static void LoadSpriteTables()
assert(load_index == SPR_ONEWAY_BASE);
load_index += LoadGrfFile("oneway.grf", load_index, i++);
+ assert(load_index == SPR_FLAGS_BASE);
+ load_index += LoadGrfFile("flags.grf", load_index, i++);
+
/* Initialize the unicode to sprite mapping table */
InitializeUnicodeGlyphMap();
diff --git a/src/lang/english.txt b/src/lang/english.txt
index 101ff2cb9..877e8874d 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -1397,6 +1397,31 @@ STR_NETWORK_LANG_ANY :Any
STR_NETWORK_LANG_ENGLISH :English
STR_NETWORK_LANG_GERMAN :German
STR_NETWORK_LANG_FRENCH :French
+STR_NETWORK_LANG_BRAZILIAN :Brazilian
+STR_NETWORK_LANG_BULGARIAN :Bulgarian
+STR_NETWORK_LANG_CHINESE :Chinese
+STR_NETWORK_LANG_CZECH :Czech
+STR_NETWORK_LANG_DANISH :Danish
+STR_NETWORK_LANG_DUTCH :Dutch
+STR_NETWORK_LANG_ESPERANTO :Esperanto
+STR_NETWORK_LANG_FINNISH :Finnish
+STR_NETWORK_LANG_HUNGARIAN :Hungarian
+STR_NETWORK_LANG_ICELANDIC :Icelandic
+STR_NETWORK_LANG_ITALIAN :Italian
+STR_NETWORK_LANG_JAPANESE :Japanese
+STR_NETWORK_LANG_KOREAN :Korean
+STR_NETWORK_LANG_LITHUANIAN :Lithuanian
+STR_NETWORK_LANG_NORWEGIAN :Norwegian
+STR_NETWORK_LANG_POLISH :Polish
+STR_NETWORK_LANG_PORTUGUESE :Portuguese
+STR_NETWORK_LANG_ROMANIAN :Romanian
+STR_NETWORK_LANG_RUSSIAN :Russian
+STR_NETWORK_LANG_SLOVAK :Slovak
+STR_NETWORK_LANG_SLOVENIAN :Slovenian
+STR_NETWORK_LANG_SPANISH :Spanish
+STR_NETWORK_LANG_SWEDISH :Swedish
+STR_NETWORK_LANG_TURKISH :Turkish
+STR_NETWORK_LANG_UKRAINIAN :Ukrainian
############ End of leave-in-this-order
STR_NETWORK_GAME_LOBBY :{WHITE}Multiplayer game lobby
diff --git a/src/network/core/config.h b/src/network/core/config.h
index dcc6042de..d8dbdb274 100644
--- a/src/network/core/config.h
+++ b/src/network/core/config.h
@@ -46,7 +46,7 @@ enum {
*/
NETWORK_MAX_GRF_COUNT = 55,
- NETWORK_NUM_LANGUAGES = 4, ///< Number of known languages (to the network protocol) + 1 for 'any'.
+ NETWORK_NUM_LANGUAGES = 29, ///< Number of known languages (to the network protocol) + 1 for 'any'.
/**
* The number of landscapes in OpenTTD.
* This number must be equal to NUM_LANDSCAPE, but as this number is used
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index 96c9a9181..80ef20b86 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -84,15 +84,73 @@ static const StringID _players_dropdown[] = {
STR_NETWORK_10_PLAYERS,
INVALID_STRING_ID
};
-
+/* The strings are in alphabetical order (in English). */
static const StringID _language_dropdown[] = {
STR_NETWORK_LANG_ANY,
+ STR_NETWORK_LANG_BRAZILIAN,
+ STR_NETWORK_LANG_BULGARIAN,
+ STR_NETWORK_LANG_CHINESE,
+ STR_NETWORK_LANG_CZECH,
+ STR_NETWORK_LANG_DANISH,
+ STR_NETWORK_LANG_DUTCH,
STR_NETWORK_LANG_ENGLISH,
- STR_NETWORK_LANG_GERMAN,
+ STR_NETWORK_LANG_ESPERANTO,
+ STR_NETWORK_LANG_FINNISH,
STR_NETWORK_LANG_FRENCH,
+ STR_NETWORK_LANG_GERMAN,
+ STR_NETWORK_LANG_HUNGARIAN,
+ STR_NETWORK_LANG_ICELANDIC,
+ STR_NETWORK_LANG_ITALIAN,
+ STR_NETWORK_LANG_JAPANESE,
+ STR_NETWORK_LANG_KOREAN,
+ STR_NETWORK_LANG_LITHUANIAN,
+ STR_NETWORK_LANG_NORWEGIAN,
+ STR_NETWORK_LANG_POLISH,
+ STR_NETWORK_LANG_PORTUGUESE,
+ STR_NETWORK_LANG_ROMANIAN,
+ STR_NETWORK_LANG_RUSSIAN,
+ STR_NETWORK_LANG_SLOVAK,
+ STR_NETWORK_LANG_SLOVENIAN,
+ STR_NETWORK_LANG_SPANISH,
+ STR_NETWORK_LANG_SWEDISH,
+ STR_NETWORK_LANG_TURKISH,
+ STR_NETWORK_LANG_UKRAINIAN,
INVALID_STRING_ID
};
+/* Used to map the _server_lang value to the sorted string. */
+static const int _server_lang_to_string[] = {
+ 0, // Any
+ 7, // English
+ 11, // German
+ 10, // French
+ 1, // Brazilian
+ 2, // Bulgarian
+ 3, // Chinese
+ 4, // Czech
+ 5, // Danish
+ 6, // Dutch
+ 8, // Esperanto
+ 9, // Finnish
+ 12, // Hungarian
+ 13, // Icelandic
+ 14, // Italian
+ 15, // Japanese
+ 16, // Korean
+ 17, // Lithuanian
+ 18, // Norwegian
+ 19, // Polish
+ 20, // Portuguese
+ 21, // Romanian
+ 22, // Russian
+ 23, // Slovak
+ 24, // Slovenian
+ 25, // Spanish
+ 26, // Swedish
+ 27, // Turkish
+ 28, // Ukrainian
+};
+
enum {
NET_PRC__OFFSET_TOP_WIDGET = 54,
NET_PRC__OFFSET_TOP_WIDGET_COMPANY = 52,
@@ -342,7 +400,7 @@ static void NetworkGameWindowWndProc(Window *w, WindowEvent *e)
DrawString(x, y, STR_NETWORK_CLIENTS, 2);
y += 10;
- SetDParam(0, _language_dropdown[sel->info.server_lang]);
+ SetDParam(0, _language_dropdown[_server_lang_to_string[sel->info.server_lang]]);
DrawString(x, y, STR_NETWORK_LANGUAGE, 2); // server language
y += 10;
@@ -609,7 +667,7 @@ static void NetworkStartServerWindowWndProc(Window *w, WindowEvent *e)
SetDParam( 9, _players_dropdown[_network_game_info.clients_max]);
SetDParam(11, _players_dropdown[_network_game_info.companies_max]);
SetDParam(13, _players_dropdown[_network_game_info.spectators_max]);
- SetDParam(15, _language_dropdown[_network_game_info.server_lang]);
+ SetDParam(15, _language_dropdown[_server_lang_to_string[_network_game_info.server_lang]]);
DrawWindowWidgets(w);
GfxFillRect(11, 63, 258, 215, 0xD7);
@@ -680,7 +738,7 @@ static void NetworkStartServerWindowWndProc(Window *w, WindowEvent *e)
ShowDropDownMenu(w, _players_dropdown, _network_game_info.spectators_max, 14, 0, 0);
break;
case 15: case 16: /* Language */
- ShowDropDownMenu(w, _language_dropdown, _network_game_info.server_lang, 16, 0, 0);
+ ShowDropDownMenu(w, _language_dropdown, _server_lang_to_string[_network_game_info.server_lang], 16, 0, 0);
break;
case 17: /* Start game */
_is_network_server = true;
@@ -715,7 +773,13 @@ static void NetworkStartServerWindowWndProc(Window *w, WindowEvent *e)
case 10: _network_game_info.clients_max = e->we.dropdown.index; break;
case 12: _network_game_info.companies_max = e->we.dropdown.index; break;
case 14: _network_game_info.spectators_max = e->we.dropdown.index; break;
- case 16: _network_game_info.server_lang = e->we.dropdown.index; break;
+ case 16:
+ for (uint i = 0; i < lengthof(_server_lang_to_string); i++) {
+ if (_server_lang_to_string[i] == e->we.dropdown.index) {
+ _network_game_info.server_lang = i;
+ }
+ }
+ break;
}
SetWindowDirty(w);
diff --git a/src/settings.cpp b/src/settings.cpp
index 1fd8effef..ea4e289fb 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -1284,7 +1284,7 @@ static const SettingDescGlobVarList _network_settings[] = {
SDTG_VAR("max_spectators", SLE_UINT8, S, 0, _network_game_info.spectators_max, 10, 0, 10, 0, STR_NULL, NULL),
SDTG_VAR("restart_game_year", SLE_INT32, S,D0, _network_restart_game_year, 0, MIN_YEAR, MAX_YEAR, 1, STR_NULL, NULL),
SDTG_VAR("min_players", SLE_UINT8, S, 0, _network_min_players, 0, 0, 10, 0, STR_NULL, NULL),
- SDTG_OMANY("server_lang", SLE_UINT8, S, 0, _network_game_info.server_lang, 0, 3, "ANY|ENGLISH|GERMAN|FRENCH", STR_NULL, NULL),
+ SDTG_OMANY("server_lang", SLE_UINT8, S, 0, _network_game_info.server_lang, 0, 28, "ANY|ENGLISH|GERMAN|FRENCH|BRAZILIAN|BULGARIAN|CHINESE|CZECH|DANISH|DUTCH|ESPERANTO|FINNISH|HUNGARIAN|ICELANDIC|ITALIAN|JAPANESE|KOREAN|LITHUANIAN|NORWEGIAN|POLISH|PORTUGUESE|ROMANIAN|RUSSIAN|SLOVAK|SLOVENIAN|SPANISH|SWEDISH|TURKISH|UKRAINIAN", STR_NULL, NULL),
SDTG_END()
};
#endif /* ENABLE_NETWORK */
diff --git a/src/table/files.h b/src/table/files.h
index 662b4c121..ac6fbbd03 100644
--- a/src/table/files.h
+++ b/src/table/files.h
@@ -59,10 +59,11 @@ static MD5File files_openttd[] = {
{ "autorail.grf", { 0xed, 0x44, 0x7f, 0xbb, 0x19, 0x44, 0x48, 0x4c, 0x07, 0x8a, 0xb1, 0xc1, 0x5c, 0x12, 0x3a, 0x60 } },
{ "canalsw.grf", { 0x13, 0x9c, 0x98, 0xcf, 0xb8, 0x7c, 0xd7, 0x1f, 0xca, 0x34, 0xa5, 0x6b, 0x65, 0x31, 0xec, 0x0f } },
{ "elrailsw.grf", { 0x4f, 0xf9, 0xac, 0x79, 0x50, 0x28, 0x9b, 0xe2, 0x15, 0x30, 0xa8, 0x1e, 0xd5, 0xfd, 0xe1, 0xda } },
- { "openttd.grf", { 0x85, 0x4f, 0xf6, 0xb5, 0xd2, 0xf7, 0xbc, 0x1e, 0xb9, 0xdc, 0x44, 0xef, 0x35, 0x5f, 0x64, 0x9b } },
+ { "openttd.grf", { 0x20, 0x64, 0x4a, 0xf6, 0x75, 0x26, 0x5b, 0x92, 0xbb, 0x6f, 0x8d, 0x0e, 0x34, 0x7e, 0xa6, 0xe3 } },
{ "trkfoundw.grf", { 0x12, 0x33, 0x3f, 0xa3, 0xd1, 0x86, 0x8b, 0x04, 0x53, 0x18, 0x9c, 0xee, 0xf9, 0x2d, 0xf5, 0x95 } },
{ "roadstops.grf", { 0x8c, 0xd9, 0x45, 0x21, 0x28, 0x82, 0x96, 0x45, 0x33, 0x22, 0x7a, 0xb9, 0x0d, 0xf3, 0x67, 0x4a } },
{ "group.grf", { 0xe8, 0x52, 0x5f, 0x1c, 0x3e, 0xf9, 0x91, 0x9d, 0x0f, 0x70, 0x8c, 0x8a, 0x21, 0xa4, 0xc7, 0x02 } },
{ "tramtrkw.grf", { 0x83, 0x0a, 0xf4, 0x9f, 0x29, 0x10, 0x48, 0xfd, 0x76, 0xe9, 0xda, 0xac, 0x5d, 0xa2, 0x30, 0x45 } },
{ "oneway.grf", { 0xbb, 0xc6, 0xa3, 0xb2, 0xb3, 0xa0, 0xc9, 0x3c, 0xc9, 0xee, 0x24, 0x7c, 0xb6, 0x51, 0x74, 0x63 } },
+ { "flags.grf", { 0xa1, 0xd7, 0x72, 0x75, 0x0e, 0x81, 0x86, 0x0e, 0xc9, 0xcd, 0xc2, 0x57, 0xb2, 0x19, 0xe1, 0x0c } },
};
diff --git a/src/table/sprites.h b/src/table/sprites.h
index 77d87d3db..777cb4261 100644
--- a/src/table/sprites.h
+++ b/src/table/sprites.h
@@ -47,7 +47,7 @@ enum Sprites {
SPR_ASCII_SPACE_BIG = 450,
/* Extra graphic spritenumbers */
- OPENTTD_SPRITES_COUNT = 116, // number of gfx-sprites in openttd.grf
+ OPENTTD_SPRITES_COUNT = 112, // number of gfx-sprites in openttd.grf
SPR_SIGNALS_BASE = 4896,
SPR_CANALS_BASE = SPR_SIGNALS_BASE + 486,
SPR_SLOPES_BASE = SPR_CANALS_BASE + 70,
@@ -62,44 +62,43 @@ enum Sprites {
SPR_PIN_DOWN = SPR_OPENTTD_BASE + 56,
SPR_BOX_EMPTY = SPR_OPENTTD_BASE + 59,
SPR_BOX_CHECKED = SPR_OPENTTD_BASE + 60,
- SPR_WINDOW_RESIZE = SPR_OPENTTD_BASE + 86, // resize icon
- SPR_HOUSE_ICON = SPR_OPENTTD_BASE + 93,
+ SPR_WINDOW_RESIZE = SPR_OPENTTD_BASE + 82, // resize icon
+ SPR_HOUSE_ICON = SPR_OPENTTD_BASE + 89,
// arrow icons pointing in all 4 directions
- SPR_ARROW_DOWN = SPR_OPENTTD_BASE + 87,
- SPR_ARROW_UP = SPR_OPENTTD_BASE + 88,
- SPR_ARROW_LEFT = SPR_OPENTTD_BASE + 89,
- SPR_ARROW_RIGHT = SPR_OPENTTD_BASE + 90,
+ SPR_ARROW_DOWN = SPR_OPENTTD_BASE + 83,
+ SPR_ARROW_UP = SPR_OPENTTD_BASE + 84,
+ SPR_ARROW_LEFT = SPR_OPENTTD_BASE + 85,
+ SPR_ARROW_RIGHT = SPR_OPENTTD_BASE + 86,
SPR_LARGE_SMALL_WINDOW = 682,
/* Clone vehicles stuff */
- SPR_CLONE_TRAIN = SPR_OPENTTD_BASE + 91,
- SPR_CLONE_ROADVEH = SPR_OPENTTD_BASE + 108,
- SPR_CLONE_SHIP = SPR_OPENTTD_BASE + 110,
- SPR_CLONE_AIRCRAFT = SPR_OPENTTD_BASE + 112,
-
- SPR_SELL_TRAIN = SPR_OPENTTD_BASE + 95,
- SPR_SELL_ROADVEH = SPR_OPENTTD_BASE + 96,
- SPR_SELL_SHIP = SPR_OPENTTD_BASE + 97,
- SPR_SELL_AIRCRAFT = SPR_OPENTTD_BASE + 98,
- SPR_SELL_ALL_TRAIN = SPR_OPENTTD_BASE + 99,
- SPR_SELL_ALL_ROADVEH = SPR_OPENTTD_BASE + 100,
- SPR_SELL_ALL_SHIP = SPR_OPENTTD_BASE + 101,
- SPR_SELL_ALL_AIRCRAFT = SPR_OPENTTD_BASE + 102,
- SPR_REPLACE_TRAIN = SPR_OPENTTD_BASE + 103,
- SPR_REPLACE_ROADVEH = SPR_OPENTTD_BASE + 104,
- SPR_REPLACE_SHIP = SPR_OPENTTD_BASE + 105,
- SPR_REPLACE_AIRCRAFT = SPR_OPENTTD_BASE + 106,
- SPR_SELL_CHAIN_TRAIN = SPR_OPENTTD_BASE + 107,
-
- SPR_SHARED_ORDERS_ICON = SPR_OPENTTD_BASE + 114,
-
- SPR_WARNING_SIGN = SPR_OPENTTD_BASE + 115, // warning sign (shown if there are any newgrf errors)
+ SPR_CLONE_TRAIN = SPR_OPENTTD_BASE + 87,
+ SPR_CLONE_ROADVEH = SPR_OPENTTD_BASE + 104,
+ SPR_CLONE_SHIP = SPR_OPENTTD_BASE + 106,
+ SPR_CLONE_AIRCRAFT = SPR_OPENTTD_BASE + 108,
+
+ SPR_SELL_TRAIN = SPR_OPENTTD_BASE + 91,
+ SPR_SELL_ROADVEH = SPR_OPENTTD_BASE + 92,
+ SPR_SELL_SHIP = SPR_OPENTTD_BASE + 93,
+ SPR_SELL_AIRCRAFT = SPR_OPENTTD_BASE + 94,
+ SPR_SELL_ALL_TRAIN = SPR_OPENTTD_BASE + 95,
+ SPR_SELL_ALL_ROADVEH = SPR_OPENTTD_BASE + 96,
+ SPR_SELL_ALL_SHIP = SPR_OPENTTD_BASE + 97,
+ SPR_SELL_ALL_AIRCRAFT = SPR_OPENTTD_BASE + 98,
+ SPR_REPLACE_TRAIN = SPR_OPENTTD_BASE + 99,
+ SPR_REPLACE_ROADVEH = SPR_OPENTTD_BASE + 100,
+ SPR_REPLACE_SHIP = SPR_OPENTTD_BASE + 101,
+ SPR_REPLACE_AIRCRAFT = SPR_OPENTTD_BASE + 102,
+ SPR_SELL_CHAIN_TRAIN = SPR_OPENTTD_BASE + 103,
+
+ SPR_SHARED_ORDERS_ICON = SPR_OPENTTD_BASE + 110,
+
+ SPR_WARNING_SIGN = SPR_OPENTTD_BASE + 111, // warning sign (shown if there are any newgrf errors)
/* Network GUI sprites */
SPR_SQUARE = SPR_OPENTTD_BASE + 20, // colored square (used for newgrf compatibility)
SPR_LOCK = SPR_OPENTTD_BASE + 19, // lock icon (for password protected servers)
- SPR_FLAGS_BASE = SPR_OPENTTD_BASE + 82, // start of the flags block (in same order as enum NetworkLanguage)
SPR_AIRPORTX_BASE = SPR_OPENTTD_BASE + OPENTTD_SPRITES_COUNT, // The sprites used for other airport angles
SPR_NEWAIRPORT_TARMAC = SPR_AIRPORTX_BASE,
@@ -171,6 +170,9 @@ enum Sprites {
/* One way road sprites */
SPR_ONEWAY_BASE = SPR_TRAMWAY_BASE + 113,
+ /* Flags sprites (in same order as enum NetworkLanguage) */
+ SPR_FLAGS_BASE = SPR_ONEWAY_BASE + 6,
+
/* Manager face sprites */
SPR_GRADIENT = 874, // background gradient behind manager face
@@ -1325,10 +1327,10 @@ enum CursorSprite {
SPR_CURSOR_TRUCK_STATION = 2726,
SPR_CURSOR_ROAD_TUNNEL = 2433,
- SPR_CURSOR_CLONE_TRAIN = SPR_OPENTTD_BASE + 92,
- SPR_CURSOR_CLONE_ROADVEH = SPR_OPENTTD_BASE + 109,
- SPR_CURSOR_CLONE_SHIP = SPR_OPENTTD_BASE + 111,
- SPR_CURSOR_CLONE_AIRPLANE = SPR_OPENTTD_BASE + 113,
+ SPR_CURSOR_CLONE_TRAIN = SPR_OPENTTD_BASE + 88,
+ SPR_CURSOR_CLONE_ROADVEH = SPR_OPENTTD_BASE + 105,
+ SPR_CURSOR_CLONE_SHIP = SPR_OPENTTD_BASE + 107,
+ SPR_CURSOR_CLONE_AIRPLANE = SPR_OPENTTD_BASE + 109
};
/// Animation macro in table/animcursors.h (_animcursors[])