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_NextMenuGametype(forbidden);
if (cv_advertise.value)
{
// Try to have the rules available "early" for opening the Host Game menu.
Get_rules();
}
if (choice != -1)
{
M_SetupNextMenu(&PLAY_MP_OptSelectDef, false);

View file

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