- Timestamp:
- Jun 3, 2006, 6:56:18 PM (19 years ago)
- Location:
- branches/script_engine/src/lib/script_engine
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/script_engine/src/lib/script_engine/script.cc
r8085 r8131 29 29 30 30 if(currentFile.length() != 0) 31 { 31 { 32 32 printf("Could not load %s because an other file is already loaded: %s\n",filename.c_str(), currentFile.c_str()); 33 33 return false; … … 216 216 } 217 217 218 void Script::getReturnedString(std::string& string) 219 { 220 char* returnValue; 221 if(returnCount > 0) 222 { 223 if(lua_istring(luaState, -1)) 224 { 225 returnValue = lua_tostring(luaState, -1); 226 returnCount--; 227 lua_pop(luaState,1); 228 } 229 } 230 string.assign(returnValue); 231 } 232 218 233 int Script::reportError(int error) 219 234 { -
branches/script_engine/src/lib/script_engine/script.h
r8104 r8131 31 31 bool getReturnedBool(); 32 32 float getReturnedFloat(); 33 void getReturnedString(std::string string); 33 34 34 35 35 36 private: 36 37 37 int reportError(int error); 38 int reportError(int error); //!< Get errormessage from the lua stack and print it. 38 39 39 40 lua_State* luaState; //!< The lua_State that the Script works on -
branches/script_engine/src/lib/script_engine/script_manager.cc
r8093 r8131 6 6 7 7 8 9 ScriptManager::ScriptManager() 8 ScriptManager::ScriptManager(std::string world) 10 9 { 11 this->init( );10 this->init(world); 12 11 13 12 } … … 19 18 } 20 19 20 //!< Fills the worldObject list 21 21 22 void ScriptManager::init( )22 void ScriptManager::init(std::string world) 23 23 { 24 24 … … 30 30 void ScriptManager::loadParams(const TiXmlElement* root) 31 31 { 32 //BaseObject::loadParams(root); 33 32 34 33 35 } 34 36 37 38 void ScriptManager::tick(float timestep) 39 { 40 } 41 42 void ScriptManager::changeWorld(std::string newWorld) 43 { 44 } 45 46 47 void Script::Manager::initScripts() 48 { 49 } 50 51 -
branches/script_engine/src/lib/script_engine/script_manager.h
r8093 r8131 2 2 #define _SCRIPT_MNAGER_H 3 3 4 4 #include <list> 5 5 #include <string> 6 6 7 #include "script.h" 7 8 #include "base_object.h" 8 9 #include "luaincl.h" … … 10 11 11 12 13 //!< Contains the names of all objects in a world and a list of all script files that need the object. 14 struct worldObject 15 { 16 std::string name; 17 std::list<std::string> scriptFiles; 18 }; 12 19 13 20 class ScriptManager //: public BaseObject 14 21 { 15 22 public: 16 ScriptManager( );23 ScriptManager(std::string world) 17 24 virtual ~ScriptManager(); 18 25 19 26 virtual void loadParams(const TiXmlElement* root); 20 27 28 virtual void tick(float timestep); 29 30 void changeWorld(std::string newWorld); 31 32 33 void initScripts(); // initializes all scripts 21 34 22 35 private: 23 void init(); 36 void init(std::string world); 37 38 std::list<scriptableObject> objectList; //!< The list of all Objects in a world (read from the *.oxw file of the world) 39 std::string currentWorld; 24 40 25 41
Note: See TracChangeset
for help on using the changeset viewer.