Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4979 in orxonox.OLD for orxonox/trunk


Ignore:
Timestamp:
Aug 10, 2005, 4:47:23 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: Objects now get cleanly ereased.
This is a fix in the Weapon-class, that kills the Resurected Projectiles created for information-gathering

Location:
orxonox/trunk/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/story_entities/world.cc

    r4978 r4979  
    133133  SoundEngine::getInstance()->flushAllBuffers();
    134134  SoundEngine::getInstance()->flushAllSources();
    135   FastFactory::flushAll();
     135  FastFactory::flushAll(true);
    136136
    137137  // erease everything that is left.
     
    850850      // tick the engines
    851851      AnimationPlayer::getInstance()->tick(this->dtS);
    852       if (this->cycle > 5)
     852//      if (this->cycle > 5)
    853853        PhysicsEngine::getInstance()->tick(this->dtS);
    854854
  • orxonox/trunk/src/util/fast_factory.cc

    r4951 r4979  
    8181}
    8282
    83 
    8483/**
    8584 * searches for a FastFactory
     
    135134  while (tmpFac != NULL)
    136135  {
     136    printf("DELETEING ALL OF %s\n",tmpFac->getName());
    137137    tmpFac->flush(hardFLUSH);
    138138    tmpFac = tmpFac->next;
     
    140140}
    141141
    142 
    143142/**
    144143 * ereases all the remaining containers, without deleting the stored Objects inside of them.
     
    152151    delMember = tmpMember;
    153152    tmpMember = tmpMember->next;
    154     if (unlikely(hardFLUSH == true))
     153    if (hardFLUSH)
     154    {
     155      PRINTF(1)("COOL\n");
    155156      delete delMember->objectPointer;
     157    }
    156158    delete delMember;
    157159  }
     
    267269      tmpFac = tmpFac->next;
    268270    }
    269 
    270   }
    271 }
     271  }
     272}
  • orxonox/trunk/src/util/fast_factory.h

    r4969 r4979  
    1515 * afterwards one can just retrieve an Object form the Class with
    1616 * this->bulletFactory->resurrect();  // this returns a BaseObject an Object of the class.
     17 *
     18 * The big difference to the FastFactory-class is, that this one is used more for the purpose
     19 * of fast game-interaction than for loading. althought one can also load FastFactorized classes
     20 * it is not the main topic.
    1721 */
    18 
    1922
    2023#ifndef _FAST_FACTORY_H
  • orxonox/trunk/src/util/garbage_collector.cc

    r4975 r4979  
    2525
    2626using namespace std;
    27 
    2827
    2928GarbageCollector* GarbageCollector::singletonRef = 0;
     
    119118void GarbageCollector::update()
    120119{
    121   if (this->time < this->delay)
    122   {
    123     return;
    124   }
    125   if (this->collectedObjects == NULL)
     120  if (this->time < this->delay || this->collectedObjects == NULL)
    126121    return;
    127122  else
     
    131126    while (tmpC != NULL)
    132127    {
    133       WorldEntity* entity = dynamic_cast<WorldEntity*>(tmpC->objectPointer);
     128      //WorldEntity* entity = dynamic_cast<WorldEntity*>(tmpC->objectPointer);
    134129      //State::getWorldEntityList()->remove(entity);
    135       entity->remove();
    136       FastFactory::kill(entity, true);
     130      //entity->remove();
     131      FastFactory::kill(tmpC->objectPointer, true);
    137132
    138133      moveC = tmpC->next;
  • orxonox/trunk/src/util/garbage_collector.h

    r4941 r4979  
    11/*!
    22 * @file garbage_collector.h
    3  * Definition of the proto class template, used quickly start work
    4  * @todo Example: this shows how to use simply add a Marker that here has to be done something.
    5  *
    6  *  The Protoclass exists, to help you quikly getting the run for how to develop in orxonox.
    7  *  It is an example for the CODING-CONVENTION, and a starting-point for every class.
    83 */
    94
     
    1712//! this class maintains the garbage collection.
    1813/**
    19    the class is been ticked by the world.cc and goes through the
    20    world_entity list to clean out all unused entities.
     14 * you can pass everything to this class that you want to be collected
     15 * just use GarbageCollector->collect(POINTER); to pass a collectable to the GarbageCollector
     16 * it will then be handled acording to the class
    2117*/
    2218class GarbageCollector : public BaseObject {
  • orxonox/trunk/src/world_entities/weapons/projectile.cc

    r4955 r4979  
    3939  this->lifeCycle = 0.0;
    4040  this->lifeSpan = 0.75f; /* sec */
     41
     42  this->remove();
    4143}
    4244
  • orxonox/trunk/src/world_entities/weapons/test_gun.cc

    r4974 r4979  
    3333#include "animation3d.h"
    3434#include "sound_engine.h"
     35
     36#include "null_parent.h"
    3537
    3638#include "fast_factory.h"
     
    175177  Projectile* pj =  dynamic_cast<Projectile*>(this->getProjectileFactory()->resurrect());
    176178
     179  pj->setParent(NullParent::getInstance());
    177180/*
    178181  PNode* target = this->getWeaponManager()->getFixedTarget();
  • orxonox/trunk/src/world_entities/weapons/weapon.cc

    r4972 r4979  
    127127  this->projectileFactory = FastFactory::searchFastFactory(projectile);
    128128  if (this->projectileFactory == NULL)
     129  {
     130    PRINTF(1)("unable to find FastFactory for the Projectile.\n");
    129131    return;
     132  }
    130133  else
    131134  {
    132135    // grabbing Parameters from the Projectile to have them at hand here.
    133     this->projectileFactory->prepare(1);
    134136    Projectile* pj = dynamic_cast<Projectile*>(this->projectileFactory->resurrect());
    135137    this->minCharge = pj->getEnergyMin();
    136138    this->maxCharge = pj->getEnergyMax();
    137139    this->chargeable = pj->isChageable();
    138   }
    139 };
     140    this->projectileFactory->kill(pj);
     141  }
     142}
    140143
    141144/**
Note: See TracChangeset for help on using the changeset viewer.