Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8250 in orxonox.OLD for branches/script_engine/src


Ignore:
Timestamp:
Jun 8, 2006, 3:06:29 PM (18 years ago)
Author:
bensch
Message:

linking

Location:
branches/script_engine/src
Files:
3 edited
2 moved

Legend:

Unmodified
Added
Removed
  • branches/script_engine/src/defs/include_paths.am

    r8093 r8250  
    3737AM_CXXFLAGS+=-I$(MAINSRCDIR)/util/track
    3838AM_CXXFLAGS+=-I$(MAINSRCDIR)/subprojects
     39AM_CXXFLAGS+=-I$(MAINSRCDIR)/../extern_libs
  • branches/script_engine/src/lib/script_engine/Makefile.am

    r8246 r8250  
    1616                script_manager.cc\
    1717                script_class.cc\
    18                 account.cc\
     18                account.cc \
    1919                object.cc
    20                
     20
    2121
    2222AM_CPPFLAGS= @LUA_INCLUDES@
     
    2727                script_manager.h\
    2828                script_class.h
    29                
     29
    3030
    3131
  • branches/script_engine/src/lib/script_engine/account.cc

    r8248 r8250  
    1  
    2  
    3  
     1
     2
     3
    44#include <iostream>
    55
    66#include "luaincl.h"
     7#include "base_object.h"
     8#include "lunar.h"
     9
     10#include "script_class.h"
    711
    812
    9  
    1013 class Account : public BaseObject {
    1114      lua_Number m_balance;
     
    1518
    1619     Account(lua_State *L)      { m_balance = luaL_checknumber(L, 1); }
    17      Account(double balance=0)    : m_balance(balance) { }
     20     Account(double balance=0)    : m_balance(balance) { this->setClassID(CL_ACCOUNT, "Account"); }
    1821
    1922     void deposit (float value) { m_balance += value; };
     
    3538   {0,NULL}
    3639 };
    37  
    38 CREATE_SCRIPTABLE_CLASS(Account, CL_ACCOUNT)
     40
     41 CREATE_SCRIPTABLE_CLASS(Account, CL_ACCOUNT);
     42
  • branches/script_engine/src/lib/script_engine/object.cc

    r8248 r8250  
    22#include <iostream>
    33
    4 #include "luaincl.h"
     4#include "base_object.h"
     5#include "lunar.h"
    56
    6 
     7#include "script_class.h"
    78
    89
     
    4950   {0,0}
    5051 };
    51  
    52 CREATE_SCRIPTABLE_CLASS(Object, CL_TEST_OBJECT)
     52
     53 CREATE_SCRIPTABLE_CLASS(Object, CL_TEST_OBJECT);
  • branches/script_engine/src/lib/script_engine/script_class.h

    r8202 r8250  
    2828{
    2929
    30 public:
    31   ScriptClass(const std::string& name, ClassID classID);
    32   virtual ~ScriptClass();
     30  public:
     31    virtual ~ScriptClass();
    3332
    34   bool operator==(const std::string& name) { return (this->getName() == name); }
    35   bool operator==(ClassID classID) { return (this->classID == classID); }
    36  
    37   virtual void registerClass(Script* script) = 0;
    38   virtual int insertObject(Script* L, BaseObject* obj, const std::string& name, bool gc=false) = 0;
     33    bool operator==(const std::string& name) { return (this->getName() == name); }
     34    bool operator==(ClassID classID) { return (this->classID == classID); }
    3935
    40 private:
    41   ClassID             classID;
     36    virtual void registerClass(Script* script) = 0;
     37    virtual int insertObject(Script* L, BaseObject* obj, bool gc=false) = 0;
     38
     39  protected:
     40    ScriptClass(const std::string& name, ClassID classID);
     41
     42  private:
     43    ClassID             classID;
    4244};
    4345
     
    4850class tScriptable : public ScriptClass
    4951{
    50   tScriptable(const std::string& name, ClassID classID)
    51   : ScriptClass(name, classID)
    52   { }
     52  public:
     53    tScriptable(const std::string& name, ClassID classID)
     54        : ScriptClass(name, classID)
     55    { }
    5356
    54   virtual void registerClass(Script* script)
    55   {
    56     Lunar<T>::Register(script);
    57   }
    58   virtual int insertObject(Script* L, BaseObject* obj, bool gc=false)
    59   {
    60     Lunar<T>::insertObject(L, dynamic_cast<T*>(obj), obj->getName(), gc);
    61   }
    62  
     57    virtual void registerClass(Script* script)
     58    {
     59      Lunar<T>::Register(script);
     60    }
     61    virtual int insertObject(Script* L, BaseObject* obj, bool gc=false)
     62    {
     63      Lunar<T>::insertObject(L, dynamic_cast<T*>(obj), obj->getName(), gc);
     64    }
     65
    6366
    6467
Note: See TracChangeset for help on using the changeset viewer.