Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 17, 2016, 6:41:22 PM (8 years ago)
Author:
landauf
Message:

merged remaining commits from cpp11_v2 to cpp11_v3 (for some reason they were not merged in the first attempt)

Location:
code/branches/cpp11_v3
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v3

  • code/branches/cpp11_v3/src/orxonox/items/MultiStateEngine.cc

    r11054 r11068  
    124124                this->state_ = 0;
    125125                if (this->getShip()->isBoosting() && forward)
    126                     this->state_ = Boost;
     126                    this->state_ = EngineState::Boost;
    127127                else if (forward && !this->state_) // this->state_ == Boost
    128                     this->state_ = Normal;
     128                    this->state_ = EngineState::Normal;
    129129                else if (direction.z > 0.0 && velocity.z < 0.0)
    130                     this->state_ = Brake;
     130                    this->state_ = EngineState::Brake;
    131131                else
    132                     this->state_ = Idle;
    133 
    134                 if (this->state_ == Idle && this->getSpeedAdd() > 0)
    135                     this->state_ = Normal;
     132                    this->state_ = EngineState::Idle;
     133
     134                if (this->state_ == EngineState::Idle && this->getSpeedAdd() > 0)
     135                    this->state_ = EngineState::Normal;
    136136            }
    137137
     
    141141
    142142                float pitch = velocity.length();
    143                 if (this->state_ & Normal)
     143                if (this->state_ & EngineState::Normal)
    144144                    defEngineSndNormal_->setPitch(clamp(pitch/MAX_VELOCITY_NORMAL + 1, 0.5f, 2.0f));
    145                 if (this->state_ & Boost)
     145                if (this->state_ & EngineState::Boost)
    146146                    defEngineSndBoost_->setPitch(clamp(pitch/MAX_VELOCITY_BOOST + 1, 0.5f, 2.0f));
    147147
    148                 if (changes & Idle)
    149                 {
    150                     lua_pushboolean(this->lua_->getInternalLuaState(), this->state_ & Idle);
     148                if (changes & EngineState::Idle)
     149                {
     150                    lua_pushboolean(this->lua_->getInternalLuaState(), this->state_ & EngineState::Idle);
    151151                    lua_setglobal(this->lua_->getInternalLuaState(), "idle");
    152152                }
    153                 if (changes & Normal)
    154                 {
    155                     lua_pushboolean(this->lua_->getInternalLuaState(), this->state_ & Normal);
     153                if (changes & EngineState::Normal)
     154                {
     155                    lua_pushboolean(this->lua_->getInternalLuaState(), this->state_ & EngineState::Normal);
    156156                    lua_setglobal(this->lua_->getInternalLuaState(), "normal");
    157                     if (this->state_ & Normal)
     157                    if (this->state_ & EngineState::Normal)
    158158                        defEngineSndNormal_->play();
    159159                    else
    160160                        defEngineSndNormal_->stop();
    161161                }
    162                 if (changes & Brake)
    163                 {
    164                     lua_pushboolean(this->lua_->getInternalLuaState(), this->state_ & Brake);
     162                if (changes & EngineState::Brake)
     163                {
     164                    lua_pushboolean(this->lua_->getInternalLuaState(), this->state_ & EngineState::Brake);
    165165                    lua_setglobal(this->lua_->getInternalLuaState(), "brake");
    166166                }
    167                 if (changes & Boost)
    168                 {
    169                     lua_pushboolean(this->lua_->getInternalLuaState(), this->state_ & Boost);
     167                if (changes & EngineState::Boost)
     168                {
     169                    lua_pushboolean(this->lua_->getInternalLuaState(), this->state_ & EngineState::Boost);
    170170                    lua_setglobal(this->lua_->getInternalLuaState(), "boost");
    171                     if (this->state_ & Boost)
     171                    if (this->state_ & EngineState::Boost)
    172172                        defEngineSndBoost_->play();
    173173                    else
  • code/branches/cpp11_v3/src/orxonox/items/MultiStateEngine.h

    r11054 r11068  
    4141    {
    4242        public:
    43             enum EngineState
     43            struct EngineState
    4444            {
    45                 Idle    = 1,
    46                 Normal  = 2,
    47                 Brake   = 4,
    48                 Boost   = 8
     45                static constexpr int Idle    = 1;
     46                static constexpr int Normal  = 2;
     47                static constexpr int Brake   = 4;
     48                static constexpr int Boost   = 8;
    4949            };
    5050
  • code/branches/cpp11_v3/src/orxonox/items/PartDestructionEvent.cc

    r10262 r11068  
    9898        {
    9999            switch (this->targetParam_) {
    100             case shieldhealth:
     100            case TargetParam::shieldhealth:
    101101                this->parent_->getParent()->setShieldHealth(operate(this->parent_->getParent()->getShieldHealth()));
    102102                break;
    103             case boostpower:
     103            case TargetParam::boostpower:
    104104                this->parent_->getParent()->setInitialBoostPower(operate(this->parent_->getParent()->getInitialBoostPower()));
    105105                break;
    106             case boostpowerrate:
     106            case TargetParam::boostpowerrate:
    107107                this->parent_->getParent()->setBoostPowerRate(operate(this->parent_->getParent()->getBoostPowerRate()));
    108108                break;
    109             case rotationthrust:
     109            case TargetParam::rotationthrust:
    110110                this->parent_->getParent()->setRotationThrust(operate(this->parent_->getParent()->getRotationThrust()));
    111111                break;
     
    120120        {
    121121            switch (this->targetParam_) {
    122             case null:
     122            case TargetParam::null:
    123123                this->parent_->getParent()->getEngineByName(targetName_)->destroy();
    124124                break;
    125             case boostfactor:
     125            case TargetParam::boostfactor:
    126126                this->parent_->getParent()->getEngineByName(targetName_)->setBoostFactor(operate(this->parent_->getParent()->getEngineByName(targetName_)->getBoostFactor()));
    127127                break;
    128             case speedfront:
     128            case TargetParam::speedfront:
    129129                this->parent_->getParent()->getEngineByName(targetName_)->setMaxSpeedFront(operate(this->parent_->getParent()->getEngineByName(targetName_)->getMaxSpeedFront()));
    130130                break;
    131             case accelerationfront:
     131            case TargetParam::accelerationfront:
    132132                this->parent_->getParent()->getEngineByName(targetName_)->setAccelerationFront(operate(this->parent_->getParent()->getEngineByName(targetName_)->getAccelerationFront()));
    133133                break;
     
    142142        {
    143143            switch (this->targetParam_) {
    144             case null:
     144            case TargetParam::null:
    145145                if (!this->parent_->getParent()->getShipPartByName(targetName_))
    146146                    return;
     
    214214            if (param == "NULL")
    215215            {
    216                 this->targetParam_ = null;
     216                this->targetParam_ = TargetParam::null;
    217217                return;
    218218            }
    219219            if (param == "boostfactor")
    220220            {
    221                 this->targetParam_ = boostfactor;
     221                this->targetParam_ = TargetParam::boostfactor;
    222222                return;
    223223            }
    224224            if (param == "speedfront")
    225225            {
    226                 this->targetParam_ = speedfront;
     226                this->targetParam_ = TargetParam::speedfront;
    227227                return;
    228228            }
    229229            if (param == "accelerationfront")
    230230            {
    231                 this->targetParam_ = accelerationfront;
     231                this->targetParam_ = TargetParam::accelerationfront;
    232232                return;
    233233            }
     
    244244            if (param == "shieldhealth")
    245245            {
    246                 this->targetParam_ = shieldhealth;
     246                this->targetParam_ = TargetParam::shieldhealth;
    247247                return;
    248248            }
    249249            if (param == "boostpower")
    250250            {
    251                 this->targetParam_ = boostpower;
     251                this->targetParam_ = TargetParam::boostpower;
    252252                return;
    253253            }
    254254            if (param == "boostpowerrate")
    255255            {
    256                 this->targetParam_ = boostpowerrate;
     256                this->targetParam_ = TargetParam::boostpowerrate;
    257257                return;
    258258            }
    259259            if (param == "rotationthrust")
    260260            {
    261                 this->targetParam_ = rotationthrust;
     261                this->targetParam_ = TargetParam::rotationthrust;
    262262                return;
    263263            }
     
    271271            if (param == "NULL")
    272272            {
    273                 this->targetParam_ = null;
     273                this->targetParam_ = TargetParam::null;
    274274                return;
    275275            }
  • code/branches/cpp11_v3/src/orxonox/items/PartDestructionEvent.h

    r11054 r11068  
    8282                    List of all allowed parameters.
    8383                */
    84             enum TargetParam
     84            enum class TargetParam
    8585            {
    8686                shieldhealth,
Note: See TracChangeset for help on using the changeset viewer.