Cataclysm-dda: Some world options are overwritten by defaults

Created on 13 Feb 2017  路  3Comments  路  Source: CleverRaven/Cataclysm-DDA

This affects options like NO_VITAMINS, FILTHY_MORALE etc.

In general, it seems that world options are loaded multiple times in some weird order. I added a new flag and wanted to test how is it loaded and found that in a world with FILTHY_MORALE flag, it is set 9 times in one game load. The new flag was only set 2 times, despite being in the same "context" as FILTHY_MORALE.

Now that I think about it, it is probably the same bug that caused the radiation mutation to reset to the default value of true.

<Bug>

Most helpful comment

warning in debug builds

That wouldn't help much. Debug builds are unbearably slow and many of the options would require getting a bit deeper into to test.
I'd much rather do it manually, by greping get_option, correcting all values, then having it hardcoded to always warn.

All 3 comments

I think I get it now:
The option system doesn't verify if we're asking for world options or global options. So when someone asks for a global option, it gives the default world settings not the current world settings.

Should asking for a world option using the non-world get_option produce a warning, give the world value instead or keep the dangerous behavior?
I think going with world value is safest here.

How about warning in debug builds and world option in release builds?
Regardless, it sounds like the interface needs changing, it shouldn't be
possible to "accidentally" ask for the wrong set of options.

warning in debug builds

That wouldn't help much. Debug builds are unbearably slow and many of the options would require getting a bit deeper into to test.
I'd much rather do it manually, by greping get_option, correcting all values, then having it hardcoded to always warn.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jeremyshannon picture jeremyshannon  路  3Comments

busterbogheart picture busterbogheart  路  3Comments

Coolthulhu picture Coolthulhu  路  3Comments

nexusmrsep picture nexusmrsep  路  3Comments

Taberone picture Taberone  路  3Comments