Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10540 in orxonox.OLD for trunk/src/world_entities/world_entity.cc


Ignore:
Timestamp:
Jan 31, 2007, 5:04:11 AM (18 years ago)
Author:
patrick
Message:

mounting point rewritten partially, for weapon slots

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/world_entity.cc

    r10537 r10540  
    416416{
    417417  // add the mount point at the last position
    418   this->mountPoints.push_back(mountPoint);
     418//   this->mountPointMap[](mountPoint);
     419  assert(false);
    419420}
    420421
     
    425426void WorldEntity::addMountPoint(int slot, MountPoint* mountPoint)
    426427{
    427   if( this->mountPoints.capacity() < (unsigned int)slot)
    428   {
    429     // reserve 5 more slots than needed so this function is called as rare as possible
    430     this->mountPoints.reserve(slot + 5);
    431   }
    432   else if( this->mountPoints[slot] != NULL)
    433   {
    434     PRINTF(4)("adding a mount point to a slot, that already is occupied! ignoring - maybe some object did not get connected well (object: %s)\n", this->getClassCName());
     428  if( this->mountPointMap.find(slot) == this->mountPointMap.end())
     429  {
     430    PRINTF(2)("adding a mount point to a slot, that already is occupied! ignoring - maybe some object did not get connected well (object: %s)\n", this->getClassCName());
    435431  }
    436432
    437433  // just connect the mount point
    438   this->mountPoints[slot] = mountPoint;
     434  this->mountPointMap[slot] = mountPoint;
    439435}
    440436
     
    446442void WorldEntity::mount(int slot, WorldEntity* entity)
    447443{
    448   if( this->mountPoints[slot] == NULL)
     444  if( this->mountPointMap.find(slot) == this->mountPointMap.end())
    449445  {
    450446    PRINTF(0)("you tried to add an entity to a mount point that doesn't exist (slot %i)\n", slot);
Note: See TracChangeset for help on using the changeset viewer.