Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 31, 2010, 3:37:40 AM (14 years ago)
Author:
landauf
Message:

merged consolecommands3 branch back to trunk.

note: the console command interface has changed completely, but the documentation is not yet up to date. just copy an existing command and change it to your needs, it's pretty self-explanatory. also the include files related to console commands are now located in core/command/. in the game it should work exactly like before, except for some changes in the auto-completion.

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/libraries/util/Convert.h

    r7266 r7284  
    109109        }
    110110    };
     111
     112    ////////////
     113    // upcast //
     114    ////////////
     115    namespace detail
     116    {
     117        // perform a static cast if ToType is a base of FromType
     118        template<class ToType, class FromType>
     119        FORCEINLINE ToType upcast(FromType input, Loki::Int2Type<true>)
     120        {
     121            return static_cast<ToType>(input);
     122        }
     123
     124        // return zero if ToType is not a base of FromType
     125        template<class ToType, class FromType>
     126        FORCEINLINE ToType upcast(FromType input, Loki::Int2Type<false>)
     127        {
     128            return 0;
     129        }
     130    }
     131
     132    // performs an upcast if ToType is a base of FromType, returns zero otherwise
     133    template <class ToType, class FromType>
     134    FORCEINLINE ToType upcast(FromType input)
     135    {
     136        enum { probe = ImplicitConversion<FromType, ToType>::exists };
     137        return detail::upcast<ToType, FromType>(input, Loki::Int2Type<probe>());
     138    }
    111139}
    112140
Note: See TracChangeset for help on using the changeset viewer.