Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 9, 2015, 5:55:42 PM (9 years ago)
Author:
fvultier
Message:

Munition may and must now be defined for each pawn separately. This way a heavy cruiser may carry more munition than a drone.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/fabienHS15/src/orxonox/weaponsystem/ReplenishingMunition.cc

    r10688 r10791  
    3636#include "core/CoreIncludes.h"
    3737#include "core/command/Executor.h"
     38#include "core/XMLPort.h"
    3839
    3940namespace orxonox
     
    4647
    4748        this->replenishInterval_ = 1.0f;
    48         this->replenishMunitionAmount_ = 1;
     49        this->replenishAmount_ = 1;
    4950
    5051        // Use the timer to initialize itself after the first tick (because the real values for
     
    5354        this->replenishingTimer_.setTimer(0.0f, false, createExecutor(createFunctor(&ReplenishingMunition::initializeTimer, this)));
    5455    }
     56
     57    void ReplenishingMunition::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     58    {
     59        SUPER(ReplenishingMunition, XMLPort, xmlelement, mode);
     60
     61        XMLPortParam(ReplenishingMunition, "replenishamount", setReplenishAmount, getReplenishAmount, xmlelement, mode);
     62        XMLPortParam(ReplenishingMunition, "replenishinterval", setReplenishInterval, getReplenishInterval, xmlelement, mode);
     63    }   
    5564
    5665    float ReplenishingMunition::getProgress()
     
    6776    void ReplenishingMunition::replenish()
    6877    {
    69         if (this->canAddMunition(this->replenishMunitionAmount_))
     78        if (this->canAddMunition(this->replenishAmount_))
    7079        {
    7180            // Make a temporary copy of bAllowMunitionRefilling_, because this might be disallowed in every
     
    7584
    7685            // Replenish munition
    77             this->addMunition(this->replenishMunitionAmount_);
     86            this->addMunition(this->replenishAmount_);
    7887
    7988            // Write back the temporary value
Note: See TracChangeset for help on using the changeset viewer.