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:
60 edited

Legend:

Unmodified
Added
Removed
  • code/branches/netp3

  • code/branches/netp3/src/orxonox/objects/Level.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/Level.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/Test.cc

    r2662 r2990  
    3131#include "core/ConfigValueIncludes.h"
    3232#include "core/ConsoleCommand.h"
     33#include "network/NetworkFunction.h"
    3334#include "Test.h"
     35#include "util/MultiType.h"
    3436
    3537namespace orxonox
     
    4143  SetConsoleCommand(Test, printV3, true).accessLevel(AccessLevel::User);
    4244  SetConsoleCommand(Test, printV4, true).accessLevel(AccessLevel::User);
     45  SetConsoleCommand(Test, call, true).accessLevel(AccessLevel::User);
     46  SetConsoleCommand(Test, call2, true).accessLevel(AccessLevel::User);
     47 
     48 
     49  //void=* aaaaa = copyPtr<sizeof(&Test::printV1)>( &NETWORK_FUNCTION_POINTER, &Test::printV1 );
     50  //void* NETWORK_FUNCTION_TEST_B = memcpy(&NETWORK_FUNCTION_POINTER, &a, sizeof(a));
     51//   NetworkFunctionBase* NETWORK_FUNCTION_TEST_C = new NetworkFunctionStatic( createFunctor(&Test::printV1), "bla", NETWORK_FUNCTION_POINTER );
     52 
     53  registerStaticNetworkFunction( &Test::printV1 );
     54  registerMemberNetworkFunction( Test, checkU1 );
     55  registerMemberNetworkFunction( Test, printBlaBla );
    4356 
    4457  Test* Test::instance_ = 0;
     
    7386
    7487
    75         void Test::registerVariables()
    76         {
    77                 registerVariable ( u1, variableDirection::toclient, new NetworkCallback<Test> ( this, &Test::checkU1 ));
     88  void Test::registerVariables()
     89  {
     90    registerVariable ( u1, variableDirection::toclient, new NetworkCallback<Test> ( this, &Test::checkU1 ));
    7891    registerVariable ( u2, variableDirection::toserver, new NetworkCallback<Test> ( this, &Test::checkU2 ));
    79                 registerVariable ( u3, variableDirection::serverMaster, new NetworkCallback<Test> ( this, &Test::checkU3 ), true );
     92    registerVariable ( u3, variableDirection::serverMaster, new NetworkCallback<Test> ( this, &Test::checkU3 ), true );
    8093    registerVariable ( u4, variableDirection::clientMaster, new NetworkCallback<Test> ( this, &Test::checkU4 ), true );
    8194   
     
    8497    registerVariable ( s3, variableDirection::serverMaster, new NetworkCallback<Test> ( this, &Test::checkS3 ), true );
    8598    registerVariable ( s4, variableDirection::clientMaster, new NetworkCallback<Test> ( this, &Test::checkS4 ), true );
    86         }
    87 
     99  }
     100 
     101  void Test::call(unsigned int clientID)
     102  {
     103    callStaticNetworkFunction( &Test::printV1, clientID );
     104    callStaticNetworkFunction( &Test::printV1, clientID );
     105  }
     106 
     107  void Test::call2(unsigned int clientID, std::string s1, std::string s2, std::string s3, std::string s4)
     108  {
     109    callMemberNetworkFunction( Test, printBlaBla, this->getObjectID(), clientID, s1, s2, s3, s4, s4 );
     110  }
     111 
     112  void Test::tick(float dt)
     113  {
     114//     std::string str1 = "blub";
     115//     //MultiType mt1(std::string("blub"));
     116//     MultiType mt1(str1);
     117//     uint8_t* mem = new uint8_t[mt1.getNetworkSize()];
     118//     uint8_t* temp = mem;
     119//     mt1.exportData( temp );
     120//     assert( temp-mem == mt1.getNetworkSize() );
     121//     MultiType mt2;
     122//     temp = mem;
     123//     mt2.importData( temp );
     124//     assert( temp-mem == mt1.getNetworkSize() );
     125//     COUT(0) << mt2 << endl;
     126    if(!Core::isMaster())
     127      call2(0, "bal", "a", "n", "ce");
     128//       callMemberNetworkFunction( Test, checkU1, this->getObjectID(), 0 );
     129  }
     130 
     131  void Test::printBlaBla(std::string s1, std::string s2, std::string s3, std::string s4, std::string s5)
     132  {
     133    COUT(0) << s1 << s2 << s3 << s4 << s5 << endl;
     134  }
     135 
    88136  void Test::checkU1(){ COUT(1) << "U1 changed: " << u1 << std::endl; }
    89137  void Test::checkU2(){ COUT(1) << "U2 changed: " << u2 << std::endl; }
  • code/branches/netp3/src/orxonox/objects/Test.h

    r2662 r2990  
    3333#include "core/BaseObject.h"
    3434#include "network/synchronisable/Synchronisable.h"
     35#include "Tickable.h"
    3536
    3637
     
    4142namespace orxonox
    4243{
    43   class _OrxonoxExport Test: public BaseObject, public Synchronisable
     44  class _OrxonoxExport Test: public BaseObject, public Synchronisable, public Tickable
    4445  {
    4546    public:
     
    4950      void setConfigValues();
    5051      void registerVariables();
     52     
     53      static void call(unsigned int clientID);
     54      void call2(unsigned int clientID, std::string s1, std::string s2, std::string s3, std::string s4);
     55      virtual void tick(float dt);
    5156
    5257
     
    7580      static void printV3(){ instance_->checkU3(); }
    7681      static void printV4(){ instance_->checkU4(); }
     82     
     83      void printBlaBla(std::string s1, std::string s2, std::string s3, std::string s4, std::string s5);
    7784
    7885    private:
  • code/branches/netp3/src/orxonox/objects/collisionshapes

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/controllers/AIController.cc

    r2896 r2990  
    101101    void AIController::tick(float dt)
    102102    {
    103         if (!this->isActive())
    104             return;
    105 
    106         if (this->target_)
    107             this->aimAtTarget();
    108 
    109         if (this->bHasTargetPosition_)
    110             this->moveToTargetPosition(dt);
    111 
    112         if (this->getControllableEntity() && this->bShooting_ && this->isCloseAtTarget(500) && this->isLookingAtTarget(Ogre::Math::PI / 20.0))
    113             this->getControllableEntity()->fire(WeaponMode::fire);
     103        if(Core::isMaster())
     104        {
     105            if (!this->isActive())
     106                return;
     107   
     108            if (this->target_)
     109                this->aimAtTarget();
     110   
     111            if (this->bHasTargetPosition_)
     112                this->moveToTargetPosition(dt);
     113   
     114            if (this->getControllableEntity() && this->bShooting_ && this->isCloseAtTarget(500) && this->isLookingAtTarget(Ogre::Math::PI / 20.0))
     115                this->getControllableEntity()->fire(WeaponMode::fire);
     116        }
    114117
    115118        SUPER(AIController, tick, dt);
  • code/branches/netp3/src/orxonox/objects/gametypes/TeamDeathmatch.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/gametypes/TeamDeathmatch.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/pickup/Usable.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/quest/AddQuest.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/quest/AddQuest.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/quest/AddQuestHint.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/quest/AddQuestHint.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/quest/AddReward.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/quest/AddReward.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/quest/ChangeQuestStatus.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/quest/ChangeQuestStatus.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/quest/CompleteQuest.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/quest/CompleteQuest.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/quest/FailQuest.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/quest/FailQuest.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/quest/GlobalQuest.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/quest/GlobalQuest.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/quest/LocalQuest.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/quest/LocalQuest.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/quest/Quest.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/quest/Quest.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/quest/QuestDescription.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/quest/QuestDescription.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/quest/QuestEffect.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/quest/QuestEffect.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/quest/QuestHint.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/quest/QuestHint.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/quest/QuestItem.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/quest/QuestItem.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/quest/QuestManager.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/quest/QuestManager.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/quest/Rewardable.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/quest/Rewardable.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/weaponSystem/WeaponSystem.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/weaponSystem/WeaponSystem.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/worldentities/Backlight.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/worldentities/Backlight.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/worldentities/Camera.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/worldentities/Camera.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/worldentities/ControllableEntity.cc

    r2973 r2990  
    6666        this->mouseLookSpeed_ = 200;
    6767
    68         this->server_position_         = Vector3::ZERO;
    69         this->client_position_         = Vector3::ZERO;
    70         this->server_linear_velocity_  = Vector3::ZERO;
    71         this->client_linear_velocity_  = Vector3::ZERO;
    72         this->server_orientation_      = Quaternion::IDENTITY;
    73         this->client_orientation_      = Quaternion::IDENTITY;
    74         this->server_angular_velocity_ = Vector3::ZERO;
    75         this->client_angular_velocity_ = Vector3::ZERO;
     68        this->common_position_         = Vector3::ZERO;
     69//         this->client_position_         = Vector3::ZERO;
     70        this->common_linear_velocity_  = Vector3::ZERO;
     71//         this->client_linear_velocity_  = Vector3::ZERO;
     72        this->common_orientation_      = Quaternion::IDENTITY;
     73//         this->client_orientation_      = Quaternion::IDENTITY;
     74        this->common_angular_velocity_ = Vector3::ZERO;
     75//         this->client_angular_velocity_ = Vector3::ZERO;
    7676
    7777
     
    326326            if (!this->isDynamic())
    327327            {
    328                 if (GameMode::isMaster())
    329                 {
    330                     this->server_position_ = this->getPosition();
    331                     this->server_orientation_ = this->getOrientation();
    332                     this->server_linear_velocity_ = this->getVelocity();
    333                     this->server_angular_velocity_ = this->getAngularVelocity();
    334                 }
    335                 else if (this->bHasLocalController_)
    336                 {
    337                     this->client_position_ = this->getPosition();
    338                     this->client_orientation_ = this->getOrientation();
    339                     this->client_linear_velocity_ = this->getVelocity();
    340                     this->client_angular_velocity_ = this->getAngularVelocity();
    341                 }
     328//                 if (GameMode::isMaster())
     329//                 {
     330                    this->common_position_ = this->getPosition();
     331                    this->common_orientation_ = this->getOrientation();
     332                    this->common_linear_velocity_ = this->getVelocity();
     333                    this->common_angular_velocity_ = this->getAngularVelocity();
     334//                 }
     335//                 else if (this->bHasLocalController_)
     336//                 {
     337//                     this->client_position_ = this->getPosition();
     338//                     this->client_orientation_ = this->getOrientation();
     339//                     this->client_linear_velocity_ = this->getVelocity();
     340//                     this->client_angular_velocity_ = this->getAngularVelocity();
     341//                 }
    342342            }
    343343        }
     
    349349        registerVariable(this->hudtemplate_,             variableDirection::toclient);
    350350
    351         registerVariable(this->server_position_,         variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerPosition));
    352         registerVariable(this->server_linear_velocity_,  variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerLinearVelocity));
    353         registerVariable(this->server_orientation_,      variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerOrientation));
    354         registerVariable(this->server_angular_velocity_, variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerAngularVelocity));
    355 
    356         registerVariable(this->server_overwrite_,        variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processOverwrite));
    357         registerVariable(this->client_overwrite_,        variableDirection::toserver);
    358 
    359         registerVariable(this->client_position_,         variableDirection::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientPosition));
    360         registerVariable(this->client_linear_velocity_,  variableDirection::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientLinearVelocity));
    361         registerVariable(this->client_orientation_,      variableDirection::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientOrientation));
    362         registerVariable(this->client_angular_velocity_, variableDirection::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientAngularVelocity));
     351//         registerVariable(this->server_position_,         variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerPosition));
     352//         registerVariable(this->server_linear_velocity_,  variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerLinearVelocity));
     353//         registerVariable(this->server_orientation_,      variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerOrientation));
     354//         registerVariable(this->server_angular_velocity_, variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerAngularVelocity));
     355//
     356//         registerVariable(this->server_overwrite_,        variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processOverwrite));
     357//         registerVariable(this->client_overwrite_,        variableDirection::toserver);
     358//
     359//         registerVariable(this->client_position_,         variableDirection::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientPosition));
     360//         registerVariable(this->client_linear_velocity_,  variableDirection::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientLinearVelocity));
     361//         registerVariable(this->client_orientation_,      variableDirection::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientOrientation));
     362//         registerVariable(this->client_angular_velocity_, variableDirection::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientAngularVelocity));
     363       
     364        registerVariable(this->common_position_,         variableDirection::serverMaster, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerPosition), true);
     365        registerVariable(this->common_linear_velocity_,  variableDirection::serverMaster, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerLinearVelocity), true);
     366        registerVariable(this->common_orientation_,      variableDirection::serverMaster, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerOrientation), true);
     367        registerVariable(this->common_angular_velocity_, variableDirection::serverMaster, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerAngularVelocity), true);
    363368
    364369        registerVariable(this->playerID_,                variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::networkcallback_changedplayerID));
     
    368373    {
    369374        if (!this->bHasLocalController_)
    370             MobileEntity::setPosition(this->server_position_);
     375            MobileEntity::setPosition(this->common_position_);
    371376    }
    372377
     
    374379    {
    375380        if (!this->bHasLocalController_)
    376             MobileEntity::setVelocity(this->server_linear_velocity_);
     381            MobileEntity::setVelocity(this->common_linear_velocity_);
    377382    }
    378383
     
    380385    {
    381386        if (!this->bHasLocalController_)
    382             MobileEntity::setOrientation(this->server_orientation_);
     387            MobileEntity::setOrientation(this->common_orientation_);
    383388    }
    384389
     
    386391    {
    387392        if (!this->bHasLocalController_)
    388             MobileEntity::setAngularVelocity(this->server_angular_velocity_);
     393            MobileEntity::setAngularVelocity(this->common_angular_velocity_);
    389394    }
    390395
     
    393398        if (this->bHasLocalController_)
    394399        {
    395             this->setPosition(this->server_position_);
    396             this->setOrientation(this->server_orientation_);
    397             this->setVelocity(this->server_linear_velocity_);
    398             this->setAngularVelocity(this->server_angular_velocity_);
    399 
    400             this->client_overwrite_ = this->server_overwrite_;
     400//             this->setPosition(this->server_position_);
     401//             this->setOrientation(this->server_orientation_);
     402//             this->setVelocity(this->server_linear_velocity_);
     403//             this->setAngularVelocity(this->server_angular_velocity_);
     404
     405//             this->client_overwrite_ = this->server_overwrite_;
    401406        }
    402407    }
     
    406411        if (this->server_overwrite_ == this->client_overwrite_)
    407412        {
    408             MobileEntity::setPosition(this->client_position_);
    409             this->server_position_ = this->getPosition();
     413//             MobileEntity::setPosition(this->client_position_);
     414//             this->server_position_ = this->getPosition();
    410415        }
    411416    }
     
    415420        if (this->server_overwrite_ == this->client_overwrite_)
    416421        {
    417             MobileEntity::setVelocity(this->client_linear_velocity_);
    418             this->server_linear_velocity_ = this->getVelocity();
     422//             MobileEntity::setVelocity(this->client_linear_velocity_);
     423//             this->server_linear_velocity_ = this->getVelocity();
    419424        }
    420425    }
     
    424429        if (this->server_overwrite_ == this->client_overwrite_)
    425430        {
    426             MobileEntity::setOrientation(this->client_orientation_);
    427             this->server_orientation_ = this->getOrientation();
     431//             MobileEntity::setOrientation(this->client_orientation_);
     432//             this->server_orientation_ = this->getOrientation();
    428433        }
    429434    }
     
    433438        if (this->server_overwrite_ == this->client_overwrite_)
    434439        {
    435             MobileEntity::setAngularVelocity(this->client_angular_velocity_);
    436             this->server_angular_velocity_ = this->getAngularVelocity();
     440//             MobileEntity::setAngularVelocity(this->client_angular_velocity_);
     441//             this->server_angular_velocity_ = this->getAngularVelocity();
    437442        }
    438443    }
     
    440445    void ControllableEntity::setPosition(const Vector3& position)
    441446    {
    442         if (GameMode::isMaster())
    443         {
     447//         if (GameMode::isMaster())
     448//         {
    444449            MobileEntity::setPosition(position);
    445             this->server_position_ = this->getPosition();
    446             ++this->server_overwrite_;
    447         }
    448         else if (this->bHasLocalController_)
    449         {
    450             MobileEntity::setPosition(position);
    451             this->client_position_ = this->getPosition();
    452         }
     450            this->common_position_ = this->getPosition();
     451//             ++this->server_overwrite_;
     452//         }
     453//         else if (this->bHasLocalController_)
     454//         {
     455//             MobileEntity::setPosition(position);
     456//             this->client_position_ = this->getPosition();
     457//         }
    453458    }
    454459
    455460    void ControllableEntity::setOrientation(const Quaternion& orientation)
    456461    {
    457         if (GameMode::isMaster())
    458         {
     462//         if (GameMode::isMaster())
     463//         {
    459464            MobileEntity::setOrientation(orientation);
    460             this->server_orientation_ = this->getOrientation();
    461             ++this->server_overwrite_;
    462         }
    463         else if (this->bHasLocalController_)
    464         {
    465             MobileEntity::setOrientation(orientation);
    466             this->client_orientation_ = this->getOrientation();
    467         }
     465            this->common_orientation_ = this->getOrientation();
     466//             ++this->server_overwrite_;
     467//         }
     468//         else if (this->bHasLocalController_)
     469//         {
     470//             MobileEntity::setOrientation(orientation);
     471//             this->client_orientation_ = this->getOrientation();
     472//         }
    468473    }
    469474
    470475    void ControllableEntity::setVelocity(const Vector3& velocity)
    471476    {
    472         if (GameMode::isMaster())
    473         {
     477//         if (GameMode::isMaster())
     478//         {
    474479            MobileEntity::setVelocity(velocity);
    475             this->server_linear_velocity_ = this->getVelocity();
    476             ++this->server_overwrite_;
    477         }
    478         else if (this->bHasLocalController_)
    479         {
    480             MobileEntity::setVelocity(velocity);
    481             this->client_linear_velocity_ = this->getVelocity();
    482         }
     480            this->common_linear_velocity_ = this->getVelocity();
     481//             ++this->server_overwrite_;
     482//         }
     483//         else if (this->bHasLocalController_)
     484//         {
     485//             MobileEntity::setVelocity(velocity);
     486//             this->client_linear_velocity_ = this->getVelocity();
     487//         }
    483488    }
    484489
    485490    void ControllableEntity::setAngularVelocity(const Vector3& velocity)
    486491    {
    487         if (GameMode::isMaster())
    488         {
     492//         if (GameMode::isMaster())
     493//         {
    489494            MobileEntity::setAngularVelocity(velocity);
    490             this->server_angular_velocity_ = this->getAngularVelocity();
    491             ++this->server_overwrite_;
    492         }
    493         else if (this->bHasLocalController_)
    494         {
    495             MobileEntity::setAngularVelocity(velocity);
    496             this->client_angular_velocity_ = this->getAngularVelocity();
    497         }
     495            this->common_angular_velocity_ = this->getAngularVelocity();
     496//             ++this->server_overwrite_;
     497//         }
     498//         else if (this->bHasLocalController_)
     499//         {
     500//             MobileEntity::setAngularVelocity(velocity);
     501//             this->client_angular_velocity_ = this->getAngularVelocity();
     502//         }
    498503    }
    499504
     
    501506    {
    502507        MobileEntity::setWorldTransform(worldTrans);
    503         if (GameMode::isMaster())
    504         {
    505             this->server_position_ = this->getPosition();
    506             this->server_orientation_ = this->getOrientation();
    507             this->server_linear_velocity_ = this->getVelocity();
    508             this->server_angular_velocity_ = this->getAngularVelocity();
    509         }
    510         else if (this->bHasLocalController_)
    511         {
    512             this->client_position_ = this->getPosition();
    513             this->client_orientation_ = this->getOrientation();
    514             this->client_linear_velocity_ = this->getVelocity();
    515             this->client_angular_velocity_ = this->getAngularVelocity();
    516         }
     508//         if (GameMode::isMaster())
     509//         {
     510            this->common_position_ = this->getPosition();
     511            this->common_orientation_ = this->getOrientation();
     512            this->common_linear_velocity_ = this->getVelocity();
     513            this->common_angular_velocity_ = this->getAngularVelocity();
     514//         }
     515//         else if (this->bHasLocalController_)
     516//         {
     517//             this->client_position_ = this->getPosition();
     518//             this->client_orientation_ = this->getOrientation();
     519//             this->client_linear_velocity_ = this->getVelocity();
     520//             this->client_angular_velocity_ = this->getAngularVelocity();
     521//         }
    517522    }
    518523}
  • code/branches/netp3/src/orxonox/objects/worldentities/ControllableEntity.h

    r2973 r2990  
    164164            bool bDestroyWhenPlayerLeft_;
    165165
    166             Vector3 server_position_;
    167             Vector3 client_position_;
    168             Vector3 server_linear_velocity_;
    169             Vector3 client_linear_velocity_;
    170             Quaternion server_orientation_;
    171             Quaternion client_orientation_;
    172             Vector3 server_angular_velocity_;
    173             Vector3 client_angular_velocity_;
     166//             Vector3 server_position_;
     167            Vector3 common_position_;
     168//             Vector3 client_position_;
     169//             Vector3 server_linear_velocity_;
     170//             Vector3 client_linear_velocity_;
     171            Vector3 common_linear_velocity_;
     172//             Quaternion server_orientation_;
     173//             Quaternion client_orientation_;
     174            Quaternion common_orientation_;
     175//             Vector3 server_angular_velocity_;
     176//             Vector3 client_angular_velocity_;
     177            Vector3 common_angular_velocity_;
    174178
    175179            PlayerInfo* player_;
  • code/branches/netp3/src/orxonox/objects/worldentities/MobileEntity.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/worldentities/MobileEntity.h

    r2911 r2990  
    6161                { this->setAngularVelocity(Vector3(x, y, z)); }
    6262            inline const Vector3& getAngularVelocity() const
    63                 { return this->linearAcceleration_; }
     63                { return this->angularVelocity_; }
    6464
    6565            void setAcceleration(const Vector3& acceleration);
  • code/branches/netp3/src/orxonox/objects/worldentities/ParticleSpawner.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/worldentities/ParticleSpawner.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/worldentities/StaticEntity.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/worldentities/StaticEntity.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • 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
  • code/branches/netp3/src/orxonox/objects/worldentities/triggers/DistanceTrigger.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/worldentities/triggers/DistanceTrigger.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/worldentities/triggers/Trigger.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/worldentities/triggers/Trigger.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
Note: See TracChangeset for help on using the changeset viewer.