Changeset 2949 for code/branches/netp2/src/orxonox
- Timestamp:
- May 2, 2009, 4:19:43 PM (16 years ago)
- Location:
- code/branches/netp2/src/orxonox/objects
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/netp2/src/orxonox/objects/Test.cc
r2948 r2949 33 33 #include "network/NetworkFunction.h" 34 34 #include "Test.h" 35 #include "util/MultiType.h" 35 36 36 37 namespace orxonox … … 43 44 SetConsoleCommand(Test, printV4, true).accessLevel(AccessLevel::User); 44 45 SetConsoleCommand(Test, call, true).accessLevel(AccessLevel::User); 46 SetConsoleCommand(Test, call2, true).accessLevel(AccessLevel::User); 45 47 46 48 … … 51 53 registerStaticNetworkFunction( &Test::printV1 ); 52 54 registerMemberNetworkFunction( Test, checkU1 ); 55 registerMemberNetworkFunction( Test, printBlaBla ); 53 56 54 57 Test* Test::instance_ = 0; … … 102 105 } 103 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 104 112 void Test::tick(float dt) 105 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; 106 126 if(!Core::isMaster()) 107 callMemberNetworkFunction( Test, checkU1, this->getObjectID(), 0 ); 108 // callMemberNetworkFunction( &Test::printV1, this->getObjectID(), 0); 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; 109 134 } 110 135 -
code/branches/netp2/src/orxonox/objects/Test.h
r2948 r2949 52 52 53 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); 54 55 virtual void tick(float dt); 55 56 … … 79 80 static void printV3(){ instance_->checkU3(); } 80 81 static void printV4(){ instance_->checkU4(); } 82 83 void printBlaBla(std::string s1, std::string s2, std::string s3, std::string s4, std::string s5); 81 84 82 85 private: -
code/branches/netp2/src/orxonox/objects/worldentities/pawns/Pawn.cc
r2836 r2949 39 39 #include "objects/worldentities/ParticleSpawner.h" 40 40 #include "objects/worldentities/ExplosionChunk.h" 41 #include "network/NetworkFunction.h" 41 42 42 43 namespace orxonox 43 44 { 44 45 CreateFactory(Pawn); 46 47 registerMemberNetworkFunction( Pawn, doFire ); 45 48 46 49 Pawn::Pawn(BaseObject* creator) : ControllableEntity(creator) … … 117 120 SUPER(Pawn, tick, dt); 118 121 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;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; 130 133 131 134 if (Core::isMaster()) … … 256 259 void Pawn::fire(WeaponMode::Enum fireMode) 257 260 { 258 this->firehack_ |= fireMode; 261 doFire(fireMode); 262 } 263 264 void Pawn::doFire(uint8_t fireMode) 265 { 266 if(Core::isMaster()) 267 { 268 if (this->weaponSystem_) 269 this->weaponSystem_->fire((WeaponMode::Enum)fireMode); 270 } 271 else 272 { 273 callMemberNetworkFunction( Pawn, doFire, this->getObjectID(), 0, ((uint8_t)fireMode)); 274 if (this->weaponSystem_) 275 this->weaponSystem_->fire((WeaponMode::Enum)fireMode); 276 } 259 277 } 260 278 -
code/branches/netp2/src/orxonox/objects/worldentities/pawns/Pawn.h
r2826 r2949 80 80 81 81 virtual void fire(WeaponMode::Enum fireMode); 82 virtual void doFire(uint8_t fireMode); 82 83 virtual void postSpawn(); 83 84
Note: See TracChangeset
for help on using the changeset viewer.