Fix Server Browser rules popup not working with new menu layout

- Instead of whitelist, we can just use GS_MENU
- Also get rules "early" if you turned advertise via the options menu/console
This commit is contained in:
toaster 2024-03-29 13:11:09 +00:00
parent 8c269b26b9
commit c7c74ec11b
2 changed files with 14 additions and 11 deletions

View file

@ -244,6 +244,12 @@ void M_MPOptSelectInit(INT32 choice)
M_PrevMenuGametype(forbidden); M_PrevMenuGametype(forbidden);
M_NextMenuGametype(forbidden); M_NextMenuGametype(forbidden);
if (cv_advertise.value)
{
// Try to have the rules available "early" for opening the Host Game menu.
Get_rules();
}
if (choice != -1) if (choice != -1)
{ {
M_SetupNextMenu(&PLAY_MP_OptSelectDef, false); M_SetupNextMenu(&PLAY_MP_OptSelectDef, false);

View file

@ -106,7 +106,7 @@ menu_t PLAY_MP_HostDef = {
void M_PopupMasterServerRules(void) void M_PopupMasterServerRules(void)
{ {
#ifdef MASTERSERVER #ifdef MASTERSERVER
if (cv_advertise.value && (serverrunning || currentMenu == &PLAY_MP_HostDef)) if (cv_advertise.value && (serverrunning || gamestate == GS_MENU))
{ {
char *rules = GetMasterServerRules(); char *rules = GetMasterServerRules();
@ -127,17 +127,14 @@ void M_MPHostInit(INT32 choice)
M_SetupNextMenu(&PLAY_MP_HostDef, false); M_SetupNextMenu(&PLAY_MP_HostDef, false);
Get_rules(); Get_rules();
// There's one downside to doing it this way: // As an async request, rules won't necessarily
// if you turn advertise on via the console, // be ready in time for the following call...
// then access this menu for the first time,
// no rules will pop up because they haven't
// arrived yet.
M_PopupMasterServerRules(); M_PopupMasterServerRules();
// HOWEVER, this menu popup isn't for people // ... but either cv_advertise is off, in case
// who know how to use the Developer Console. // it'll be ready for OPTIONS_ServerDef, or it's
// People who CAN do that should already know // been turned on via console/elsewhere and
// what kind of service they're connecting to. // Get_rules() has already been called by
// (it'll still appear in the logs later, too!) // M_MPOptSelectInit.
} }
void M_HandleHostMenuGametype(INT32 choice) void M_HandleHostMenuGametype(INT32 choice)