src/network/network_gui.cpp
branchgamebalance
changeset 9895 7bd07f43b0e3
parent 6167 1475cf991e66
child 9910 0b2aebc8283e
equal deleted inserted replaced
9894:70d78ac95d6c 9895:7bd07f43b0e3
    30 #include "../helpers.hpp"
    30 #include "../helpers.hpp"
    31 
    31 
    32 #define BGC 5
    32 #define BGC 5
    33 #define BTC 15
    33 #define BTC 15
    34 
    34 
    35 typedef struct network_d {
    35 struct network_d {
    36 	PlayerID company;        // select company in network lobby
    36 	PlayerID company;        // select company in network lobby
    37 	byte field;              // select text-field in start-server and game-listing
    37 	byte field;              // select text-field in start-server and game-listing
    38 	NetworkGameList *server; // selected server in lobby and game-listing
    38 	NetworkGameList *server; // selected server in lobby and game-listing
    39 	FiosItem *map;           // selected map in start-server
    39 	FiosItem *map;           // selected map in start-server
    40 } network_d;
    40 };
    41 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(network_d));
    41 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(network_d));
    42 
    42 
    43 typedef struct network_ql_d {
    43 struct network_ql_d {
    44 	network_d n;                 // see above; general stuff
    44 	network_d n;                 // see above; general stuff
    45 	querystr_d q;                // text-input in start-server and game-listing
    45 	querystr_d q;                // text-input in start-server and game-listing
    46 	NetworkGameList **sort_list; // list of games (sorted)
    46 	NetworkGameList **sort_list; // list of games (sorted)
    47 	list_d l;                    // accompanying list-administration
    47 	list_d l;                    // accompanying list-administration
    48 } network_ql_d;
    48 };
    49 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(network_ql_d));
    49 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(network_ql_d));
    50 
    50 
    51 /* Global to remember sorting after window has been closed */
    51 /* Global to remember sorting after window has been closed */
    52 static Listing _ng_sorting;
    52 static Listing _ng_sorting;
    53 
    53 
    54 static char _edit_str_buf[150];
    54 static char _edit_str_buf[150];
    55 static bool _chat_tab_completion_active;
    55 static bool _chat_tab_completion_active;
    56 
    56 
    57 static void ShowNetworkStartServerWindow(void);
    57 static void ShowNetworkStartServerWindow();
    58 static void ShowNetworkLobbyWindow(NetworkGameList *ngl);
    58 static void ShowNetworkLobbyWindow(NetworkGameList *ngl);
    59 extern void SwitchMode(int new_mode);
    59 extern void SwitchMode(int new_mode);
    60 
    60 
    61 static const StringID _connection_types_dropdown[] = {
    61 static const StringID _connection_types_dropdown[] = {
    62 	STR_NETWORK_LAN_INTERNET,
    62 	STR_NETWORK_LAN_INTERNET,
   549 	WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
   549 	WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
   550 	_network_game_window_widgets,
   550 	_network_game_window_widgets,
   551 	NetworkGameWindowWndProc,
   551 	NetworkGameWindowWndProc,
   552 };
   552 };
   553 
   553 
   554 void ShowNetworkGameWindow(void)
   554 void ShowNetworkGameWindow()
   555 {
   555 {
   556 	static bool first = true;
   556 	static bool first = true;
   557 	Window *w;
   557 	Window *w;
   558 	DeleteWindowById(WC_NETWORK_WINDOW, 0);
   558 	DeleteWindowById(WC_NETWORK_WINDOW, 0);
   559 
   559 
   776 	WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
   776 	WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
   777 	_network_start_server_window_widgets,
   777 	_network_start_server_window_widgets,
   778 	NetworkStartServerWindowWndProc,
   778 	NetworkStartServerWindowWndProc,
   779 };
   779 };
   780 
   780 
   781 static void ShowNetworkStartServerWindow(void)
   781 static void ShowNetworkStartServerWindow()
   782 {
   782 {
   783 	Window *w;
   783 	Window *w;
   784 	DeleteWindowById(WC_NETWORK_WINDOW, 0);
   784 	DeleteWindowById(WC_NETWORK_WINDOW, 0);
   785 
   785 
   786 	w = AllocateWindowDesc(&_network_start_server_window_desc);
   786 	w = AllocateWindowDesc(&_network_start_server_window_desc);
  1149 	}
  1149 	}
  1150 	return true;
  1150 	return true;
  1151 }
  1151 }
  1152 
  1152 
  1153 // Finds the amount of actions in the popup and set the height correct
  1153 // Finds the amount of actions in the popup and set the height correct
  1154 static uint ClientListPopupHeigth(void) {
  1154 static uint ClientListPopupHeigth() {
  1155 	int i, num = 0;
  1155 	int i, num = 0;
  1156 
  1156 
  1157 	// Find the amount of actions
  1157 	// Find the amount of actions
  1158 	for (i = 0; i < MAX_CLIENTLIST_ACTION; i++) {
  1158 	for (i = 0; i < MAX_CLIENTLIST_ACTION; i++) {
  1159 		if (_clientlist_action[i][0] == '\0') continue;
  1159 		if (_clientlist_action[i][0] == '\0') continue;
  1366 		_selected_clientlist_y = 0;
  1366 		_selected_clientlist_y = 0;
  1367 		break;
  1367 		break;
  1368 	}
  1368 	}
  1369 }
  1369 }
  1370 
  1370 
  1371 void ShowClientList(void)
  1371 void ShowClientList()
  1372 {
  1372 {
  1373 	AllocateWindowDescFront(&_client_list_desc, 0);
  1373 	AllocateWindowDescFront(&_client_list_desc, 0);
  1374 }
  1374 }
  1375 
  1375 
  1376 
  1376 
  1458 	WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_MODAL,
  1458 	WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_MODAL,
  1459 	_network_join_status_window_widget,
  1459 	_network_join_status_window_widget,
  1460 	NetworkJoinStatusWindowWndProc,
  1460 	NetworkJoinStatusWindowWndProc,
  1461 };
  1461 };
  1462 
  1462 
  1463 void ShowJoinStatusWindow(void)
  1463 void ShowJoinStatusWindow()
  1464 {
  1464 {
  1465 	Window *w;
  1465 	Window *w;
  1466 	DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
  1466 	DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
  1467 	w = AllocateWindowDesc(&_network_join_status_window_desc);
  1467 	w = AllocateWindowDesc(&_network_join_status_window_desc);
  1468 	/* Parent the status window to the lobby */
  1468 	/* Parent the status window to the lobby */