Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9235 in orxonox.OLD for trunk/src/lib/network


Ignore:
Timestamp:
Jul 5, 2006, 4:39:02 PM (18 years ago)
Author:
bensch
Message:

merged the presentation back

Location:
trunk/src/lib/network
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/network/handshake.cc

    r8362 r9235  
    4343
    4444  candel_id = registerVarId( new SynchronizeableInt( &localState.canDel, &remoteState.canDel, "canDel", PERMISSION_ALL ) );
     45 
     46  registerVar( new SynchronizeableString( &localState.preferedNickName, &remoteState.preferedNickName, "preferedNickName", PERMISSION_ALL ) );
    4547
    4648  localState.completed = 0;
  • trunk/src/lib/network/handshake.h

    r7954 r9235  
    2828 
    2929  std::string errorString;
     30 
     31  //additional data
     32  std::string preferedNickName;
    3033};
    3134
     
    4346    inline bool       allowDel(){ return localState.canDel == 1; }
    4447    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; }
    4551   
    4652    virtual void varChangeHandler( std::list<int> & id );
  • trunk/src/lib/network/network_game_manager.cc

    r9110 r9235  
    4242#include "multiplayer_team_deathmatch.h"
    4343
     44#include "preferences.h"
     45
    4446
    4547/* using namespace std is default, this needs to be here */
     
    99101  std::string playableModel = rules.getPlayableModelFileName( userId, team, playableClassId );
    100102  std::string playableTexture = rules.getPlayableModelFileName( userId, team, playableClassId );
     103  float       playableScale = rules.getPlayableScale( userId, team, playableClassId );
    101104 
    102105  BaseObject * bo = Factory::fabricate( playableClassId );
     
    107110  Playable & playable = *(dynamic_cast<Playable*>(bo));
    108111 
    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 );
    113115  playable.setOwner( userId );
    114116  playable.setUniqueID( SharedNetworkData::getInstance()->getNewUniqueID() );
     
    125127  stats->setPlayableUniqueId( playable.getUniqueID() );
    126128  stats->setModelFileName( playableModel );
     129 
     130  if ( userId == 0 )
     131    stats->setNickName( Preferences::getInstance()->getString( "multiplayer", "nickname", "Server" ) );
    127132 
    128133  if ( rules.isA( CL_MULTIPLAYER_TEAM_DEATHMATCH ) )
  • trunk/src/lib/network/network_stream.cc

    r9059 r9235  
    3737#include "network_log.h"
    3838
     39#include "player_stats.h"
    3940
    4041#include "lib/util/loading/factory.h"
     
    153154  assert( peers[0].handshake == NULL );
    154155  peers[0].handshake = hs;
     156 
     157  hs->setPreferedNickName( Preferences::getInstance()->getString( "multiplayer", "nickname", "Player" ) );
     158 
    155159//   peers[0].handshake->setSynchronized( true );
    156160  //this->connectSynchronizeable(*hs);
     
    392396              {
    393397                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                }
    394403              }
    395404             
  • trunk/src/lib/network/player_stats.cc

    r9110 r9235  
    2222#include "state.h"
    2323#include "shared_network_data.h"
     24
     25#include "preferences.h"
    2426
    2527#include "debug.h"
     
    187189void PlayerStats::setNickName( std::string nick )
    188190{
    189   if ( isServer() )
     191  if ( SharedNetworkData::getInstance()->isGameServer() )
    190192  {
    191193    this->nickName = nick;
     
    226228  if ( getStats( SharedNetworkData::getInstance()->getHostID() ) )
    227229    getStats( SharedNetworkData::getInstance()->getHostID() )->setNickName( newNick );
     230   
     231  Preferences::getInstance()->setString( "multiplayer", "nickname", newNick );
    228232}
    229233
Note: See TracChangeset for help on using the changeset viewer.