ref: e5336a1bdc44021605c20f9c50876b6cb5c90f9a
parent: 7b1aff6c464f28e7d5f8b10fd33b15f5d15122a6
author: Simon Howard <[email protected]>
date: Tue Sep 20 15:57:39 EDT 2011
Auto-select IWAD based on query response from server. Subversion-branch: /branches/v2-branch Subversion-revision: 2387
--- a/src/setup/multiplayer.c
+++ b/src/setup/multiplayer.c
@@ -769,12 +769,36 @@
return action;
}
-static void SelectQueryAddress(TXT_UNCAST_ARG(button), TXT_UNCAST_ARG(addr))
+static void SelectQueryAddress(TXT_UNCAST_ARG(button),
+ TXT_UNCAST_ARG(querydata))
{
TXT_CAST_ARG(txt_button_t, button);
+ TXT_CAST_ARG(net_querydata_t, querydata);
+ int i;
+ // Set address to connect to:
+
free(connect_address);
connect_address = strdup(button->label);
+
+ // Auto-choose IWAD if there is already a player connected.
+
+ if (querydata->num_players > 0
+ && !(querydata->gamemission == doom && querydata->gamemode == shareware))
+ {
+ for (i = 0; found_iwads[i] != NULL; ++i)
+ {
+ if (found_iwads[i]->mode == querydata->gamemode
+ && found_iwads[i]->mission == querydata->gamemission)
+ {
+ found_iwad_selected = i;
+ break;
+ }
+ }
+ }
+
+ // Finished with search.
+
TXT_CloseWindow(query_window);
}
@@ -794,7 +818,7 @@
TXT_AddWidgets(results_table,
TXT_NewLabel(ping_time_str),
TXT_NewButton2(NET_AddrToString(addr),
- SelectQueryAddress, addr),
+ SelectQueryAddress, querydata),
TXT_NewLabel(description),
NULL);