Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8485 in orxonox.OLD for branches/script_engine/src/lib/util


Ignore:
Timestamp:
Jun 15, 2006, 5:33:25 PM (18 years ago)
Author:
snellen
Message:

helicopter scripted

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/script_engine/src/lib/util/executor/executor_lua.h

    r8408 r8485  
    183183
    184184
     185///////////
     186//// 3 ////
     187///////////
     188//! Executes a Function with a lua_State* parameter.
     189template<class T, typename type0, typename type1, typename type2> class ExecutorLua3 : public Executor
     190{
     191  public:
     192    /**
     193   * @brief Constructor of a ExecutorXML
     194   * @param function a Function to call
     195     */
     196    ExecutorLua3(void(T::*function)(type0, type1, type2))
     197  : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>())
     198    {
     199      this->functionPointer = function;
     200      this->functorType = Executor_Objective | Executor_NoLoadString;
     201    }
     202
     203    /**
     204     * @brief executes the Command on BaseObject
     205     * @param object the BaseObject to execute this Executor on
     206     * @param loadString ignored in this case
     207     */
     208    virtual void operator()(BaseObject* object, const SubString& = SubString()) const
     209    {
     210      PRINTF(1)("no usefull executor\n");
     211    }
     212
     213    virtual void operator()(BaseObject* object, int& count, void* values) const
     214    {
     215      lua_State* state = (lua_State*)values;
     216      count = 0;
     217
     218      (dynamic_cast<T*>(object)->*(functionPointer))(
     219          fromLua<type0>(state, 1),
     220          fromLua<type1>(state, 2),
     221          fromLua<type2>(state, 3) );
     222    }
     223
     224    /**
     225     * @returns a _new_ Copy of this Executor
     226     */
     227    virtual Executor* clone () const
     228    {
     229      return new ExecutorLua3<T, type0, type1, type2>(this->functionPointer);
     230    }
     231  private:
     232    void          (T::*functionPointer)(type0, type1, type2);
     233};
     234
    185235
    186236
     
    210260      this->functorType = Executor_Objective | Executor_NoLoadString;
    211261    }
    212 
     262   
    213263    /**
    214264     * @brief executes the Command on BaseObject
Note: See TracChangeset for help on using the changeset viewer.