Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 8, 2007, 5:37:26 PM (16 years ago)
Author:
landauf
Message:

added a config-file-parser and a makro ( SetConfigValue(variable, defaultvalue) ) to get user-modified values from the config-file (or to write the defaultvalue into it if the variable isn't yet in the file).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy/src/orxonox/core/IdentifierIncludes.h

    r365 r434  
    1616#include "Iterator.h"
    1717#include "OrxonoxClass.h"
     18#include "ConfigValueContainer.h"
    1819
     20#include "OgreVector3.h"
     21#include "OgreColourValue.h"
     22
     23namespace orxonox
     24{
     25    typedef Ogre::Vector3 Vector3;
     26    typedef Ogre::ColourValue ColourValue;
     27}
    1928
    2029// Intern macro, containing the common parts of RegisterObject and RegisterRootObject
     
    6271#define ID(StringOrInt) \
    6372    Factory::getIdentifier(StringOrInt)
     73
     74// bla
     75#define SetConfigValue(varname, defvalue) \
     76    ConfigValueContainer* container##varname = this->getIdentifier()->getConfigValueContainer(#varname); \
     77    if (!container##varname) \
     78    { \
     79        container##varname = new ConfigValueContainer(this->getIdentifier()->getName(), #varname, defvalue); \
     80        this->getIdentifier()->setConfigValueContainer(#varname, container##varname); \
     81    } \
     82    this->varname = container##varname->getValue(varname)
Note: See TracChangeset for help on using the changeset viewer.