Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9727 in orxonox.OLD for branches/new_class_id/src


Ignore:
Timestamp:
Sep 14, 2006, 5:24:31 PM (18 years ago)
Author:
bensch
Message:

orxonox/new_class_id: new Executor construct, that is much more typesafe, faster, and easier to extend…

Also changed the LoadParam process, and adapted ScriptEngine calls

Then at the end, some missing headers appeared, and appended them to all the cc-files again.

Location:
branches/new_class_id/src
Files:
47 edited
2 copied

Legend:

Unmodified
Added
Removed
  • branches/new_class_id/src/lib/graphics/effects/atmospheric_engine.cc

    r9715 r9727  
    2020#include "effects/fog_effect.h"
    2121
    22 #include "util/loading/load_param.h"
     22#include "util/loading/load_param_xml.h"
    2323#include "util/loading/factory.h"
    2424
  • branches/new_class_id/src/lib/graphics/effects/lense_flare.cc

    r9716 r9727  
    2727#include "light.h"
    2828#include "state.h"
     29#include "debug.h"
    2930
    3031#include "render2D/image_plane.h"
  • branches/new_class_id/src/lib/graphics/effects/volfog_effect.cc

    r9716 r9727  
    2323#include "glincl.h"
    2424//#include "shell_command.h"
     25#include "debug.h"
     26
    2527
    2628#define GLX_GLXEXT_PROTOTYPES
  • branches/new_class_id/src/lib/graphics/graphics_engine.cc

    r9715 r9727  
    4040
    4141#include "shell_command.h"
    42 
     42#include "loading/load_param_xml.h"
    4343
    4444#include "parser/tinyxml/tinyxml.h"
     
    118118{
    119119  LoadParamXML(root, "GraphicsEffect", this, GraphicsEngine, loadGraphicsEffects)
    120   .describe("loads a graphics effect");
     120   .describe("loads a graphics effect");
    121121}
    122122
  • branches/new_class_id/src/lib/graphics/light.cc

    r9716 r9727  
    2222#include "glincl.h"
    2323#include "vector.h"
    24 #include "parser/tinyxml/tinyxml.h"
    25 #include "util/loading/load_param.h"
     24#include "util/loading/load_param_xml.h"
    2625#include "util/loading/factory.h"
    2726#include "debug.h"
     
    265264void LightManager::loadParams(const TiXmlElement* root)
    266265{
     266  printf("Loading Lights\n");
    267267  LoadParamXML(root, "Lights", this, LightManager, loadLights)
    268268  .describe("an XML-Element to load lights from.");
     
    277277void LightManager::loadLights(const TiXmlElement* root)
    278278{
     279  printf("Loading single Lights\n");
     280
    279281  const TiXmlElement* element = root->FirstChildElement();
    280282
  • branches/new_class_id/src/lib/graphics/render2D/element_2d.cc

    r9715 r9727  
    3131
    3232#include "color.h"
    33 
     33#include "debug.h"
    3434#include "shell_command.h"
     35
    3536SHELL_COMMAND(debug, Element2D, debug2D);
    3637
  • branches/new_class_id/src/lib/gui/gl/glmenu/glmenu_imagescreen.cc

    r9716 r9727  
    2424#include "util/loading/factory.h"
    2525#include "util/loading/load_param.h"
     26#include "debug.h"
    2627
    2728#include "class_id_DEPRECATED.h"
  • branches/new_class_id/src/lib/lang/base_object.cc

    r9724 r9727  
    1919#include "base_object.h"
    2020
     21#include "debug.h"
    2122#include "util/loading/load_param.h"
    2223
  • branches/new_class_id/src/lib/particles/model_particles.cc

    r9716 r9727  
    2323#include "state.h"
    2424#include "shell_command.h"
     25#include "debug.h"
    2526
    2627#include "class_id_DEPRECATED.h"
  • branches/new_class_id/src/lib/particles/particle_system.cc

    r9715 r9727  
    2323#include "model.h"
    2424
    25 #include "util/loading/load_param.h"
     25#include "util/loading/load_param_xml.h"
    2626#include "util/loading/factory.h"
    2727#include "material.h"
     
    2929#include "shell_command.h"
    3030
    31 #include "parser/tinyxml/tinyxml.h"
    3231#include <algorithm>
    3332
  • branches/new_class_id/src/lib/physics/physics_connection.cc

    r9716 r9727  
    1919
    2020#include "physics_engine.h"
     21#include "debug.h"
    2122
    2223#include "field.h"
  • branches/new_class_id/src/lib/physics/physics_engine.cc

    r9715 r9727  
    1818#include "physics_engine.h"
    1919
    20 #include "parser/tinyxml/tinyxml.h"
    2120#include "util/loading/factory.h"
    22 #include "util/loading/load_param.h"
     21#include "util/loading/load_param_xml.h"
    2322
    2423
  • branches/new_class_id/src/lib/script_engine/lunar.h

    r8408 r9727  
    1616  userdataType;
    1717public:
    18   typedef Executor* mfp;
     18  typedef Executor<lua_State*>* mfp;
    1919  typedef struct { const char *name; mfp mfunc; }
    2020  RegType;
     
    184184    lua_remove(L, 1);  // remove self so member function args start at index 1
    185185    // get member function from upvalue
    186     Executor *l = static_cast<Executor*>(lua_touserdata(L, lua_upvalueindex(1)));
    187     int value;
    188     (*l)(obj, value, L);  // call member function
    189     return value;
     186    mfp l = static_cast<mfp>(lua_touserdata(L, lua_upvalueindex(1)));
     187    (*l)(obj, L);  // call member function
     188    return l->hasRetVal()? 1 : 0;
    190189  }
    191190
  • branches/new_class_id/src/lib/script_engine/script_manager.cc

    r9715 r9727  
    2727#include "script_trigger.h"
    2828#include "luaincl.h"
    29 #include "loading/load_param.h"
    30 #include "parser/tinyxml/tinyxml.h"
     29#include "loading/load_param_xml.h"
    3130
    3231
  • branches/new_class_id/src/lib/script_engine/script_method.cc

    r8711 r9727  
    2525{ }
    2626
    27 ScriptMethod* ScriptMethod::addMethod(const std::string& methodName, const Executor& executor)
     27ScriptMethod* ScriptMethod::addMethod(const std::string& methodName, const Executor<lua_State*>& executor)
    2828{
    2929  this->methods.push_back(ScriptMethod::Method(methodName, executor));
     
    3232}
    3333
    34 ScriptMethod::Method::Method(const std::string& name, const Executor& executor)
     34ScriptMethod::Method::Method(const std::string& name, const Executor<lua_State*>& executor)
    3535{
    3636  this->name = name;
  • branches/new_class_id/src/lib/script_engine/script_method.h

    r8711 r9727  
    1818  ~ScriptMethod();
    1919
    20   ScriptMethod* addMethod(const std::string& methodName, const Executor& executor);
     20  ScriptMethod* addMethod(const std::string& methodName, const Executor<lua_State*>& executor);
    2121
    2222  unsigned int size() const { return methods.size(); };
    2323
    2424  const std::string& name(unsigned int methodNumber) const { return methods[methodNumber].name; };
    25   const Executor* executor(unsigned int methodNumber) const { return methods[methodNumber].executor; };
     25  const Executor<lua_State*>* executor(unsigned int methodNumber) const { return methods[methodNumber].executor; };
    2626
    2727
     
    2929  struct Method
    3030  {
    31     Method(const std::string& name, const Executor& executor);
    32     std::string    name;
    33     Executor*      executor;
     31    Method(const std::string& name, const Executor<lua_State*>& executor);
     32    std::string             name;
     33    Executor<lua_State*>*   executor;
    3434  };
    3535
  • branches/new_class_id/src/lib/shell/shell_command.cc

    r9715 r9727  
    3636   * @param paramCount the count of parameters this command takes
    3737   */
    38   ShellCommand::ShellCommand(const std::string& commandName, const std::string& className, Executor* executor)
     38  ShellCommand::ShellCommand(const std::string& commandName, const std::string& className, Executor<const SubString>* executor)
    3939  {
    4040    this->registerObject(this, ShellCommand::_objectList);
     
    7575   * @brief registers a new ShellCommand
    7676   */
    77   ShellCommand* ShellCommand::registerCommand(const std::string& commandName, const std::string& className, Executor* executor)
     77  ShellCommand* ShellCommand::registerCommand(const std::string& commandName, const std::string& className, Executor<const SubString>* executor)
    7878  {
    7979    if (ShellCommand::exists(commandName, className))
  • branches/new_class_id/src/lib/shell/shell_command.h

    r9715 r9727  
    7171    ShellCommand* completionPlugin(unsigned int parameter, const CompletorPlugin& completorPlugin);
    7272
    73     static ShellCommand* registerCommand(const std::string& commandName, const std::string& className, Executor* executor);
     73    static ShellCommand* registerCommand(const std::string& commandName, const std::string& className, Executor<const SubString>* executor);
    7474    static void unregisterCommand(const std::string& commandName, const std::string& className);
    7575    static const ShellCommand* const getCommand(const std::string& commandName, const std::string& className);
     
    8787
    8888  protected:
    89     ShellCommand(const std::string& commandName, const std::string& className, Executor* executor);
     89    ShellCommand(const std::string& commandName, const std::string& className, Executor<const SubString>* executor);
    9090    virtual ~ShellCommand();
    9191
     
    9999    std::string                      description;           //!< A description for this commnand. (initially ""). Assigned with (create)->describe("blablabla");
    100100    std::vector<CompletorPlugin*>    completors;            //!< Completors for the Parameters
    101     Executor*                        executor;              //!< The Executor, that really executes the Function.
     101    Executor<const SubString>*       executor;              //!< The Executor, that really executes the Function.
    102102  };
    103103
  • branches/new_class_id/src/lib/util/Makefile.am

    r9709 r9727  
    2121                loading/game_loader.cc \
    2222                loading/load_param.cc \
     23                loading/load_param_xml.cc \
    2324                loading/load_param_description.cc \
    2425                loading/factory.cc \
     
    5960                loading/game_loader.h \
    6061                loading/load_param.h \
     62                loading/load_param_xml.h \
    6163                loading/load_param_description.h \
    6264                loading/factory.h \
  • branches/new_class_id/src/lib/util/executor/executor.cc

    r9715 r9727  
    1919
    2020
    21 ObjectListDefinition(Executor);
     21ObjectListDefinition(ExecutorBase);
    2222
    2323/**
     
    2727 * @param paramCount the count of parameters this command takes
    2828 */
    29 Executor::Executor(const MultiType& param0,
    30                    const MultiType& param1,
    31                    const MultiType& param2,
    32                    const MultiType& param3,
    33                    const MultiType& param4,
    34                    const MultiType& param5,
    35                    const MultiType& param6)
     29ExecutorBase::ExecutorBase(bool hasRetVal,
     30                           const MultiType& param0,
     31                           const MultiType& param1,
     32                           const MultiType& param2,
     33                           const MultiType& param3,
     34                           const MultiType& param4,
     35                           const MultiType& param5,
     36                           const MultiType& param6)
     37  : bRetVal(hasRetVal)
    3638{
    37   this->registerObject(this, Executor::_objectList);
     39  this->registerObject(this, ExecutorBase::_objectList);
    3840
    3941  // What Parameters have we got
     
    5860
    5961/**
    60  * deconstructs a Executor
     62 * clones this element into executor.
     63 * @param executor the Executor to clone
    6164 */
    62 Executor::~Executor()
    63 {}
    64 
    65 /**
    66  * clones this element into executor.
    67  */
    68 void Executor::cloning(Executor* executor) const
     65void ExecutorBase::cloning(ExecutorBase* executor) const
    6966{
    7067  executor->functorType  = this->functorType;
     
    8380 * @returns itself
    8481 */
    85 Executor* Executor::defaultValues(const MultiType& value0,
     82void ExecutorBase::defaultValues(const MultiType& value0,
    8683                                  const MultiType& value1,
    8784                                  const MultiType& value2,
     
    9188                                  const MultiType& value6)
    9289{
    93   if (this == NULL)
    94     return NULL;
    95 
    9690  const MultiType* value[5];
    9791  value[0] = &value0;
     
    109103    }
    110104  }
    111   return this;
    112105}
    113106
     
    115108 * @brief prints out nice information about the Executor
    116109 */
    117 void Executor::debug()
     110void ExecutorBase::debug()
    118111{
    119 
    120112}
  • branches/new_class_id/src/lib/util/executor/executor.h

    r9715 r9727  
    1818  Executor_Objective         = 1,
    1919  Executor_Static            = 2,
    20 
    21   Executor_NoLoadString      = 8,
    2220} Executor_Type;
    2321
     
    3634 *  Functions with many types (@see functor_list.h)
    3735 */
    38 class Executor : public BaseObject
     36class ExecutorBase : public BaseObject
    3937{
    40   ObjectListDeclaration(Executor);
    41   public:
    42     virtual ~Executor();
     38  ObjectListDeclaration(ExecutorBase);
     39public:
     40  //    virtual bool operator==(const Executor* executor) const = 0;
    4341
    44     virtual Executor* clone () const = 0;
    45 //    virtual bool operator==(const Executor* executor) const = 0;
     42  /** @param i the i'th defaultValue, @returns reference to the MultiType */
     43  inline MultiType& getDefaultValue(unsigned int i) { return defaultValue[i]; };
    4644
    47     // SETTING up the EXECUTOR
    48     Executor* defaultValues(const MultiType& value0 = MT_NULL, const MultiType& value1 = MT_NULL,
    49                             const MultiType& value2 = MT_NULL, const MultiType& value3 = MT_NULL,
    50                             const MultiType& value4 = MT_NULL, const MultiType& param5 = MT_NULL,
    51                             const MultiType& param6 = MT_NULL);
    52     /** @param i the i'th defaultValue, @returns reference to the MultiType */
    53     inline MultiType& getDefaultValue(unsigned int i) { return defaultValue[i]; };
     45  // EXECUTE
     46  /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */
     47  //     virtual void operator()(BaseObject* object, int& count, void* values) const = 0;
     48  /** executes a Command @param object the object to apply this to @param parameters the parameters the command takes */
     49  //     virtual void operator()(BaseObject* object, const SubString& sub = SubString()) const = 0;
    5450
    55     // EXECUTE
    56     /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */
    57     virtual void operator()(BaseObject* object, int& count, void* values) const = 0;
    58     /** executes a Command @param object the object to apply this to @param parameters the parameters the command takes */
    59     virtual void operator()(BaseObject* object, const SubString& sub = SubString()) const = 0;
     51  // RETRIEVE INFORMATION
     52  /** @returns the Type of this Function (either static or objective) */
     53  inline long getType() const { return this->functorType; };
     54  /** @returns the Count of Parameters this Executor takes */
     55  inline unsigned int getParamCount() const { return this->paramCount; };
     56  /** @returns true if the Executor has a return Value. */
     57  inline bool hasRetVal() const { return bRetVal; };
    6058
    61     // RETRIEVE INFORMATION
    62     /** @returns the Type of this Function (either static or objective) */
    63     inline long getType() const { return this->functorType; };
    64     /** @returns the Count of Parameters this Executor takes */
    65     inline unsigned int getParamCount() const { return this->paramCount; };
     59  static void debug();
    6660
    67     static void debug();
     61protected:
     62  ExecutorBase(bool hasRetVal = false,
     63               const MultiType& param0 = MT_NULL, const MultiType& param1 = MT_NULL,
     64               const MultiType& param2 = MT_NULL, const MultiType& param3 = MT_NULL,
     65               const MultiType& param4 = MT_NULL, const MultiType& param5 = MT_NULL,
     66               const MultiType& param6 = MT_NULL);
    6867
    69   protected:
    70     Executor(const MultiType& param0 = MT_NULL, const MultiType& param1 = MT_NULL,
    71              const MultiType& param2 = MT_NULL, const MultiType& param3 = MT_NULL,
    72              const MultiType& param4 = MT_NULL, const MultiType& param5 = MT_NULL,
    73              const MultiType& param6 = MT_NULL);
     68  // SETTING up the EXECUTOR
     69  void defaultValues(const MultiType& value0 = MT_NULL, const MultiType& value1 = MT_NULL,
     70                     const MultiType& value2 = MT_NULL, const MultiType& value3 = MT_NULL,
     71                     const MultiType& value4 = MT_NULL, const MultiType& param5 = MT_NULL,
     72                     const MultiType& param6 = MT_NULL);
    7473
    75     void cloning(Executor* executor) const;
     74  void cloning(ExecutorBase* executor) const;
    7675
    77   protected:
    78     short                       functorType;      //!< The type of Function we've got (either static or objective).
    79     unsigned int                paramCount;       //!< the count of parameters.
    80     MultiType                   defaultValue[7];  //!< Default Values.
     76protected:
     77  short                       functorType;      //!< The type of Function we've got (either static or objective).
     78  unsigned int                paramCount;       //!< the count of parameters.
     79  MultiType                   defaultValue[7];  //!< Default Values.
     80
     81  bool                        bRetVal;          //!< True if the Executor has a return Value.
    8182};
     83
     84template <typename CallType> class Executor : public ExecutorBase
     85{
     86public:
     87  virtual Executor<CallType>* clone () const = 0;
     88
     89  /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */
     90  virtual void operator()(BaseObject* object, CallType& values) const = 0;
     91
     92  /**
     93   * @brief set the default values of the executor
     94   * @param value0 the first default value
     95   * @param value1 the second default value
     96   * @param value2 the third default value
     97   * @param value3 the fourth default value
     98   * @param value4 the fifth default value
     99   * @returns itself
     100   * @note: THIS FUNCTION WILL BE REPLACED BY A CONFIGURATOR (most probably).
     101  */
     102  Executor* defaultValues(const MultiType& value0 = MT_NULL, const MultiType& value1 = MT_NULL,
     103                          const MultiType& value2 = MT_NULL, const MultiType& value3 = MT_NULL,
     104                          const MultiType& value4 = MT_NULL, const MultiType& value5 = MT_NULL,
     105                          const MultiType& value6 = MT_NULL)
     106  {
     107    this->ExecutorBase::defaultValues(value0, value1, value2, value3, value4, value5, value6);
     108    return this;
     109  }
     110
     111
     112
     113protected:
     114  Executor(bool hasRetVal,
     115           const MultiType& param0 = MT_NULL, const MultiType& param1 = MT_NULL,
     116           const MultiType& param2 = MT_NULL, const MultiType& param3 = MT_NULL,
     117           const MultiType& param4 = MT_NULL, const MultiType& param5 = MT_NULL,
     118           const MultiType& param6 = MT_NULL)
     119      : ExecutorBase(hasRetVal, param0, param1, param2, param3, param4, param5, param6)
     120  {}
     121};
     122
     123
    82124
    83125#include "executor/executor_functional.h"
  • branches/new_class_id/src/lib/util/executor/executor_functional.h

    r9406 r9727  
    9494///////////
    9595//! @brief ExecutorClass, that can execute Functions without any parameters.
    96 template<class T> class __EXECUTOR_FUNCTIONAL_NAME(0) : public Executor
     96template<class T> class __EXECUTOR_FUNCTIONAL_NAME(0) : public Executor<const SubString>
    9797{
    9898private:
     
    106106   */
    107107  __EXECUTOR_FUNCTIONAL_NAME(0) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST )
    108       : Executor()
     108      : Executor<const SubString>(false)
    109109  {
    110110    this->functorType = Executor_Objective;
     
    132132   * @returns a new Executor that's a copy of this one.
    133133   */
    134   virtual Executor* clone() const
     134  virtual Executor<const SubString>* clone() const
    135135  {
    136136    return new __EXECUTOR_FUNCTIONAL_NAME(0)<T>(this->functionPointer);
     
    144144///////////
    145145//! @brief ExecutorClass, that can execute Functions with one parameter.
    146 template<class T, typename type0> class __EXECUTOR_FUNCTIONAL_NAME(1) : public Executor
     146template<class T, typename type0> class __EXECUTOR_FUNCTIONAL_NAME(1) : public Executor<const SubString>
    147147{
    148148private:
     
    156156   */
    157157  __EXECUTOR_FUNCTIONAL_NAME(1) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST)
    158       : Executor(ExecutorParamType<type0>())
     158      : Executor<const SubString>(false, ExecutorParamType<type0>())
    159159  {
    160160    this->functorType = Executor_Objective;
     
    186186   * @returns a new Executor that's a copy of this one.
    187187   */
    188   virtual Executor* clone() const
     188  virtual Executor<const SubString>* clone() const
    189189  {
    190190    return  new __EXECUTOR_FUNCTIONAL_NAME(1)<T, type0>(this->functionPointer);
     
    196196///////////
    197197//! @brief ExecutorClass, that can execute Functions with two parameters.
    198 template<class T, typename type0, typename type1> class __EXECUTOR_FUNCTIONAL_NAME(2) : public Executor
     198template<class T, typename type0, typename type1> class __EXECUTOR_FUNCTIONAL_NAME(2) : public Executor<const SubString>
    199199{
    200200private:
     
    208208   */
    209209  __EXECUTOR_FUNCTIONAL_NAME(2) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST)
    210       : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>())
     210      : Executor<const SubString>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>())
    211211  {
    212212    this->functorType = Executor_Objective;
     
    239239   * @returns a new Executor that's a copy of this one.
    240240   */
    241   virtual Executor* clone() const
     241  virtual Executor<const SubString>* clone() const
    242242  {
    243243    return new __EXECUTOR_FUNCTIONAL_NAME(2)<T, type0, type1>(this->functionPointer);
     
    250250///////////
    251251//! @brief ExecutorClass, that can execute Functions with three parameters.
    252 template<class T, typename type0, typename type1, typename type2> class __EXECUTOR_FUNCTIONAL_NAME(3) : public Executor
     252template<class T, typename type0, typename type1, typename type2> class __EXECUTOR_FUNCTIONAL_NAME(3) : public Executor<const SubString>
    253253{
    254254private:
     
    262262   */
    263263  __EXECUTOR_FUNCTIONAL_NAME(3) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2) __EXECUTOR_FUNCTIONAL_CONST)
    264       : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>())
     264      : Executor<const SubString>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>())
    265265  {
    266266    this->functorType = Executor_Objective;
     
    295295   * @returns a new Executor that's a copy of this one.
    296296   */
    297   virtual Executor* clone() const
     297  virtual Executor<const SubString>* clone() const
    298298  {
    299299    return new __EXECUTOR_FUNCTIONAL_NAME(3)<T, type0, type1, type2>(this->functionPointer);
     
    307307///////////
    308308//! @brief ExecutorClass, that can execute Functions with four parameters.
    309 template<class T, typename type0, typename type1, typename type2, typename type3> class __EXECUTOR_FUNCTIONAL_NAME(4) : public Executor
     309template<class T, typename type0, typename type1, typename type2, typename type3> class __EXECUTOR_FUNCTIONAL_NAME(4) : public Executor<const SubString>
    310310{
    311311private:
     
    319319   */
    320320  __EXECUTOR_FUNCTIONAL_NAME(4) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3) __EXECUTOR_FUNCTIONAL_CONST)
    321       : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>())
     321      : Executor<const SubString>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>())
    322322  {
    323323    this->functorType = Executor_Objective;
     
    354354   * @returns a new Executor that's a copy of this one.
    355355   */
    356   virtual Executor* clone() const
     356  virtual Executor<const SubString>* clone() const
    357357  {
    358358    return new __EXECUTOR_FUNCTIONAL_NAME(4)<T, type0, type1, type2, type3>(this->functionPointer);
     
    366366///////////
    367367//! @brief ExecutorClass, that can execute Functions with five parameters.
    368 template<class T, typename type0, typename type1, typename type2, typename type3, typename type4> class __EXECUTOR_FUNCTIONAL_NAME(5) : public Executor
     368template<class T, typename type0, typename type1, typename type2, typename type3, typename type4> class __EXECUTOR_FUNCTIONAL_NAME(5) : public Executor<const SubString>
    369369{
    370370private:
     
    378378   */
    379379  __EXECUTOR_FUNCTIONAL_NAME(5) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3, type4) __EXECUTOR_FUNCTIONAL_CONST)
    380       : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>(), ExecutorParamType<type4>())
     380      : Executor<const SubString>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>(), ExecutorParamType<type4>())
    381381  {
    382382    this->functorType = Executor_Objective;
     
    415415   * @returns a new Executor that's a copy of this one.
    416416   */
    417   virtual Executor* clone() const
     417  virtual Executor<const SubString>* clone() const
    418418  {
    419419    return new __EXECUTOR_FUNCTIONAL_NAME(5)<T, type0, type1, type2, type3, type4>(this->functionPointer);
     
    427427 */
    428428#define EXECUTOR_FUNCTIONAL_CREATOR0() \
    429 template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST) \
     429template<class T> Executor<const SubString>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST) \
    430430{ \
    431431  return new __EXECUTOR_FUNCTIONAL_NAME(0)<T>(functionPointer); \
     
    437437 */
    438438#define EXECUTOR_FUNCTIONAL_CREATOR1(type0) \
    439 template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \
     439template<class T> Executor<const SubString>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \
    440440{ \
    441441  return new __EXECUTOR_FUNCTIONAL_NAME(1)<T, type0##_TYPE>(functionPointer); \
     
    448448 */
    449449#define EXECUTOR_FUNCTIONAL_CREATOR2(type0, type1) \
    450 template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \
     450template<class T> Executor<const SubString>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \
    451451{ \
    452452  return new __EXECUTOR_FUNCTIONAL_NAME(2)<T, type0##_TYPE, type1##_TYPE>(functionPointer); \
     
    460460 */
    461461#define EXECUTOR_FUNCTIONAL_CREATOR3(type0, type1, type2) \
    462 template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE, type2##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \
     462template<class T> Executor<const SubString>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE, type2##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \
    463463{ \
    464464  return new __EXECUTOR_FUNCTIONAL_NAME(3)<T, type0##_TYPE, type1##_TYPE, type2##_TYPE>(functionPointer); \
     
    473473 */
    474474#define EXECUTOR_FUNCTIONAL_CREATOR4(type0, type1, type2, type3) \
    475 template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE, type2##_TYPE, type3##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \
     475template<class T> Executor<const SubString>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE, type2##_TYPE, type3##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \
    476476{ \
    477477  return new __EXECUTOR_FUNCTIONAL_NAME(4)<T, type0##_TYPE, type1##_TYPE, type2##_TYPE, type3##_TYPE>(functionPointer); \
     
    487487 */
    488488#define EXECUTOR_FUNCTIONAL_CREATOR5(type0, type1, type2, type3, type4) \
    489 template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \
     489template<class T> Executor<const SubString>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \
    490490{ \
    491491    return new __EXECUTOR_FUNCTIONAL_NAME(5)<T, type0##_TYPE, type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE>(functionPointer); \
  • branches/new_class_id/src/lib/util/executor/executor_lua.h

    r9006 r9727  
    4040///////////
    4141//! Executes a Function with a lua_State* parameter.
    42 template<class T> class ExecutorLua0 : public Executor
    43 {
    44   public:
    45     /**
    46    * @brief Constructor of a ExecutorXML
    47    * @param function a Function to call
    48      */
    49     ExecutorLua0(void(T::*function)())
    50   : Executor()
    51     {
    52       this->functionPointer = function;
    53       this->functorType = Executor_Objective | Executor_NoLoadString;
    54     }
    55 
    56     /**
    57      * @brief executes the Command on BaseObject
    58      * @param object the BaseObject to execute this Executor on
    59      * @param loadString ignored in this case
    60      */
    61     virtual void operator()(BaseObject* object, const SubString& = SubString()) const
    62     {
    63       PRINTF(1)("no usefull executor\n");
    64     }
    65 
    66     virtual void operator()(BaseObject* object, int& count, void* values) const
    67     {
    68       (dynamic_cast<T*>(object)->*(functionPointer))();
    69       count = 0;
    70     }
    71 
    72     /**
    73      * @returns a _new_ Copy of this Executor
    74      */
    75     virtual Executor* clone () const
    76     {
    77       return new ExecutorLua0<T>(ExecutorLua0<T>(this->functionPointer));
    78     }
    79   private:
    80     void          (T::*functionPointer)();
     42template<class T> class ExecutorLua0 : public Executor<lua_State*>
     43{
     44public:
     45  /**
     46  * @brief Constructor of a ExecutorXML
     47  * @param function a Function to call
     48   */
     49  ExecutorLua0(void(T::*function)())
     50      : Executor<lua_State*>(false)
     51  {
     52    this->functionPointer = function;
     53    this->functorType = Executor_Objective;
     54  }
     55
     56
     57  virtual void operator()(BaseObject* object, lua_State*& state) const
     58  {
     59    (dynamic_cast<T*>(object)->*(functionPointer))();
     60  }
     61
     62  /**
     63   * @returns a _new_ Copy of this Executor
     64   */
     65  virtual Executor<lua_State*>* clone () const
     66  {
     67    return new ExecutorLua0<T>(ExecutorLua0<T>(this->functionPointer));
     68  }
     69private:
     70  void          (T::*functionPointer)();
    8171};
    8272
     
    8777///////////
    8878//! Executes a Function with a lua_State* parameter.
    89 template<class T, typename type0> class ExecutorLua1 : public Executor
    90 {
    91   public:
    92     /**
    93    * @brief Constructor of a ExecutorXML
    94    * @param function a Function to call
    95      */
    96     ExecutorLua1(void(T::*function)(type0))
    97   : Executor(ExecutorParamType<type0>())
    98     {
    99       this->functionPointer = function;
    100       this->functorType = Executor_Objective | Executor_NoLoadString;
    101     }
    102 
    103     /**
    104      * @brief executes the Command on BaseObject
    105      * @param object the BaseObject to execute this Executor on
    106      * @param loadString ignored in this case
    107      */
    108     virtual void operator()(BaseObject* object, const SubString& = SubString()) const
    109     {
    110       PRINTF(1)("no usefull executor\n");
    111     }
    112 
    113     virtual void operator()(BaseObject* object, int& count, void* values) const
    114     {
    115       lua_State* state = (lua_State*)values;
    116       count = 0;
    117 
    118       (dynamic_cast<T*>(object)->*(functionPointer))(fromLua<type0>(state, 1));
    119     }
    120 
    121     /**
    122      * @returns a _new_ Copy of this Executor
    123      */
    124     virtual Executor* clone () const
    125     {
    126       return new ExecutorLua1<T, type0>((this->functionPointer));
    127     }
    128   private:
    129     void          (T::*functionPointer)(type0);
     79template<class T, typename type0> class ExecutorLua1 : public Executor<lua_State*>
     80{
     81public:
     82  /**
     83  * @brief Constructor of a ExecutorXML
     84  * @param function a Function to call
     85   */
     86  ExecutorLua1(void(T::*function)(type0))
     87      : Executor<lua_State*>(false, ExecutorParamType<type0>())
     88  {
     89    this->functionPointer = function;
     90    this->functorType = Executor_Objective;
     91  }
     92
     93  virtual void operator()(BaseObject* object, lua_State*& state) const
     94  {
     95    (dynamic_cast<T*>(object)->*(functionPointer))(fromLua<type0>(state, 1));
     96  }
     97
     98  /**
     99   * @returns a _new_ Copy of this Executor
     100   */
     101  virtual Executor<lua_State*>* clone () const
     102  {
     103    return new ExecutorLua1<T, type0>((this->functionPointer));
     104  }
     105private:
     106  void          (T::*functionPointer)(type0);
    130107};
    131108
     
    136113///////////
    137114//! Executes a Function with a lua_State* parameter.
    138 template<class T, typename type0, typename type1> class ExecutorLua2 : public Executor
    139 {
    140   public:
    141     /**
    142    * @brief Constructor of a ExecutorXML
    143    * @param function a Function to call
    144      */
    145     ExecutorLua2(void(T::*function)(type0, type1))
    146   : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>())
    147     {
    148       this->functionPointer = function;
    149       this->functorType = Executor_Objective | Executor_NoLoadString;
    150     }
    151 
    152     /**
    153      * @brief executes the Command on BaseObject
    154      * @param object the BaseObject to execute this Executor on
    155      * @param loadString ignored in this case
    156      */
    157     virtual void operator()(BaseObject* object, const SubString& = SubString()) const
    158     {
    159       PRINTF(1)("no usefull executor\n");
    160     }
    161 
    162     virtual void operator()(BaseObject* object, int& count, void* values) const
    163     {
    164       lua_State* state = (lua_State*)values;
    165       count = 0;
    166 
    167       (dynamic_cast<T*>(object)->*(functionPointer))(
    168           fromLua<type0>(state, 1),
     115template<class T, typename type0, typename type1> class ExecutorLua2 : public Executor<lua_State*>
     116{
     117public:
     118  /**
     119  * @brief Constructor of a ExecutorXML
     120  * @param function a Function to call
     121   */
     122  ExecutorLua2(void(T::*function)(type0, type1))
     123      : Executor<lua_State*>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>())
     124  {
     125    this->functionPointer = function;
     126    this->functorType = Executor_Objective;
     127  }
     128
     129  /**
     130   * @brief executes the Command on BaseObject
     131   * @param object the BaseObject to execute this Executor on
     132   * @param loadString ignored in this case
     133   */
     134  virtual void operator()(BaseObject* object, const SubString& = SubString()) const
     135  {
     136    PRINTF(1)("no usefull executor\n");
     137  }
     138
     139  virtual void operator()(BaseObject* object, lua_State*& state) const
     140  {
     141    (dynamic_cast<T*>(object)->*(functionPointer))(
     142      fromLua<type0>(state, 1),
    169143      fromLua<type1>(state, 2) );
    170     }
    171 
    172     /**
    173      * @returns a _new_ Copy of this Executor
    174      */
    175     virtual Executor* clone () const
    176     {
    177       return new ExecutorLua2<T, type0, type1>(this->functionPointer);
    178     }
    179   private:
    180     void          (T::*functionPointer)(type0, type1);
     144  }
     145
     146  /**
     147   * @returns a _new_ Copy of this Executor
     148   */
     149  virtual Executor<lua_State*>* clone () const
     150  {
     151    return new ExecutorLua2<T, type0, type1>(this->functionPointer);
     152  }
     153private:
     154  void          (T::*functionPointer)(type0, type1);
    181155};
    182156
     
    186160///////////
    187161//! Executes a Function with a lua_State* parameter.
    188 template<class T, typename type0, typename type1, typename type2> class ExecutorLua3 : public Executor
    189 {
    190   public:
    191     /**
    192    * @brief Constructor of a ExecutorXML
    193    * @param function a Function to call
    194      */
    195     ExecutorLua3(void(T::*function)(type0, type1, type2))
    196   : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>())
    197     {
    198       this->functionPointer = function;
    199       this->functorType = Executor_Objective | Executor_NoLoadString;
    200     }
    201 
    202     /**
    203      * @brief executes the Command on BaseObject
    204      * @param object the BaseObject to execute this Executor on
    205      * @param loadString ignored in this case
    206      */
    207     virtual void operator()(BaseObject* object, const SubString& = SubString()) const
    208     {
    209       PRINTF(1)("no usefull executor\n");
    210     }
    211 
    212     virtual void operator()(BaseObject* object, int& count, void* values) const
    213     {
    214       lua_State* state = (lua_State*)values;
    215       count = 0;
    216 
    217       (dynamic_cast<T*>(object)->*(functionPointer))(
    218           fromLua<type0>(state, 1),
     162template<class T, typename type0, typename type1, typename type2> class ExecutorLua3 : public Executor<lua_State*>
     163{
     164public:
     165  /**
     166  * @brief Constructor of a ExecutorXML
     167  * @param function a Function to call
     168   */
     169  ExecutorLua3(void(T::*function)(type0, type1, type2))
     170      : Executor<lua_State*>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>())
     171  {
     172    this->functionPointer = function;
     173    this->functorType = Executor_Objective;
     174  }
     175
     176  /**
     177   * @brief executes the Command on BaseObject
     178   * @param object the BaseObject to execute this Executor on
     179   * @param loadString ignored in this case
     180   */
     181  virtual void operator()(BaseObject* object, const SubString& = SubString()) const
     182  {
     183    PRINTF(1)("no usefull executor\n");
     184  }
     185
     186  virtual void operator()(BaseObject* object, lua_State*& state) const
     187  {
     188    (dynamic_cast<T*>(object)->*(functionPointer))(
     189      fromLua<type0>(state, 1),
    219190      fromLua<type1>(state, 2),
    220191      fromLua<type2>(state, 3) );
    221     }
    222 
    223     /**
    224      * @returns a _new_ Copy of this Executor
    225      */
    226     virtual Executor* clone () const
    227     {
    228       return new ExecutorLua3<T, type0, type1, type2>(this->functionPointer);
    229     }
    230   private:
    231     void          (T::*functionPointer)(type0, type1, type2);
     192  }
     193
     194  /**
     195   * @returns a _new_ Copy of this Executor
     196   */
     197  virtual Executor<lua_State*>* clone () const
     198  {
     199    return new ExecutorLua3<T, type0, type1, type2>(this->functionPointer);
     200  }
     201private:
     202  void          (T::*functionPointer)(type0, type1, type2);
    232203};
    233204
     
    237208///////////
    238209//! Executes a Function with a lua_State* parameter.
    239 template<class T, typename type0, typename type1, typename type2, typename type3> class ExecutorLua4 : public Executor
    240 {
    241   public:
    242     /**
    243    * @brief Constructor of a ExecutorXML
    244    * @param function a Function to call
    245      */
    246     ExecutorLua4(void(T::*function)(type0, type1, type2, type3))
    247   : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>())
    248     {
    249       this->functionPointer = function;
    250       this->functorType = Executor_Objective | Executor_NoLoadString;
    251     }
    252 
    253     /**
    254      * @brief executes the Command on BaseObject
    255      * @param object the BaseObject to execute this Executor on
    256      * @param loadString ignored in this case
    257      */
    258     virtual void operator()(BaseObject* object, const SubString& = SubString()) const
    259     {
    260       PRINTF(1)("no usefull executor\n");
    261     }
    262 
    263     virtual void operator()(BaseObject* object, int& count, void* values) const
    264     {
    265       lua_State* state = (lua_State*)values;
    266       count = 0;
    267 
    268       (dynamic_cast<T*>(object)->*(functionPointer))(
    269           fromLua<type0>(state, 1),
     210template<class T, typename type0, typename type1, typename type2, typename type3> class ExecutorLua4 : public Executor<lua_State*>
     211{
     212public:
     213  /**
     214  * @brief Constructor of a ExecutorXML
     215  * @param function a Function to call
     216   */
     217  ExecutorLua4(void(T::*function)(type0, type1, type2, type3))
     218      : Executor<lua_State*>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>())
     219  {
     220    this->functionPointer = function;
     221    this->functorType = Executor_Objective;
     222  }
     223
     224  virtual void operator()(BaseObject* object, lua_State*& state) const
     225  {
     226    (dynamic_cast<T*>(object)->*(functionPointer))(
     227      fromLua<type0>(state, 1),
    270228      fromLua<type1>(state, 2),
    271229      fromLua<type2>(state, 3),
    272230      fromLua<type3>(state, 4) );
    273     }
    274 
    275     /**
    276      * @returns a _new_ Copy of this Executor
    277      */
    278     virtual Executor* clone () const
    279     {
    280       return new ExecutorLua4<T, type0, type1, type2, type3>(this->functionPointer);
    281     }
    282   private:
    283     void          (T::*functionPointer)(type0, type1, type2, type3);
     231  }
     232
     233  /**
     234   * @returns a _new_ Copy of this Executor
     235   */
     236  virtual Executor<lua_State*>* clone () const
     237  {
     238    return new ExecutorLua4<T, type0, type1, type2, type3>(this->functionPointer);
     239  }
     240private:
     241  void          (T::*functionPointer)(type0, type1, type2, type3);
    284242};
    285243
     
    296254///////////
    297255//! Executes a Function with a lua_State* parameter.
    298 template<class T, typename ret> class ExecutorLua0ret : public Executor
    299 {
    300   public:
    301     /**
    302    * @brief Constructor of a ExecutorXML
    303    * @param function a Function to call
    304      */
    305     ExecutorLua0ret(ret (T::*function)())
    306   : Executor()
    307     {
    308       this->functionPointer = function;
    309       this->functorType = Executor_Objective | Executor_NoLoadString;
    310     }
    311    
    312     /**
    313      * @brief executes the Command on BaseObject
    314      * @param object the BaseObject to execute this Executor on
    315      * @param loadString ignored in this case
    316      */
    317     virtual void operator()(BaseObject* object, const SubString& = SubString()) const
    318     {
    319       PRINTF(1)("no usefull executor\n");
    320     }
    321 
    322     virtual void operator()(BaseObject* object, int& count, void* values) const
    323     {
    324       lua_State* state = (lua_State*)values;
    325       count = 1;
    326 
    327       toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))());
    328     }
    329 
    330     /**
    331      * @returns a _new_ Copy of this Executor
    332      */
    333     virtual Executor* clone () const
    334     {
    335       return new ExecutorLua0ret<T, ret>(this->functionPointer);
    336     }
    337   private:
    338     ret           (T::*functionPointer)();
     256template<class T, typename ret> class ExecutorLua0ret : public Executor<lua_State*>
     257{
     258public:
     259  /**
     260  * @brief Constructor of a ExecutorXML
     261  * @param function a Function to call
     262   */
     263  ExecutorLua0ret(ret (T::*function)())
     264      : Executor<lua_State*>(true)
     265  {
     266    this->functionPointer = function;
     267    this->functorType = Executor_Objective;
     268  }
     269
     270  virtual void operator()(BaseObject* object, lua_State*& state) const
     271  {
     272    toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))());
     273  }
     274
     275  /**
     276   * @returns a _new_ Copy of this Executor
     277   */
     278  virtual Executor<lua_State*>* clone () const
     279  {
     280    return new ExecutorLua0ret<T, ret>(this->functionPointer);
     281  }
     282private:
     283  ret           (T::*functionPointer)();
    339284};
    340285
     
    345290///////////
    346291//! Executes a Function with a lua_State* parameter.
    347 template<class T, typename ret, typename type0> class ExecutorLua1ret : public Executor
    348 {
    349   public:
    350     /**
    351    * @brief Constructor of a ExecutorXML
    352    * @param function a Function to call
    353      */
    354     ExecutorLua1ret(ret (T::*function)(type0))
    355   : Executor(ExecutorParamType<type0>())
    356     {
    357       this->functionPointer = function;
    358       this->functorType = Executor_Objective | Executor_NoLoadString;
    359     }
    360 
    361     /**
    362      * @brief executes the Command on BaseObject
    363      * @param object the BaseObject to execute this Executor on
    364      * @param loadString ignored in this case
    365      */
    366     virtual void operator()(BaseObject* object, const SubString& = SubString()) const
    367     {
    368       PRINTF(1)("no usefull executor\n");
    369     }
    370 
    371     virtual void operator()(BaseObject* object, int& count, void* values) const
    372     {
    373       lua_State* state = (lua_State*)values;
    374       count = 1;
    375 
    376       toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))(
    377           fromLua<type0>(state, 1)));
    378     }
    379 
    380     /**
    381      * @returns a _new_ Copy of this Executor
    382      */
    383     virtual Executor* clone () const
    384     {
    385       return new ExecutorLua1ret<T, ret, type0>(this->functionPointer);
    386     }
    387   private:
    388     ret           (T::*functionPointer)(type0);
     292template<class T, typename ret, typename type0> class ExecutorLua1ret : public Executor<lua_State*>
     293{
     294public:
     295  /**
     296  * @brief Constructor of a ExecutorXML
     297  * @param function a Function to call
     298   */
     299  ExecutorLua1ret(ret (T::*function)(type0))
     300      : Executor<lua_State*>(true, ExecutorParamType<type0>())
     301  {
     302    this->functionPointer = function;
     303    this->functorType = Executor_Objective;
     304  }
     305
     306  virtual void operator()(BaseObject* object, lua_State*& state) const
     307  {
     308    toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))(
     309                 fromLua<type0>(state, 1)));
     310  }
     311
     312  /**
     313   * @returns a _new_ Copy of this Executor
     314   */
     315  virtual Executor<lua_State*>* clone () const
     316  {
     317    return new ExecutorLua1ret<T, ret, type0>(this->functionPointer);
     318  }
     319private:
     320  ret           (T::*functionPointer)(type0);
    389321};
    390322
     
    393325///////////
    394326//! Executes a Function with a lua_State* parameter.
    395 template<class T, typename ret, typename type0, typename type1> class ExecutorLua2ret : public Executor
    396 {
    397   public:
    398     /**
    399    * @brief Constructor of a ExecutorXML
    400    * @param function a Function to call
    401      */
    402     ExecutorLua2ret(ret (T::*function)(type0, type1))
    403   : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>())
    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 = 1;
    423 
    424       toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))(
    425           fromLua<type0>(state, 1),
    426           fromLua<type1>(state, 2) ));
    427     }
    428 
    429     /**
    430      * @returns a _new_ Copy of this Executor
    431      */
    432     virtual Executor* clone () const
    433     {
    434       return new ExecutorLua2ret<T, ret, type0, type1>(this->functionPointer);
    435     }
    436   private:
    437     ret           (T::*functionPointer)(type0, type1);
     327template<class T, typename ret, typename type0, typename type1> class ExecutorLua2ret : public Executor<lua_State*>
     328{
     329public:
     330  /**
     331  * @brief Constructor of a ExecutorXML
     332  * @param function a Function to call
     333   */
     334  ExecutorLua2ret(ret (T::*function)(type0, type1))
     335      : Executor<lua_State*>(true, ExecutorParamType<type0>(), ExecutorParamType<type1>())
     336  {
     337    this->functionPointer = function;
     338    this->functorType = Executor_Objective;
     339  }
     340
     341  virtual void operator()(BaseObject* object, lua_State*& state) const
     342  {
     343    toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))(
     344                 fromLua<type0>(state, 1),
     345                 fromLua<type1>(state, 2) ));
     346  }
     347
     348  /**
     349   * @returns a _new_ Copy of this Executor
     350   */
     351  virtual Executor<lua_State*>* clone () const
     352  {
     353    return new ExecutorLua2ret<T, ret, type0, type1>(this->functionPointer);
     354  }
     355private:
     356  ret           (T::*functionPointer)(type0, type1);
    438357};
    439358
     
    443362///////////
    444363//! Executes a Function with a lua_State* parameter.
    445 template<class T, typename ret, typename type0, typename type1, typename type2> class ExecutorLua3ret : public Executor
    446 {
    447   public:
    448     /**
    449    * @brief Constructor of a ExecutorXML
    450    * @param function a Function to call
    451      */
    452     ExecutorLua3ret(ret (T::*function)(type0, type1, type2))
    453   : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>())
    454     {
    455       this->functionPointer = function;
    456       this->functorType = Executor_Objective | Executor_NoLoadString;
    457     }
    458 
    459     /**
    460      * @brief executes the Command on BaseObject
    461      * @param object the BaseObject to execute this Executor on
    462      * @param loadString ignored in this case
    463      */
    464     virtual void operator()(BaseObject* object, const SubString& = SubString()) const
    465     {
    466       PRINTF(1)("no usefull executor\n");
    467     }
    468 
    469     virtual void operator()(BaseObject* object, int& count, void* values) const
    470     {
    471       lua_State* state = (lua_State*)values;
    472       count = 1;
    473 
    474       toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))(
    475           fromLua<type0>(state, 1),
    476           fromLua<type1>(state, 2),
    477           fromLua<type2>(state, 3) ));
    478     }
    479 
    480     /**
    481      * @returns a _new_ Copy of this Executor
    482      */
    483     virtual Executor* clone () const
    484     {
    485       return new ExecutorLua3ret<T, ret, type0, type1, type2>(this->functionPointer);
    486     }
    487   private:
    488     ret          (T::*functionPointer)(type0, type1, type2);
     364template<class T, typename ret, typename type0, typename type1, typename type2> class ExecutorLua3ret : public Executor<lua_State*>
     365{
     366public:
     367  /**
     368  * @brief Constructor of a ExecutorXML
     369  * @param function a Function to call
     370   */
     371  ExecutorLua3ret(ret (T::*function)(type0, type1, type2))
     372      : Executor<lua_State*>(true, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>())
     373  {
     374    this->functionPointer = function;
     375    this->functorType = Executor_Objective;
     376  }
     377
     378  /**
     379   * @brief executes the Command on BaseObject
     380   * @param object the BaseObject to execute this Executor on
     381   * @param loadString ignored in this case
     382   */
     383  virtual void operator()(BaseObject* object, const SubString& = SubString()) const
     384  {
     385    PRINTF(1)("no usefull executor\n");
     386  }
     387
     388  virtual void operator()(BaseObject* object, lua_State*& state) const
     389  {
     390    toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))(
     391                 fromLua<type0>(state, 1),
     392                 fromLua<type1>(state, 2),
     393                 fromLua<type2>(state, 3) ));
     394  }
     395
     396  /**
     397   * @returns a _new_ Copy of this Executor
     398   */
     399  virtual Executor<lua_State*>* clone () const
     400  {
     401    return new ExecutorLua3ret<T, ret, type0, type1, type2>(this->functionPointer);
     402  }
     403private:
     404  ret          (T::*functionPointer)(type0, type1, type2);
    489405};
    490406
     
    494410///////////
    495411//! Executes a Function with a lua_State* parameter.
    496 template<class T, typename ret, typename type0, typename type1, typename type2, typename type3> class ExecutorLua4ret : public Executor
    497 {
    498   public:
    499     /**
    500    * @brief Constructor of a ExecutorXML
    501    * @param function a Function to call
    502      */
    503     ExecutorLua4ret(ret (T::*function)(type0, type1, type2, type3))
    504   : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>())
    505     {
    506       this->functionPointer = function;
    507       this->functorType = Executor_Objective | Executor_NoLoadString;
    508     }
    509 
    510     /**
    511      * @brief executes the Command on BaseObject
    512      * @param object the BaseObject to execute this Executor on
    513      * @param loadString ignored in this case
    514      */
    515     virtual void operator()(BaseObject* object, const SubString& = SubString()) const
    516     {
    517       PRINTF(1)("no usefull executor\n");
    518     }
    519 
    520     virtual void operator()(BaseObject* object, int& count, void* values) const
    521     {
    522       lua_State* state = (lua_State*)values;
    523       count = 1;
    524 
    525       toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))(
    526           fromLua<type0>(state, 1),
    527           fromLua<type1>(state, 2),
    528           fromLua<type2>(state, 3),
    529           fromLua<type3>(state, 4) ));
    530     }
    531 
    532     /**
    533      * @returns a _new_ Copy of this Executor
    534      */
    535     virtual Executor* clone () const
    536     {
    537       return new ExecutorLua4ret<T, ret, type0, type1, type2, type3>(this->functionPointer);
    538     }
    539   private:
    540     ret          (T::*functionPointer)(type0, type1, type2, type3);
     412template<class T, typename ret, typename type0, typename type1, typename type2, typename type3> class ExecutorLua4ret : public Executor<lua_State*>
     413{
     414public:
     415  /**
     416  * @brief Constructor of a ExecutorXML
     417  * @param function a Function to call
     418   */
     419  ExecutorLua4ret(ret (T::*function)(type0, type1, type2, type3))
     420      : Executor<lua_State*>(true, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>())
     421  {
     422    this->functionPointer = function;
     423    this->functorType = Executor_Objective;
     424  }
     425
     426  virtual void operator()(BaseObject* object, lua_State*& state) const
     427  {
     428    toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))(
     429                 fromLua<type0>(state, 1),
     430                 fromLua<type1>(state, 2),
     431                 fromLua<type2>(state, 3),
     432                 fromLua<type3>(state, 4) ));
     433  }
     434
     435  /**
     436   * @returns a _new_ Copy of this Executor
     437   */
     438  virtual Executor<lua_State*>* clone () const
     439  {
     440    return new ExecutorLua4ret<T, ret, type0, type1, type2, type3>(this->functionPointer);
     441  }
     442private:
     443  ret          (T::*functionPointer)(type0, type1, type2, type3);
    541444};
    542445
     
    545448///////////
    546449//! Executes a Function with a lua_State* parameter.
    547 template<class T, typename ret, typename type0, typename type1, typename type2, typename type3, typename type4> class ExecutorLua5ret : public Executor
    548 {
    549   public:
    550     /**
    551    * @brief Constructor of a ExecutorXML
    552    * @param function a Function to call
    553      */
    554     ExecutorLua5ret(ret (T::*function)(type0, type1, type2, type3, type4))
    555   : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>(), ExecutorParamType<type4>())
    556     {
    557       this->functionPointer = function;
    558       this->functorType = Executor_Objective | Executor_NoLoadString;
    559     }
    560 
    561     /**
    562      * @brief executes the Command on BaseObject
    563      * @param object the BaseObject to execute this Executor on
    564      * @param loadString ignored in this case
    565      */
    566     virtual void operator()(BaseObject* object, const SubString& = SubString()) const
    567     {
    568       PRINTF(1)("no usefull executor\n");
    569     }
    570 
    571     virtual void operator()(BaseObject* object, int& count, void* values) const
    572     {
    573       lua_State* state = (lua_State*)values;
    574       count = 1;
    575 
    576       toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))(
    577           fromLua<type0>(state, 1),
    578           fromLua<type1>(state, 2),
    579           fromLua<type2>(state, 3),
    580           fromLua<type3>(state, 4),
    581           fromLua<type4>(state, 5) ));
    582     }
    583 
    584     /**
    585      * @returns a _new_ Copy of this Executor
    586      */
    587     virtual Executor* clone () const
    588     {
    589       return new ExecutorLua5ret<T, ret, type0, type1, type2, type3, type4>(this->functionPointer);
    590     }
    591   private:
    592     ret          (T::*functionPointer)(type0, type1, type2, type3, type4);
     450template<class T, typename ret, typename type0, typename type1, typename type2, typename type3, typename type4> class ExecutorLua5ret : public Executor<lua_State*>
     451{
     452public:
     453  /**
     454  * @brief Constructor of a ExecutorXML
     455  * @param function a Function to call
     456   */
     457  ExecutorLua5ret(ret (T::*function)(type0, type1, type2, type3, type4))
     458      : Executor<lua_State*>(true, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>(), ExecutorParamType<type4>())
     459  {
     460    this->functionPointer = function;
     461    this->functorType = Executor_Objective;
     462  }
     463
     464  virtual void operator()(BaseObject* object, lua_State*& state) const
     465  {
     466    toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))(
     467                 fromLua<type0>(state, 1),
     468                 fromLua<type1>(state, 2),
     469                 fromLua<type2>(state, 3),
     470                 fromLua<type3>(state, 4),
     471                 fromLua<type4>(state, 5) ));
     472  }
     473
     474  /**
     475   * @returns a _new_ Copy of this Executor
     476   */
     477  virtual Executor<lua_State*>* clone () const
     478  {
     479    return new ExecutorLua5ret<T, ret, type0, type1, type2, type3, type4>(this->functionPointer);
     480  }
     481private:
     482  ret          (T::*functionPointer)(type0, type1, type2, type3, type4);
    593483};
    594484
     
    597487///////////
    598488//! Executes a Function with a lua_State* parameter.
    599 template<class T, typename ret, typename type0, typename type1, typename type2, typename type3, typename type4, typename type5> class ExecutorLua6ret : public Executor
    600 {
    601   public:
    602     /**
    603    * @brief Constructor of a ExecutorXML
    604    * @param function a Function to call
    605      */
    606     ExecutorLua6ret(ret (T::*function)(type0, type1, type2, type3, type4, type5))
    607   : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(),
    608              ExecutorParamType<type2>(), ExecutorParamType<type3>(),
    609              ExecutorParamType<type4>(), ExecutorParamType<type5>())
    610              {
    611                this->functionPointer = function;
    612                this->functorType = Executor_Objective | Executor_NoLoadString;
    613              }
    614 
    615     /**
    616               * @brief executes the Command on BaseObject
    617               * @param object the BaseObject to execute this Executor on
    618               * @param loadString ignored in this case
    619      */
    620              virtual void operator()(BaseObject* object, const SubString& = SubString()) const
    621              {
    622                PRINTF(1)("no usefull executor\n");
    623              }
    624 
    625              virtual void operator()(BaseObject* object, int& count, void* values) const
    626              {
    627                lua_State* state = (lua_State*)values;
    628                count = 1;
    629 
    630                toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))(
    631                    fromLua<type0>(state, 1),
    632                    fromLua<type1>(state, 2),
    633                    fromLua<type2>(state, 3),
    634                    fromLua<type3>(state, 4),
    635                    fromLua<type4>(state, 5),
    636                    fromLua<type5>(state, 6) ));
    637              }
    638 
    639     /**
    640               * @returns a _new_ Copy of this Executor
    641      */
    642              virtual Executor* clone () const
    643              {
    644                return new ExecutorLua6ret<T, ret, type0, type1, type2, type3, type4, type5>(this->functionPointer);
    645              }
    646   private:
    647     ret           (T::*functionPointer)(type0, type1, type2, type3, type4, type5);
     489template<class T, typename ret, typename type0, typename type1, typename type2, typename type3, typename type4, typename type5> class ExecutorLua6ret : public Executor<lua_State*>
     490{
     491public:
     492  /**
     493  * @brief Constructor of a ExecutorXML
     494  * @param function a Function to call
     495   */
     496  ExecutorLua6ret(ret (T::*function)(type0, type1, type2, type3, type4, type5))
     497      : Executor<lua_State*>(true, ExecutorParamType<type0>(), ExecutorParamType<type1>(),
     498                             ExecutorParamType<type2>(), ExecutorParamType<type3>(),
     499                             ExecutorParamType<type4>(), ExecutorParamType<type5>())
     500  {
     501    this->functionPointer = function;
     502    this->functorType = Executor_Objective;
     503  }
     504
     505  virtual void operator()(BaseObject* object, lua_State*& state) const
     506  {
     507    toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))(
     508                 fromLua<type0>(state, 1),
     509                 fromLua<type1>(state, 2),
     510                 fromLua<type2>(state, 3),
     511                 fromLua<type3>(state, 4),
     512                 fromLua<type4>(state, 5),
     513                 fromLua<type5>(state, 6) ));
     514  }
     515
     516  /**
     517            * @returns a _new_ Copy of this Executor
     518   */
     519  virtual Executor<lua_State*>* clone () const
     520  {
     521    return new ExecutorLua6ret<T, ret, type0, type1, type2, type3, type4, type5>(this->functionPointer);
     522  }
     523private:
     524  ret           (T::*functionPointer)(type0, type1, type2, type3, type4, type5);
    648525};
    649526
     
    652529///////////
    653530//! Executes a Function with a lua_State* parameter.
    654 template<class T, typename ret, typename type0, typename type1, typename type2, typename type3, typename type4, typename type5, typename type6> class ExecutorLua7ret : public Executor
    655 {
    656   public:
    657     /**
    658    * @brief Constructor of a ExecutorXML
    659    * @param function a Function to call
    660      */
    661     ExecutorLua7ret(ret (T::*function)(type0, type1, type2, type3, type4, type5, type6))
    662   : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(),
    663              ExecutorParamType<type2>(), ExecutorParamType<type3>(),
    664              ExecutorParamType<type4>(), ExecutorParamType<type5>(),
    665              ExecutorParamType<type6>())
    666              {
    667                this->functionPointer = function;
    668                this->functorType = Executor_Objective | Executor_NoLoadString;
    669              }
    670 
    671     /**
    672               * @brief executes the Command on BaseObject
    673               * @param object the BaseObject to execute this Executor on
    674               * @param loadString ignored in this case
    675      */
    676              virtual void operator()(BaseObject* object, const SubString& = SubString()) const
    677              {
    678                PRINTF(1)("no usefull executor\n");
    679              }
    680 
    681              virtual void operator()(BaseObject* object, int& count, void* values) const
    682              {
    683                lua_State* state = (lua_State*)values;
    684                count = 1;
    685 
    686                toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))(
    687                    fromLua<type0>(state, 1),
    688                    fromLua<type1>(state, 2),
    689                    fromLua<type2>(state, 3),
    690                    fromLua<type3>(state, 4),
    691                    fromLua<type4>(state, 5),
    692                    fromLua<type5>(state, 6),
    693                    fromLua<type6>(state, 7) ));
    694              }
    695 
    696     /**
    697               * @returns a _new_ Copy of this Executor
    698      */
    699              virtual Executor* clone () const
    700              {
    701                return new ExecutorLua7ret<T, ret, type0, type1, type2, type3, type4, type5, type6>(this->functionPointer);
    702              }
    703   private:
    704     ret           (T::*functionPointer)(type0, type1, type2, type3, type4, type5, type6);
     531template<class T, typename ret, typename type0, typename type1, typename type2, typename type3, typename type4, typename type5, typename type6> class ExecutorLua7ret : public Executor<lua_State*>
     532{
     533public:
     534  /**
     535  * @brief Constructor of a ExecutorXML
     536  * @param function a Function to call
     537   */
     538  ExecutorLua7ret(ret (T::*function)(type0, type1, type2, type3, type4, type5, type6))
     539      : Executor<lua_State*>(true, ExecutorParamType<type0>(), ExecutorParamType<type1>(),
     540                             ExecutorParamType<type2>(), ExecutorParamType<type3>(),
     541                             ExecutorParamType<type4>(), ExecutorParamType<type5>(),
     542                             ExecutorParamType<type6>())
     543  {
     544    this->functionPointer = function;
     545    this->functorType = Executor_Objective;
     546  }
     547
     548  virtual void operator()(BaseObject* object, lua_State*& state) const
     549  {
     550    toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))(
     551                 fromLua<type0>(state, 1),
     552                 fromLua<type1>(state, 2),
     553                 fromLua<type2>(state, 3),
     554                 fromLua<type3>(state, 4),
     555                 fromLua<type4>(state, 5),
     556                 fromLua<type5>(state, 6),
     557                 fromLua<type6>(state, 7) ));
     558  }
     559
     560  /**
     561            * @returns a _new_ Copy of this Executor
     562   */
     563  virtual Executor<lua_State*>* clone () const
     564  {
     565    return new ExecutorLua7ret<T, ret, type0, type1, type2, type3, type4, type5, type6>(this->functionPointer);
     566  }
     567private:
     568  ret           (T::*functionPointer)(type0, type1, type2, type3, type4, type5, type6);
    705569};
    706570
  • branches/new_class_id/src/lib/util/executor/executor_xml.h

    r8362 r9727  
    1919 * What must be defined is a XML-root to search the ParameterName under an  a Function to call.
    2020 */
    21 template<class T> class ExecutorXML : public Executor
     21template<class T> class ExecutorXML : public Executor<const TiXmlElement*>
    2222{
    23   public:
    24     /**
     23public:
     24  /**
    2525   * @brief Constructor of a ExecutorXML
    26      * @param function a Function to call
    27      * @param root The XML root to search paramName under
    28      * @param paramName the ParameterName the search in root, and lookup the TiXmlElement from
    29      */
    30     ExecutorXML(void(T::*function)(const TiXmlElement*), const TiXmlElement* root, const char* paramName)
    31       : Executor(MT_EXT1)
    32     {
    33       PRINTF(4)("Loading %s from XML-element %p\n", paramName, root);
     26   * @param function a Function to call
     27   * @param root The XML root to search paramName under
     28   * @param paramName the ParameterName the search in root, and lookup the TiXmlElement from
     29   */
     30  ExecutorXML(void(T::*function)(const TiXmlElement*), const TiXmlElement* root, const std::string& paramName)
     31      : Executor<const TiXmlElement*>(false, MT_EXT1)
     32  {
     33    PRINTF(4)("Loading %s from XML-element %p\n", paramName.c_str(), root);
    3434
    35       if (likely(root != NULL && paramName != NULL))
    36         this->element = root->FirstChildElement(paramName);
    37       else
    38         this->element = NULL;
     35    if (likely(root != NULL))
     36      this->element = root->FirstChildElement(paramName);
     37    else
     38      this->element = NULL;
    3939
    40       this->functionPointer = function;
    41       this->functorType = Executor_Objective | Executor_NoLoadString;
    42     }
     40    this->paramName = paramName;
     41    this->functionPointer = function;
     42    this->functorType = Executor_Objective;
     43  }
    4344
    44     /**
    45      * @brief clones an ExecutorXML, used to copy this Element.
    46      * @returns a _new_ Copy of this Executor
    47      */
    48     virtual Executor* clone () const
    49     {
    50       ExecutorXML<T>* executor = new ExecutorXML<T>();
    51       this->cloning(executor);
    52       executor->functionPointer = this->functionPointer;
    53       executor->element = this->element;
    54       return executor;
    55     }
     45  /**
     46   * @brief clones an ExecutorXML, used to copy this Element.
     47   * @returns a _new_ Copy of this Executor
     48   */
     49  virtual Executor<const TiXmlElement*>* clone () const
     50  {
     51    return new ExecutorXML<T>(functionPointer, element, paramName);
     52  }
    5653
    57     /**
    58      * @brief executes the Command on BaseObject
    59      * @param object the BaseObject to execute this Executor on
    60      * @param loadString ignored in this case
    61      */
    62     virtual void operator()(BaseObject* object, const SubString& = SubString()) const
    63     {
    64       if (object != NULL && this->element != NULL)
    65         (dynamic_cast<T*>(object)->*(functionPointer))(this->element);
    66     }
     54  /**
     55   * @brief executes the Command on BaseObject
     56   * @param object the BaseObject to execute this Executor on
     57   * @param root ignored in this case
     58   */
     59  virtual void operator()(BaseObject* object, const TiXmlElement*& element) const
     60  {
     61    assert (object != NULL);
     62    if (this->element != NULL)
     63      (dynamic_cast<T*>(object)->*(functionPointer))(this->element);
     64  }
    6765
    68     virtual void operator()(BaseObject* object, int& count, void* values) const
    69     {
    70       PRINTF(1)("missuse of XML-operator, OR IMPLEMENT.\n");
    71     }
    72 
    73   private:
    74     /**
    75    * @brief used for the copy-(Clone)-constructor
    76      */
    77     ExecutorXML() : Executor() { };
    78 
    79 
    80   private:
    81     void    (T::*functionPointer)(const TiXmlElement*);  //!< The functionPointer to the function to be called
    82     const   TiXmlElement* element;                       //!< The XML-element to call.
     66private:
     67  void    (T::*functionPointer)(const TiXmlElement*);  //!< The functionPointer to the function to be called
     68  const   TiXmlElement* element;                       //!< The XML-element to call.
     69  std::string           paramName;
    8370};
    8471
  • branches/new_class_id/src/lib/util/loading/game_loader.cc

    r9715 r9727  
    2121#include "util/loading/load_param.h"
    2222
     23#include "debug.h"
    2324#include "shell_command.h"
    2425#include "campaign.h"
  • branches/new_class_id/src/lib/util/loading/load_param.cc

    r9406 r9727  
    1818#include "util/loading/load_param.h"
    1919#include "load_param_description.h"
    20 
    21 #include <stdarg.h>
    22 
     20#include "compiler.h"
     21#include "debug.h"
    2322/**
    2423 * Constructs a new LoadParameter
     
    2827 * @param executor the Executor, that executes the loading procedure.
    2928 */
    30 CLoadParam::CLoadParam(const TiXmlElement* root, const std::string& paramName, BaseObject* object, Executor* executor, bool inLoadCycle)
    31   :  object(object), paramName(paramName)
    32 {
    33   this->inLoadCycle = inLoadCycle;
    34 
     29LoadParamBase::LoadParamBase(const TiXmlElement* root, const std::string& paramName, BaseObject* object, bool inLoadCycle)
     30    :  object(object), paramName(paramName), inLoadCycle(inLoadCycle)
     31{
    3532  // determin the LoadString.
    3633  if (likely(!inLoadCycle))
     
    4037  else
    4138    this->loadElem = NULL;
    42 
     39}
     40
     41
     42/**
     43 * @param descriptionText The text to set as a description for this Parameter
     44 * @returns a pointer to itself.
     45 */
     46void LoadParamBase::describe(const std::string& descriptionText)
     47{
     48  if (LoadClassDescription::parametersDescription && this->paramDesc && this->paramDesc->getDescription().empty())
     49  {
     50    this->paramDesc->setDescription(descriptionText);
     51  }
     52}
     53
     54
     55
     56
     57CLoadParam::CLoadParam(const TiXmlElement* root, const std::string& paramName, BaseObject* object, Executor<const SubString>* executor, bool inLoadCycle)
     58    : LoadParamBase(root, paramName, object, inLoadCycle)
     59{
     60  assert (executor != NULL);
    4361  // set the Executor.
    4462  this->executor = executor;
    45 
    4663  //if (this->executor)
    4764  //  this->executor->setName(paramName);
     
    5673CLoadParam::~CLoadParam()
    5774{
    58   if (likely(this->executor != NULL))
    59   {
    60     std::string loadString = "";
    61     if (this->loadElem != NULL &&  this->loadElem->ToText())
    62       loadString = this->loadElem->Value();
    63     if (likely(this->object != NULL) &&
    64         ( !loadString.empty() ||
    65           ((this->executor->getType() & Executor_NoLoadString) == Executor_NoLoadString)))
     75  assert(this->object != NULL);
     76
     77  std::string loadString;
     78  if (this->loadElem != NULL &&  this->loadElem->ToText())
     79  {
     80    loadString = this->loadElem->Value();
     81    if (!loadString.empty())
    6682    {
    67       PRINTF(4)("Loading value '%s' with Parameters '%s' onto: %s::%s\n", this->paramName.c_str(), loadString.c_str(), this->object->getClassCName(), this->object->getCName());
     83      PRINTF(0)("Loading value '%s' with Parameters '%s' onto: %s::%s\n",
     84                this->paramName.c_str(), loadString.c_str(), this->object->getClassCName(), this->object->getCName());
    6885      (*this->executor)(this->object, SubString(loadString, ",", SubString::WhiteSpaces, false, '\\'));
    6986    }
    70     delete this->executor;
    71   }
     87  }
     88  delete this->executor;
    7289}
    7390
     
    90107}
    91108
    92 
    93 
    94 /**
    95  * @param descriptionText The text to set as a description for this Parameter
    96  * @returns a pointer to itself.
    97 */
    98 CLoadParam& CLoadParam::describe(const std::string& descriptionText)
    99 {
    100   if (LoadClassDescription::parametersDescription && this->paramDesc && this->paramDesc->getDescription().empty())
    101   {
    102     this->paramDesc->setDescription(descriptionText);
    103   }
    104   return *this;
    105 }
    106109
    107110// const LoadParamDescription* LoadParamDescription::getClass(const char* className)
  • branches/new_class_id/src/lib/util/loading/load_param.h

    r8048 r9727  
    2525
    2626#include "executor/executor.h"
    27 #include "executor/executor_xml.h"
     27#include "parser/tinyxml/tinyxml.h"
    2828
    2929// Forward Declaration //
    3030class LoadClassDescription;
    3131class LoadParamDescription;
    32 class MultiType;
    33 
    3432
    3533/**
     
    4745#define LoadParam_CYCLE(ROOT, PARAMETER_NAME, OBJECT, CLASS, FUNCTION) \
    4846         CLoadParam(ROOT, PARAMETER_NAME, OBJECT, createExecutor<CLASS>(&CLASS::FUNCTION), true)
    49 
    50 #define LoadParamXML(ROOT, PARAMETER_NAME, OBJECT, CLASS, FUNCTION) \
    51          CLoadParam(ROOT, PARAMETER_NAME, OBJECT, new ExecutorXML<CLASS>(&CLASS::FUNCTION, ROOT, PARAMETER_NAME), false)
    52 
    53 #define LoadParamXML_CYCLE(ROOT, PARAMETER_NAME, OBJECT, CLASS, FUNCTION) \
    54          CLoadParam(ROOT, PARAMETER_NAME, OBJECT, new ExecutorXML<CLASS>(&CLASS::FUNCTION, ROOT, PARAMETER_NAME), true)
    55 
    5647
    5748/**
     
    7869}
    7970
     71
    8072/**************************
    8173**** REAL DECLARATIONS ****
    8274**************************/
    83 //! abstract Base class for a Loadable parameter
    84 class CLoadParam : public BaseObject
     75class LoadParamBase : public BaseObject
    8576{
    86   public:
    87     CLoadParam(const TiXmlElement* root, const std::string& paramName, BaseObject* object, Executor* executor, bool inLoadCycle = false);
    88     virtual ~CLoadParam();
     77protected:
     78  LoadParamBase(const TiXmlElement* root, const std::string& paramName, BaseObject* object, bool inLoadCycle = false);
    8979
    90     CLoadParam& describe(const std::string& descriptionText);
    91     CLoadParam& defaultValues(const MultiType& value0 = MT_NULL, const MultiType& value1 = MT_NULL,
    92                               const MultiType& value2 = MT_NULL, const MultiType& value3 = MT_NULL,
    93                               const MultiType& value4 = MT_NULL);
    94     CLoadParam& attribute(const std::string& attributeName, const Executor& executor);
     80protected:
     81  void describe(const std::string& descriptionText);
     82
     83protected:
     84  BaseObject*              object;
     85  const std::string        paramName;
     86  bool                     inLoadCycle;
     87
     88  LoadClassDescription*    classDesc;            //!< The LoadClassDescription of this CLoadParameter
     89  LoadParamDescription*    paramDesc;            //!< The LoadParameterDescription of this LoadParameter
     90  const TiXmlElement*      loadElem;             //!< The Element to load.
     91};
    9592
    9693
    97   private:
    98     bool                     inLoadCycle;
    99     Executor*                executor;
    100     BaseObject*              object;
    101     const std::string        paramName;
     94//! abstract Base class for a Loadable parameter
     95class CLoadParam : public LoadParamBase
     96{
     97public:
     98  CLoadParam(const TiXmlElement* root, const std::string& paramName, BaseObject* object, Executor<const SubString>* executor, bool inLoadCycle = false);
     99  virtual ~CLoadParam();
    102100
    103     LoadClassDescription*    classDesc;            //!< The LoadClassDescription of this CLoadParameter
    104     LoadParamDescription*    paramDesc;            //!< The LoadParameterDescription of this LoadParameter
    105     const TiXmlElement*      loadElem;             //!< The Element to load.
    106     const void*              pointerToParam;       //!< A Pointer to a Parameter.
     101  CLoadParam& defaultValues(const MultiType& value0 = MT_NULL, const MultiType& value1 = MT_NULL,
     102                            const MultiType& value2 = MT_NULL, const MultiType& value3 = MT_NULL,
     103                            const MultiType& value4 = MT_NULL);
     104  CLoadParam& describe(const std::string& descriptionText) { LoadParamBase::describe(descriptionText); return *this; };
     105  //     CLoadParam& attribute(const std::string& attributeName, const Executor<SubString>& executor);
    107106
    108     MultiType*               defaultValue;
     107
     108private:
     109  Executor<const SubString>*         executor;
    109110};
    110111
  • branches/new_class_id/src/lib/util/loading/load_param_description.h

    r7221 r9727  
    5757class LoadClassDescription
    5858{
    59   friend class CLoadParam;
     59  friend class LoadParamBase;
    6060public:
    6161  LoadClassDescription(const std::string& className);
  • branches/new_class_id/src/lib/util/loading/load_param_xml.cc

    r9726 r9727  
    1616#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_LOADING
    1717
    18 #include "util/loading/load_param.h"
     18#include "util/loading/load_param_xml.h"
    1919#include "load_param_description.h"
    2020
    21 #include <stdarg.h>
    22 
    23 /**
    24  * Constructs a new LoadParameter
    25  * @param root the XML-element to load this Parameter from
    26  * @param paramName the Parameter to load
    27  * @param object the BaseObject, to load this parameter on to (will be cast to executor's Parameter)
    28  * @param executor the Executor, that executes the loading procedure.
    29  */
    30 CLoadParam::CLoadParam(const TiXmlElement* root, const std::string& paramName, BaseObject* object, Executor* executor, bool inLoadCycle)
    31   :  object(object), paramName(paramName)
     21XmlLoadParam::XmlLoadParam(const TiXmlElement* root, const std::string& paramName, BaseObject* object, Executor<const TiXmlElement*>* executor, bool inLoadCycle )
     22    : LoadParamBase(root, paramName, object, inLoadCycle)
    3223{
    33   this->inLoadCycle = inLoadCycle;
    34 
    35   // determin the LoadString.
    36   if (likely(!inLoadCycle))
    37     this->loadElem = grabParameterElement(root, paramName);
    38   else if (paramName == root->Value())
    39     this->loadElem = (TiXmlElement*)root->FirstChild();
    40   else
    41     this->loadElem = NULL;
    42 
    43   // set the Executor.
    4424  this->executor = executor;
    45 
    46   //if (this->executor)
    47   //  this->executor->setName(paramName);
    48 }
    49 
    50 /**
    51  * This is a VERY SPECIAL deconsrtuctor.
    52  * It is made, so that it loads the Parameters on destruction.
    53  * meaning, if an Executor a valid Object exist, and all
    54  * Execution-Conditions are met, they are executed here.
    55  */
    56 CLoadParam::~CLoadParam()
    57 {
    58   if (likely(this->executor != NULL))
    59   {
    60     std::string loadString = "";
    61     if (this->loadElem != NULL &&  this->loadElem->ToText())
    62       loadString = this->loadElem->Value();
    63     if (likely(this->object != NULL) &&
    64         ( !loadString.empty() ||
    65           ((this->executor->getType() & Executor_NoLoadString) == Executor_NoLoadString)))
    66     {
    67       PRINTF(4)("Loading value '%s' with Parameters '%s' onto: %s::%s\n", this->paramName.c_str(), loadString.c_str(), this->object->getClassCName(), this->object->getCName());
    68       (*this->executor)(this->object, SubString(loadString, ",", SubString::WhiteSpaces, false, '\\'));
    69     }
    70     delete this->executor;
    71   }
    72 }
    73 
    74 /**
    75  * @brief set the default values of the executor
    76  * @param value0 the first default value
    77  * @param value1 the second default value
    78  * @param value2 the third default value
    79  * @param value3 the fourth default value
    80  * @param value4 the fifth default value
    81  */
    82 CLoadParam& CLoadParam::defaultValues(const MultiType& value0, const MultiType& value1,
    83                                       const MultiType& value2, const MultiType& value3,
    84                                       const MultiType& value4)
    85 {
    86   assert(this->executor != NULL);
    87   this->executor->defaultValues(value0, value1, value2, value3, value4);
    88 
    89   return *this;
    9025}
    9126
    9227
     28XmlLoadParam::~XmlLoadParam()
     29{
     30  assert(this->object != NULL);
    9331
    94 /**
    95  * @param descriptionText The text to set as a description for this Parameter
    96  * @returns a pointer to itself.
    97 */
    98 CLoadParam& CLoadParam::describe(const std::string& descriptionText)
    99 {
    100   if (LoadClassDescription::parametersDescription && this->paramDesc && this->paramDesc->getDescription().empty())
    101   {
    102     this->paramDesc->setDescription(descriptionText);
    103   }
    104   return *this;
     32  (*this->executor)(this->object, this->loadElem);
     33
     34  delete this->executor;
    10535}
    106 
    107 // const LoadParamDescription* LoadParamDescription::getClass(const char* className)
    108 // {
    109 //   tIterator<LoadClassDescription>* iterator = LoadClassDescription::classList->getIterator();
    110 //   LoadClassDescription* enumClassDesc = iterator->firstElement();
    111 //   while (enumClassDesc)
    112 //   {
    113 //     if (!strcmp(enumClassDesc->className, classNameBegin, className))
    114 //     {
    115 //       delete iterator;
    116 //       return enumClassDesc;
    117 //     }
    118 //     enumClassDesc = iterator->nextElement();
    119 //   }
    120 //   delete iterator;
    121 //
    122 //   return NULL;
    123 // }
    124 
    125 
    126 
    127 
    128 /*
    129  * @param object The object this Parameter is loaded too.
    130  * @param root: the XML-element to load this option from.
    131  * @param paramName: The name of the parameter loaded.
    132  * @param paramCount: how many parameters this loading-function takes
    133  * @param multi: if false LoadParam assumes only one occurence of this parameter in root, if true it assumes multiple occurences.
    134  * @param ...: the parameter information (1. Parameter, 2. Default Value for the Parameter, ...)
    135 */
    136 /*LoadParam::LoadParam(const TiXmlElement* root, BaseObject* object, const char* paramName,
    137                              int paramCount, bool multi, const void* pointerToParam, ...)
    138 {
    139   this->setClassID(CL_LOAD_PARAM, "LoadParam");
    140   this->executor = NULL;
    141 
    142   this->loadString = NULL;
    143   this->pointerToParam = pointerToParam;
    144 
    145   if (paramCount == 0 || this->pointerToParam != NULL)
    146     this->loadString = "none";
    147   else
    148 {
    149       if (likely(!multi))
    150         this->loadString = grabParameter(root, paramName);
    151       else
    152 {
    153           if (!strcmp(root->Value(), paramName))
    154 {
    155               const TiXmlNode* val = root->FirstChild();
    156               if( val->ToText())
    157                 this->loadString = val->Value();
    158 }
    159 }
    160 }
    161 
    162   this->paramDesc = NULL;
    163   if (LoadClassDescription::parametersDescription)
    164 {
    165     // locating the class
    166     this->classDesc = LoadClassDescription::addClass(object->getClassCName());
    167 
    168     if ((this->paramDesc = this->classDesc->addParam(paramName)) != NULL)
    169 {
    170 
    171       this->paramDesc->paramCount = paramCount;
    172       this->paramDesc->types = new int[paramCount];
    173       this->paramDesc->defaultValues = new char*[paramCount];
    174 
    175       va_list types;
    176       va_start (types, pointerToParam);
    177       char defaultVal[512];
    178       for(int i = 0; i < paramCount; i++)
    179 {
    180         defaultVal[0] = '\0';
    181           // parameters parsed
    182         int tmpType = va_arg (types, int);
    183         this->paramDesc->types[i] = tmpType;
    184         switch (tmpType)
    185 {
    186   case MT_INT:
    187             sprintf(defaultVal, "%d", va_arg(types, int));
    188             break;
    189 //          case MT_LONG:
    190 //            sprintf(defaultVal, "%0.3f", va_arg(types, l_LONG_TYPE));
    191 //            break;
    192   case MT_FLOAT:
    193             sprintf(defaultVal, "%0.3f", va_arg(types, double));
    194             break;
    195   case MT_STRING:
    196             sprintf(defaultVal, "%s", va_arg(types, l_STRING_TYPE));
    197             break;
    198   case MT_EXT1:
    199             sprintf(defaultVal, "");
    200             break;
    201 }
    202         this->paramDesc->defaultValues[i] = new char[strlen(defaultVal)+1];
    203         strcpy(this->paramDesc->defaultValues[i], defaultVal);
    204 }
    205       va_end(types);
    206 
    207       int argCount = 0;
    208 }
    209 }
    210 }*/
    211 
    212 
    213 
    214 
    215 
    216 
    217 
    218 
    219 
    220 
    221 //////////////////////
    222 // HELPER FUNCTIONS //
    223 //////////////////////
    224 /**
    225  * @param root: The XML-element to grab a parameter from
    226  * @param parameterName: the parameter to grab
    227  * @returns the Value of the parameter if found, NULL otherwise
    228 */
    229 std::string grabParameter(const TiXmlElement* root, const std::string& parameterName)
    230 {
    231   const TiXmlElement* element;
    232   const TiXmlNode* node;
    233 
    234   if (root == NULL)
    235     return "";
    236 
    237   element = root->FirstChildElement( parameterName);
    238   if( element == NULL) return "";
    239 
    240   node = element->FirstChild();
    241   while( node != NULL)
    242   {
    243     if( node->ToText()) return node->Value();
    244     node = node->NextSibling();
    245   }
    246   return "";
    247 }
    248 
    249 /**
    250  * @param root: The XML-element to grab a parameter from
    251  * @param parameterName: the parameter to grab
    252  * @returns the Element of the parameter if found, NULL otherwise
    253  */
    254 const TiXmlElement* grabParameterElement(const TiXmlElement* root, const std::string& parameterName)
    255 {
    256   const TiXmlElement* element;
    257   const TiXmlNode* node;
    258 
    259   if (root == NULL)
    260     return NULL;
    261 
    262   element = root->FirstChildElement( parameterName);
    263   if( element == NULL) return NULL;
    264 
    265   node = element->FirstChild();
    266   while( node != NULL)
    267   {
    268     if( node->ToText()) return (TiXmlElement*)node;
    269     node = node->NextSibling();
    270   }
    271   return NULL;
    272 }
    273 
    274 
    275 
  • branches/new_class_id/src/lib/util/loading/load_param_xml.h

    r9726 r9727  
    1515
    1616/*!
    17  * @file load_param.h
    18  * A Class and macro-functions, that makes our lives easy to load-in parameters
     17 * @file load_param_xml.h
     18 * A Class and macro-functions, that makes our lives easy to load-in parameters from XML
    1919 */
    2020
    21 #ifndef _LOAD_PARAM_H
    22 #define _LOAD_PARAM_H
     21#ifndef _LOAD_PARAM_XML_H
     22#define _LOAD_PARAM_XML_H
    2323
    24 #include "base_object.h"
    25 
    26 #include "executor/executor.h"
     24#include "load_param.h"
    2725#include "executor/executor_xml.h"
    2826
    29 // Forward Declaration //
    30 class LoadClassDescription;
    31 class LoadParamDescription;
    32 class MultiType;
    33 
    34 
    35 /**
    36  * Loads a Parameter from ROOT named PARAMETER_NAME
    37  * onto OBJECT of CLASS, trough the FUNCTION
    38  * @param ROOT the TiXmlElement to load the Parameter from
    39  * @param PARAMETER_NAME the Name of the Parameter to load
    40  * @param OBJECT The BaseObject to load the new setting to.
    41  * @param CLASS What Class the BaseObejct is of (this is for identifying the Functuon)
    42  * @param FUNCTION The function of Class to Load (if you want to call &CLASS::FUNCTION write FUNCTION here).
    43  */
    44 #define LoadParam(ROOT, PARAMETER_NAME, OBJECT, CLASS, FUNCTION) \
    45          CLoadParam(ROOT, PARAMETER_NAME, OBJECT, createExecutor<CLASS>(&CLASS::FUNCTION), false)
    46 
    47 #define LoadParam_CYCLE(ROOT, PARAMETER_NAME, OBJECT, CLASS, FUNCTION) \
    48          CLoadParam(ROOT, PARAMETER_NAME, OBJECT, createExecutor<CLASS>(&CLASS::FUNCTION), true)
    49 
    5027#define LoadParamXML(ROOT, PARAMETER_NAME, OBJECT, CLASS, FUNCTION) \
    51          CLoadParam(ROOT, PARAMETER_NAME, OBJECT, new ExecutorXML<CLASS>(&CLASS::FUNCTION, ROOT, PARAMETER_NAME), false)
     28         XmlLoadParam(ROOT, PARAMETER_NAME, OBJECT, new ExecutorXML<CLASS>(&CLASS::FUNCTION, ROOT, PARAMETER_NAME), false)
    5229
    5330#define LoadParamXML_CYCLE(ROOT, PARAMETER_NAME, OBJECT, CLASS, FUNCTION) \
    54          CLoadParam(ROOT, PARAMETER_NAME, OBJECT, new ExecutorXML<CLASS>(&CLASS::FUNCTION, ROOT, PARAMETER_NAME), true)
     31         XmlLoadParam(ROOT, PARAMETER_NAME, OBJECT, new ExecutorXML<CLASS>(&CLASS::FUNCTION, ROOT, PARAMETER_NAME), true)
    5532
    56 
    57 /**
    58  * this Starts a Cycle in the Loading Process
    59  * be aware, that in the cycle the first parameter of load_param should because
    60  * called element, and that you must say true at the Fith parameter, or it will fail
    61  * also you will have to close the Cycle again with LOAD_PARAM_END_CYCLE
    62  *
    63  * @param ROOT The root XLM-element to search element under.
    64  * @param ELEMENT the element to search
    65  */
    66 #define LOAD_PARAM_START_CYCLE(ROOT, ELEMENT) \
    67   const TiXmlElement* ELEMENT; \
    68   ELEMENT= ROOT->FirstChildElement(); \
    69   while( ELEMENT != NULL) \
    70 {
    71 /**
    72    * closes a LoadParam Loop
    73    * @see LOAD_PARAM_START_CYCLE
    74    * @param ELEMENT the Element to step through.
    75  */
    76 #define LOAD_PARAM_END_CYCLE(ELEMENT) \
    77   ELEMENT = ELEMENT->NextSiblingElement(); \
    78 }
    79 
    80 /**************************
    81 **** REAL DECLARATIONS ****
    82 **************************/
    83 //! abstract Base class for a Loadable parameter
    84 class CLoadParam : public BaseObject
     33class XmlLoadParam : public LoadParamBase
    8534{
    8635  public:
    87     CLoadParam(const TiXmlElement* root, const std::string& paramName, BaseObject* object, Executor* executor, bool inLoadCycle = false);
    88     virtual ~CLoadParam();
     36    XmlLoadParam(const TiXmlElement* root, const std::string& paramName, BaseObject* object, Executor<const TiXmlElement*>* executor, bool inLoadCycle = false);
     37    virtual ~XmlLoadParam();
    8938
    90     CLoadParam& describe(const std::string& descriptionText);
    91     CLoadParam& defaultValues(const MultiType& value0 = MT_NULL, const MultiType& value1 = MT_NULL,
    92                               const MultiType& value2 = MT_NULL, const MultiType& value3 = MT_NULL,
    93                               const MultiType& value4 = MT_NULL);
    94     CLoadParam& attribute(const std::string& attributeName, const Executor& executor);
    95 
     39    XmlLoadParam& describe(const std::string& descriptionText) { LoadParamBase::describe(descriptionText); return *this; };
    9640
    9741  private:
    98     bool                     inLoadCycle;
    99     Executor*                executor;
    100     BaseObject*              object;
    101     const std::string        paramName;
    102 
    103     LoadClassDescription*    classDesc;            //!< The LoadClassDescription of this CLoadParameter
    104     LoadParamDescription*    paramDesc;            //!< The LoadParameterDescription of this LoadParameter
    105     const TiXmlElement*      loadElem;             //!< The Element to load.
    106     const void*              pointerToParam;       //!< A Pointer to a Parameter.
    107 
    108     MultiType*               defaultValue;
     42    Executor<const TiXmlElement*>*    executor;
    10943};
    11044
    111 // helper function
    112 
    113 std::string grabParameter(const TiXmlElement* root, const std::string& parameterName);
    114 const TiXmlElement* grabParameterElement(const TiXmlElement* root, const std::string& parameterName);
    115 
    116 #endif /* _LOAD_PARAM_H */
     45#endif /* _LOAD_PARAM_XML_H */
  • branches/new_class_id/src/story_entities/campaign.cc

    r9715 r9727  
    2424
    2525#include "campaign_data.h"
     26#include "debug.h"
    2627
    2728
  • branches/new_class_id/src/story_entities/campaign_data.cc

    r9715 r9727  
    1818
    1919#include "util/loading/factory.h"
    20 #include "util/loading/load_param.h"
     20#include "util/loading/load_param_xml.h"
    2121
    2222#include "story_entity.h"
    2323
     24#include "debug.h"
    2425
    2526
  • branches/new_class_id/src/story_entities/game_world.cc

    r9723 r9727  
    3838
    3939#include "util/loading/factory.h"
    40 #include "util/loading/load_param.h"
     40#include "util/loading/load_param_xml.h"
    4141#include "loading/fast_factory.h"
    4242#include "shell_command.h"
     
    415415    if (currentFrame - this->lastFrame < .01)
    416416    {
    417       SDL_Delay((int)1000.0 * (0.01 - (currentFrame - lastFrame)));
     417      SDL_Delay((int)(1000.0 * (0.01 - (currentFrame - lastFrame))));
    418418      currentFrame = Timer::getNow();
    419419    }
  • branches/new_class_id/src/story_entities/game_world_data.cc

    r9715 r9727  
    4141#include "util/loading/factory.h"
    4242#include "loading/fast_factory.h"
    43 #include "util/loading/load_param.h"
     43#include "util/loading/load_param_xml.h"
    4444
    4545#include "graphics_engine.h"
     
    193193ErrorMessage GameWorldData::loadWorldEntities(const TiXmlElement* root)
    194194{
    195 
    196195  const TiXmlElement* element = root->FirstChildElement("WorldEntities");
    197196  bool mouseCaptured = EventHandler::getInstance()->grabbedEvents();
  • branches/new_class_id/src/story_entities/single_player_world.cc

    r9716 r9727  
    2020
    2121#include "state.h"
     22#include "debug.h"
    2223
    2324#include "util/loading/load_param.h"
  • branches/new_class_id/src/story_entities/story_entity.cc

    r9715 r9727  
    2525#include "util/loading/resource_manager.h"
    2626
    27 
     27#include "debug.h"
    2828
    2929ObjectListDefinition(StoryEntity);
     
    102102void StoryEntity::setLoadFile(const std::string& fileName)
    103103{
     104  printf("===Testing %s:: %s\n", this->getCName(), fileName.c_str());
    104105  if (File(fileName).isFile())
    105106  {
  • branches/new_class_id/src/util/game_rules.cc

    r9715 r9727  
    1717#include "game_rules.h"
    1818
    19 #include "util/loading/load_param.h"
     19#include "util/loading/load_param_xml.h"
    2020#include "util/loading/factory.h"
    2121
  • branches/new_class_id/src/world_entities/bsp_entity.cc

    r9716 r9727  
    1717#include "util/loading/resource_manager.h"
    1818#include "util/loading/resource_manager.h"
     19
     20#include "debug.h"
    1921
    2022#include "class_id_DEPRECATED.h"
  • branches/new_class_id/src/world_entities/npcs/network_turret.cc

    r9716 r9727  
    3030
    3131#include "weapons/aiming_turret.h"
     32#include "debug.h"
    3233
    3334#include "class_id_DEPRECATED.h"
  • branches/new_class_id/src/world_entities/planet.cc

    r9716 r9727  
    3030#include "primitive_model.h"
    3131
    32 
     32#include "debug.h"
    3333
    3434#include "class_id_DEPRECATED.h"
  • branches/new_class_id/src/world_entities/power_ups/power_up.cc

    r9715 r9727  
    2424#include "util/loading/load_param.h"
    2525
     26#include "debug.h"
    2627
    2728ObjectListDefinition(PowerUp);
  • branches/new_class_id/src/world_entities/power_ups/weapon_power_up.cc

    r9716 r9727  
    2525#include "util/loading/factory.h"
    2626#include "util/loading/load_param.h"
    27 
     27#include "debug.h"
    2828
    2929#include "class_id_DEPRECATED.h"
  • branches/new_class_id/src/world_entities/recorder.cc

    r9716 r9727  
    2020#include "util/loading/resource_manager.h"
    2121#include "state.h"
    22 
     22#include "debug.h"
    2323
    2424#include "class_id_DEPRECATED.h"
  • branches/new_class_id/src/world_entities/skybox.cc

    r9716 r9727  
    2929#include "util/loading/resource_manager.h"
    3030
    31 
     31#include "debug.h"
    3232
    3333#include "class_id_DEPRECATED.h"
  • branches/new_class_id/src/world_entities/skydome.cc

    r9715 r9727  
    2424#include "converter.h"
    2525#include "util/loading/resource_manager.h"
     26
     27#include "debug.h"
    2628
    2729#define DTOR (PI/180.0f)
  • branches/new_class_id/src/world_entities/terrain.cc

    r9716 r9727  
    3232
    3333#include "state.h"
    34 
     34#include "debug.h"
    3535
    3636#include "class_id_DEPRECATED.h"
  • branches/new_class_id/src/world_entities/weapons/aiming_system.cc

    r9715 r9727  
    2121
    2222#include "state.h"
     23#include "debug.h"
    2324
    2425#include "aabb.h"
    2526#include "obb_tree.h"
    26 
    27 #include <vector>
    28 
    2927
    3028
  • branches/new_class_id/src/world_entities/weapons/weapon_manager.cc

    r9715 r9727  
    2525#include "playable.h"
    2626
    27 #include "util/loading/load_param.h"
     27#include "util/loading/load_param_xml.h"
    2828#include "util/loading/factory.h"
    2929
  • branches/new_class_id/src/world_entities/world_entity.cc

    r9722 r9727  
    3939#include "game_rules.h"
    4040#include "kill.h"
     41#include "debug.h"
    4142
    4243
Note: See TracChangeset for help on using the changeset viewer.