Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 19, 2009, 9:35:10 PM (16 years ago)
Author:
scheusso
Message:

merged netp2 → netp3

Location:
code/branches/netp3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/netp3

  • code/branches/netp3/src/orxonox/objects/worldentities/pawns/Pawn.cc

    r2904 r2990  
    3939#include "objects/worldentities/ParticleSpawner.h"
    4040#include "objects/worldentities/ExplosionChunk.h"
     41#include "network/NetworkFunction.h"
    4142
    4243namespace orxonox
    4344{
    4445    CreateFactory(Pawn);
     46   
     47    registerMemberNetworkFunction( Pawn, doFire );
    4548
    4649    Pawn::Pawn(BaseObject* creator) : ControllableEntity(creator)
     
    117120        SUPER(Pawn, tick, dt);
    118121
    119         if (this->weaponSystem_)
    120         {
    121             if (this->fire_ & WeaponMode::fire)
    122                 this->weaponSystem_->fire(WeaponMode::fire);
    123             if (this->fire_ & WeaponMode::altFire)
    124                 this->weaponSystem_->fire(WeaponMode::altFire);
    125             if (this->fire_ & WeaponMode::altFire2)
    126                 this->weaponSystem_->fire(WeaponMode::altFire2);
    127         }
    128         this->fire_ = this->firehack_;
    129         this->firehack_ = 0x0;
    130 
    131         if (this->health_ <= 0)
     122//         if (this->weaponSystem_)
     123//         {
     124//             if (this->fire_ & WeaponMode::fire)
     125//                 this->weaponSystem_->fire(WeaponMode::fire);
     126//             if (this->fire_ & WeaponMode::altFire)
     127//                 this->weaponSystem_->fire(WeaponMode::altFire);
     128//             if (this->fire_ & WeaponMode::altFire2)
     129//                 this->weaponSystem_->fire(WeaponMode::altFire2);
     130//         }
     131//         this->fire_ = this->firehack_;
     132//         this->firehack_ = 0x0;
     133
     134        if (Core::isMaster())
     135          if (this->health_ <= 0)
    132136            this->death();
    133137    }
     
    254258    void Pawn::fire(WeaponMode::Enum fireMode)
    255259    {
    256         this->firehack_ |= fireMode;
     260        doFire(fireMode);
     261    }
     262   
     263    void Pawn::doFire(uint8_t fireMode)
     264    {
     265        if(Core::isMaster())
     266        {
     267            if (this->weaponSystem_)
     268                this->weaponSystem_->fire((WeaponMode::Enum)fireMode);
     269        }
     270        else
     271        {
     272            callMemberNetworkFunction( Pawn, doFire, this->getObjectID(), 0, ((uint8_t)fireMode));
     273            if (this->weaponSystem_)
     274                this->weaponSystem_->fire((WeaponMode::Enum)fireMode);
     275        }
    257276    }
    258277
  • code/branches/netp3/src/orxonox/objects/worldentities/pawns/Pawn.h

    r2826 r2990  
    8080
    8181            virtual void fire(WeaponMode::Enum fireMode);
     82            virtual void doFire(uint8_t fireMode);
    8283            virtual void postSpawn();
    8384
Note: See TracChangeset for help on using the changeset viewer.