Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 26, 2009, 9:20:57 PM (15 years ago)
Author:
landauf
Message:

merged netp3 branch back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc

    r3073 r3084  
    3939#include "objects/worldentities/ParticleSpawner.h"
    4040#include "objects/worldentities/ExplosionChunk.h"
     41
    4142#include "objects/weaponsystem/WeaponSystem.h"
    4243#include "objects/weaponsystem/WeaponSlot.h"
     
    4445#include "objects/weaponsystem/WeaponSet.h"
    4546
     47#include "network/NetworkFunction.h"
     48
    4649namespace orxonox
    4750{
    4851    CreateFactory(Pawn);
     52
     53    registerMemberNetworkFunction( Pawn, doFire );
    4954
    5055    Pawn::Pawn(BaseObject* creator) : ControllableEntity(creator)
     
    123128        SUPER(Pawn, tick, dt);
    124129
    125         if (this->weaponSystem_ && GameMode::isMaster())
    126         {
    127             for (unsigned int firemode = 0; firemode < WeaponSystem::MAX_FIRE_MODES; firemode++)
    128                 if (this->fire_ & WeaponSystem::getFiremodeMask(firemode))
    129                     this->weaponSystem_->fire(firemode);
    130 
    131             if (this->bReload_)
    132                 this->weaponSystem_->reload();
    133         }
    134 
    135         this->fire_ = this->firehack_;
    136         this->firehack_ = 0x0;
     130//        if (this->weaponSystem_ && GameMode::isMaster())
     131//        {
     132//            for (unsigned int firemode = 0; firemode < WeaponSystem::MAX_FIRE_MODES; firemode++)
     133//                if (this->fire_ & WeaponSystem::getFiremodeMask(firemode))
     134//                    this->weaponSystem_->fire(firemode);
     135//
     136//            if (this->bReload_)
     137//                this->weaponSystem_->reload();
     138//        }
     139//
     140//        this->fire_ = this->firehack_;
     141//        this->firehack_ = 0x0;
    137142        this->bReload_ = false;
    138143
    139         if (this->health_ <= 0)
     144        if (GameMode::isMaster())
     145          if (this->health_ <= 0)
    140146            this->death();
    141147    }
     
    263269    void Pawn::fire(unsigned int firemode)
    264270    {
    265         this->firehack_ |= WeaponSystem::getFiremodeMask(firemode);
     271        this->doFire(firemode);
     272    }
     273
     274    void Pawn::doFire(uint8_t firemode)
     275    {
     276        if(GameMode::isMaster())
     277        {
     278            if (this->weaponSystem_)
     279                this->weaponSystem_->fire(firemode);
     280        }
     281        else
     282        {
     283            callMemberNetworkFunction(Pawn, doFire, this->getObjectID(), 0, ((uint8_t)firemode));
     284            if (this->weaponSystem_)
     285                this->weaponSystem_->fire(firemode);
     286        }
    266287    }
    267288
Note: See TracChangeset for help on using the changeset viewer.