Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2180 for code/branches/overlay


Ignore:
Timestamp:
Nov 12, 2008, 12:55:14 AM (16 years ago)
Author:
rgrieder
Message:

Bugfix in MultiType::convert(MT_null): it now clears the MT, so does reset(). However resetValue() only resets the value to the default zero value.
This bug caused command arguments like "Stats" to get parsed to "0.0". Wherever that Vector2 came from..

Location:
code/branches/overlay/src/util
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/overlay/src/util/MultiType.cc

    r2087 r2180  
    4343    switch (type)
    4444    {
     45        case MT_null:
     46            this->reset(); return true;
    4547        case MT_char:
    4648            return this->convert<char>(); break;
  • code/branches/overlay/src/util/MultiType.h

    r2087 r2180  
    301301
    302302        /** @brief Current content gets deleted. New type is MT_null */
    303         inline void                       reset()                         { if (this->value_) this->value_->reset(); }
    304 
    305         template <typename T> inline void setType()                       { this->assignValue(T());                            } /** @brief Resets the value and changes the internal type to T. */
    306         inline void                       setType(const MultiType& other) { this->setType(other.getType());                    } /** @brief Resets the value and changes the internal type to the type of the other MultiType. */
    307         inline void                       setType(MT_Type type)           { this->reset(); this->convert(type); this->reset(); } /** @brief Resets the value and changes the internal type to the given type. */
     303        inline void                       reset()                         { if (this->value_) delete this->value_; this->value_ = 0; }
     304        /** @brief Current content gets overridden with default zero value */
     305        inline void                       resetValue()                    { if (this->value_) this->value_->reset(); }
     306
     307        template <typename T> inline void setType()                       { this->assignValue(T());                                 } /** @brief Resets the value and changes the internal type to T. */
     308        inline void                       setType(const MultiType& other) { this->setType(other.getType());                         } /** @brief Resets the value and changes the internal type to the type of the other MultiType. */
     309        inline void                       setType(MT_Type type)           { this->reset(); this->convert(type); this->resetValue(); } /** @brief Resets the value and changes the internal type to the given type. */
    308310
    309311        /** @brief Returns the current type. */
Note: See TracChangeset for help on using the changeset viewer.