Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 24, 2012, 8:49:19 PM (13 years ago)
Author:
decapitb
Message:

tower defense update

Location:
code/branches/presentation2012
Files:
5 edited
2 copied

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2012

  • code/branches/presentation2012/src

    • Property svn:mergeinfo set to (toggle deleted branches)
      /code/branches/dockingsystem2/srcmergedeligible
      /code/branches/environment3/srcmergedeligible
      /code/branches/formation/srcmergedeligible
      /code/branches/gamecontent/srcmergedeligible
      /code/branches/hud/srcmergedeligible
      /code/branches/masterserverfix/srcmergedeligible
      /code/branches/menue/srcmergedeligible
      /code/branches/newlevel2012/srcmergedeligible
      /code/branches/output/srcmergedeligible
      /code/branches/pickup2012/srcmergedeligible
      /code/branches/presentation/srcmergedeligible
      /code/branches/presentation2011/srcmergedeligible
      /code/branches/shipSelection/srcmergedeligible
      /code/branches/sound2012/srcmergedeligible
      /code/branches/spacegate/srcmergedeligible
      /code/branches/spaceraceTwo/srcmergedeligible
      /code/branches/surfaceRace/srcmergedeligible
      /code/branches/usability/srcmergedeligible
      /code/trunk/srcmergedeligible
  • code/branches/presentation2012/src/modules

    • Property svn:mergeinfo set to (toggle deleted branches)
      /code/branches/dockingsystem2/src/modulesmergedeligible
      /code/branches/environment3/src/modulesmergedeligible
      /code/branches/formation/src/modulesmergedeligible
      /code/branches/gamecontent/src/modulesmergedeligible
      /code/branches/hud/src/modulesmergedeligible
      /code/branches/masterserverfix/src/modulesmergedeligible
      /code/branches/menue/src/modulesmergedeligible
      /code/branches/newlevel2012/src/modulesmergedeligible
      /code/branches/output/src/modulesmergedeligible
      /code/branches/pickup2012/src/modulesmergedeligible
      /code/branches/presentation/src/modulesmergedeligible
      /code/branches/presentation2011/src/modulesmergedeligible
      /code/branches/shipSelection/src/modulesmergedeligible
      /code/branches/sound2012/src/modulesmergednon-inheritableeligible
      /code/branches/spacegate/src/modulesmergedeligible
      /code/branches/spaceraceTwo/src/modulesmergedeligible
      /code/branches/surfaceRace/src/modulesmergedeligible
      /code/branches/usability/src/modulesmergedeligible
      /code/trunk/src/modulesmergedeligible
  • code/branches/presentation2012/src/modules/pickup

    • Property svn:mergeinfo set to (toggle deleted branches)
      /code/branches/dockingsystem2/src/modules/pickupmergedeligible
      /code/branches/environment3/src/modules/pickupmergedeligible
      /code/branches/formation/src/modules/pickupmergedeligible
      /code/branches/gamecontent/src/modules/pickupmergedeligible
      /code/branches/hud/src/modules/pickupmergedeligible
      /code/branches/masterserverfix/src/modules/pickupmergedeligible
      /code/branches/menue/src/modules/pickupmergedeligible
      /code/branches/newlevel2012/src/modules/pickupmergedeligible
      /code/branches/output/src/modules/pickupmergedeligible
      /code/branches/pickup2012/src/modules/pickupmergedeligible
      /code/branches/presentation/src/modules/pickupmergedeligible
      /code/branches/presentation2011/src/modules/pickupmergedeligible
      /code/branches/shipSelection/src/modules/pickupmergedeligible
      /code/branches/sound2012/src/modules/pickupmergedeligible
      /code/branches/spacegate/src/modules/pickupmergedeligible
      /code/branches/spaceraceTwo/src/modules/pickupmergedeligible
      /code/branches/surfaceRace/src/modules/pickupmergedeligible
      /code/branches/usability/src/modules/pickupmergedeligible
      /code/trunk/src/modules/pickupmergedeligible
  • TabularUnified code/branches/presentation2012/src/modules/pickup/PickupPrereqs.h

    r9195 r9241  
    6868namespace orxonox
    6969{
    70 
    7170    class CollectiblePickup;
    7271    class DroppedPickup;
  • TabularUnified code/branches/presentation2012/src/modules/pickup/items/FlagPickup.cc

    r9240 r9241  
    2828
    2929/**
    30     @file FlagPickup.cc
    31     @brief Implementation of the FlagPickup class.
    32 */
     30 @file FlagPickup.cc
     31 @brief Implementation of the FlagPickup class.
     32 */
    3333
    3434#include "FlagPickup.h"
     
    3737#include "core/CoreIncludes.h"
    3838#include "core/XMLPort.h"
    39 
    4039#include "pickup/PickupIdentifier.h"
    4140
    4241namespace orxonox
    4342{
    44 
     43   
    4544    CreateFactory(FlagPickup);
    46 
     45   
    4746    /**
    48     @brief
    49         Constructor. Registers the object and initializes the member variables.
    50     */
     47     @brief
     48     Constructor. Registers the object and initializes the member variables.
     49     */
    5150    FlagPickup::FlagPickup(BaseObject* creator) : Pickup(creator)
    5251    {
    5352        RegisterObject(FlagPickup);
    54 
     53       
    5554        this->initialize();
    5655    }
    57 
     56   
    5857    /**
    59     @brief
    60         Destructor.
    61     */
     58     @brief
     59     Destructor.
     60     */
    6261    FlagPickup::~FlagPickup()
    6362    {
    64 
     63       
    6564    }
    66 
     65   
    6766    /**
    68     @brief
    69         Initializes the member variables.
    70     */
     67     @brief
     68     Initializes the member variables.
     69     */
    7170    void FlagPickup::initialize(void)
    7271    {
    7372        this->flagType_ = 0;
    74 
     73       
    7574        this->addTarget(ClassIdentifier<Pawn>::getIdentifier());
    7675    }
    77 
     76   
    7877    /**
    79     @brief
    80         Initializes the PickupIdentifier of this pickup.
    81     */
     78     @brief
     79     Initializes the PickupIdentifier of this pickup.
     80     */
    8281    void FlagPickup::initializeIdentifier(void)
    8382    {
     
    9089        this->pickupIdentifier_->addParameter(type1, val);
    9190    }
    92 
     91   
    9392    /**
    94     @brief
    95         Method for creating a FlagPickup object through XML.
    96     */
     93     @brief
     94     Method for creating a FlagPickup object through XML.
     95     */
    9796    void FlagPickup::XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode)
    9897    {
    9998        SUPER(FlagPickup, XMLPort, xmlelement, mode);
    100 
     99       
    101100        XMLPortParam(FlagPickup, "flagType", setFlagType, getFlagType, xmlelement, mode);
    102101        //XMLPortParam(FlagPickup, "teamNumber", setTeamNumber, getTeamNumber, xmlelement, mode);
    103 
     102       
    104103        this->initializeIdentifier();
    105104    }
    106 
    107 
     105   
     106   
    108107    /**
    109     @brief
    110         Get the flag type of this pickup.
    111     @return
    112         Returns the falg type as a string.
    113     */
     108     @brief
     109     Get the flag type of this pickup.
     110     @return
     111     Returns the falg type as a string.
     112     */
    114113    const int FlagPickup::getFlagType(void) const
    115114    {
    116115                return this->flagType_;
    117116        }
    118 
     117   
    119118    /**
    120     @brief
    121         Set the type of the HealthPickup.
    122     @param type
    123         The type as a string.
    124     */
     119     @brief
     120     Set the type of the FlagPickup.
     121     @param type
     122     The type as a string.
     123     */
    125124    void FlagPickup::setFlagType(int type)
    126125    {
     
    133132        }
    134133    }
     134   
     135    /**
     136     @brief
     137     Is called when the pickup has transited from used to unused or the other way around.
     138     */
     139    void FlagPickup::changedUsed(void)
     140    {
     141        SUPER(FlagPickup, changedUsed);
     142       
     143        Pawn* pawn = this->carrierToPawnHelper();
     144       
     145        if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
     146            this->Pickupable::destroy();
     147       
     148        // If the pickup has transited to used.
     149        if(this->isUsed())
     150        {
     151            this->bPickedUp_ = true;
     152            this->pickedUpBy_ = pawn;
     153            orxout(internal_error, context::pickups) << "flag picked up." << endl;
    135154
     155        }
     156    }
     157   
    136158    /**
    137        @brief
    138            Is called when the pickup has transited from used to unused or the other way around.
    139        */
    140        void FlagPickup::changedUsed(void)
    141        {
    142            SUPER(FlagPickup, changedUsed);
    143 
    144            Pawn* pawn = this->carrierToPawnHelper();
    145 
    146            if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
    147                this->Pickupable::destroy();
    148 
    149            // If the pickup has transited to used.
    150            if(this->isUsed())
    151            {
    152                  this->bPickedUp_ = true;
    153                  this->pickedUpBy_ = pawn;
    154            }
    155        }
    156 
    157        /**
    158        @brief
    159            Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails.
    160        @return
    161            A pointer to the Pawn, or NULL if the conversion failed.
    162        */
    163        Pawn* FlagPickup::carrierToPawnHelper(void)
    164        {
    165            PickupCarrier* carrier = this->getCarrier();
    166            Pawn* pawn = dynamic_cast<Pawn*>(carrier);
    167 
    168            if(pawn == NULL)
    169                orxout(internal_error, context::pickups) << "Invalid PickupCarrier in HealthPickup." << endl;
    170 
    171            return pawn;
    172        }
    173 
    174 
    175 
     159     @brief
     160     Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails.
     161     @return
     162     A pointer to the Pawn, or NULL if the conversion failed.
     163     */
     164    Pawn* FlagPickup::carrierToPawnHelper(void)
     165    {
     166        PickupCarrier* carrier = this->getCarrier();
     167        Pawn* pawn = dynamic_cast<Pawn*>(carrier);
     168       
     169        if(pawn == NULL)
     170            orxout(internal_error, context::pickups) << "Invalid PickupCarrier in Flag Pickup." << endl;
     171       
     172        return pawn;
     173    }
     174   
     175   
     176   
    176177        void FlagPickup::tick(float dt)
    177            {
    178                    SUPER(FlagPickup, tick, dt);
    179 
    180                Pawn* pawn = this->carrierToPawnHelper();
    181 
    182                    if(pawn->isAlive() && pawn->hasFlag()){
    183                this->Pickupable::destroy();
    184                    }
    185 
    186            }
     178    {
     179        SUPER(FlagPickup, tick, dt);
     180       
     181        //Pawn* pawn = this->carrierToPawnHelper();
     182       
     183//        if(pawn->isAlive() && pawn->hasFlag()){
     184//            this->Pickupable::destroy();
     185//        }
     186       
     187    }
    187188}
  • TabularUnified code/branches/presentation2012/src/modules/pickup/items/FlagPickup.h

    r9240 r9241  
    2828
    2929/**
    30     @file FlagPickup.h
    31     @brief Declaration of the FlagPickup class.
    32     @ingroup PickupItems
    33 */
     30 @file FlagPickup.h
     31 @brief Declaration of the FlagPickup class.
     32 @ingroup PickupItems
     33 */
    3434
    3535#ifndef _FlagPickup_H__
     
    4747
    4848namespace orxonox {
    49 /*
    50     @ingroup PickupItems
    51    
    52 
    53     @author
    54         Nino Weingart
    55 
    56     @ingroup PickupItems
    57     */
     49    /*
     50     @ingroup PickupItems
     51     
     52     
     53     @author
     54     Nino Weingart
     55     
     56     @ingroup PickupItems
     57     */
    5858    class _PickupExport FlagPickup : public Pickup, public Tickable
    5959    {
    60         public:
    61 
    62             FlagPickup(BaseObject* creator); //!< Constructor.
    63             virtual ~FlagPickup(); //!< Destructor.
    64 
    65             virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a FlagPickup object through XML.
    66 
    67             virtual void tick(float dt);
    68 
     60    public:
     61       
     62        FlagPickup(BaseObject* creator); //!< Constructor.
     63        ~FlagPickup(); //!< Destructor.
     64       
     65        virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a FlagPickup object through XML.
     66       
     67        virtual void tick(float dt);
     68       
    6969            const int getFlagType(void) const; //!< Get the flag type of this pickup.
    7070           
    7171                inline bool isPickedUp() const
    72                         { return this->bPickedUp_; }
     72        { return this->bPickedUp_; }
    7373                inline Pawn* pickedUpBy() const
    74                         { return this->pickedUpBy_; }
    75                        
     74        { return this->pickedUpBy_; }
     75       
    7676                inline void setPickedUp(bool pickedUp)
    7777                { this->bPickedUp_ = pickedUp; }
     
    7979                inline void ignorePickedUp()
    8080                { this->Pickupable::destroy(); }
    81                        
     81       
    8282            virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around.
    83 
    84         protected:
    85             void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup.
    86 
    87             /**
    88             @brief Set the flag type of this pickup.
    89             @param type The type of this pickup as an enum.
    90             */
    91             inline void setFlagTypeDirect(int type)
    92                 { this->flagType_ = type; }
    93             void setFlagType(int type); //!< Set the type of the FlagPickup.
    94 
    95         private:
    96             Pawn* carrierToPawnHelper(void); //!< Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails.
    97             void initialize(void); //!< Initializes the member variables.
    98             Pawn* pickedUpBy_;
    99                         int flagType_;
    100                        
    101                         bool bPickedUp_;
    102                        
     83       
     84    protected:
     85        void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup.
     86       
     87        /**
     88         @brief Set the flag type of this pickup.
     89         @param type The type of this pickup as an enum.
     90         */
     91        inline void setFlagTypeDirect(int type)
     92        { this->flagType_ = type; }
     93       
     94        void setFlagType(int type); //!< Set the type of the FlagPickup.
     95       
     96    private:
     97        Pawn* carrierToPawnHelper(void); //!< Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails.
     98        void initialize(void); //!< Initializes the member variables.
     99        Pawn* pickedUpBy_;
     100        int flagType_;
     101       
     102        bool bPickedUp_;
     103       
    103104    };
    104105}
Note: See TracChangeset for help on using the changeset viewer.