Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8767


Ignore:
Timestamp:
Jul 20, 2011, 11:27:45 PM (13 years ago)
Author:
dafrick
Message:

Some cleanup…

Location:
code/trunk/src/modules
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/modules/gametypes/RaceCheckPoint.cc

    r8706 r8767  
    3131#include "core/CoreIncludes.h"
    3232#include "core/XMLPort.h"
     33#include "util/Convert.h"
     34
    3335#include "SpaceRace.h"
    34 #include "util/Convert.h"
    3536
    3637namespace orxonox
    3738{
    3839    CreateFactory(RaceCheckPoint);
    39    
     40
    4041    RaceCheckPoint::RaceCheckPoint(BaseObject* creator): DistanceTrigger(creator), RadarViewable(creator, static_cast<WorldEntity*>(this))
    4142    {
     
    5051        this->setRadarVisibility(false);
    5152    }
    52    
     53
    5354    RaceCheckPoint::~RaceCheckPoint()
    5455    {
    5556    }
    56    
     57
    5758    void RaceCheckPoint::tick(float dt)
    5859    {
     
    6061
    6162        SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get());
     63        assert(gametype);
    6264        if (this->getCheckpointIndex() == gametype->getCheckpointsReached())
    6365            this->setRadarVisibility(true);
     
    6668    }
    6769
    68    
    6970    void RaceCheckPoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    7071    {
     
    7576        XMLPortParam(RaceCheckPoint, "timelimit", setTimelimit, getTimeLimit, xmlelement, mode).defaultValues(0);
    7677    }
    77    
     78
    7879    void RaceCheckPoint::triggered(bool bIsTriggered)
    7980    {
     
    99100        }
    100101    }
    101    
     102
    102103    void RaceCheckPoint::setTimelimit(float timeLimit)
    103104    {
     
    115116        }
    116117    }
    117    
     118
    118119}
  • code/trunk/src/modules/gametypes/RaceCheckPoint.h

    r8706 r8767  
    3434#include "objects/triggers/DistanceTrigger.h"
    3535#include "interfaces/RadarViewable.h"
    36 //#include <boost/concept_check.hpp>
    3736
    3837namespace orxonox
    3938{
    40   /**
    41   @brief
    42     The RaceCheckPoint class enables the creation of a check point to use in a SpaceRace level.
    43     !!! Don't forget to control the indexes of your check points and to set one last check point!!!
    44   */
     39    /**
     40    @brief
     41        The RaceCheckPoint class enables the creation of a check point to use in a SpaceRace level.
     42        !!! Don't forget to control the indexes of your check points and to set one last check point!!!
     43    */
    4544    class _GametypesExport RaceCheckPoint : public DistanceTrigger, public RadarViewable
    4645    {
  • code/trunk/src/modules/gametypes/SpaceRace.cc

    r8706 r8767  
    3131#include "core/CoreIncludes.h"
    3232#include "network/Host.h"
    33 #include <util/Clock.h>
    34 #include <util/Math.h>
    3533#include "util/Convert.h"
     34#include "util/Math.h"
    3635
    3736namespace orxonox
    3837{
    3938    CreateUnloadableFactory(SpaceRace);
    40    
     39
    4140    SpaceRace::SpaceRace(BaseObject* creator) : Gametype(creator)
    4241    {
    4342        RegisterObject(SpaceRace);
    44         this->bCheckpointsReached_ = 0;
     43        this->checkpointsReached_ = 0;
    4544        this->bTimeIsUp_ = false;
    4645        this->numberOfBots_ = 0;
    4746    }
    48    
     47
    4948    void SpaceRace::end()
    5049    {
    5150        this->Gametype::end();
    52          
     51
    5352        if (this->bTimeIsUp_)
    5453        {
     
    5756            int ms = this->clock_.getMilliseconds()-1000*s;
    5857            const std::string& message = multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) + " seconds !!\n"
    59                         + "You didn't reach the check point " + multi_cast<std::string>(this->bCheckpointsReached_+1)
     58                        + "You didn't reach the check point " + multi_cast<std::string>(this->checkpointsReached_+1)
    6059                        + " before the time limit. You lose!";
    6160            COUT(3) << message;
    6261            const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
    63             Host::Broadcast(message);
    6462        }
    6563        else
     
    7270            COUT(3) << message << std::endl;
    7371            const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
    74             Host::Broadcast(message);
    7572            float time = this->clock_.getSecondsPrecise();
    7673            this->scores_.insert(time);
     
    8784        std::string message("The match has started! Reach the check points as quickly as possible!");
    8885        COUT(3) << message << std::endl;
    89         Host::Broadcast(message);
     86        const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
    9087    }
    91    
     88
    9289    void SpaceRace::newCheckpointReached()
    9390    {
    94         this->bCheckpointsReached_++;
     91        this->checkpointsReached_++;
    9592        this->clock_.capture();
    9693        int s = this->clock_.getSeconds();
     
    10198        COUT(3) << message;
    10299        const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
    103         Host::Broadcast(message);
    104100    }
    105101
  • code/trunk/src/modules/gametypes/SpaceRace.h

    r8706 r8767  
    3030#define _SpaceRace_H__
    3131
     32#include "gametypes/GametypesPrereqs.h"
     33
     34#include <set>
     35#include <string>
     36
     37#include <util/Clock.h>
     38
    3239#include "gametypes/Gametype.h"
    33 #include "gametypes/GametypesPrereqs.h"
     40
    3441#include "RaceCheckPoint.h"
    35 #include <boost/concept_check.hpp>
    36 #include <util/Clock.h>
    37 #include <string.h>
    38 #include <set>
    3942
    4043namespace orxonox
     
    4750    {
    4851        friend class RaceCheckPoint;
    49        
     52
    5053        public:
    5154            SpaceRace(BaseObject* creator);
     
    5356
    5457            virtual void start();
    55                 virtual void end();
     58            virtual void end();
    5659
    5760            virtual void newCheckpointReached();
    5861
    5962            inline void setCheckpointsReached(int n)
    60             { this->bCheckpointsReached_ = n;}
     63                { this->checkpointsReached_ = n;}
    6164            inline int getCheckpointsReached()
    62             { return this->bCheckpointsReached_; }
     65                { return this->checkpointsReached_; }
    6366            inline void timeIsUp()
    64             { this->bTimeIsUp_ = true;}
     67                { this->bTimeIsUp_ = true;}
    6568
    6669        protected:
    6770
    6871        private:
    69             int bCheckpointsReached_; //The current number of check points reached by the player.
     72            int checkpointsReached_; //The current number of check points reached by the player.
    7073            std::set<float> scores_; //The times of the players are saved in a set.
    7174            bool bTimeIsUp_; //True if one of the check points is reached too late.
  • code/trunk/src/modules/objects/SpaceBoundaries.cc

    r8706 r8767  
    5858        {
    5959            this->pawnsIn_.clear();
    60        
     60
    6161            for( std::vector<BillboardAdministration>::iterator current = this->billboards_.begin(); current != this->billboards_.end(); current++)
    6262            {
     
    6969        }
    7070    }
    71    
     71
    7272    void SpaceBoundaries::checkWhoIsIn()
    7373    {
     
    9494        }
    9595    }
    96    
     96
    9797    void SpaceBoundaries::positionBillboard(const Vector3& position, float alpha)
    9898    {
     
    124124        this->billboards_[current].billy->setCommonUpVector(upVector);
    125125    }
    126    
     126
    127127    void SpaceBoundaries::setBillboardOptions(Billboard *billy)
    128128    {
     
    135135        }
    136136    }
    137    
     137
    138138    void SpaceBoundaries::removeAllBillboards()
    139139    {
     
    144144        }
    145145    }
    146    
     146
    147147    void SpaceBoundaries::setMaxDistance(float r)
    148148    {
     
    153153        return this->maxDistance_;
    154154    }
    155    
     155
    156156    void SpaceBoundaries::setWarnDistance(float r)
    157157    {
     
    162162        return this->warnDistance_;
    163163    }
    164    
     164
    165165    void SpaceBoundaries::setShowDistance(float r)
    166166    {
     
    171171        return this->showDistance_;
    172172    }
    173    
     173
    174174    void SpaceBoundaries::setHealthDecrease(float amount)
    175175    {
     
    180180        return this->healthDecrease_;
    181181    }
    182    
     182
    183183    void SpaceBoundaries::setReaction(int mode)
    184184    {
     
    200200        XMLPortParam(SpaceBoundaries, "reactionMode", setReaction, getReaction, xmlelement, mode);
    201201    }
    202    
     202
    203203    void SpaceBoundaries::tick(float dt)
    204204    {
    205205        this->checkWhoIsIn();
    206206        this->removeAllBillboards();
    207        
     207
    208208        float distance;
    209209        bool humanItem;
     
    247247        }
    248248    }
    249    
     249
    250250    float SpaceBoundaries::computeDistance(WorldEntity *item)
    251251    {
     
    258258        }
    259259    }
    260    
     260
    261261    void SpaceBoundaries::displayWarning(const std::string warnText)
    262     {   
     262    {
    263263        // TODO
    264264    }
    265    
     265
    266266    void SpaceBoundaries::displayBoundaries(Pawn *item, float alpha)
    267267    {
    268        
     268
    269269        Vector3 direction = item->getPosition() - this->getPosition();
    270270        direction.normalise();
    271        
     271
    272272        Vector3 boundaryPosition = this->getPosition() + direction * this->maxDistance_;
    273        
     273
    274274        this->positionBillboard(boundaryPosition, alpha);
    275275    }
    276    
     276
    277277    void SpaceBoundaries::conditionalBounceBack(Pawn *item, float currentDistance, float dt)
    278278    {
     
    281281        Vector3 velocity = item->getVelocity();
    282282        float normalSpeed = item->getVelocity().dotProduct(normal);
    283        
     283
    284284        /* Check, whether the Pawn would leave the boundary in the next tick, if so send it back. */
    285285        if( this->reaction_ == 0 && currentDistance + normalSpeed * dt > this->maxDistance_ - 10 ) // -10: "security measure"
     
    292292        }
    293293    }
    294    
     294
    295295    void SpaceBoundaries::bounceBack(Pawn *item, Vector3 *normal, Vector3 *velocity)
    296296    {
     
    299299        Vector3 acceleration = item->getAcceleration();
    300300        acceleration = acceleration.reflect(*normal);
    301        
     301
    302302        item->lookAt( *velocity + this->getPosition() );
    303        
     303
    304304        item->setAcceleration(acceleration * dampingFactor);
    305305        item->setVelocity(*velocity * dampingFactor);
    306        
     306
    307307        item->setPosition( item->getPosition() - *normal * 10 ); // Set the position of the Pawn to be well inside the boundary.
    308308    }
    309    
     309
    310310    bool SpaceBoundaries::isHumanPlayer(Pawn *item)
    311311    {
     
    319319        return false;
    320320    }
    321    
     321
    322322}
  • code/trunk/src/modules/objects/SpaceBoundaries.h

    r8706 r8767  
    4545{
    4646
    47 /**
    48 @brief SpaceBoundaries gives level creators the possibility to bar Pawns from leaving a defined area (until now this area is a ball).
     47    /**
     48    @brief SpaceBoundaries gives level creators the possibility to bar Pawns from leaving a defined area (until now this area is a ball).
    4949
    50        Some attributes can/should be defined in the XML-File:
    51        - 'position' : absolute position of the object of SpaceBoundaries in the level (usually 0,0,0)
    52        - 'maxDistance' : defines the area, where a pawn is allowed to be (radius of a ball).
    53        - 'warnDistance' : If the distance between the pawn of the human player and 'position' is bigger than 'warnDistance', a message is displayed to
    54                           inform the player that he'll soon be leaving the allowed area. (not implemented yet!)
    55        - 'showDistance' : If the distance between the pawn and the boundary of the allowed area is smaller than 'showDistance', the boundary is shown.
    56        - 'reactionMode' : Integer-Value. Defines what effect appears if a space ship has crossed the boundaries.
    57                             0: Reflect the space ship (default).
    58                             1: Decrease Health of the space ship after having left the allowed area.
    59                             2: Inverted Version of 0. Prohibit to fly INTO a defined area.
    60        - 'healthDecrease' : a measure to define how fast the health of a pawn should decrease after leaving the allowed area (unnecessary if 'reactionMode' == 0).
    61                             Recommended values: 0.1 (slow health decrease) to 5 (very fast health decrease)
     50        Some attributes can/should be defined in the XML-File:
     51        - 'position' : absolute position of the object of SpaceBoundaries in the level (usually 0,0,0)
     52        - 'maxDistance' : defines the area, where a pawn is allowed to be (radius of a ball).
     53        - 'warnDistance' : If the distance between the pawn of the human player and 'position' is bigger than 'warnDistance', a message is displayed to
     54                            inform the player that he'll soon be leaving the allowed area. (not implemented yet!)
     55        - 'showDistance' : If the distance between the pawn and the boundary of the allowed area is smaller than 'showDistance', the boundary is shown.
     56        - 'reactionMode' : Integer-Value. Defines what effect appears if a space ship has crossed the boundaries.
     57                                0: Reflect the space ship (default).
     58                                1: Decrease Health of the space ship after having left the allowed area.
     59                                2: Inverted Version of 0. Prohibit to fly INTO a defined area.
     60        - 'healthDecrease' : a measure to define how fast the health of a pawn should decrease after leaving the allowed area (unnecessary if 'reactionMode' == 0).
     61                                Recommended values: 0.1 (slow health decrease) to 5 (very fast health decrease)
    6262
    63 Follow http://www.orxonox.net/wiki/SpaceBoundaries to get some further information.
     63        Follow http://www.orxonox.net/wiki/SpaceBoundaries to get some further information.
    6464
    65 Examples:
    66 Two examples how one could include SpaceBoundaries in the XML-File. The first one uses reflection, the second one health decrease.
    67 @code
    68 <SpaceBoundaries position="0,0,0" maxDistance="1000" warnDistance="800" showDistance="100" reactionMode="0" />
    69 @endcode
     65        Examples:
     66        Two examples how one could include SpaceBoundaries in the XML-File. The first one uses reflection, the second one health decrease.
     67        @code
     68        <SpaceBoundaries position="0,0,0" maxDistance="1000" warnDistance="800" showDistance="100" reactionMode="0" />
     69        @endcode
    7070
    71 @code
    72 <SpaceBoundaries position="0,0,0" maxDistance="1000" warnDistance="800" showDistance="100" reactionMode="1" healthDecrease="0.2" />
    73 @endcode
    74 */
    75 
     71        @code
     72        <SpaceBoundaries position="0,0,0" maxDistance="1000" warnDistance="800" showDistance="100" reactionMode="1" healthDecrease="0.2" />
     73        @endcode
     74    */
    7675    class _ObjectsExport SpaceBoundaries : public StaticEntity, public Tickable
    7776    {
     
    7978            SpaceBoundaries(BaseObject* creator);
    8079            ~SpaceBoundaries();
    81            
     80
    8281            void setMaxDistance(float r);
    8382            float getMaxDistance();
    84            
     83
    8584            void setWarnDistance(float r);
    8685            float getWarnDistance();
    87            
     86
    8887            void setShowDistance(float r);
    8988            float getShowDistance();
    90            
     89
    9190            void setHealthDecrease(float amount);
    9291            float getHealthDecrease();
    93            
     92
    9493            void setReaction(int mode);
    9594            int getReaction();
    9695
    9796            void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    98            
     97
    9998            void tick(float dt);
    10099
    101100        private:
    102101            struct BillboardAdministration{ bool usedYet; Billboard* billy; };
    103            
     102
    104103            // Variabeln::
    105104            std::list<WeakPtr<Pawn> > pawnsIn_; //!< List of the pawns that this instance of SpaceBoundaries has to handle.
    106            
     105
    107106            std::vector<BillboardAdministration> billboards_;
    108        
     107
    109108            int reaction_; //!< Values: 0, 1, 2.
    110109                           //!< 0: Reflection on boundary (Standard).
     
    114113            float warnDistance_; //!< Distance in which a warning is displayed.
    115114            float showDistance_; //!< Distance at which the boundaries are displayed.
    116            
     115
    117116            float healthDecrease_; //!< Rate of health loss.
    118            
     117
    119118            //RadarViewable* centerRadar_; //!< Representation of the space boundary in the radar.
    120        
     119
    121120            // Funktionen::
    122121            float computeDistance(WorldEntity *item); //!< Compute distance to center point.
     
    126125            void bounceBack(Pawn *item, Vector3 *normal, Vector3 *velocity);
    127126            bool isHumanPlayer(Pawn *item);
    128            
     127
    129128            void checkWhoIsIn(); //!< Update the list 'pawnsIn_'.
    130            
     129
    131130            void positionBillboard(const Vector3& position, float alpha); //!< Display a Billboard at the position 'position'.
    132131            void setBillboardOptions(Billboard *billy);
    133132            void removeAllBillboards(); //!< Hide all elements of '*billboard_' and set their attribute 'usedYet' to 0.
    134            
    135133    };
    136134}
  • code/trunk/src/modules/portals/PortalEndPoint.cc

    r8706 r8767  
    2828
    2929#include "PortalEndPoint.h"
     30
     31#include <ctime>
     32
     33#include "core/CoreIncludes.h"
    3034#include "core/XMLPort.h"
     35
     36#include "worldentities/MobileEntity.h"
     37
    3138#include "objects/triggers/MultiTriggerContainer.h"
     39
    3240#include "portals/PortalLink.h"
    33 #include "worldentities/MobileEntity.h"
    34 #include <ctime>
    3541
    3642namespace orxonox
    3743{
    3844    CreateFactory(PortalEndPoint);
    39    
     45
    4046    /*static*/ const std::string PortalEndPoint::EVENTFUNCTIONNAME = "execute";
    4147
     
    4551    {
    4652        RegisterObject(PortalEndPoint);
    47        
     53
    4854        this->trigger_ = new DistanceMultiTrigger(this);
    4955        this->trigger_->setName("portal");
    50         this->attach(trigger_);
     56        this->attach(this->trigger_);
    5157
    5258        this->setRadarObjectColour(ColourValue::White);
     
    5460        this->setRadarVisibility(true);
    5561    }
    56    
     62
    5763    PortalEndPoint::~PortalEndPoint()
    5864    {
     
    6470    {
    6571        SUPER(PortalEndPoint, XMLPort, xmlelement, mode);
    66        
     72
    6773        XMLPortParam(PortalEndPoint, "id", setID, getID, xmlelement, mode);
    6874        XMLPortParam(PortalEndPoint, "design", setTemplate, getTemplate, xmlelement, mode);
     
    7076        XMLPortParamExtern(PortalEndPoint, DistanceMultiTrigger, this->trigger_, "distance", setDistance, getDistance, xmlelement, mode);
    7177        XMLPortParamLoadOnly(PortalEndPoint, "target", setTarget, xmlelement, mode).defaultValues("Pawn");
    72        
     78
    7379        // Add the DistanceMultiTrigger as event source.
    7480        this->addEventSource(this->trigger_, EVENTFUNCTIONNAME);
    75        
     81
    7682        if(mode == XMLPort::LoadObject)
    7783        {
     
    8389    {
    8490        SUPER(PortalEndPoint, XMLEventPort, xmlelement, mode);
    85        
     91
    8692        XMLPortEventSink(PortalEndPoint, BaseObject, EVENTFUNCTIONNAME, execute, xmlelement, mode);
    8793    }
     
    9197        if(!this->isActive())
    9298            return true;
    93        
     99
    94100        MultiTriggerContainer * cont = orxonox_cast<MultiTriggerContainer *>(trigger);
    95101        if(cont == 0)
    96102            return true;
    97        
     103
    98104        DistanceMultiTrigger * originatingTrigger = orxonox_cast<DistanceMultiTrigger *>(cont->getOriginator());
    99105        if(originatingTrigger == 0)
     
    101107            return true;
    102108        }
    103        
     109
    104110        MobileEntity * entity = orxonox_cast<MobileEntity *>(cont->getData());
    105111        if(entity == 0)
    106112            return true;
    107        
     113
    108114        if(bTriggered)
    109115        {
     
    117123            this->recentlyJumpedOut_.erase(entity);
    118124        }
    119        
     125
    120126        return true;
    121127    }
     
    124130    {
    125131        SUPER(PortalEndPoint, changedActivity);
    126        
     132
    127133        this->setRadarVisibility(this->isActive());
    128134    }
  • code/trunk/src/modules/portals/PortalEndPoint.h

    r8706 r8767  
    3838#include "portals/PortalsPrereqs.h"
    3939
     40#include <map>
    4041#include <set>
    4142#include <string>
    42 #include <map>
     43
     44#include "core/EventIncludes.h"
    4345
    4446#include "worldentities/StaticEntity.h"
    4547#include "interfaces/RadarViewable.h"
    46 #include "graphics/Billboard.h"
    4748#include "objects/triggers/DistanceMultiTrigger.h"
    48 #include "core/EventIncludes.h"
    49 #include <ctime>
    5049
    5150namespace orxonox
     
    5453     @brief
    5554     A PortalEndPoint serves as portal entrance and/or exit.
    56      
     55
    5756     @ingroup Portals
    5857     */
    59    
     58
    6059    class _PortalsExport PortalEndPoint : public StaticEntity, public RadarViewable
    6160    {
     
    6362            PortalEndPoint(BaseObject* creator);
    6463            virtual ~PortalEndPoint();
    65            
     64
    6665            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    6766            virtual void changedActivity(void);
    68            
     67
    6968            inline void setTarget(const std::string & target)                 //!< add types which are allowed to activate the PortalEndPoint
    7069                { this->trigger_->addTarget(target); }
    71            
     70
    7271            void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
    7372            static std::map<unsigned int, PortalEndPoint *> idMap_s; //!< Maps the id of each PortalEndPoint to a pointer to that PortalEndPoint
     
    7877            inline void setID(unsigned int id)
    7978                { this->id_ = id; }
    80            
     79
    8180            inline unsigned int getID() const
    8281                { return this->id_; }
    83            
     82
    8483            /// \brief Set templateName_ (the name of the design Template) and add that Template to this Object
    8584            inline void setTemplate(const std::string & name)
     
    9998             * \param entity The Entity which should jump out of this portal */
    10099            void jumpOut(MobileEntity * entity);
    101            
     100
    102101            /** \brief Tells wether a certain Entity is allowed to enter the PortalEndPoint?
    103102                @return @c true if the entity not just came out of this portal and the reenterDelay has expired for it, @c false otherwise
     
    105104            bool letsEnter(MobileEntity* entity);
    106105        protected:
    107            
     106
    108107        private:
    109108            static const std::string EVENTFUNCTIONNAME; //!< = "execute"
    110            
     109
    111110            unsigned int id_;            //!< the hopefully (depends on the writer of the levelfile) unique id, which is used to establish links between PortalEndPoints
    112111            DistanceMultiTrigger * trigger_;      //!< the DistanceMultiTrigger which notices near entities of the defined type
  • code/trunk/src/modules/portals/PortalLink.cc

    r8706 r8767  
    2828
    2929#include "PortalLink.h"
     30
     31#include "core/CoreIncludes.h"
    3032#include "core/XMLPort.h"
    31 #include "objects/triggers/MultiTriggerContainer.h"
     33
    3234#include "worldentities/MobileEntity.h"
    3335
     
    3739
    3840    std::map<PortalEndPoint *, PortalEndPoint *> PortalLink::links_s;
    39    
     41
    4042    PortalLink::PortalLink(BaseObject* creator) : BaseObject(creator), fromID_(0), toID_(0), from_(0), to_(0)
    4143    {
    4244        RegisterObject(PortalLink);
    4345    }
    44    
     46
    4547    PortalLink::~PortalLink()
    4648    {
    47        
     49
    4850    }
    49    
     51
    5052    void PortalLink::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    5153    {
     
    5456        XMLPortParam(PortalLink, "toID", setToID, getToID, xmlelement, mode);
    5557
     58        // Beware: This means, that the PortalEndPoints must exist before the PortalLink is created.
    5659        if(mode == XMLPort::LoadObject)
    5760        {
     
    6568    {
    6669        if(entrance == 0)
    67         {
    6870            return;
    69         }
    70        
     71
    7172        std::map<PortalEndPoint *, PortalEndPoint *>::iterator endpoints = PortalLink::links_s.find(entrance);
    72        
    7373        if(endpoints == PortalLink::links_s.end())  // entrance has no corresponding exit
    7474            return;
  • code/trunk/src/modules/portals/PortalLink.h

    r8706 r8767  
    3737
    3838#include "portals/PortalsPrereqs.h"
    39 #include "tools/interfaces/Tickable.h"
    40 #include "core/BaseObject.h"
    41 #include "PortalEndPoint.h"
    42 #include "objects/eventsystem/EventListener.h"
    4339
    4440#include <map>
     41
     42#include "PortalEndPoint.h"
     43
     44#include "core/BaseObject.h"
    4545
    4646namespace orxonox
     
    5757            virtual ~PortalLink();
    5858            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     59
    5960            inline void setFromID(unsigned int from)    //!< set the ID of the PortalEndPoint which should act as the entrance of this link
    60             {
    61                 this->fromID_ = from;
    62             }
     61                { this->fromID_ = from; }
    6362            inline unsigned int getFromID(unsigned int) const
    64             {
    65                 return this->fromID_;
    66             }
     63                { return this->fromID_; }
    6764            inline void setToID(unsigned int to)     //!< set the ID of the PortalEndPoint which should act as the exit of this link
    68             {
    69                 this->toID_ = to;
    70             }
     65                { this->toID_ = to; }
    7166            inline unsigned int getToID(unsigned int) const
    72             {
    73                 return this->toID_;
    74             }
     67                { return this->toID_; }
    7568            /*! \brief Let an entity enter a certain PortalEndPoint
    7669                \param entity pointer to the entity which is entering a PortalEndPoint
  • code/trunk/src/modules/weapons/projectiles/BasicProjectile.cc

    r8706 r8767  
    5252        // Default damage must be zero, otherwise it would be above zero if no settings are made in the weaponsettings xml file.
    5353        // same thing for all weaponmodes files
    54         this->damage_ = 0;
    55         this->healthdamage_ = 0;
    56         this->shielddamage_ = 0;
     54        this->damage_ = 0.0f;
     55        this->healthdamage_ = 0.0f;
     56        this->shielddamage_ = 0.0f;
    5757    }
    5858
Note: See TracChangeset for help on using the changeset viewer.