summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-05-10 08:58:52 +0000
committerrubidium <rubidium@openttd.org>2008-05-10 08:58:52 +0000
commitf23026cce8fa49974e3dd06e00dd073cb45f906b (patch)
tree746df1921c03a63762ea8a5c0a05a16d672c34fe /src/network
parente099831210a55f71f7def91d2ee9fb6c3058a1eb (diff)
downloadopenttd-f23026cce8fa49974e3dd06e00dd073cb45f906b.tar.xz
(svn r13027) -Codechange: use StrEmpty instead of arr[0] == '\0' and remove the need for WE_ON_EDIT_TEXT_CANCEL.
Diffstat (limited to 'src/network')
-rw-r--r--src/network/network_gui.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index b3b4f5a25..2ec0afe13 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -579,8 +579,10 @@ static void NetworkGameWindowWndProc(Window *w, WindowEvent *e)
break;
case WE_ON_EDIT_TEXT:
- NetworkAddServer(e->we.edittext.str);
- NetworkRebuildHostList();
+ if (!StrEmpty(e->we.edittext.str)) {
+ NetworkAddServer(e->we.edittext.str);
+ NetworkRebuildHostList();
+ }
break;
case WE_RESIZE: {
@@ -917,7 +919,7 @@ static void NetworkStartServerWindowWndProc(Window *w, WindowEvent *e)
if (nd->widget_id == NSSW_SETPWD) {
ttd_strlcpy(_network_server_password, e->we.edittext.str, lengthof(_network_server_password));
- _network_game_info.use_password = (_network_server_password[0] != '\0');
+ _network_game_info.use_password = !StrEmpty(_network_server_password);
} else {
int32 value = atoi(e->we.edittext.str);
w->InvalidateWidget(nd->widget_id);
@@ -1673,15 +1675,14 @@ static void NetworkJoinStatusWindowWndProc(Window *w, WindowEvent *e)
}
break;
- /* If the server asks for a password, we need to fill it in */
- case WE_ON_EDIT_TEXT_CANCEL:
+ case WE_ON_EDIT_TEXT:
+ if (StrEmpty(e->we.edittext.str)) {
NetworkDisconnect();
ShowNetworkGameWindow();
- break;
-
- case WE_ON_EDIT_TEXT:
+ } else {
SEND_COMMAND(PACKET_CLIENT_PASSWORD)(pw_type, e->we.edittext.str);
- break;
+ }
+ break;
}
}