Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1596 for code/branches


Ignore:
Timestamp:
Jun 12, 2008, 10:53:51 PM (16 years ago)
Author:
landauf
Message:
  • added feature to add a callback function to configvalues. they get called if the value changes. an examples is in Core.cc.
  • changed the SetConfigValue macro and the Identifier::updateConfigValues() function to work properly with inherited classes in both possible cases: 1) they overwrite the config-value or 2) they don't. an example is ParticleProjectile that defines it's own speed_ configvalue.
Location:
code/branches/core3/src
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core3/src/core/ConfigValueContainer.cc

    r1505 r1596  
    5959        this->sectionname_ = identifier->getName();
    6060        this->varname_ = varname;
     61        this->callback_ = 0;
    6162
    6263        this->value_ = defvalue;
     
    9899            this->update();
    99100        }
     101    }
     102
     103    /**
     104        @brief Destructor: Deletes the callback object if necessary.
     105    */
     106    ConfigValueContainer::~ConfigValueContainer()
     107    {
     108        if (this->callback_)
     109            delete this->callback_;
    100110    }
    101111
     
    335345        @param description The description
    336346    */
    337     void ConfigValueContainer::description(const std::string& description)
     347    ConfigValueContainer& ConfigValueContainer::description(const std::string& description)
    338348    {
    339349        if (!this->bAddedDescription_)
     
    343353            this->bAddedDescription_ = true;
    344354        }
     355        return (*this);
    345356    }
    346357
  • code/branches/core3/src/core/ConfigValueContainer.h

    r1505 r1596  
    5555namespace orxonox
    5656{
     57    class ConfigValueCallbackBase
     58    {
     59        public:
     60            virtual void call(void* object) = 0;
     61            inline virtual ~ConfigValueCallbackBase() {}
     62    };
     63
     64    template <class T>
     65    class ConfigValueCallback: public ConfigValueCallbackBase
     66    {
     67        public:
     68            inline ConfigValueCallback(void (T::*function) (void)) : function_(function) {}
     69            inline virtual ~ConfigValueCallback() {}
     70            inline virtual void call(void* object)
     71                { (((T*)object)->*this->function_)(); }
     72
     73        private:
     74            void (T::*function_) (void);
     75    };
     76
     77
    5778    //! The ConfigValuecontainer contains all needed informations about a configurable variable.
    5879    /**
     
    7697            ConfigValueContainer(ConfigFileType type, Identifier* identifier, const std::string& varname, const MultiTypeMath& defvalue);
    7798            ConfigValueContainer(ConfigFileType type, Identifier* identifier, const std::string& varname, const std::vector<MultiTypeMath>& defvalue);
    78 
    79             /** @brief Returns the configured value. @param value This is only needed to determine the right type. @return The value */
    80             template <typename T>
    81             inline ConfigValueContainer& getValue(T* value)
    82                 { this->value_.getValue(value); return *this; }
    83             template <typename T>
    84             inline ConfigValueContainer& getValue(std::vector<T>* value)
    85             {
    86                 value->clear();
    87                 for (unsigned int i = 0; i < this->valueVector_.size(); i++)
    88                     value->push_back(this->valueVector_[i]);
     99            ~ConfigValueContainer();
     100
     101            /** @brief Returns the configured value. @param value A pointer to the variable to store the value. @return The ConfigValueContainer */
     102            template <typename T, class C>
     103            ConfigValueContainer& getValue(T* value, C* object)
     104            {
     105                if (this->callback_ && object)
     106                {
     107                    T temp = *value;
     108                    this->value_.getValue(value);
     109                    if ((*value) != temp)
     110                        this->callback_->call(object);
     111                }
     112                else
     113                {
     114                    this->value_.getValue(value);
     115                }
     116                return *this;
     117            }
     118
     119            /** @brief Returns the configured vector. @param value A pointer to the vector to store the values. @return The ConfigValueContainer */
     120            template <typename T, class C>
     121            ConfigValueContainer& getValue(std::vector<T>* value, C* object)
     122            {
     123                if (this->callback_ && object)
     124                {
     125                    std::vector<T> temp = *value;
     126
     127                    value->clear();
     128                    for (unsigned int i = 0; i < this->valueVector_.size(); ++i)
     129                        value->push_back(this->valueVector_[i]);
     130
     131                    if (value->size() != temp.size())
     132                    {
     133                        this->callback_->call(object);
     134                    }
     135                    else
     136                    {
     137                        for (unsigned int i = 0; i < value->size(); ++i)
     138                        {
     139                            if ((*value)[i] != temp[i])
     140                            {
     141                                this->callback_->call(object);
     142                                break;
     143                            }
     144                        }
     145                    }
     146                }
     147                else
     148                {
     149                    value->clear();
     150                    for (unsigned int i = 0; i < this->valueVector_.size(); ++i)
     151                        value->push_back(this->valueVector_[i]);
     152                }
    89153                return *this;
    90154            }
     
    104168                { return this->valueVector_.size(); }
    105169
    106             void description(const std::string& description);
     170            ConfigValueContainer& description(const std::string& description);
    107171            const std::string& getDescription() const;
     172
     173            template <class T>
     174            inline ConfigValueContainer& callback(void (T::*function) (void))
     175            {
     176                if (!this->callback_)
     177                    this->callback_ = new ConfigValueCallback<T>(function);
     178                return (*this);
     179            }
    108180
    109181            bool set(const MultiTypeMath& input);
     
    142214            bool                       bAddedDescription_;          //!< True if a description was added
    143215            LanguageEntryLabel         description_;                //!< The description
     216            ConfigValueCallbackBase*   callback_;                   //!< A callback function to call after getValue if the value changed
    144217    };
    145218}
  • code/branches/core3/src/core/ConfigValueIncludes.h

    r1543 r1596  
    4848*/
    4949#define SetConfigValue(varname, defvalue) \
    50     orxonox::ConfigValueContainer* container##varname = this->getIdentifier()->getConfigValueContainer(#varname); \
     50    static orxonox::Identifier* identifier##varname = this->getIdentifier(); \
     51    orxonox::ConfigValueContainer* container##varname = identifier##varname->getConfigValueContainer(#varname); \
    5152    if (!container##varname) \
    5253    { \
    53         container##varname = new orxonox::ConfigValueContainer(CFT_Settings, this->getIdentifier(), #varname, varname = defvalue); \
    54         this->getIdentifier()->addConfigValueContainer(#varname, container##varname); \
     54        container##varname = new orxonox::ConfigValueContainer(CFT_Settings, identifier##varname, #varname, varname = defvalue); \
     55        identifier##varname->addConfigValueContainer(#varname, container##varname); \
    5556    } \
    56     container##varname->getValue(&varname)
     57    container##varname->getValue(&varname, this)
    5758
    5859/**
     
    6364*/
    6465#define SetConfigValueGeneric(classname, varname, defvalue) \
    65     orxonox::ConfigValueContainer* container##varname = ClassIdentifier<classname>::getIdentifier()->getConfigValueContainer(#varname); \
     66    static orxonox::Identifier* identifier##varname = ClassIdentifier<classname>::getIdentifier(); \
     67    orxonox::ConfigValueContainer* container##varname = identifier##varname->getConfigValueContainer(#varname); \
    6668    if (!container##varname) \
    6769    { \
    68         container##varname = new orxonox::ConfigValueContainer(CFT_Settings, ClassIdentifier<classname>::getIdentifier(), #varname, varname = defvalue); \
    69         ClassIdentifier<classname>::getIdentifier()->addConfigValueContainer(#varname, container##varname); \
     70        container##varname = new orxonox::ConfigValueContainer(CFT_Settings, identifier##varname, #varname, varname = defvalue); \
     71        identifier##varname->addConfigValueContainer(#varname, container##varname); \
    7072    } \
    71     container##varname->getValue(&varname)
     73    container##varname->getValue(&varname, this)
    7274
    7375/**
     
    7779*/
    7880#define SetConfigValueVector(varname, defvalue) \
    79     orxonox::ConfigValueContainer* container##varname = this->getIdentifier()->getConfigValueContainer(#varname); \
     81    static orxonox::Identifier* identifier##varname = this->getIdentifier(); \
     82    orxonox::ConfigValueContainer* container##varname = identifier##varname->getConfigValueContainer(#varname); \
    8083    if (!container##varname) \
    8184    { \
     
    8386        for (unsigned int i = 0; i < defvalue.size(); i++) \
    8487            temp.push_back(MultiTypeMath(defvalue[i])); \
    85         container##varname = new orxonox::ConfigValueContainer(CFT_Settings, this->getIdentifier(), #varname, temp); \
     88        container##varname = new orxonox::ConfigValueContainer(CFT_Settings, identifier##varname, #varname, temp); \
    8689        container##varname->setVectorType(varname); \
    87         this->getIdentifier()->addConfigValueContainer(#varname, container##varname); \
     90        identifier##varname->addConfigValueContainer(#varname, container##varname); \
    8891    } \
    89     container##varname->getValue(&varname)
     92    container##varname->getValue(&varname, this)
    9093
    9194/**
     
    98101    { \
    99102        container##varname##reset->reset(); \
    100         container##varname##reset->getValue(&varname); \
     103        container##varname##reset->getValue(&varname, this); \
    101104    } \
    102105    else \
     
    115118    { \
    116119        container##varname##modify##modifier->modifier(__VA_ARGS__); \
    117         container##varname##modify##modifier->getValue(&varname); \
     120        container##varname##modify##modifier->getValue(&varname, this); \
    118121    } \
    119122    else \
  • code/branches/core3/src/core/Core.cc

    r1586 r1596  
    9696    void Core::setConfigValues()
    9797    {
    98         SetConfigValue(softDebugLevelConsole_, 3).description("The maximal level of debug output shown in the console");
    99         SetConfigValue(softDebugLevelLogfile_, 3).description("The maximal level of debug output shown in the logfile");
    100         SetConfigValue(softDebugLevelShell_, 1).description("The maximal level of debug output shown in the ingame shell");
    101 
     98        SetConfigValue(softDebugLevelConsole_, 3).description("The maximal level of debug output shown in the console").callback(&Core::debugLevelChanged);
     99        SetConfigValue(softDebugLevelLogfile_, 3).description("The maximal level of debug output shown in the logfile").callback(&Core::debugLevelChanged);
     100        SetConfigValue(softDebugLevelShell_, 1).description("The maximal level of debug output shown in the ingame shell").callback(&Core::debugLevelChanged);
     101        SetConfigValue(language_, Language::getLanguage().defaultLanguage_).description("The language of the ingame text").callback(&Core::languageChanged);
     102    }
     103
     104    /**
     105        @brief Callback function if the debug level has changed.
     106    */
     107    void Core::debugLevelChanged()
     108    {
    102109        // softDebugLevel_ is the maximum of the 3 variables
    103110        this->softDebugLevel_ = this->softDebugLevelConsole_;
     
    111118        OutputHandler::setSoftDebugLevel(OutputHandler::LD_Logfile, this->softDebugLevelLogfile_);
    112119        OutputHandler::setSoftDebugLevel(OutputHandler::LD_Shell,   this->softDebugLevelShell_);
    113 
    114         std::string temp = this->language_;
    115         SetConfigValue(language_, Language::getLanguage().defaultLanguage_).description("The language of the ingame text");
    116 
    117         if (this->language_ != temp)
    118         {
    119             // Read the translation file after the language was configured
    120             Language::getLanguage().readTranslatedLanguageFile();
    121         }
     120    }
     121
     122    /**
     123        @brief Callback function if the language has changed.
     124    */
     125    void Core::languageChanged()
     126    {
     127        // Read the translation file after the language was configured
     128        Language::getLanguage().readTranslatedLanguageFile();
    122129    }
    123130
  • code/branches/core3/src/core/Core.h

    r1586 r1596  
    5252            static bool& isCreatingCoreSettings();
    5353            void setConfigValues();
     54            void debugLevelChanged();
     55            void languageChanged();
    5456
    5557            static int getSoftDebugLevel(OutputHandler::OutputDevice device = OutputHandler::LD_All);
  • code/branches/core3/src/core/Identifier.cc

    r1592 r1596  
    3939#include "ConsoleCommand.h"
    4040#include "CommandExecutor.h"
    41 #include "Iterator.h"
    42 #include "ObjectList.h"
    43 #include "OrxonoxClass.h"
    4441#include "XMLPort.h"
    4542
     
    198195
    199196    /**
    200         @brief Updates the config-values of all existing objects of this class by calling their setConfigValues() function.
    201     */
    202     void Identifier::updateConfigValues() const
    203     {
    204         for (BaseIterator it = this->getObjects()->begin(); it; ++it)
    205             (*it)->setConfigValues();
    206     }
    207 
    208     /**
    209197        @brief Tells the container to which Identifier it belongs to.
    210198    */
  • code/branches/core3/src/core/Identifier.h

    r1592 r1596  
    6161
    6262#include "MetaObjectList.h"
    63 #include "ObjectListBase.h"
     63#include "Iterator.h"
    6464#include "util/Debug.h"
    6565#include "util/String.h"
     
    112112            void setName(const std::string& name);
    113113
    114             void updateConfigValues() const;
     114            virtual void updateConfigValues(bool updateChildren = true) const = 0;
    115115
    116116            /** @brief Returns the parents of the class the Identifier belongs to. @return The list of all parents */
     
    301301            static bool isFirstCall();
    302302            void addObject(T* object);
     303
     304            void updateConfigValues(bool updateChildren = true) const;
    303305
    304306            XMLPortParamContainer* getXMLPortParamContainer(const std::string& paramname);
     
    417419        COUT(5) << "*** ClassIdentifier: Added object to " << this->getName() << "-list." << std::endl;
    418420        object->getMetaList().add(this->objects_, this->objects_->add(new ObjectListElement<T>(object)));
     421    }
     422
     423    /**
     424        @brief Updates the config-values of all existing objects of this class by calling their setConfigValues() function.
     425    */
     426    template <class T>
     427    void ClassIdentifier<T>::updateConfigValues(bool updateChildren) const
     428    {
     429        if (!this->hasConfigValues())
     430            return;
     431
     432        for (ObjectListIterator<T> it = ObjectList<T>::begin(); it; ++it)
     433            it->setConfigValues();
     434
     435        if (updateChildren)
     436            for (std::set<const Identifier*>::const_iterator it = this->getChildrenBegin(); it != this->getChildrenEnd(); ++it)
     437                (*it)->updateConfigValues(false);
    419438    }
    420439
  • code/branches/core3/src/core/ObjectListIterator.h

    r1591 r1596  
    3636
    3737    Usage:
    38     for (Iterator<myClass> it = ObjectList<myClass>::begin(); it != ObjectList<myClass>::end(); ++it)
     38    for (ObjectListIterator<myClass> it = ObjectList<myClass>::begin(); it != ObjectList<myClass>::end(); ++it)
    3939    {
    4040        it->someFunction(...);
  • code/branches/core3/src/core/OrxonoxClass.cc

    r1574 r1596  
    4444        this->parents_ = 0;
    4545        this->metaList_ = new MetaObjectList();
    46 
    47         this->setConfigValues();
    4846    }
    4947
  • code/branches/core3/src/core/Shell.cc

    r1594 r1596  
    9090    void Shell::setConfigValues()
    9191    {
    92         SetConfigValue(maxHistoryLength_, 100);
    93         SetConfigValue(historyOffset_, 0);
     92        SetConfigValue(maxHistoryLength_, 100).callback(&Shell::commandHistoryLengthChanged);
     93        SetConfigValue(historyOffset_, 0).callback(&Shell::commandHistoryOffsetChanged);
    9494        SetConfigValueVector(commandHistory_, std::vector<std::string>());
    95 
     95    }
     96
     97    void Shell::commandHistoryOffsetChanged()
     98    {
    9699        if (this->historyOffset_ >= this->maxHistoryLength_)
    97100            this->historyOffset_ = 0;
     101    }
     102
     103    void Shell::commandHistoryLengthChanged()
     104    {
     105        this->commandHistoryOffsetChanged();
    98106
    99107        while (this->commandHistory_.size() > this->maxHistoryLength_)
  • code/branches/core3/src/core/Shell.h

    r1586 r1596  
    6767
    6868            virtual void setConfigValues();
     69            void commandHistoryOffsetChanged();
     70            void commandHistoryLengthChanged();
    6971
    7072            void registerListener(ShellListener* listener);
  • code/branches/core3/src/core/input/InputManager.cc

    r1586 r1596  
    340340          getIdentifier()->addConfigValueContainer("CoeffPos", cont);
    341341      }
    342       cont->getValue(&coeffPos);
     342      cont->getValue(&coeffPos, this);
    343343
    344344      cont = getIdentifier()->getConfigValueContainer("CoeffNeg");
     
    348348          getIdentifier()->addConfigValueContainer("CoeffNeg", cont);
    349349      }
    350       cont->getValue(&coeffNeg);
     350      cont->getValue(&coeffNeg, this);
    351351
    352352      cont = getIdentifier()->getConfigValueContainer("Zero");
     
    356356          getIdentifier()->addConfigValueContainer("Zero", cont);
    357357      }
    358       cont->getValue(&zero);
     358      cont->getValue(&zero, this);
    359359
    360360      // copy values to our own variables
  • code/branches/core3/src/core/input/KeyBinder.cc

    r1586 r1596  
    234234  void KeyBinder::setConfigValues()
    235235  {
    236     SetConfigValueGeneric(KeyBinder, analogThreshold_, 0.05f)  .description("Threshold for analog axes until which the state is 0.");
    237     SetConfigValueGeneric(KeyBinder, mouseSensitivity_, 1.0f)  .description("Mouse sensitivity.");
    238     SetConfigValueGeneric(KeyBinder, bDeriveMouseInput_, false).description("Whether or not to derive moues movement for the absolute value.");
    239     SetConfigValueGeneric(KeyBinder, derivePeriod_, 0.05f).description("Accuracy of the mouse input deriver. The higher the more precise, but laggier.");
    240     SetConfigValueGeneric(KeyBinder, mouseSensitivityDerived_, 1.0f).description("Mouse sensitivity if mouse input is derived.");
    241     SetConfigValueGeneric(KeyBinder, bClipMouse_, true).description("Whether or not to clip absolute value of mouse in non derive mode.");
     236    SetConfigValue(/*Generic(KeyBinder, */analogThreshold_, 0.05f)  .description("Threshold for analog axes until which the state is 0.");
     237    SetConfigValue(/*Generic(KeyBinder, */mouseSensitivity_, 1.0f)  .description("Mouse sensitivity.");
     238    SetConfigValue(/*Generic(KeyBinder, */bDeriveMouseInput_, false).description("Whether or not to derive moues movement for the absolute value.");
     239    SetConfigValue(/*Generic(KeyBinder, */derivePeriod_, 0.05f).description("Accuracy of the mouse input deriver. The higher the more precise, but laggier.");
     240    SetConfigValue(/*Generic(KeyBinder, */mouseSensitivityDerived_, 1.0f).description("Mouse sensitivity if mouse input is derived.");
     241    SetConfigValue(/*Generic(KeyBinder, */bClipMouse_, true).description("Whether or not to clip absolute value of mouse in non derive mode.");
    242242
    243243    float oldThresh = buttonThreshold_;
    244     SetConfigValueGeneric(KeyBinder, buttonThreshold_, 0.80f).description("Threshold for analog axes until which the button is not pressed.");
     244    SetConfigValue(/*Generic(KeyBinder, */buttonThreshold_, 0.80f).description("Threshold for analog axes until which the button is not pressed.");
    245245    if (oldThresh != buttonThreshold_)
    246246      for (unsigned int i = 0; i < nHalfAxes_s; i++)
     
    272272    }
    273273    std::string old = button.bindingString_;
    274     cont->getValue(&button.bindingString_);
     274    cont->getValue(&button.bindingString_, this);
    275275
    276276    // keybinder stuff
  • code/branches/core3/src/orxonox/GraphicsEngine.cc

    r1591 r1596  
    9797    SetConfigValue(ogreLogLevelCritical_, 2).description("Corresponding orxonox debug level for ogre Critical");
    9898
    99     unsigned int old = this->detailLevelParticle_;
    100     SetConfigValue(detailLevelParticle_, 2).description("O: off, 1: low, 2: normal, 3: high");
    101 
    102     if (this->detailLevelParticle_ != old)
    103       for (ObjectList<ParticleInterface>::iterator it = ObjectList<ParticleInterface>::begin(); it; ++it)
    104         it->detailLevelChanged(this->detailLevelParticle_);
     99    SetConfigValue(detailLevelParticle_, 2).description("O: off, 1: low, 2: normal, 3: high").callback(&GraphicsEngine::detailLevelParticleChanged);
     100  }
     101
     102  void GraphicsEngine::detailLevelParticleChanged()
     103  {
     104    for (ObjectList<ParticleInterface>::iterator it = ObjectList<ParticleInterface>::begin(); it; ++it)
     105      it->detailLevelChanged(this->detailLevelParticle_);
    105106  }
    106107
  • code/branches/core3/src/orxonox/GraphicsEngine.h

    r1563 r1596  
    5656        public:
    5757            void setConfigValues();
     58            void detailLevelParticleChanged();
    5859            bool setup();
    5960            bool declareRessourceLocations();
  • code/branches/core3/src/orxonox/Settings.cc

    r1535 r1596  
    6868  void Settings::setConfigValues()
    6969  {
    70     SetConfigValue(dataPath_, "../../Media/").description("Relative path to the game data.");
     70    SetConfigValue(dataPath_, "../../Media/").description("Relative path to the game data.").callback(&Settings::dataPathChanged);
     71  }
     72
     73  /**
     74    @brief Callback function if the datapath has changed.
     75  */
     76  void Settings::dataPathChanged()
     77  {
    7178    if (dataPath_ != "" && dataPath_[dataPath_.size() - 1] != '/')
    7279    {
  • code/branches/core3/src/orxonox/Settings.h

    r1535 r1596  
    4848    public:
    4949      void setConfigValues();
     50      void dataPathChanged();
    5051
    5152      static const std::string& getDataPath();
  • code/branches/core3/src/orxonox/objects/ParticleProjectile.cc

    r1563 r1596  
    3232#include "SpaceShip.h"
    3333#include "core/CoreIncludes.h"
    34 
     34#include "core/ConfigValueIncludes.h"
    3535namespace orxonox
    3636{
     
    5252            this->particles_ = 0;
    5353        }
     54
     55        this->setConfigValues();
    5456    }
    5557
     
    6062    }
    6163
     64    void ParticleProjectile::setConfigValues()
     65    {
     66        SetConfigValue(speed_, 5000.0).description("The speed of a projectile in units per second").callback(&ParticleProjectile::speedChanged);
     67    }
     68
     69    void ParticleProjectile::speedChanged()
     70    {
     71        Projectile::speed_s = this->speed_;
     72        if (this->owner_)
     73            this->setVelocity(this->owner_->getInitialDir() * this->speed_);
     74    }
     75
    6276    void ParticleProjectile::changedVisibility()
    6377    {
  • code/branches/core3/src/orxonox/objects/ParticleProjectile.h

    r1558 r1596  
    4444            virtual ~ParticleProjectile();
    4545            virtual void changedVisibility();
     46            void setConfigValues();
     47            void speedChanged();
    4648
    4749        private:
  • code/branches/core3/src/orxonox/objects/Projectile.cc

    r1592 r1596  
    4444namespace orxonox
    4545{
    46     float Projectile::speed_ = 5000;
     46    float Projectile::speed_s = 5000;
    4747
    4848    Projectile::Projectile(SpaceShip* owner) : owner_(owner)
     
    7474        SetConfigValue(damage_, 15.0).description("The damage caused by the projectile");
    7575        SetConfigValue(lifetime_, 4.0).description("The time in seconds a projectile stays alive");
    76         SetConfigValue(speed_, 5000.0).description("The speed of a projectile in units per second");
     76        SetConfigValue(speed_, 5000.0).description("The speed of a projectile in units per second").callback(&Projectile::speedChanged);
     77    }
    7778
     79    void Projectile::speedChanged()
     80    {
     81        Projectile::speed_s = this->speed_;
    7882        if (this->owner_)
    7983            this->setVelocity(this->owner_->getInitialDir() * this->speed_);
  • code/branches/core3/src/orxonox/objects/Projectile.h

    r1552 r1596  
    4242            virtual ~Projectile();
    4343            void setConfigValues();
     44            void speedChanged();
    4445            void destroyObject();
    4546            virtual void tick(float dt);
    4647
    4748            static float getSpeed()
    48                 { return Projectile::speed_; }
     49                { return Projectile::speed_s; }
    4950
    5051        protected:
     
    5556            std::string explosionTemplateName_;
    5657            std::string smokeTemplateName_;
    57             static float speed_;
     58        protected:
     59            static float speed_s;
     60            float speed_;
     61        private:
    5862            float lifetime_;
    5963            float damage_;
  • code/branches/core3/src/orxonox/objects/RotatingProjectile.cc

    r1584 r1596  
    6565    void RotatingProjectile::setConfigValues()
    6666    {
    67         SetConfigValue(colour_, ColourValue(1.0, 0.0, 0.0));
     67        SetConfigValue(colour_, ColourValue(1.0, 0.0, 0.0)).callback(&RotatingProjectile::colourChanged);
     68    }
    6869
     70    void RotatingProjectile::colourChanged()
     71    {
    6972        if (this->isInitialized())
    7073        {
  • code/branches/core3/src/orxonox/objects/RotatingProjectile.h

    r1558 r1596  
    1414            virtual ~RotatingProjectile();
    1515            void setConfigValues();
     16            void colourChanged();
    1617            virtual void tick(float dt);
    1718            virtual void changedVisibility();
Note: See TracChangeset for help on using the changeset viewer.