Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 12, 2008, 10:53:51 PM (17 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/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_)
Note: See TracChangeset for help on using the changeset viewer.