Browse Source

Fix display of Connection menu (#354)

pull/366/head
Mathieu Maret 7 years ago committed by Anders Jenbo
parent
commit
3c416b16d7
  1. 45
      SourceX/DiabloUI/selconn.cpp

45
SourceX/DiabloUI/selconn.cpp

@ -19,17 +19,28 @@ _SNETVERSIONDATA *selconn_FileInfo;
DWORD provider;
UiArtText SELCONNECT_DIALOG_DESCRIPTION(selconn_Description, { 35, 275, 205, 66 });
// Should be in the same order than SELCONN_DIALOG_ITEM
enum {
#ifndef NONET
SELCONN_TCP,
#ifdef BUGGY
SELCONN_UDP,
#endif
#endif
SELCONN_LOOPBACK,
};
UiListItem SELCONN_DIALOG_ITEMS[] = {
#ifndef NONET
{ "Client-Server (TCP)", 0 },
{ "Client-Server (TCP)", SELCONN_TCP },
#ifdef BUGGY
{ "Peer-to-Peer (UDP)", 1 },
{ "Peer-to-Peer (UDP)", SELCONN_UDP },
#endif
{ "Loopback", 2 },
#else
{ "Loopback", 0 },
#endif
{ "Loopback", SELCONN_LOOPBACK },
};
UiItem SELCONNECT_DIALOG[] = {
MAINMENU_BACKGROUND,
MAINMENU_LOGO,
@ -49,7 +60,7 @@ UiItem SELCONNECT_DIALOG[] = {
void selconn_Load()
{
LoadBackgroundArt("ui_art\\selconn.pcx");
UiInitList(0, 2, selconn_Focus, selconn_Select, selconn_Esc, SELCONNECT_DIALOG, size(SELCONNECT_DIALOG));
UiInitList(0, size(SELCONN_DIALOG_ITEMS) - 1, selconn_Focus, selconn_Select, selconn_Esc, SELCONNECT_DIALOG, size(SELCONNECT_DIALOG));
}
void selconn_Free()
@ -67,15 +78,19 @@ void selconn_Focus(int value)
{
int players = MAX_PLRS;
switch (value) {
case 0:
#ifndef NONET
case SELCONN_TCP:
strcpy(selconn_Description, "All computers must be connected to a TCP-compatible network.");
players = MAX_PLRS;
break;
case 1:
#ifdef BUGGY
case SELCONN_UDP:
strcpy(selconn_Description, "All computers must be connected to a UDP-compatible network.");
players = MAX_PLRS;
break;
case 2:
#endif
#endif
case SELCONN_LOOPBACK:
strcpy(selconn_Description, "Play by yourself with no network exposure.");
players = 1;
break;
@ -88,13 +103,17 @@ void selconn_Focus(int value)
void selconn_Select(int value)
{
switch (value) {
case 0:
#ifndef NONET
case SELCONN_TCP:
provider = 'TCPN';
break;
case 1:
#ifdef BUGGY
case SELCONN_UDP:
provider = 'UDPN';
break;
case 2:
#endif
#endif
case SELCONN_LOOPBACK:
provider = 'SCBL';
break;
}
@ -129,4 +148,4 @@ int UiSelectProvider(
return selconn_ReturnValue;
}
}
} // namespace dvl

Loading…
Cancel
Save