diff options
author | tron <tron@openttd.org> | 2006-04-07 09:15:17 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2006-04-07 09:15:17 +0000 |
commit | 1440451a6bbf1ab4e1be45a920dece78ce02fe5b (patch) | |
tree | edbe7351bead6d2a9cf436daa032b94dc54198cb | |
parent | 10454a6dd136e4d0abff667c12256f1761078f22 (diff) | |
download | openttd-1440451a6bbf1ab4e1be45a920dece78ce02fe5b.tar.xz |
(svn r4315) Remove MAX_QUERYSTR_LEN, rather use lengthof() the real thing
-rw-r--r-- | network_gui.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/network_gui.c b/network_gui.c index adec0c004..59496e450 100644 --- a/network_gui.c +++ b/network_gui.c @@ -25,7 +25,6 @@ #define BGC 5 #define BTC 15 -#define MAX_QUERYSTR_LEN 64 typedef struct network_d { byte company; // select company in network lobby @@ -51,7 +50,8 @@ typedef struct NetworkGameSorting { /* Global to remember sorting after window has been closed */ static NetworkGameSorting _ng_sorting; -static char _edit_str_buf[MAX_QUERYSTR_LEN]; +static char _edit_str_buf[64]; + static void ShowNetworkStartServerWindow(void); static void ShowNetworkLobbyWindow(NetworkGameList *ngl); @@ -544,7 +544,6 @@ void ShowNetworkGameWindow(void) { static bool first = true; Window *w; - querystr_d *querystr; DeleteWindowById(WC_NETWORK_WINDOW, 0); /* Only show once */ @@ -563,12 +562,13 @@ void ShowNetworkGameWindow(void) w = AllocateWindowDesc(&_network_game_window_desc); if (w != NULL) { - querystr = &WP(w, network_ql_d).q; - ttd_strlcpy(_edit_str_buf, _network_player_name, MAX_QUERYSTR_LEN); + querystr_d* querystr = &WP(w, network_ql_d).q; + + ttd_strlcpy(_edit_str_buf, _network_player_name, lengthof(_edit_str_buf)); w->vscroll.cap = 12; querystr->text.caret = true; - querystr->text.maxlength = MAX_QUERYSTR_LEN; + querystr->text.maxlength = lengthof(_edit_str_buf); querystr->text.maxwidth = 120; querystr->text.buf = _edit_str_buf; UpdateTextBufferSize(&querystr->text); @@ -774,7 +774,7 @@ static void ShowNetworkStartServerWindow(void) DeleteWindowById(WC_NETWORK_WINDOW, 0); w = AllocateWindowDesc(&_network_start_server_window_desc); - ttd_strlcpy(_edit_str_buf, _network_server_name, MAX_QUERYSTR_LEN); + ttd_strlcpy(_edit_str_buf, _network_server_name, lengthof(_edit_str_buf)); _saveload_mode = SLD_NEW_GAME; BuildFileList(); @@ -782,7 +782,7 @@ static void ShowNetworkStartServerWindow(void) w->vscroll.count = _fios_num+1; WP(w, network_ql_d).q.text.caret = true; - WP(w, network_ql_d).q.text.maxlength = MAX_QUERYSTR_LEN; + WP(w, network_ql_d).q.text.maxlength = lengthof(_edit_str_buf); WP(w, network_ql_d).q.text.maxwidth = 160; WP(w, network_ql_d).q.text.buf = _edit_str_buf; UpdateTextBufferSize(&WP(w, network_ql_d).q.text); |