Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 29, 2009, 10:30:19 PM (16 years ago)
Author:
rgrieder
Message:

Changed the way config values associated with general settings (ConfigFileType::Settings) are handled:

  • ConfigFileManager only handles config files listed in the ConfigFileType enum (normal enum again)
  • ConfigFileManager only takes care of ConfigFiles and returns a pointer to the right one, just two functions left. —> use like: ConfigFileManager::getInstance().getConfigFile(myType)→doSomething();
  • Moved all code (except for the argument completion functions) relating to ConfigFileType::Settings to a new class: SettingsConfigFile, which is a Singleton (it doesn't make sense to have multiple instances unless you start coding a lot more)
  • SettingsConfigFile handles config value containers according to their section and entry in the ini file, not according to class and variables names. (In most cases it will be class and variable names though)
  • SettingsConfigFile supports:
    • clear() (removes any file entries not associated to a config value container)
    • updateConfigValues() (does exactly that through the identifier)
    • config, tconfig and getConfig
    • commands listed above are exported to tolua, and tconfig, config and getConfig were given shortcuts in Lua (e.g. orxonox.config)
  • If you need to organise ConfigFiles yourself, just do it without the ConfigFileManager, like the KeyBinder does.
  • All getValue() functions have been split into getOrCreateValue() and getValue(), which is const
  • Removed obsolete config value management code in the Identifier (it still stores and destroys them and provides access to them)

All of that leads to one HUGE advantage:
"config OutputHandler softDebugLevelInGameConsole"
works now :D (any further implications are up to the reader…)
(it didn't work before because the actual config value container is in the InGameConsole singleton)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gamestate/src/libraries/core/CorePrereqs.h

    r6105 r6432  
    8484    }
    8585
     86    namespace ConfigFileType
     87    {
     88        enum Value
     89        {
     90            Settings,
     91            JoyStickCalibration,
     92            CommandHistory
     93            // Don't forget to adjust the array size in the ConfigFileManager when adding a new entry here!
     94        };
     95    }
     96
    8697    namespace KeybindMode
    8798    {
     
    124135    class ConfigFileManager;
    125136    class ConfigFileSection;
    126     struct ConfigFileType;
    127137    class ConfigValueContainer;
    128138    class ConsoleCommand;
     
    172182    class PathConfig;
    173183    struct ResourceInfo;
     184    class SettingsConfigFile;
    174185    class Shell;
    175186    class ShellListener;
Note: See TracChangeset for help on using the changeset viewer.