Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 21, 2009, 12:57:06 AM (15 years ago)
Author:
scheusso
Message:

first attempts to have synchronised fire direction and target
however client cannot select targets yet (probably because of classtreemask hack)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2/src/orxonox/worldentities/ControllableEntity.cc

    r6108 r6112  
    5050
    5151    registerMemberNetworkFunction( ControllableEntity, fire );
     52    registerMemberNetworkFunction( ControllableEntity, setTargetInternal );
    5253
    5354    ControllableEntity::ControllableEntity(BaseObject* creator) : MobileEntity(creator)
     
    232233            callMemberNetworkFunction(ControllableEntity, fire, this->getObjectID(), 0, firemode);
    233234        }
     235    }
     236   
     237    void ControllableEntity::setTarget( WorldEntity* target )
     238    {
     239        this->target_ = target;
     240        if ( !GameMode::isMaster() )
     241        {
     242            if ( target != 0 )
     243            {
     244                callMemberNetworkFunction(ControllableEntity, setTargetInternal, this->getObjectID(), 0, target->getObjectID() );
     245            }
     246           else
     247           {
     248                callMemberNetworkFunction(ControllableEntity, setTargetInternal, this->getObjectID(), 0, OBJECTID_UNKNOWN );
     249           }
     250        }
     251    }
     252   
     253    void ControllableEntity::setTargetInternal( uint32_t targetID )
     254    {
     255        this->setTarget( orxonox_cast<WorldEntity*>(Synchronisable::getSynchronisable(targetID)) );
    234256    }
    235257
Note: See TracChangeset for help on using the changeset viewer.