Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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.
File:
1 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
Note: See TracChangeset for help on using the changeset viewer.