Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9003 in orxonox.OLD for trunk/src/lib


Ignore:
Timestamp:
Jul 2, 2006, 1:36:13 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the single_player_map branche back
merged with command:
svn merge -r8896:HEAD https://svn.orxonox.net/orxonox/branches/single_player_map .
no conflicts

Location:
trunk/src/lib
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/collision_reaction/cr_physics_ground_walk.cc

    r8894 r9003  
    2323#include "world_entity.h"
    2424#include "cr_physics_ground_walk.h"
     25#include "collision_reaction.h"
    2526
    2627#include <vector>
     
    5859void CRPhysicsGroundWalk::reactToCollision(Collision* collision)
    5960{
    60   CollisionEvent* ce = collision->getCollisionEvents().front();
    61   Vector normal = ce->getGroundNormal();
    62   // normal.normalize();
    63 
    64   // put it back
    65   //   PRINTF(0)("putting it back to lastPos: \n");
    66   //   this->lastPositions[0].debug();
    67   //   PRINTF(0)("current pos:\n");
    68   //   collision->getEntityB()->getAbsCoor().debug();
    69 
    70   float height;
     61
    7162  AABB* box = collision->getEntityB()->getModelAABB();
    7263  WorldEntity* entity = collision->getEntityB();
    73 
    74   // collision position maths
    75   Vector collPos =  collision->getEntityB()->getAbsCoor()  + box->center - ce->getCollisionPosition();
    76 
    77   float CR_MAX_WALK_HEIGHT = 2.0f;
    78   float CR_THRESHOLD = 0.2f;
    7964
    8065  if( box == NULL)
     
    8570
    8671
    87   switch( ce->getType())
     72  float CR_MAX_WALK_HEIGHT = 2.0f;
     73  float CR_THRESHOLD = 0.2f;
     74
     75  float height = 0;
     76  float front = 0;
     77  float side = 0;
     78
     79  //PRINTF(0)("collision raction======================================\n");
     80
     81  const std::vector<CollisionEvent*>* collisionEvents = &(collision->getCollisionEvents());
     82  std::vector<CollisionEvent*>::const_iterator it = collisionEvents->begin();
     83  for(; it != collisionEvents->end(); it++)
    8884  {
    89     case COLLISION_TYPE_AXIS_Y:
    90 
    91       height = collPos.y - box->halfLength[1];
    92      // PRINTF(0)("height: %f          , model height: %f\n", height, box->halfLength[1]);
    93      // PRINTF(0)(" ground normal: %f, %f, %f\n", normal.x, normal.y, normal.z);
    94 
    95       // object is beneath the plane (ground)
    96       if( height <= 0.0f )
    97       {
    98         entity->shiftCoor(Vector(0, -height, 0));
    99       }
    100       // object is already in the wall
    101       else if( ce->isInWall())
    102       {
    103         entity->setAbsCoor(entity->getLastAbsCoor());
    104       }
    105       break;
    106 
    107 
    108     case COLLISION_TYPE_AXIS_X:
    109     case COLLISION_TYPE_AXIS_Z:
    110       break;
    111 
    112     }
    113 
    114 
     85
     86    CollisionEvent* ce = (*it);
     87    Vector normal = ce->getGroundNormal();
     88
     89    // calculate the collision position
     90    Vector collPos =  collision->getEntityB()->getAbsCoor()  + box->center - ce->getCollisionPosition();
     91
     92    // test the 3 axis differently
     93    switch( ce->getType())
     94    {
     95        // collision in the x-axis
     96      case COLLISION_TYPE_AXIS_X:
     97        front = collPos.x - box->halfLength[0]; // should be [0]
     98
     99        // object is beneath the plane (ground)
     100        if( front <= 0.0f )
     101        {
     102          Vector backoff = entity->getAbsDirX() * front;
     103//           entity->shiftCoor(backoff);
     104        }
     105        // object is already in the wall
     106        else if( ce->isInWall())
     107        {
     108//           entity->setAbsCoor(entity->getLastAbsCoor());
     109        }
     110        break;
     111
     112
     113        // collision in the y-axis
     114      case COLLISION_TYPE_AXIS_Y:
     115        // calulate the height above ground
     116        height = collPos.y - box->halfLength[1];
     117
     118
     119        // object is beneath the plane (ground)
     120        if( height <= 0.0f )
     121        {
     122          entity->shiftCoor(Vector(0.0f, -height, 0.0f));
     123          entity->setOnGround(true);
     124        }
     125        // object is already in the wall
     126        else if( ce->isInWall())
     127        {
     128          entity->setAbsCoor(entity->getLastAbsCoor());
     129        }
     130        else
     131        {
     132          // entity is not on ground
     133          entity->setOnGround(false);
     134        }
     135        break;
     136
     137
     138        // collision in the z-axis
     139      case COLLISION_TYPE_AXIS_Z:
     140
     141        side = collPos.z - box->halfLength[2]; // should be [2]
     142
     143        // object is beneath the plane (ground)
     144        if( side <= 0.0f )
     145        {
     146          Vector backoff = entity->getAbsDirX() * side;
     147//           entity->shiftCoor(backoff);
     148        }
     149        // object is already in the wall
     150        else if( ce->isInWall())
     151        {
     152//           entity->setAbsCoor(entity->getLastAbsCoor());
     153        }
     154        break;
     155    }
     156  }
     157  //PRINTF(0)("collision distances: x: %f, y: %f, z: %f\n", front, height, side);
    115158
    116159
     
    126169
    127170
    128   if( box != NULL) {
    129 
    130 
    131     if(ce->getCollisionPosition().x <= 0.9 && ce->getGroundNormal().len() <= 1.4f) {
     171  if( box != NULL)
     172  {
     173
     174
     175    if(ce->getCollisionPosition().x <= 0.9 && ce->getGroundNormal().len() <= 1.4f)
     176    {
    132177      collision->getEntityB()->setAbsCoor(collision->getEntityB()->getLastAbsCoor());
    133178      return;
    134179    }
    135     if(ce->getCollisionPosition().z <= 0.9 && ce->getGroundNormal().len() <= 1.4f) {
     180    if(ce->getCollisionPosition().z <= 0.9 && ce->getGroundNormal().len() <= 1.4f)
     181    {
    136182      collision->getEntityB()->setAbsCoor(collision->getEntityB()->getLastAbsCoor());
    137183      return;
    138184    }
    139185
    140     if(ce->getGroundNormal().len() <= 0.1f) {
     186    if(ce->getGroundNormal().len() <= 0.1f)
     187    {
    141188      collision->getEntityB()->setAbsCoor(collision->getEntityB()->getLastAbsCoor());
    142189      return;
     
    144191
    145192
    146     if(ce->getGroundNormal().len() >= 1.4f) {
     193    if(ce->getGroundNormal().len() >= 1.4f)
     194    {
    147195      downspeed++;
    148196      collision->getEntityB()->setAbsCoor(collision->getEntityB()->getAbsCoor() + Vector(0.0,-0.08*downspeed,0.0));
     
    164212
    165213    }
    166     else {
     214    else
     215    {
    167216      if(height.y <  box->halfLength[1] + 0.0f   /* && height.y  >  - 55.0f*/) // below ground
    168217      {
     
    194243 */
    195244void CRPhysicsGroundWalk::update(WorldEntity* owner)
    196 {
    197 
    198 }
    199 
    200 
     245{}
     246
     247
  • trunk/src/lib/graphics/importer/bsp_file.cc

    r8894 r9003  
    4646BspFile::BspFile()
    4747{}
     48
     49BspFile::~ BspFile()
     50{
     51  delete [] nodes;
     52  delete [] leaves;
     53  delete [] planes;
     54  delete [] bspModels;
     55  delete [] leafFaces;
     56  delete [] faces;
     57  delete [] leafBrushes;
     58  delete [] brushes;
     59  delete [] brushSides;
     60  delete [] vertice;
     61  delete [] meshverts;
     62  delete [] visData;
     63  delete [] textures;
     64  delete [] patchVertice;
     65  delete [] patchIndexes;
     66 // delete [] patchTrianglesPerRow;
     67  delete [] lightMaps;
     68 
     69  for(int i = 0; i < this->numPatches; ++i) delete this->VertexArrayModels[i];
     70 // delete  [] VertexArrayModels;
     71 
     72  for(int i = 0; i < this->numTextures; ++i)
     73  {
     74    delete this->Materials[i].mat;
     75    //delete this->Materials[i].aviMat;
     76  }
     77  delete [] this->Materials;
     78  //delete [] testSurf;
     79 
     80 
     81 
     82}
    4883
    4984/**
     
    294329    this->patchVertice = new char[8*8*44*(this->numPatches+10)];
    295330    this->patchIndexes = new char[7*8*2*4*(this->numPatches+10)];
    296     this->patchRowIndexes = new int*[7*4*this->numPatches];
     331 // this->patchRowIndexes = new int*[7*4*this->numPatches]; Not needed?
    297332    this->patchTrianglesPerRow = new char[7*4*this->numPatches];
    298333    this->VertexArrayModels  = new VertexArrayModel*[this->numPatches];
     
    464499
    465500    if(File(absFileName).exists()) {
    466       PRINTF(0)("BSP FILE: gefunden . \n");
     501      PRINTF(4)("BSP FILE: gefunden . \n");
    467502      this->Materials[i] = this->loadAVI(fileName);
    468503      continue;
     
    553588    }
    554589
    555     PRINTF(0)("BSP FILE: Textur %s nicht  gefunden . \n", &this->textures[8+72*i]);
     590    PRINTF(0)("BSP FILE: Texture %s not found.",&this->textures[8+ 72*i] );
    556591    //  Default Material
    557592    this->Materials[i].mat = new Material();
     
    10121047  Face->meshvert = patchOffset -sz;  //3*(patchOffset-sz)*level1*level1;
    10131048  Face->n_meshverts = sz;
    1014   PRINTF(4)("BSP FILE: sz: %i. \n", sz);
    1015   PRINTF(4)("BSP FILE: Face->meshvert %i . \n", Face->meshvert);
     1049  PRINTF(0)("BSP FILE: sz: %i. \n", sz);
     1050  PRINTF(0)("BSP FILE: Face->meshvert %i . \n", Face->meshvert);
    10161051
    10171052  //Face->n_meshverts = sz;
  • trunk/src/lib/graphics/importer/bsp_file.h

    r8490 r9003  
    151151public:
    152152  BspFile();
     153  ~BspFile();
    153154  int read(const char* name );
    154155  void build_tree();
     
    183184
    184185  int** patchRowIndexes;
    185   VertexArrayModel** VertexArrayModels;
     186  VertexArrayModel** VertexArrayModels; 
    186187  int patchOffset;
    187188
  • trunk/src/lib/graphics/importer/bsp_manager.cc

    r8894 r9003  
    11/*
    22   orxonox - the future of 3D-vertical-scrollers
    3  
     3
    44   Copyright (C) 2006 orx
    5  
     5
    66   This program is free software; you can redistribute it and/or modify
    77   it under the terms of the GNU General Public License as published by
    88   the Free Software Foundation; either version 2, or (at your option)
    99   any later version.
    10  
     10
    1111   ### File Specific:
    1212   main-programmer: bottac@ee.ethz.ch
    13  
     13
    1414   Inspired by:
    1515   Rendering Q3 Maps by Morgan McGuire                  http://graphics.cs.brown.edu/games/quake/quake3.html
    1616   Unofficial Quake 3 Map Specs by Kekoa Proudfoot      http://graphics.stanford.edu/~kekoa/q3/
    17  
     17
    1818   Collision detection adapted from:
    1919   Quake 3 Collision Detection by Nathan Ostgard        http://www.devmaster.net/articles/quake3collision/
     
    6969BspManager::BspManager(const TiXmlElement* root)
    7070{
    71  
    72  
     71
     72
    7373  if( root != NULL)
    7474    this->loadParams(root);
    75  
     75
    7676  CDEngine::getInstance()->setBSPModel(this);
    7777} */
    7878
    79 void BspManager::load(const char* fileName, float scale)
     79BspManager::~BspManager()
     80{
     81  if(this->bspFile)
     82    delete this->bspFile;
     83}
     84
     85int BspManager::load(const char* fileName, float scale)
    8086{
    8187  // open a BSP file
     88
     89
    8290  this->bspFile = new BspFile();
    8391  this->bspFile->scale =  scale;
    84   this->bspFile->read(ResourceManager::getFullName(fileName).c_str());
     92  if(this->bspFile->read(ResourceManager::getFullName(fileName).c_str()) == -1)
     93    return -1;
     94
    8595  this->bspFile->build_tree();
    8696  this->root  = this->bspFile->get_root();
     
    8898
    8999  this->outputFraction = 1.0f;
     100
     101  return 0;
    90102}
    91103/*
     
    99111  this->root  = this->bspFile->get_root();
    100112  this->alreadyVisible = new bool [this->bspFile->numFaces];
    101  
     113
    102114  CDEngine::getInstance()->setBSPModel(this);
    103115}
     
    962974  Vector dest = worldEntity->getAbsCoor() - upDir*40.0f; //
    963975  Vector dest1 = position + forwardDir*4.0f;
    964   Vector dest2 = position2 + forwardDir;
     976  Vector dest2 = position2 + forwardDir*4.0;
    965977  dest = position - Vector(0.0, 40.0,0.0);
    966978  Vector out = dest;
     
    974986
    975987  if( box != NULL) {
    976     position = worldEntity->getAbsCoor() +  box->center; // + box->axis[1] * box->halfLength[1];
    977     dest     = worldEntity->getAbsCoor() +  box->center - box->axis[1] * box->halfLength[1] * 40.0;
    978 
    979     position1 = worldEntity->getAbsCoor() +  box->center + box->axis[0] * box->halfLength[0] * 2.0f;
    980     dest1     = worldEntity->getAbsCoor() +  box->center - box->axis[0] * box->halfLength[0] *2.0f;
    981 
    982 
    983     position2 = worldEntity->getAbsCoor() +  box->center + box->axis[2] * box->halfLength[2] * 2.0f;
    984     dest2     = worldEntity->getAbsCoor() +  box->center - box->axis[2] * box->halfLength[2] * 2.0f;
     988    position = worldEntity->getAbsCoor() +  box->center + Vector(0.0, 1.0, 0.0) * box->halfLength[1];
     989    dest     = worldEntity->getAbsCoor() +  box->center - Vector(0.0, 1.0, 0.0) * (box->halfLength[1] + BSP_Y_OFFSET);
     990
     991    position1 = worldEntity->getAbsCoor() +  box->center - worldEntity->getAbsDirX() * (box->halfLength[0]  + BSP_X_OFFSET);
     992    dest1     = worldEntity->getAbsCoor() +  box->center + worldEntity->getAbsDirX() * (box->halfLength[0]  + BSP_X_OFFSET);
     993
     994    position2 = worldEntity->getAbsCoor() +  box->center - worldEntity->getAbsDirZ() * (box->halfLength[2]  + BSP_Z_OFFSET);
     995    dest2     = worldEntity->getAbsCoor() +  box->center + worldEntity->getAbsDirZ() * (box->halfLength[2]  + BSP_Z_OFFSET);
    985996
    986997  } else {
     
    9891000  }
    9901001
     1002
     1003//   PRINTF(0)("x and v\n");
     1004//   worldEntity->getAbsDirX().debug();
     1005//   worldEntity->getAbsDirV().debug();
    9911006
    9921007
     
    10351050  plane* testPlane = this->collPlane;
    10361051
    1037 
    10381052  bool xCollision = false;
    10391053  bool zCollision = false;
    1040   if(!SolidFlag) {
     1054
    10411055
    10421056    // 2nd Collision Detection
     
    10481062    this->checkCollisionRayN(this->root,0.0f,1.0f, &position1, &dest1 );
    10491063
    1050     if(!this->outputAllSolid != 1.0f) {
     1064    if(this->outputFraction < 1.0f) {
    10511065      out.x = dest1.x + (dest1.x -position1.x) * this->outputFraction;
     1066      dest1 = position1 + (dest1 -position1) * this->outputFraction;
    10521067      xCollision = true;
    10531068      testPlane = this->collPlane;
    10541069    }
    1055     if(this->outputAllSolid) {
     1070    if(this->outputAllSolid ) {
     1071
     1072      this->collPlane = new plane;
     1073      this->collPlane->x = 0.0f;
     1074      this->collPlane->y = 0.0f;
     1075      this->collPlane->z = 0.0f;
     1076      testPlane = this->collPlane;
    10561077      SolidFlag = true;
    1057       xCollision = true; 
     1078      xCollision = true;
    10581079    }
    10591080    //out.z = this->outputFraction;
    10601081
    1061     if(!SolidFlag) {
     1082
    10621083
    10631084      // 3rd Collision Detection
     
    10671088      this->inputStart =  position2;
    10681089      this->inputEnd =   dest2;
     1090
    10691091      this->checkCollisionRayN(this->root,0.0f,1.0f, &position2, &dest2 );
    10701092      //out.x = this->outputFraction;
    10711093
    1072       if(this->outputFraction != 1.0f ) {
     1094      if(this->outputFraction < 1.0f ) {
    10731095        out.z = out.z = dest2.z + (dest2.z -position2.z) * this->outputFraction;
     1096        dest2 = position2 + (dest2 -position2) * this->outputFraction;
    10741097        zCollision = true;
    10751098        testPlane = this->collPlane;
    10761099
    10771100      }
    1078       if(this->outputAllSolid) {
    1079           SolidFlag = true;
    1080           zCollision = true;   
     1101      if(this->outputAllSolid ) {
     1102        this->collPlane = new plane;
     1103        this->collPlane->x = 0.0f;
     1104        this->collPlane->y = 0.0f;
     1105        this->collPlane->z = 0.0f;
     1106        testPlane = this->collPlane;
     1107
     1108        SolidFlag = true;
     1109        zCollision = true;
    10811110      }
    1082     }
    1083   }//end if
     1111
     1112  //end if
    10841113  /*
    10851114  This is how you would calculate the Coordinates where worldEntity Collided with the BSP world.
     
    10911120  // Return the normal here: Normal's stored in this->collPlane;
    10921121  if( collision) {
    1093     PRINTF(5)("We got a collision!! Are you sure: outputFraction = %f\n", this->outputFraction);
    1094     worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y || (xCollision ? COLLISION_TYPE_AXIS_X :0) | (zCollision ? COLLISION_TYPE_AXIS_Z :0), this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out, SolidFlag);
    1095   } else {
    1096     if(xCollision || zCollision) {
    1097 
    1098       worldEntity->registerCollision((xCollision ? COLLISION_TYPE_AXIS_X :0) | (zCollision ? COLLISION_TYPE_AXIS_Z :0) , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out, SolidFlag);
    1099     }
    1100 
    1101   }
     1122    worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out, SolidFlag);
     1123}
     1124  if(xCollision) {
     1125    worldEntity->registerCollision(COLLISION_TYPE_AXIS_X , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z),dest1 , SolidFlag);
     1126  }
     1127  if(zCollision) {
     1128    worldEntity->registerCollision(COLLISION_TYPE_AXIS_Z , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), dest2 , SolidFlag);
     1129  }
     1130
     1131
    11021132  //else  worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y, this->parent, worldEntity, Vector(0.0, 2.0, 0.0), dest, false);
    11031133
  • trunk/src/lib/graphics/importer/bsp_manager.h

    r8724 r9003  
    2828
    2929
     30#define BSP_X_OFFSET 20.0f
     31#define BSP_Y_OFFSET 40.0f
     32#define BSP_Z_OFFSET 20.0f
     33
    3034
    3135// FORWARD DECLARATIONS
     
    4145class WorldEntity;
    4246
     47
     48// Obsolete
    4349struct BspCollisionEvent
    4450{
     
    5460
    5561  BspManager(const char* fileName, float scale = 0.4f);
    56   void load(const char* fileName, float scale);
     62
     63  // Deconstructor
     64  ~BspManager();
     65
     66
    5767
    5868  // Functions
     69  int load(const char* fileName, float scale);
    5970  const void draw();
    6071  const void tick(float time);
     
    99110  Vector inputStart;
    100111  Vector inputEnd;
    101  
     112
    102113  Vector traceMins; //!< Mins of current bbox
    103114  Vector traceMaxs; //!< Maxs of current bbox
     
    112123  ::std::deque<int> opal; //!< the others here.
    113124
    114   Vector out;  //!< For debugging only
     125  Vector out;  //!< Stores collision coordinates
    115126  Vector out1; //!< For debugging only
    116127  Vector out2; //!< For debugging only
    117                        
     128
    118129  int tgl;
    119130};
  • trunk/src/lib/graphics/importer/interactive_model.h

    r8894 r9003  
    4040    virtual int getAnimation() = 0;
    4141
     42    virtual bool isAnimationFinished() { return false; }
     43
    4244    virtual void setAnimationSpeed(float speed) {}
    4345};
  • trunk/src/lib/graphics/importer/md2/md2Model.cc

    r8894 r9003  
    8585
    8686  this->scaleFactor = scale;
     87  this->animationSpeed = 1.0f;
    8788
    8889  shadeDots = MD2Model::anormsDots[0];
     
    103104  this->pModelInfo.pTexCoor = (float*)this->data->pTexCoor;
    104105
    105   this->animationSpeed = 1.0f;
    106106
    107107  // triangle conversion
  • trunk/src/lib/graphics/importer/md2/md2Model.h

    r8894 r9003  
    161161  inline int MD2Model::getAnimation() { return this->animationState.type; }
    162162  virtual void setAnimationSpeed(float speed) { this->animationSpeed = speed; }
     163  virtual bool isAnimationFinished() { return (this->animationState.currentFrame == this->animationState.endFrame )?true:false; }
    163164  /**  scales the current model @param scaleFactor: the factor [0..1] to use for scaling */
    164165  void scaleModel(float scaleFactor) { this->scaleFactor = scaleFactor;}
  • trunk/src/lib/script_engine/script.cc

    r8783 r9003  
    2424
    2525#include "class_list.h"
     26// uncommet this when the std:string and the const bug is fixed
     27//CREATE_SCRIPTABLE_CLASS(Script, CL_SCRIPT,
     28//                               addMethod("addObject", ExecutorLua2<Script,std::string,std::string>(&Script::addObject))
     29//                               ):
    2630
    2731Script::Script(const TiXmlElement* root)
     
    7377bool Script::loadFile(const std::string& filename)
    7478 {
    75 
     79   this->setName(filename);
    7680   std::string filedest(ResourceManager::getInstance()->getDataDir());
    7781   filedest += "scripts/" + filename;
     
    9397     {
    9498      currentFile = filename;
     99      //this->addThisScript();
    95100      return true;
    96101     }
     
    323328 }
    324329
     330
     331void Script::addThisScript()
     332{
     333  BaseObject* scriptClass = ClassList::getObject("Script", CL_SCRIPT_CLASS);
     334   if (scriptClass != NULL)
     335   {
     336     static_cast<ScriptClass*>(scriptClass)->registerClass(this);
     337     static_cast<ScriptClass*>(scriptClass)->insertObject(this, this,"thisscript", false);
     338   }
     339}
     340
    325341 int Script::reportError(int error)
    326342 {
  • trunk/src/lib/script_engine/script.h

    r8711 r9003  
    3131    void loadFileNoRet(const std::string& filename) { loadFile(filename); };
    3232    bool loadFile(const std::string& filename);
    33     void addObject(const std::string& className, const std::string& objectName);
     33    void addObject( const std::string& className,const std::string& objectName);
    3434
    3535    /// QUERRYING
     
    6161
    6262  private:
    63 
     63    void addThisScript();
    6464    int  reportError(int error);                      //!< Get errormessage from the lua stack and print it.
    6565    bool registerStandartClasses();                   //!< Register all the classes that the script might need
  • trunk/src/lib/script_engine/script_class.h

    r8408 r9003  
    3434  virtual void registerClass(Script* script) = 0;
    3535  virtual int insertObject(Script* L, BaseObject* obj, bool gc=false) = 0;
     36  virtual int insertObject(Script* L, BaseObject* obj, const std::string& name, bool gc=false) = 0;
    3637
    3738  const ScriptMethod* scriptMethods() const { return this->_scriptMethods; }
     
    6465    return Lunar<T>::insertObject(L, dynamic_cast<T*>(obj), obj->getName(), gc);
    6566  }
     67
     68  virtual int insertObject(Script* L, BaseObject* obj,const std::string& name, bool gc=false)
     69  {
     70    return Lunar<T>::insertObject(L, dynamic_cast<T*>(obj), name, gc);
     71  }
    6672};
    6773
  • trunk/src/lib/script_engine/script_manager.cc

    r8711 r9003  
    7474    while(!scripts->empty())
    7575      delete scripts->front();
     76  //Delete all triggers
     77  if(this->getTriggers())
     78    while(!triggers->empty())
     79      delete triggers->front();
     80 
    7681}
    7782
  • trunk/src/lib/util/executor/executor_lua.cc

    r8894 r9003  
    3737template<> void toLua<float>(lua_State* state, float value) { lua_pushnumber(state, (lua_Number) value); };
    3838template<> void toLua<char>(lua_State* state, char value) { lua_pushnumber(state, (lua_Number) value); };
    39 template<> void toLua<const std::string&>(lua_State* state, const std::string& value) {lua_pushstring (state, value.c_str()); }
     39template<> void toLua<const std::string&>(lua_State* state, const std::string& value) { lua_pushstring (state, value.c_str()); }
Note: See TracChangeset for help on using the changeset viewer.