Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 9, 2010, 9:32:58 PM (15 years ago)
Author:
rgrieder
Message:

Removed excess white space at the end of lines.

Location:
code/branches/presentation3/src/modules/pickup/items
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation3/src/modules/pickup/items/DronePickup.cc

    r7034 r7127  
    4949
    5050    CreateFactory(DronePickup);
    51    
     51
    5252    /**
    5353    @brief
     
    5757    {
    5858        RegisterObject(DronePickup);
    59        
     59
    6060        this->initialize();
    6161    }
    62    
     62
    6363    /**
    6464    @brief
     
    6767    DronePickup::~DronePickup()
    6868    {
    69        
     69
    7070    }
    71    
     71
    7272    /**
    73     @brief 
     73    @brief
    7474        Initializes the member variables.
    7575    */
     
    8080        this->droneTemplate_ = "";
    8181    }
    82    
     82
    8383    /**
    8484    @brief
     
    9191        this->pickupIdentifier_->addParameter(type, val);
    9292    }
    93    
     93
    9494    /**
    9595    @brief
     
    100100        SUPER(DronePickup, XMLPort, xmlelement, mode);
    101101        XMLPortParam(DronePickup, "droneTemplate", setDroneTemplate, getDroneTemplate, xmlelement, mode);
    102        
     102
    103103        this->initializeIdentifier();
    104104    }
    105    
     105
    106106    void DronePickup::setDroneTemplate(std::string templatename){
    107107        droneTemplate_ = templatename;
    108     } 
    109    
     108    }
     109
    110110    const std::string& DronePickup::getDroneTemplate() const
    111111    {
     
    120120    {
    121121        SUPER(DronePickup, changedUsed);
    122        
     122
    123123        //! If the pickup is not picked up nothing must be done.
    124124        if(!this->isPickedUp())
    125125            return;
    126        
     126
    127127        //! If the pickup has transited to used.
    128128        if(this->isUsed())
     
    132132                if(pawn == NULL) //!< If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
    133133                    this->destroy();
    134                
     134
    135135                //Attach to pawn
    136136                Drone* drone = new Drone(pawn->getCreator()); // this is neccessary because the projectiles fired need a valid creator for the particlespawner (when colliding against something)
     
    143143                    droneController->setOwner(pawn);
    144144                }
    145                
     145
    146146                Vector3 spawnPosition = pawn->getWorldPosition() + Vector3(30,0,-30);
    147147                drone->setPosition(spawnPosition);
    148                
     148
    149149                //! The pickup has been used up.
    150150                this->setUsed(false);
     
    159159        }
    160160    }
    161    
     161
    162162    /**
    163163    @brief
     
    170170        PickupCarrier* carrier = this->getCarrier();
    171171        Pawn* pawn = dynamic_cast<Pawn*>(carrier);
    172        
     172
    173173        if(pawn == NULL)
    174174        {
    175175            COUT(1) << "Invalid PickupCarrier in DronePickup." << std::endl;
    176176        }
    177        
     177
    178178        return pawn;
    179179    }
    180    
     180
    181181    /**
    182182    @brief
     
    189189        if(item == NULL)
    190190            item = new DronePickup(this);
    191        
     191
    192192        SUPER(DronePickup, clone, item);
    193        
     193
    194194        DronePickup* pickup = dynamic_cast<DronePickup*>(item);
    195195        pickup->setDroneTemplate(this->getDroneTemplate());
    196        
     196
    197197        pickup->initializeIdentifier();
    198198    }
  • code/branches/presentation3/src/modules/pickup/items/DronePickup.h

    r7034 r7127  
    4747
    4848namespace orxonox {
    49    
     49
    5050
    5151    class _PickupExport DronePickup : public Pickup, public Tickable
    5252    {
    5353        public:
    54        
     54
    5555            DronePickup(BaseObject* creator); //!< Constructor.
    5656            virtual ~DronePickup(); //!< Destructor.
    57            
     57
    5858            virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a DronePickup object through XML.
    59            
     59
    6060            virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around.
    6161            virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass.
    6262
    6363            void setDroneTemplate(std::string templatename);
    64             const std::string& getDroneTemplate() const; 
    65            
     64            const std::string& getDroneTemplate() const;
     65
    6666        protected:
    6767            void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup.
    68        
     68
    6969        private:
    7070            void initialize(void); //!< Initializes the member variables.
    7171            std::string droneTemplate_;
    7272            Pawn* carrierToPawnHelper(void); //!< Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails.
    73            
    7473
    75        
     74
     75
    7676    };
    7777}
  • code/branches/presentation3/src/modules/pickup/items/HealthPickup.cc

    r7008 r7127  
    4545namespace orxonox
    4646{
    47    
     47
    4848    /*static*/ const std::string HealthPickup::healthTypeLimited_s = "limited";
    4949    /*static*/ const std::string HealthPickup::healthTypeTemporary_s = "temporary";
    5050    /*static*/ const std::string HealthPickup::healthTypePermanent_s = "permanent";
    51    
     51
    5252    CreateFactory(HealthPickup);
    53    
     53
    5454    /**
    5555    @brief
     
    5959    {
    6060        RegisterObject(HealthPickup);
    61        
     61
    6262        this->initialize();
    6363    }
    64    
     64
    6565    /**
    6666    @brief
     
    6969    HealthPickup::~HealthPickup()
    7070    {
    71        
    72     }
    73    
    74     /**
    75     @brief 
     71
     72    }
     73
     74    /**
     75    @brief
    7676        Initializes the member variables.
    7777    */
    7878    void HealthPickup::initialize(void)
    79     {       
     79    {
    8080        this->health_ = 0;
    8181        this->healthRate_ = 0;
     
    8383        this->maxHealthSave_ = 0;
    8484        this->maxHealthOverwrite_ = 0;
    85        
     85
    8686        this->addTarget(ClassIdentifier<Pawn>::getIdentifier());
    8787    }
    88    
     88
    8989    /**
    9090    @brief
     
    9898        std::string val1 = stream.str();
    9999        this->pickupIdentifier_->addParameter(type1, val1);
    100        
     100
    101101        std::string val2 = this->getHealthType();
    102102        std::string type2 = "healthType";
    103103        this->pickupIdentifier_->addParameter(type2, val2);
    104        
     104
    105105        stream.clear();
    106106        stream << this->getHealthRate();
     
    109109        this->pickupIdentifier_->addParameter(type3, val3);
    110110    }
    111    
     111
    112112    /**
    113113    @brief
     
    117117    {
    118118        SUPER(HealthPickup, XMLPort, xmlelement, mode);
    119        
     119
    120120        XMLPortParam(HealthPickup, "health", setHealth, getHealth, xmlelement, mode);
    121121        XMLPortParam(HealthPickup, "healthRate", setHealthRate, getHealthRate, xmlelement, mode);
    122122        XMLPortParam(HealthPickup, "healthType", setHealthType, getHealthType, xmlelement, mode);
    123        
     123
    124124        if(!this->isContinuous())
    125125            this->healthRate_ = 0.0;
    126        
     126
    127127        this->initializeIdentifier();
    128128    }
    129    
     129
    130130    /**
    131131    @brief
     
    138138    {
    139139        SUPER(HealthPickup, tick, dt);
    140        
     140
    141141        if(this->isContinuous() && this->isUsed())
    142142        {
     
    144144            if(pawn == NULL) //!< If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
    145145                this->destroy();
    146            
     146
    147147            //! Calculate the health that is added this tick.
    148148            float health = dt*this->getHealthRate();
     
    152152            float fullHealth = pawn->getHealth() + health;
    153153            this->setHealth(this->getHealth()-health);
    154                    
     154
    155155            switch(this->getHealthTypeDirect())
    156156            {
     
    173173                    COUT(1) << "Invalid healthType in HealthPickup." << std::endl;
    174174            }
    175            
     175
    176176            //! If all health has been transfered.
    177177            if(this->getHealth() == 0)
     
    181181        }
    182182    }
    183    
     183
    184184    /**
    185185    @brief
     
    193193        if(!this->isPickedUp())
    194194            return;
    195        
     195
    196196        //! If the pickup has transited to used.
    197197        if(this->isUsed())
     
    202202                if(pawn == NULL) //!< If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
    203203                    this->destroy();
    204                
     204
    205205                float health = 0;
    206206                switch(this->getHealthTypeDirect())
     
    226226                        COUT(1) << "Invalid healthType in HealthPickup." << std::endl;
    227227                }
    228                
     228
    229229                //! The pickup has been used up.
    230230                this->setUsed(false);
     
    237237                PickupCarrier* carrier = this->getCarrier();
    238238                Pawn* pawn = dynamic_cast<Pawn*>(carrier);
    239                
     239
    240240                if(pawn == NULL)
    241241                {
     
    244244                    return;
    245245                }
    246                
     246
    247247                if(pawn->getMaxHealth() == this->maxHealthOverwrite_)
    248248                {
     
    252252                }
    253253            }
    254            
     254
    255255            //! If either the pickup can only be used once or it is continuous and used up, it is destroyed upon setting it to unused.
    256256            if(this->isOnce() || (this->isContinuous() && this->getHealth() == 0))
     
    260260        }
    261261    }
    262    
     262
    263263    /**
    264264    @brief
     
    271271        PickupCarrier* carrier = this->getCarrier();
    272272        Pawn* pawn = dynamic_cast<Pawn*>(carrier);
    273        
     273
    274274        if(pawn == NULL)
    275275        {
    276276            COUT(1) << "Invalid PickupCarrier in HealthPickup." << std::endl;
    277277        }
    278        
     278
    279279        return pawn;
    280280    }
    281    
     281
    282282    /**
    283283    @brief
     
    297297        pickup->setHealthRate(this->getHealthRate());
    298298        pickup->setHealthTypeDirect(this->getHealthTypeDirect());
    299        
     299
    300300        pickup->initializeIdentifier();
    301301    }
    302    
     302
    303303    /**
    304304    @brief
     
    322322        }
    323323    }
    324    
     324
    325325    /**
    326326    @brief
     
    341341        }
    342342    }
    343    
     343
    344344    /**
    345345    @brief
     
    356356        else
    357357        {
    358             COUT(1) << "Invalid healthSpeed in HealthPickup." << std::endl; 
    359         }
    360     }
    361    
     358            COUT(1) << "Invalid healthSpeed in HealthPickup." << std::endl;
     359        }
     360    }
     361
    362362    /**
    363363    @brief
  • code/branches/presentation3/src/modules/pickup/items/HealthPickup.h

    r6709 r7127  
    4545
    4646namespace orxonox {
    47    
     47
    4848    //! Enum for the type of the HealthPickup
    4949    namespace pickupHealthType
     
    5656        };
    5757    }
    58    
     58
    5959    /**
    6060    @brief
     
    7171    {
    7272        public:
    73        
     73
    7474            HealthPickup(BaseObject* creator); //!< Constructor.
    7575            virtual ~HealthPickup(); //!< Destructor.
    76            
     76
    7777            virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a HealthPickup object through XML.
    7878            virtual void tick(float dt); //!< Is called every tick.
    79            
     79
    8080            virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around.
    8181            virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass.
    82            
     82
    8383            /**
    8484            @brief Get the health that is transfered to the Pawn upon usage of this pickup.
     
    9393            inline float getHealthRate(void)
    9494                { return this->healthRate_; }
    95                
     95
    9696            /**
    9797            @brief Get the type of HealthPickup, this pickup is.
    98             @return Returns the health type as an enum. 
     98            @return Returns the health type as an enum.
    9999            */
    100100            inline pickupHealthType::Value getHealthTypeDirect(void)
    101101                { return this->healthType_; }
    102102            const std::string& getHealthType(void); //!< Get the health type of this pickup.
    103            
     103
    104104        protected:
    105105            void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup.
     
    107107            void setHealth(float health); //!< Sets the health.
    108108            void setHealthRate(float speed); //!< Set the rate at which health is transferred if the pickup is continuous.
    109            
     109
    110110            /**
    111111            @brief Set the health type of this pickup.
     
    115115                { this->healthType_ = type; }
    116116            void setHealthType(std::string type); //!< Set the type of the HealthPickup.
    117        
     117
    118118        private:
    119119            void initialize(void); //!< Initializes the member variables.
    120120            Pawn* carrierToPawnHelper(void); //!< Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails.
    121            
     121
    122122            float health_; //!< The health that is transferred to the Pawn.
    123123            float healthRate_; //!< The rate at which the health is transferred.
     
    125125            float maxHealthOverwrite_; //!< Helper to remember with which value we overwrote the maxHealh, to detect if someone else changed it as well.
    126126            pickupHealthType::Value healthType_; //!< The type of the HealthPickup.
    127            
     127
    128128            //! Strings for the health types.
    129129            static const std::string healthTypeLimited_s;
    130130            static const std::string healthTypeTemporary_s;
    131131            static const std::string healthTypePermanent_s;
    132        
     132
    133133    };
    134134}
  • code/branches/presentation3/src/modules/pickup/items/InvisiblePickup.h

    r7112 r7127  
    4444
    4545namespace orxonox {
    46        
     46
    4747    /**
    4848    @brief
     
    5757    {
    5858        public:
    59        
     59
    6060            InvisiblePickup(BaseObject* creator); //!< Constructor.
    6161            virtual ~InvisiblePickup(); //!< Destructor.
     
    6363            virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around.
    6464            virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass.
    65            
     65
    6666            /**
    6767            @brief Checks whether the Pawn is invisible.
     
    7272            inline float getDuration()
    7373                { return this->duration_; }
    74  
     74
    7575        protected:
    7676            bool setInvisible(bool invisibility); //!< Set the Pawn to be invisible or visible again.
     
    7878            void initializeIdentifier(void);
    7979            virtual void pickupTimerCallback(void); //!< Function that gets called when the timer ends.
    80        
     80
    8181        private:
    8282            void initialize(void); //!< Initializes the member variables.
  • code/branches/presentation3/src/modules/pickup/items/MetaPickup.cc

    r6709 r7127  
    4040
    4141namespace orxonox {
    42  
     42
    4343    CreateFactory(MetaPickup);
    44    
     44
    4545    //! Setting the static variables to their values.
    4646    /*static*/ const std::string MetaPickup::metaTypeNone_s = "none";
    4747    /*static*/ const std::string MetaPickup::metaTypeUse_s = "use";
    4848    /*static*/ const std::string MetaPickup::metaTypeDrop_s = "drop";
    49    
     49
    5050    /**
    5151    @brief
     
    5555    {
    5656        RegisterObject(MetaPickup);
    57        
     57
    5858        this->initialize();
    5959    }
    60    
     60
    6161    /**
    6262    @brief
     
    6565    MetaPickup::~MetaPickup()
    6666    {
    67        
    68     }
    69    
     67
     68    }
     69
    7070    /**
    7171    @brief
     
    7575    {
    7676        this->addTarget(ClassIdentifier<PickupCarrier>::getIdentifier());
    77        
     77
    7878        this->setActivationTypeDirect(pickupActivationType::immediate);
    7979        this->setDurationTypeDirect(pickupDurationType::once);
    8080        this->metaType_ = pickupMetaType::none;
    8181    }
    82    
     82
    8383    /**
    8484    @brief
     
    9191        this->pickupIdentifier_->addParameter(type, val);
    9292    }
    93    
     93
    9494    /**
    9595    @brief
     
    9999    {
    100100        SUPER(MetaPickup, XMLPort, xmlelement, mode);
    101        
     101
    102102        XMLPortParam(MetaPickup, "metaType", setMetaType, getMetaType, xmlelement, mode);
    103        
     103
    104104        this->initializeIdentifier();
    105105    }
    106    
     106
    107107    /**
    108108    @brief
     
    113113    {
    114114        SUPER(MetaPickup, changedUsed);
    115        
     115
    116116        //! If the MetaPickup transited to used.
    117117        if(this->isUsed())
     
    144144        }
    145145    }
    146        
     146
    147147    /**
    148148    @brief
     
    155155        if(item == NULL)
    156156            item = new MetaPickup(this);
    157        
     157
    158158        SUPER(MetaPickup, clone, item);
    159        
     159
    160160        MetaPickup* pickup = dynamic_cast<MetaPickup*>(item);
    161161        pickup->setMetaTypeDirect(this->getMetaTypeDirect());
    162        
     162
    163163        pickup->initializeIdentifier();
    164164    }
    165    
     165
    166166    /**
    167167    @brief
     
    184184        }
    185185    }
    186    
     186
    187187    /**
    188188    @brief
     
    206206        }
    207207    }
    208    
     208
    209209}
  • code/branches/presentation3/src/modules/pickup/items/MetaPickup.h

    r6709 r7127  
    5151        };
    5252    }
    53    
     53
    5454    /**
    5555    @brief
     
    6060    class _PickupExport MetaPickup : public Pickup
    6161    {
    62        
     62
    6363        public:
    6464            MetaPickup(BaseObject* creator); //!< Constructor. Registers and initializes the object.
    6565            virtual ~MetaPickup(); //!< Destructor.
    66            
     66
    6767            virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a MetaPickup object through XML.
    68            
     68
    6969            virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around.
    7070            virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass.
    71            
     71
    7272            /**
    7373            @brief Returns the meta type of the MetaPickup.
     
    7777                { return this->metaType_; }
    7878            const std::string& getMetaType(void); //!< Get the meta type of this MetaPickup.
    79            
     79
    8080        protected:
    8181            void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup.
    82            
     82
    8383            /**
    8484            @brief Set the meta type of the MetaPickup.
     
    8888                { this->metaType_ =  type; }
    8989            void setMetaType(const std::string& type); //!< Set the meta type of this MetaPickup.
    90            
     90
    9191        private:
    9292            void initialize(void); //!< Initializes the member variables.
    93            
     93
    9494            pickupMetaType::Value metaType_; //!< The meta type of the MetaPickup, determines which actions are taken.
    95            
     95
    9696            //! Static strings for the meta types.
    9797            static const std::string metaTypeNone_s;
    9898            static const std::string metaTypeUse_s;
    9999            static const std::string metaTypeDrop_s;
    100            
    101        
     100
     101
    102102    };
    103103
  • code/branches/presentation3/src/modules/pickup/items/ShieldPickup.cc

    r6998 r7127  
    7979        PickupCarrier* carrier = this->getCarrier();
    8080        Pawn* pawn = dynamic_cast<Pawn*>(carrier);
    81        
     81
    8282        if(pawn == NULL)
    8383        {
     
    8686        return pawn;
    8787    }
    88    
     88
    8989    /**
    9090    @brief
     
    117117        std::string val2 = stream.str();
    118118        this->pickupIdentifier_->addParameter(type2, val2);
    119        
     119
    120120        stream.clear();
    121121        stream << this->getShieldAbsorption();
     
    269269
    270270    void ShieldPickup::pickupTimerCallback(void)
    271     {       
     271    {
    272272        this->setUsed(false);
    273273    }
  • code/branches/presentation3/src/modules/pickup/items/SpeedPickup.cc

    r6755 r7127  
    137137        if(engine == NULL) //!< If the PickupCarrier is no Engine, then this pickup is useless and therefore is destroyed.
    138138            this->destroy();
    139        
     139
    140140        //! If the pickup has transited to used.
    141141        if(this->isUsed())
     
    156156            engine->setSpeedAdd(0.0f);
    157157            engine->setSpeedMultiply(1.0f);
    158            
     158
    159159            if(this->isOnce())
    160160            {
     
    186186            COUT(1) << "Invalid PickupCarrier in SpeedPickup." << std::endl;
    187187        }
    188        
     188
    189189        return engine;
    190190    }
     
    269269
    270270    void SpeedPickup::pickupTimerCallback(void)
    271     {       
     271    {
    272272        this->setUsed(false);
    273273    }
  • code/branches/presentation3/src/modules/pickup/items/SpeedPickup.h

    r6709 r7127  
    7878        protected:
    7979            void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup.
    80            
     80
    8181            virtual void pickupTimerCallback(void); //!< Function that gets called when timer ends.
    8282
Note: See TracChangeset for help on using the changeset viewer.