Mercurial > hg > openttd
changeset 3470:b04ae66805ea draft
(svn r4315) Remove MAX_QUERYSTR_LEN, rather use lengthof() the real thing
author | tron <tron@openttd.org> |
---|---|
date | Fri, 07 Apr 2006 09:15:17 +0000 |
parents | 44801860eafb |
children | 05eabc9fb366 |
files | network_gui.c |
diffstat | 1 files changed, 8 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ /* 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 @@ { static bool first = true; Window *w; - querystr_d *querystr; DeleteWindowById(WC_NETWORK_WINDOW, 0); /* Only show once */ @@ -563,12 +562,13 @@ 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 @@ 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 @@ 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);