Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8815 in orxonox.OLD for branches/single_player_map


Ignore:
Timestamp:
Jun 26, 2006, 6:26:21 PM (18 years ago)
Author:
snellen
Message:

script thestranger.lua tells thestranger to move to 288,19,208, scripttrigger is in the cell where the game starts, added debug output to find out why it doesn't work

Location:
branches/single_player_map/src
Files:
2 edited

Legend:

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

    r8808 r8815  
    386386  private:
    387387    ret           (T::*functionPointer)(type0, type1);
     388};
     389
     390
     391///////////
     392//// 3 ////
     393///////////
     394//! Executes a Function with a lua_State* parameter.
     395template<class T, typename ret, typename type0, typename type1, typename type2> class ExecutorLua3ret : public Executor
     396{
     397  public:
     398    /**
     399   * @brief Constructor of a ExecutorXML
     400   * @param function a Function to call
     401     */
     402    ExecutorLua3ret(ret (T::*function)(type0, type1, type2))
     403  : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>())
     404    {
     405      this->functionPointer = function;
     406      this->functorType = Executor_Objective | Executor_NoLoadString;
     407    }
     408
     409    /**
     410     * @brief executes the Command on BaseObject
     411     * @param object the BaseObject to execute this Executor on
     412     * @param loadString ignored in this case
     413     */
     414    virtual void operator()(BaseObject* object, const SubString& = SubString()) const
     415    {
     416      PRINTF(1)("no usefull executor\n");
     417    }
     418
     419    virtual void operator()(BaseObject* object, int& count, void* values) const
     420    {
     421      lua_State* state = (lua_State*)values;
     422      count = 0;
     423
     424      toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))(
     425          fromLua<type0>(state, 1),
     426      fromLua<type1>(state, 2),
     427      fromLua<type2>(state, 3) ));
     428    }
     429
     430    /**
     431     * @returns a _new_ Copy of this Executor
     432     */
     433    virtual Executor* clone () const
     434    {
     435      return new ExecutorLua3ret<T, ret, type0, type1, type2>(this->functionPointer);
     436    }
     437  private:
     438    ret          (T::*functionPointer)(type0, type1, type2);
    388439};
    389440
  • branches/single_player_map/src/world_entities/npcs/generic_npc.cc

    r8814 r8815  
    4040#include "script_class.h"
    4141CREATE_SCRIPTABLE_CLASS(GenericNPC, CL_GENERIC_NPC,
    42                         addMethod("walkTo", ExecutorLua7ret<GenericNPC,float, float, float, float, float, float, float, float>(&GenericNPC::walkTo))
     42                        //addMethod("walkTo", ExecutorLua7ret<GenericNPC,float, float, float, float, float, float, float, float>(&GenericNPC::walkTo))
     43                        addMethod("walkTo", ExecutorLua3ret<GenericNPC,float,float,float,float>(&GenericNPC::walkTo))
    4344                       );
    4445
     
    182183{
    183184  Quaternion q = this->getAbsDir();
     185 
     186  printf("%s moving to %f, %f, %f \n",this->getName(),x,y,z);
    184187
    185188  return this->walkTo(x, y, z, q.w, q.v.x, q.v.y, q.v.z);
Note: See TracChangeset for help on using the changeset viewer.