summaryrefslogtreecommitdiff
path: root/network_gui.c
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2005-12-20 20:52:05 +0000
committerDarkvater <darkvater@openttd.org>2005-12-20 20:52:05 +0000
commit0f41b99c5e106e11708d0be478e7defb92f0a43a (patch)
treea8811c0d9f666534f8861378b0eb8b6629c5186b /network_gui.c
parent8f873d4ece827d8f95f8ded0f49b47dbe5942506 (diff)
downloadopenttd-0f41b99c5e106e11708d0be478e7defb92f0a43a.tar.xz
(svn r3322) - Fix: Network window crash when it receives invalid information for example from the integrated nightly, so validate the network-input when it is received
- CodeChange: added str_validate(char *str) function that checks if a string contains only printable characters and if not, replaces those characters by question marks. Also move IsValidAsciiChar() to string.h
Diffstat (limited to 'network_gui.c')
-rw-r--r--network_gui.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/network_gui.c b/network_gui.c
index 8da59c644..5c755dbd2 100644
--- a/network_gui.c
+++ b/network_gui.c
@@ -179,16 +179,12 @@ static void NetworkGameWindowWndProc(Window *w, WindowEvent *e)
DrawString(260, y, STR_NETWORK_CLIENTS, 2); // clients on the server / maximum slots
y += 10;
- if (sel->info.server_lang < NETWORK_NUM_LANGUAGES) {
- SetDParam(0, STR_NETWORK_LANG_ANY + sel->info.server_lang);
- DrawString(260, y, STR_NETWORK_LANGUAGE, 2); // server language
- }
+ SetDParam(0, STR_NETWORK_LANG_ANY + sel->info.server_lang);
+ DrawString(260, y, STR_NETWORK_LANGUAGE, 2); // server language
y += 10;
- if (sel->info.map_set < NUM_LANDSCAPE ) {
- SetDParam(0, STR_TEMPERATE_LANDSCAPE + sel->info.map_set);
- DrawString(260, y, STR_NETWORK_TILESET, 2); // tileset
- }
+ SetDParam(0, STR_TEMPERATE_LANDSCAPE + sel->info.map_set);
+ DrawString(260, y, STR_NETWORK_TILESET, 2); // tileset
y += 10;
SetDParam(0, sel->info.map_width);
@@ -231,7 +227,7 @@ static void NetworkGameWindowWndProc(Window *w, WindowEvent *e)
case WE_CLICK:
_selected_field = e->click.widget;
- switch(e->click.widget) {
+ switch (e->click.widget) {
case 0: case 14: /* Close 'X' | Cancel button */
DeleteWindowById(WC_NETWORK_WINDOW, 0);
break;