Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 10, 2015, 6:38:44 PM (9 years ago)
Author:
landauf
Message:

the AI sometimes selected its own ship as target while it was steering a rocket. after destroying the rocket, the AI would then try to hit itself which led to random crashes (because of a division by zero error which was previously fixed in r10630).
this commit does not fix the root cause, but detects this case and changes the target.

Location:
code/trunk/src/orxonox/controllers
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/controllers/ArtificialController.cc

    r10624 r10631  
    8282    void ArtificialController::changedControllableEntity()
    8383    {
     84        FormationController::changedControllableEntity(); // super
     85
    8486        if (!this->getControllableEntity())
    8587            this->removeFromFormation();
  • code/trunk/src/orxonox/controllers/FormationController.cc

    r10624 r10631  
    10871087    }
    10881088
     1089    void FormationController::changedControllableEntity()
     1090    {
     1091        Controller::changedControllableEntity(); // super
     1092
     1093        // when changing the controllable entity, ensure that the controller does not use the new entity as target
     1094        if (this->target_ && this->getControllableEntity() == static_cast<ControllableEntity*>(this->target_))
     1095            this->forgetTarget();
     1096    }
    10891097}
  • code/trunk/src/orxonox/controllers/FormationController.h

    r9797 r10631  
    9999      FormationController* getSlave( void ) { return this->slaves_.back(); }
    100100
     101      virtual void changedControllableEntity();
     102
    101103  protected:
    102104      bool formationFlight_;
  • code/trunk/src/orxonox/controllers/NewHumanController.cc

    r10624 r10631  
    496496    void NewHumanController::changedControllableEntity()
    497497    {
     498        HumanController::changedControllableEntity(); // super
     499
    498500        this->controlMode_ = 0;
    499501        this->centerCursor();
Note: See TracChangeset for help on using the changeset viewer.