Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 4, 2006, 2:24:40 PM (18 years ago)
Author:
patrick
Message:

removed many very heavy segfaults

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/coll_rect/src/lib/collision_reaction/cr_engine.cc

    r10000 r10006  
    6666      PRINTF(0)("CollisionReaction Error: CollisionEvent cache size missmatch: %i of %i\n", this->collisionEventsUnused.size(), CR_MAX_COLLISION_EVENTS);
    6767
    68     this->flushCollisions();
     68    this->reset();
    6969
    7070    CollisionIterator it1 = this->collisionsUnused.begin();
     
    121121      return this->collisionsUsed.back();
    122122    }
    123     else return NULL;
     123    else
     124    {
     125      PRINTF(0)("There is no Collision Object left in the precache table, fatal error will cause segfault, change CR_MAX_COLLISIONS\n");
     126      assert(false);
     127      return NULL;
     128    }
    124129  }
    125130
     
    136141      return this->collisionEventsUsed.back();
    137142    }
    138     else return NULL;
     143    else
     144    {
     145      PRINTF(0)("There is no Collision Object left in the precache table, fatal error will cause segfault, change CR_MAX_COLLISION_EVENTS\n");
     146      assert(false);
     147      return NULL;
     148    }
    139149  }
    140150
     
    147157    // for all collisions:
    148158    CollisionIterator ci = CollisionTube::getInstance()->begin();
    149     for(; ci < CollisionTube::getInstance()->end(); ++ci)
     159    for(; ci < CollisionTube::getInstance()->end(); ci++)
    150160    {
    151161      for( int i = CREngine::CR_PHYSICS_MOMENTUM; i < CREngine::CR_NUMBER; i++)
     
    153163        if( _reactionList[i] == NULL)
    154164          continue;
     165
     166        assert((*ci)->getEntityA() != NULL && (*ci)->getEntityB() != NULL);
     167
     168        PRINTF(0)("CR CHECK: collision between: %s, %s\n", (*ci)->getEntityA()->getClassName().c_str(), (*ci)->getEntityB()->getClassName().c_str());
    155169
    156170        // check if entity A or B is subscibed for this event
     
    161175          PRINTF(0)("react to %i\n", i);
    162176        }
    163 
    164         (*ci)->reset();
    165177      }
    166     }
    167 
    168     this->flushCollisions();
     178      (*ci)->reset();
     179    }
     180
     181    this->reset();
    169182  }
    170183
     
    173186   * flushes all the collision lists and puts them to their initial state
    174187   */
    175   void CREngine::flushCollisions()
     188  void CREngine::reset()
    176189  {
    177190    CollisionIterator it1 = this->collisionsUsed.begin();
     
    185198    this->collisionsUsed.clear();
    186199    this->collisionEventsUsed.clear();
     200
     201    CollisionTube::getInstance()->reset();
    187202  }
    188203
Note: See TracChangeset for help on using the changeset viewer.