Changeset 9235 in orxonox.OLD for trunk/src/lib/network
- Timestamp:
- Jul 5, 2006, 4:39:02 PM (18 years ago)
- Location:
- trunk/src/lib/network
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/network/handshake.cc
r8362 r9235 43 43 44 44 candel_id = registerVarId( new SynchronizeableInt( &localState.canDel, &remoteState.canDel, "canDel", PERMISSION_ALL ) ); 45 46 registerVar( new SynchronizeableString( &localState.preferedNickName, &remoteState.preferedNickName, "preferedNickName", PERMISSION_ALL ) ); 45 47 46 48 localState.completed = 0; -
trunk/src/lib/network/handshake.h
r7954 r9235 28 28 29 29 std::string errorString; 30 31 //additional data 32 std::string preferedNickName; 30 33 }; 31 34 … … 43 46 inline bool allowDel(){ return localState.canDel == 1; } 44 47 inline void del(){ localState.canDel = 1; } 48 49 inline void setPreferedNickName( const std::string & nick ){ localState.preferedNickName = nick; } 50 inline std::string getPreferedNickName(){ return remoteState.preferedNickName; } 45 51 46 52 virtual void varChangeHandler( std::list<int> & id ); -
trunk/src/lib/network/network_game_manager.cc
r9110 r9235 42 42 #include "multiplayer_team_deathmatch.h" 43 43 44 #include "preferences.h" 45 44 46 45 47 /* using namespace std is default, this needs to be here */ … … 99 101 std::string playableModel = rules.getPlayableModelFileName( userId, team, playableClassId ); 100 102 std::string playableTexture = rules.getPlayableModelFileName( userId, team, playableClassId ); 103 float playableScale = rules.getPlayableScale( userId, team, playableClassId ); 101 104 102 105 BaseObject * bo = Factory::fabricate( playableClassId ); … … 107 110 Playable & playable = *(dynamic_cast<Playable*>(bo)); 108 111 109 if ( playableTexture != "" ) 110 playable.loadMD2Texture( playableTexture ); 111 if ( playableModel != "" ) 112 playable.loadModel( playableModel ); 112 playable.loadMD2Texture( playableTexture ); 113 114 playable.loadModel( playableModel, 100.0f ); 113 115 playable.setOwner( userId ); 114 116 playable.setUniqueID( SharedNetworkData::getInstance()->getNewUniqueID() ); … … 125 127 stats->setPlayableUniqueId( playable.getUniqueID() ); 126 128 stats->setModelFileName( playableModel ); 129 130 if ( userId == 0 ) 131 stats->setNickName( Preferences::getInstance()->getString( "multiplayer", "nickname", "Server" ) ); 127 132 128 133 if ( rules.isA( CL_MULTIPLAYER_TEAM_DEATHMATCH ) ) -
trunk/src/lib/network/network_stream.cc
r9059 r9235 37 37 #include "network_log.h" 38 38 39 #include "player_stats.h" 39 40 40 41 #include "lib/util/loading/factory.h" … … 153 154 assert( peers[0].handshake == NULL ); 154 155 peers[0].handshake = hs; 156 157 hs->setPreferedNickName( Preferences::getInstance()->getString( "multiplayer", "nickname", "Player" ) ); 158 155 159 // peers[0].handshake->setSynchronized( true ); 156 160 //this->connectSynchronizeable(*hs); … … 392 396 { 393 397 handleNewClient( it->second.userId ); 398 399 if ( PlayerStats::getStats( it->second.userId ) && it->second.handshake->getPreferedNickName() != "" ) 400 { 401 PlayerStats::getStats( it->second.userId )->setNickName( it->second.handshake->getPreferedNickName() ); 402 } 394 403 } 395 404 -
trunk/src/lib/network/player_stats.cc
r9110 r9235 22 22 #include "state.h" 23 23 #include "shared_network_data.h" 24 25 #include "preferences.h" 24 26 25 27 #include "debug.h" … … 187 189 void PlayerStats::setNickName( std::string nick ) 188 190 { 189 if ( isServer() )191 if ( SharedNetworkData::getInstance()->isGameServer() ) 190 192 { 191 193 this->nickName = nick; … … 226 228 if ( getStats( SharedNetworkData::getInstance()->getHostID() ) ) 227 229 getStats( SharedNetworkData::getInstance()->getHostID() )->setNickName( newNick ); 230 231 Preferences::getInstance()->setString( "multiplayer", "nickname", newNick ); 228 232 } 229 233
Note: See TracChangeset
for help on using the changeset viewer.