Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6863


Ignore:
Timestamp:
May 7, 2010, 4:14:18 PM (15 years ago)
Author:
gnadler
Message:

orxonox crashes while, respectively after destroying either the Rocket or the Controller.

Location:
code/branches/rocket
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/rocket/data/levels/includes/weaponsettings3.oxi

    r6834 r6863  
    3939        </Weapon>
    4040        <Weapon>
    41           <SimpleRocketFire mode=2 muzzleoffset="10,10,10" />
     41          <SimpleRocketFire mode=2 muzzleoffset="0,0,0" />
    4242        </Weapon>
    4343      </WeaponPack>
  • code/branches/rocket/src/modules/weapons/RocketController.cc

    r6834 r6863  
    4848                this->rocket->setController(dynamic_cast<RocketController*>(this));
    4949                this->setControllableEntity(dynamic_cast<ControllableEntity*> (rocket));
     50                this->haha=0;
    5051    }
    5152
     
    5960    void RocketController::tick(float dt)
    6061    {
     62                haha++;
    6163
    6264        SimpleRocket *rocket = static_cast<SimpleRocket*>(this->getControllableEntity());
    63                 double rd = rand();
    64                 if (rd > 0.5) rocket->rotateRoll(5);
     65                rocket->setAcceleration(rocket->getAcceleration()*2);
     66                if (haha < 100) rocket->rotateYaw(10);
     67                else {
     68                if (rand() > 0.5) rocket->rotateRoll(5);
    6569                else rocket->rotatePitch(5);
     70                }
    6671
    6772    }
     
    6974
    7075        RocketController::~RocketController() {
     76               
    7177                COUT(0)<< "RocketController destroyed\n";
    7278        }
  • code/branches/rocket/src/modules/weapons/RocketController.h

    r6834 r6863  
    5252           
    5353            virtual void tick(float dt);
    54                         SimpleRocket* getRocket(){return rocket;};
     54                        SimpleRocket* getRocket(){return this->rocket;};
    5555        protected:
    5656
     
    5858        private:
    5959                        SimpleRocket* rocket;
     60                        WeakPtr<PlayerInfo> player_;
     61                                                int haha;
     62
    6063
    6164    };
  • code/branches/rocket/src/modules/weapons/projectiles/SimpleRocket.cc

    r6834 r6863  
    9898    {
    9999                if (this->isInitialized()) {
     100                        this->getController()->destroy();
    100101                COUT(0)<< "simplerocket destroyed\n";
    101                 delete this->getController();
    102102                }
    103103        }
     
    158158            if (victim)
    159159                victim->hit(this->owner_, contactPoint, dmg);
    160 //             this->destroy();
     160             this->destroy();
    161161        }
    162162        return false;
  • code/branches/rocket/src/modules/weapons/projectiles/SimpleRocket.h

    r6834 r6863  
    112112                { return this->damage_; }
    113113            virtual void fired(unsigned int firemode);
     114                       
    114115
    115116        private:
     
    118119            float damage_;
    119120            bool bDestroy_;
     121
    120122
    121123            WeakPtr<PlayerInfo> player_;
  • code/branches/rocket/src/modules/weapons/weaponmodes/SimpleRocketFire.cc

    r6834 r6863  
    4545    {
    4646        RegisterObject(SimpleRocketFire);
    47                
    4847
    49       /*  this->reloadTime_ = 0.20f;
     48        this->reloadTime_ = 0.20f;
    5049        this->bParallelReload_ = false;
    5150        this->damage_ = 100;
    52         this->speed_ = 500;
     51        this->speed_ = 50;
    5352
    54         this->setMunitionName("LaserMunition");*/
     53        this->setMunitionName("LaserMunition");
    5554        // The firing sound of the Rocket is played in Rocket.cc (because of OpenAl sound positioning)
    5655    }
     
    6766                this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());
    6867                rocket->setOrientation(this->getMuzzleOrientation());
    69         rocket->setPosition(this->getMuzzlePosition());
    70                 rocket->setVelocity(this->getMuzzleDirection() * rocket->getVelocity());
     68                Vector3 pos = this->getMuzzlePosition() + (this->getMuzzleOrientation()* Vector3(-2, -3, -2));
     69        rocket->setPosition(pos);
     70                rocket->setVelocity(this->getMuzzleDirection()*this->speed_);
     71                //Ogre::Vector3 vec = this->getMuzzlePosition();
     72                //vec.normalise();
     73                //rocket->setAcceleration(100*vec);
    7174                rocket->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
    7275                //con->getRocket()->setPosition(this->getMuzzlePosition());
    73         //con->setControllableEntity(dynamic_cast<ControllableEntity*>(rocket));
     76        //con->setControllableEntity(dynamic_cast<rocket*>(ControllableEntity));
    7477        //con->getControllableEntity()->setPosition(this->getMuzzlePosition());
    7578
Note: See TracChangeset for help on using the changeset viewer.