Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 8, 2008, 7:02:46 PM (16 years ago)
Author:
landauf
Message:

hopefully solved the conversion problem :)

it's a lot of metaprogramming now but this reduces the risk getting unnecessary compiler errors:
if (convert(a, b))

return true;

else

return convertFallback(a, b);

if convert(a, b) is defined and always used you could still get an error if convertFallback(a, b) uses something (like stream << object) that isn't supported for a or b. but with some template tricks it's possible to not even consider using convertFallback(a, b) at compiletime and avoid the error as long as convert(a, b) is implemented.

util/Conver.h is now opened for curious coders ;)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core2/src/util/MultiTypeMath.cc

    r1001 r1003  
    165165
    166166    if (this->type_ == MT_vector2)
    167         ConvertValue(&output, this->vector2_, CP_FromType);
     167        ConvertValue(&output, this->vector2_);
    168168    else if (this->type_ == MT_vector3)
    169         ConvertValue(&output, this->vector3_, CP_FromType);
     169        ConvertValue(&output, this->vector3_);
    170170    else if (this->type_ == MT_colourvalue)
    171171    { std::cout << "3_1\n";
    172         ConvertValue(&output, this->colourvalue_, CP_FromType);}
     172        ConvertValue(&output, this->colourvalue_);}
    173173    else if (this->type_ == MT_quaternion)
    174         ConvertValue(&output, this->quaternion_, CP_FromType);
     174        ConvertValue(&output, this->quaternion_);
    175175    else if (this->type_ == MT_radian)
    176176        ConvertValue(&output, this->radian_);
     
    186186{
    187187    if (this->type_ == MT_vector2)
    188         return ConvertValue(&this->vector2_, value, orxonox::Vector2(0, 0), CP_FromType);
     188        return ConvertValue(&this->vector2_, value, orxonox::Vector2(0, 0));
    189189    else if (this->type_ == MT_vector3)
    190         return ConvertValue(&this->vector3_, value, orxonox::Vector3(0, 0, 0), CP_FromType);
     190        return ConvertValue(&this->vector3_, value, orxonox::Vector3(0, 0, 0));
    191191    else if (this->type_ == MT_colourvalue)
    192192    { std::cout << "4_1\n";
    193         return ConvertValue(&this->colourvalue_, value, orxonox::ColourValue(0, 0, 0, 0), CP_FromType); }
     193        return ConvertValue(&this->colourvalue_, value, orxonox::ColourValue(0, 0, 0, 0)); }
    194194    else if (this->type_ == MT_quaternion)
    195         return ConvertValue(&this->quaternion_, value, orxonox::Quaternion(1, 0, 0, 0), CP_FromType);
     195        return ConvertValue(&this->quaternion_, value, orxonox::Quaternion(1, 0, 0, 0));
    196196    else if (this->type_ == MT_radian)
    197197        return ConvertValue(&this->radian_, value, orxonox::Radian(0));
Note: See TracChangeset for help on using the changeset viewer.