Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef AI_LUA_CORE_HPP
00017 #define AI_LUA_CORE_HPP
00018
00019 #include <boost/shared_ptr.hpp>
00020
00021 struct lua_State;
00022 class LuaKernel;
00023 class config;
00024
00025
00026
00027 namespace ai {
00028
00029 class engine_lua;
00030 class lua_object_base;
00031 typedef boost::shared_ptr<lua_object_base> lua_object_ptr;
00032
00033
00034
00035
00036 class lua_ai_context
00037 {
00038 private:
00039 lua_State *L;
00040 int num_;
00041 int side_;
00042 lua_ai_context(lua_State *l, int num, int side) : L(l), num_(num), side_(side)
00043 {
00044 }
00045 static lua_ai_context* create(lua_State *L, char const *code, engine_lua *engine);
00046 public:
00047 ~lua_ai_context();
00048 lua_ai_context()
00049 : L(NULL)
00050 , num_(0)
00051 , side_(0)
00052 {
00053 }
00054 void load();
00055 void get_persistent_data(config &) const;
00056 void set_persistent_data(const config &);
00057 static void init(lua_State *L);
00058 friend class ::LuaKernel;
00059 };
00060
00061
00062
00063
00064
00065 class lua_ai_action_handler
00066 {
00067 private:
00068 lua_State *L;
00069 lua_ai_context &context_;
00070 int num_;
00071 lua_ai_action_handler(lua_State *l, lua_ai_context &context, int num) : L(l), context_(context),num_(num)
00072 {
00073 }
00074 static lua_ai_action_handler* create(lua_State *L, char const *code, lua_ai_context &context);
00075 public:
00076 ~lua_ai_action_handler();
00077 void handle(config &, bool configOut, lua_object_ptr);
00078 friend class ::LuaKernel;
00079 };
00080
00081 }
00082
00083 #endif