Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5745 in orxonox.OLD for branches/world_entities


Ignore:
Timestamp:
Nov 23, 2005, 9:41:24 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: removed WeaponManager from all the Weapons, because weapon should not know where it is connected to

Location:
branches/world_entities
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • branches/world_entities/aclocal.m4

    r5739 r5745  
    1 # generated automatically by aclocal 1.9.5 -*- Autoconf -*-
     1# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
    22
    33# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
     
    2929# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
    3030AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
    31          [AM_AUTOMAKE_VERSION([1.9.5])])
     31         [AM_AUTOMAKE_VERSION([1.9.6])])
    3232
    3333# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
  • branches/world_entities/src/world_entities/player.cc

    r5622 r5745  
    7979
    8080  //weapons:
    81   Weapon* wpRight = new TestGun(this->weaponMan, 0);
     81  Weapon* wpRight = new TestGun(0);
    8282  wpRight->setName("testGun Right");
    83   Weapon* wpLeft = new TestGun(this->weaponMan, 1);
     83  Weapon* wpLeft = new TestGun(1);
    8484  wpLeft->setName("testGun Left");
    8585  Weapon* cannon = dynamic_cast<Weapon*>(Factory::getFirst()->fabricate(CL_CANNON));
    86   cannon->setWeaponManager(this->weaponMan);
     86
    8787  cannon->setName("BFG");
    8888
     
    344344    //if (this->weaponMan->hasFreeSlot(2, WTYPE_TURRET))
    345345    {
    346       turret = new Turret(this->weaponMan);
     346      turret = new Turret();
    347347      this->weaponMan->addWeapon(turret, 2);
    348348      this->weaponMan->changeWeaponConfig(2);
     
    353353    //if (this->weaponMan->hasFreeSlot(3))
    354354    {
    355       turret = new AimingTurret(this->weaponMan);
     355      turret = new AimingTurret();
    356356      this->weaponMan->addWeapon(turret, 3);
    357357
  • branches/world_entities/src/world_entities/weapons/aiming_turret.cc

    r5622 r5745  
    4040   creates a new weapon
    4141*/
    42 AimingTurret::AimingTurret (WeaponManager* weaponManager)
    43   : Weapon(weaponManager)
     42AimingTurret::AimingTurret ()
     43  : Weapon()
    4444{
    4545  this->init();
     
    143143    return;
    144144
    145   PNode* target = this->getWeaponManager()->getFixedTarget();
    146 
    147   if (target != NULL)
    148   {
    149145    pj->setVelocity(/*this->getVelocity()+*/(this->getAbsDir().apply(Vector(1,0,0))*250.0 + VECTOR_RAND(13)
    150146            /*target->getAbsCoor() - this->getAbsCoor()*/)*.5);//this->getVelocity());
    151   }
    152   else
    153     pj->setVelocity(target->getVelocity());
    154147
    155148  pj->setParent(NullParent::getInstance());
     
    168161void AimingTurret::draw () const
    169162{
    170   this->getWeaponManager()->getFixedTarget()->debugDraw(10);
    171 
    172163  /* draw gun body */
    173164  glMatrixMode(GL_MODELVIEW);
  • branches/world_entities/src/world_entities/weapons/aiming_turret.h

    r5559 r5745  
    1515  {
    1616  public:
    17     AimingTurret (WeaponManager* weaponManager);
     17    AimingTurret ();
    1818    AimingTurret(const TiXmlElement* root);
    1919    virtual ~AimingTurret ();
  • branches/world_entities/src/world_entities/weapons/cannon.cc

    r5744 r5745  
    4848   creates a new weapon
    4949*/
    50 Cannon::Cannon (WeaponManager* weaponManager)
    51   : Weapon(weaponManager)
     50Cannon::Cannon ()
     51  : Weapon()
    5252{
    5353  this->init();
  • branches/world_entities/src/world_entities/weapons/cannon.h

    r5621 r5745  
    1313  {
    1414  public:
    15     Cannon (WeaponManager* weaponManager);
     15    Cannon ();
    1616    Cannon (const TiXmlElement* root);
    1717    virtual ~Cannon ();
  • branches/world_entities/src/world_entities/weapons/test_gun.cc

    r5622 r5745  
    4848   creates a new weapon
    4949*/
    50 TestGun::TestGun (WeaponManager* weaponManager, int leftRight)
    51   : Weapon(weaponManager)
     50TestGun::TestGun ( int leftRight)
     51  : Weapon()
    5252{
    5353  this->init();
  • branches/world_entities/src/world_entities/weapons/test_gun.h

    r5500 r5745  
    3838  {
    3939  public:
    40     TestGun (WeaponManager* weaponManager, int leftRight);
     40    TestGun (int leftRight);
    4141    TestGun (const TiXmlElement* root);
    4242    virtual ~TestGun ();
  • branches/world_entities/src/world_entities/weapons/turret.cc

    r5622 r5745  
    4040   creates a new weapon
    4141*/
    42 Turret::Turret (WeaponManager* weaponManager)
    43   : Weapon(weaponManager)
     42Turret::Turret ()
     43  : Weapon()
    4444{
    4545  this->init();
     
    117117{
    118118  Quaternion quat;
    119   Vector direction = this->getWeaponManager()->getFixedTarget()->getAbsCoor() - this->getAbsCoor();
     119  Vector direction = this->getAbsCoor();/*this->getWeaponManager()->getFixedTarget()->getAbsCoor() - this->getAbsCoor();*/
    120120
    121121  direction.normalize();
     
    135135    return;
    136136
    137   PNode* target = this->getWeaponManager()->getFixedTarget();
    138 
    139   if (target != NULL)
    140   {
    141137    pj->setVelocity(this->getVelocity()+(this->getAbsDir().apply(Vector(1,0,0))*100.0 + VECTOR_RAND(13)
    142138            /*target->getAbsCoor() - this->getAbsCoor()*/)*.5);//this->getVelocity());
    143   }
    144   else
    145     pj->setVelocity(target->getVelocity());
    146139
    147140  pj->setParent(NullParent::getInstance());
     
    159152void Turret::draw () const
    160153{
    161   this->getWeaponManager()->getFixedTarget()->debugDraw(10);
    162 
    163154  /* draw gun body */
    164155  glMatrixMode(GL_MODELVIEW);
  • branches/world_entities/src/world_entities/weapons/turret.h

    r5740 r5745  
    1212  {
    1313  public:
    14     Turret (WeaponManager* weaponManager = NULL);
     14    Turret ();
    1515    Turret(const TiXmlElement* root);
    1616    virtual ~Turret ();
  • branches/world_entities/src/world_entities/weapons/weapon.cc

    r5500 r5745  
    4141 * creates a new weapon
    4242*/
    43 Weapon::Weapon (WeaponManager* weaponManager)
     43Weapon::Weapon ()
    4444{
    4545  this->init();
    46   this->setWeaponManager(weaponManager);
    4746}
    4847
     
    9796  this->energyMax = 10.0;                          //< How much energy can be carried
    9897  this->capability = WTYPE_ALL;                    //< The Weapon has all capabilities @see W_Capability.
    99 
    100   this->setWeaponManager(NULL);                    //< By default the Weapon is free, and unhandled by a WeaponManager (this is good for small enemies).
    10198}
    10299
  • branches/world_entities/src/world_entities/weapons/weapon.h

    r5500 r5745  
    8181  public:
    8282    // INITIALISATION //
    83     Weapon (WeaponManager* weaponManager = NULL);
     83    Weapon ();
    8484    virtual ~Weapon ();
    8585
     
    9292    float increaseEnergy(float energyToAdd);
    9393    ///////////////////
    94 
    95     /** @param weaponManager sets the WeaponManager for this Weapon (NULL if free)) */
    96     inline void setWeaponManager(WeaponManager* weaponManager) { this->weaponManager = weaponManager; };
    97     /** @returns the WeaponManager of this Weapon (or NULL if it is free) */
    98     inline WeaponManager* getWeaponManager() const { return this->weaponManager; };
    9994
    10095    /** @returns true if the Weapon is Active  (this is used to check if the weapon must be drawn)*/
     
    220215    ClassID              projectile;                      //!< the projectile used for this weapon (since they should be generated via macro and the FastFactory, only the ClassID must be known.)
    221216    FastFactory*         projectileFactory;               //!< A factory, that produces and handles the projectiles.
    222 
    223     WeaponManager*       weaponManager;                   //!< The weaponManager this weapon is connected to. if NULL it is assumed, that the weapon is freely connected to an entity without a binding WeaponManager.
    224217  };
    225218
Note: See TracChangeset for help on using the changeset viewer.