Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1484 for code


Ignore:
Timestamp:
May 29, 2008, 1:01:47 PM (16 years ago)
Author:
landauf
Message:

some spaceshipAI tweaks for network

Location:
code/branches/network/src/orxonox/objects
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/network/src/orxonox/objects/SpaceShip.cc

    r1481 r1484  
    315315        XMLPortParamLoadOnly(SpaceShip, "rotDamp", setRotDamp, xmlelement, mode);
    316316        myShip_=true; // TODO: this is only a hack
     317
    317318        SpaceShip::create();
    318         getFocus();
     319        if (this->isExactlyA(Class(SpaceShip)))
     320            getFocus();
    319321    }
    320322
  • code/branches/network/src/orxonox/objects/SpaceShip.h

    r1479 r1484  
    154154
    155155            float emitterRate_;
     156
     157        protected:
    156158            bool myShip_;
    157159
  • code/branches/network/src/orxonox/objects/SpaceShipAI.cc

    r1480 r1484  
    6868        for (int i = 4; i <= NUM_AI_TEAMS; ++i)
    6969            this->teamColours_[i] = ColourValue(rnd(), rnd(), rnd(), 1);
    70 
    71         actionTimer_.setTimer(ACTION_INTERVAL, true, this, createExecutor(createFunctor(&SpaceShipAI::action)));
     70    }
     71
     72    void SpaceShipAI::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     73    {
     74        SpaceShip::XMLPort(xmlelement, mode);
     75        myShip_=true;
     76
     77        this->actionTimer_.setTimer(ACTION_INTERVAL, true, this, createExecutor(createFunctor(&SpaceShipAI::action)));
    7278    }
    7379
     
    8894            newenemy->setRotDamp(1.0);
    8995            Element xmlelement;
    90             newenemy->create();
     96            newenemy->XMLPort(xmlelement, XMLPort::LoadObject);
    9197        }
    9298    }
     
    218224    void SpaceShipAI::searchNewTargetPosition()
    219225    {
    220         this->targetPosition_ += Vector3(rnd(-10000,10000), rnd(-10000,10000), rnd(-10000,10000));
     226        this->targetPosition_ = Vector3(rnd(-5000,5000), rnd(-5000,5000), rnd(-5000,5000));
    221227        this->bHasTargetPosition_ = true;
    222228    }
  • code/branches/network/src/orxonox/objects/SpaceShipAI.h

    r1479 r1484  
    4444        public:
    4545            SpaceShipAI();
     46            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    4647            static void createEnemy(int num);
    4748            static void killEnemies(int num);
Note: See TracChangeset for help on using the changeset viewer.