Use variables as setting names instead of strings #1395
Labels
A-Engine
B-Settings
C-Code-Quality
A section of code that is hard to understand or change
P-Normal
This issue isn't a big priority, but it would still be nice to have it closed soon
Problem
Currently our settings system is a bit flaky. Here are some of its problems:
settings.setString("foo", "true");
,settings.getBool("foo", false)
will return true, although that isn't the right type..getString(name, defaultValue)
, the setting is initialized with the given default value if there isn't one already. This means that you may end up having multiple places with different default values for the same setting, or even different types. This is very bug prone and difficult to maintain.Solution
We could make settings something similar to the tags we currently have.
E.g., on a
plugin.hpp
, we could declare all of it's settings:On the
plugin.cpp
:These settings could be (de)serialized to/from JSON using our JSON (de)serializers. E.g.:
The text was updated successfully, but these errors were encountered: