sauerbraten / p1xbraten

my patches on top of the official Cube 2: Sauerbraten client & server
15 stars 3 forks source link

Bot match settings reset after game restart #64

Open xXRaptorSc0pezXx opened 1 year ago

xXRaptorSc0pezXx commented 1 year ago

Whenever I restart the game, the bot match settings don't save, they always just revert to 5 bots, 50 minimum skill, 100 maximum skill. Sauer saves these settings by default but after installing p1x they no longer save.

sauerbraten commented 1 year ago

Interesting, I would expect the settings to be saved the same way. Can you try /usep1xbratenmenus 0, then change the bot match settings, quit, re-open and see if they are saved then?

xXRaptorSc0pezXx commented 1 year ago

Just tried it but it still doesn't save them with the p1x menus off. It does however work when not using p1x at all (so just using the vanilla client).

sauerbraten commented 1 year ago

the problem is the timeline of executing the cubescript files:

  1. p1xbraten (like vanilla) always runs menus.cfg before any config files, and menus.cfg sets the default values for the botmatch parameters
  2. p1xbraten (like vanille) then executes config.cfg, which contains the values from last time the user interacted with the GUI, so these values are "restored" from the config
  3. p1xbraten runs its p1xbraten.cfg which contains usep1xbratenmenus (0 or 1, doesn't matter), and when that variable is changed, a function runs that executed either menus.cfg or data/p1xbraten/menus.cfg, and since both of these files contain the default values, the values from config.cfg are overwritten again

I think the fix here is to change usep1xbratenmenus from a VARFP to a pure C++ variable and a COMMAND with emuvar behavior...

sauerbraten commented 1 year ago

I'm pretty sure this will be fixed upstream by Nieb's menu overhaul.