network_gui.c
changeset 206 7f8c26d8526b
parent 193 0a7025304867
child 211 2954c4b30525
equal deleted inserted replaced
205:49e96fd94d63 206:7f8c26d8526b
    29 static byte _players_max;
    29 static byte _players_max;
    30 /* Should be ??????????? (something) but since network is not yet really done
    30 /* Should be ??????????? (something) but since network is not yet really done
    31 * we'll just use some dummy here
    31 * we'll just use some dummy here
    32 */
    32 */
    33 static byte _network_connection;
    33 static byte _network_connection;
       
    34 static uint16 _network_game_count_last;
    34 
    35 
    35 static void NetworkGameWindowWndProc(Window *w, WindowEvent *e)
    36 static void NetworkGameWindowWndProc(Window *w, WindowEvent *e)
    36 {
    37 {
    37 	switch(e->event) {
    38 	switch(e->event) {
       
    39 	case WE_TICK: {
       
    40 		if (_network_game_count_last != _network_game_count) {
       
    41 			SetWindowDirty(w);
       
    42 			}
       
    43 		}
       
    44 		break;
    38 	case WE_PAINT: {
    45 	case WE_PAINT: {
    39 
    46 
    40 		SET_DPARAM16(0, 0x00);
    47 		SET_DPARAM16(0, 0x00);
    41 		SET_DPARAM16(2, STR_NETWORK_LAN + _network_connection);
    48 		SET_DPARAM16(2, STR_NETWORK_LAN + _network_connection);
    42 		DrawWindowWidgets(w);
    49 		DrawWindowWidgets(w);
    84 		}
    91 		}
    85 		break;
    92 		break;
    86 
    93 
    87 	case WE_DROPDOWN_SELECT: /* we have selected a dropdown item in the list */
    94 	case WE_DROPDOWN_SELECT: /* we have selected a dropdown item in the list */
    88 		_network_connection = e->dropdown.index;
    95 		_network_connection = e->dropdown.index;
    89 
    96 		switch (_network_connection) {
    90 		SetWindowDirty(w);
    97 		case 0:
       
    98 			NetworkGameListFromLAN();
       
    99 			_network_game_count_last = _network_game_count;
       
   100 			SetWindowDirty(w);
       
   101 			break;
       
   102 		case 1:
       
   103 			NetworkGameListFromInternet();
       
   104 			_network_game_count_last = _network_game_count;
       
   105 			SetWindowDirty(w);
       
   106 			break;
       
   107 		}
    91 		break;
   108 		break;
    92 
   109 
    93 	case WE_MOUSELOOP:
   110 	case WE_MOUSELOOP:
    94 		if (_selected_field == 6)
   111 		if (_selected_field == 6)
    95 			HandleEditBox(w, 6);
   112 			HandleEditBox(w, 6);
   162 	NetworkLobbyInit();
   179 	NetworkLobbyInit();
   163 
   180 
   164 	w = AllocateWindowDesc(&_network_game_window_desc);
   181 	w = AllocateWindowDesc(&_network_game_window_desc);
   165 	strcpy(_edit_str_buf, "Your name");
   182 	strcpy(_edit_str_buf, "Your name");
   166 
   183 
       
   184 	_network_game_count_last = _network_game_count;
   167 
   185 
   168 	WP(w,querystr_d).caret = 1;
   186 	WP(w,querystr_d).caret = 1;
   169 	WP(w,querystr_d).maxlen = MAX_QUERYSTR_LEN;
   187 	WP(w,querystr_d).maxlen = MAX_QUERYSTR_LEN;
   170 	WP(w,querystr_d).maxwidth = 240;
   188 	WP(w,querystr_d).maxwidth = 240;
   171 	WP(w,querystr_d).buf = _edit_str_buf;
   189 	WP(w,querystr_d).buf = _edit_str_buf;