Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


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

Continued working on script manager

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  
    2929
    3030   if(currentFile.length() != 0)
    31    { 
     31   {
    3232     printf("Could not load %s because an other file is already loaded: %s\n",filename.c_str(), currentFile.c_str());
    3333     return false;
     
    216216 }
    217217
     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
    218233 int Script::reportError(int error)
    219234 {
  • branches/script_engine/src/lib/script_engine/script.h

    r8104 r8131  
    3131    bool  getReturnedBool();
    3232    float getReturnedFloat();
     33    void getReturnedString(std::string string);
    3334
    3435
    3536  private:
    3637
    37     int reportError(int error);
     38    int reportError(int error);          //!< Get errormessage from the lua stack and print it.
    3839
    3940    lua_State*         luaState;         //!< The lua_State that the Script works on
  • branches/script_engine/src/lib/script_engine/script_manager.cc

    r8093 r8131  
    66
    77
    8 
    9 ScriptManager::ScriptManager()
     8ScriptManager::ScriptManager(std::string world)
    109{
    11   this->init();
     10  this->init(world);
    1211
    1312}
     
    1918}
    2019
     20//!< Fills the worldObject list
    2121
    22 void ScriptManager::init()
     22void ScriptManager::init(std::string world)
    2323{
    2424
     
    3030void ScriptManager::loadParams(const TiXmlElement* root)
    3131{
     32  //BaseObject::loadParams(root);
     33
    3234
    3335}
    3436
     37
     38void ScriptManager::tick(float timestep)
     39{
     40}
     41
     42void ScriptManager::changeWorld(std::string newWorld)
     43{
     44}
     45
     46
     47void Script::Manager::initScripts()
     48{
     49}
     50
     51
  • branches/script_engine/src/lib/script_engine/script_manager.h

    r8093 r8131  
    22#define _SCRIPT_MNAGER_H
    33
    4 
     4#include <list>
    55#include <string>
    66
     7#include "script.h"
    78#include "base_object.h"
    89#include "luaincl.h"
     
    1011
    1112
     13//!< Contains the names of all objects in a world and a list of all script files that need the object.
     14struct worldObject
     15{
     16  std::string name;
     17  std::list<std::string> scriptFiles;
     18};
    1219
    1320class ScriptManager //: public BaseObject
    1421{
    1522 public:
    16   ScriptManager();
     23  ScriptManager(std::string world)
    1724  virtual ~ScriptManager();
    1825
    1926  virtual void loadParams(const TiXmlElement* root);
    2027
     28  virtual void tick(float timestep);
     29
     30  void changeWorld(std::string newWorld);
     31
     32
     33  void initScripts(); // initializes all scripts
    2134
    2235 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;
    2440
    2541
Note: See TracChangeset for help on using the changeset viewer.