Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9691 in orxonox.OLD for branches/new_class_id


Ignore:
Timestamp:
Aug 22, 2006, 11:45:21 PM (18 years ago)
Author:
bensch
Message:

new_class_id: adapted Network

Location:
branches/new_class_id/src
Files:
33 edited

Legend:

Unmodified
Added
Removed
  • branches/new_class_id/src/lib/coord/p_node.cc

    r9684 r9691  
    729729  if (likely(PNode::nullParent == NULL))
    730730  {
    731     PNode::nullParent = new PNode(NULL, PNODE_PARENT_MODE_DEFAULT | PNODE_REPARENT_TO_NULL);
     731    PNode::nullParent = new NullParent();
    732732    //PNode::nullParent->registerObject(, CL_NULL_PARENT);
    733733    PNode::nullParent->setName("NullParent");
     
    11051105}
    11061106
    1107 
     1107NewObjectListDefinition(NullParent);
     1108
     1109NullParent::NullParent()
     1110  : PNode(NULL, PNODE_PARENT_MODE_DEFAULT | PNODE_REPARENT_TO_NULL)
     1111{
     1112  this->registerObject(this, NullParent::_objectList);
     1113}
  • branches/new_class_id/src/lib/coord/p_node.h

    r9684 r9691  
    5050  PNODE_REPARENT_DELETE_CHILDREN       = 0x0040,    //!< Deletes the Children of the node when This Node is Removed. (Use with care).
    5151  /// FIXME
    52    PNODE_REPARENT_KEEP_POSITION         = 0x0080,    //!< Tries to keep the Position if the Node is reparented.
     52  PNODE_REPARENT_KEEP_POSITION         = 0x0080,    //!< Tries to keep the Position if the Node is reparented.
    5353
    5454
     
    7373
    7474//! Patent Node is a Engine to calculate the position of an Object in respect to the position of its parent.
    75 class PNode : virtual public BaseObject, virtual public Synchronizeable {
     75class PNode : virtual public BaseObject, virtual public Synchronizeable
     76{
    7677  NewObjectListDeclaration(PNode);
    7778
    78   public:
     79public:
    7980  PNode (PNode* parent = PNode::getNullParent(), long nodeFlags = PNODE_PARENT_MODE_DEFAULT);
    8081  virtual ~PNode ();
     
    9798  inline const Vector& getRelCoor () const { return this->prevRelCoordinate; };
    9899  /** @returns the Relative Coordinate Destination */
    99   inline const Vector& getRelCoorSoft2D() const { return (this->toCoordinate)? *this->toCoordinate : this->relCoordinate; };
     100inline const Vector& getRelCoorSoft2D() const { return (this->toCoordinate)? *this->toCoordinate : this->relCoordinate; };
    100101  void setAbsCoor (const Vector& absCoord);
    101102  void setAbsCoor (float x, float y, float z);
     
    132133  inline const Quaternion& getRelDir () const { return this->prevRelDirection; };
    133134  /** @returns the Relative Directional Destination */
    134   inline const Quaternion& getRelDirSoft2D() const { return (this->toDirection)? *this->toDirection : this->relDirection; };
     135inline const Quaternion& getRelDirSoft2D() const { return (this->toDirection)? *this->toDirection : this->relDirection; };
    135136  /** @returns a Vector pointing into the relative Direction */
    136137  inline Vector getRelDirV() const { return this->prevRelDirection.apply(Vector(0,1,0)); };
     
    180181  void removeNodeFlags(unsigned short nodeFlags);
    181182
    182   // NULL_PARENT //
    183183  /** @returns the NullParent, the (main) ROOT of the PNode Tree. If it does not yet exist, it will be created. */
    184   static PNode* getNullParent()  { return (PNode::nullParent != NULL)? PNode::nullParent : PNode::createNullParent(); };
     184static PNode* getNullParent()  { return (PNode::nullParent != NULL) ? PNode::nullParent : PNode::createNullParent(); };
    185185
    186186  // UPDATING //
     
    197197  float distance(const PNode* node) const { return (this->getAbsCoor() - node->getAbsCoor()).len(); };
    198198
    199  private:
     199private:
    200200  /** tells the child that the parent's Coordinate has changed */
    201201  inline void parentCoorChanged () { this->bRelCoorChanged = true; }
    202202  /** tells the child that the parent's Direction has changed */
    203203  inline void parentDirChanged () { this->bRelDirChanged = true; }
    204  public:
     204public:
    205205  /** @returns the last calculated coordinate */
    206206  inline Vector getLastAbsCoor() { return this->lastAbsCoordinate; }
    207  private:
     207private:
    208208  static PNode* createNullParent();
    209209  void reparent();
     
    211211  void eraseChild(PNode* child);
    212212
    213  private:
     213private:
    214214  bool               bRelCoorChanged;    //!< If Relative Coordinate has changed since last time we checked
    215215  bool               bRelDirChanged;     //!< If Relative Direction has changed since last time we checked
     
    223223  Vector             lastAbsCoordinate;  //!< this is used for speedcalculation, it stores the last coordinate
    224224  Quaternion         prevRelDirection;   //!< The last Relative Direciton from the last update-Cycle.
    225 //  Quaternion         lastAbsDirection;
     225  //  Quaternion         lastAbsDirection;
    226226
    227227  Vector             velocity;           //!< Saves the velocity.
     
    240240  static PNode*      nullParent;         //!< The ROOT of the main PNode Tree.
    241241
    242   private:
    243     float coorx;
    244     float coory;
    245     float coorz;
    246 
    247     float rotw;
    248     float rotx;
    249     float roty;
    250     float rotz;
    251 
    252   private:
    253     int relCoordinate_handle;
    254     int relDirection_handle;
    255     Vector relCoordinate_write;
    256     Quaternion relDirection_write;
    257 
    258   public:
    259     virtual void varChangeHandler( std::list<int> & id );
     242private:
     243  float coorx;
     244  float coory;
     245  float coorz;
     246
     247  float rotw;
     248  float rotx;
     249  float roty;
     250  float rotz;
     251
     252private:
     253  int relCoordinate_handle;
     254  int relDirection_handle;
     255  Vector relCoordinate_write;
     256  Quaternion relDirection_write;
     257
     258public:
     259  virtual void varChangeHandler( std::list<int> & id );
    260260};
    261261
     262// NULL_PARENT //
     263class NullParent : public PNode
     264{
     265  NewObjectListDeclaration(NullParent);
     266  friend class PNode;
     267  NullParent();
     268};
     269
     270
    262271#endif /* _P_NODE_H */
  • branches/new_class_id/src/lib/lang/base_object.cc

    r9686 r9691  
    2121#include "util/loading/load_param.h"
    2222
     23NewObjectListDefinition(BaseObject);
     24
    2325/**
    2426 * @brief sets the name from a LoadXML-Element
     
    2628 */
    2729BaseObject::BaseObject(const std::string& objectName)
     30  : _leafClassID(&BaseObject::classID())
    2831{
    2932  this->className = "BaseObject";
  • branches/new_class_id/src/lib/lang/base_object.h

    r9686 r9691  
    2626class BaseObject : public sigslot::has_slots<>
    2727{
    28 
     28  NewObjectListDeclaration(BaseObject);
    2929public:
    3030  BaseObject (const std::string& objectName = "");
     
    4949
    5050  /** @returns the ID of the Topmost object of the ClassStack */
    51   inline int getLeafClassID() const { return _classes.front()._objectList->id(); }
     51  inline const int& getLeafClassID() const { return _leafClassID->id(); }
    5252
    5353  bool isA(const NewObjectListBase& objectList) const;
     
    8888  std::string                         className;    //!< the name of the class
    8989  ClassList                           _classes;     //!< All Classes this object is part of.
    90 
     90  const NewClassID*                       _leafClassID;  //!< Topmost ClassID.
    9191};
    9292
     
    104104inline void BaseObject::registerObject(T* object, NewObjectList<T>& objectList)
    105105{
     106  this->_leafClassID = &objectList.identity();
    106107  this->_classes.push_front(ClassEntry(&objectList, objectList.registerObject(object)));
    107108}
  • branches/new_class_id/src/lib/lang/new_class_id.h

    r9685 r9691  
    1717  NewClassID(int id, const std::string& name) : _id(id), _name(name) { };
    1818  // the copy constructor is also defined.
    19   int id() const { return _id; };
     19  const int& id() const { return _id; };
    2020  const std::string& name() const { return _name; };
    2121
     
    2323  bool operator==(int id) const { return _id == id; };
    2424  bool operator==(const std::string& name) const { return _name == name; };
     25  bool operator!=(NewClassID id) const { return _id != id._id && _name != id._name; };
     26  bool operator!=(int id) const { return _id != id; };
     27  bool operator!=(const std::string& name) const { return _name != name; };
    2528
    2629private:
  • branches/new_class_id/src/lib/lang/new_object_list.h

    r9686 r9691  
    2525  public: \
    2626   static inline const NewObjectList<ClassName>& objectList() { return ClassName::_objectList; }; \
    27    static inline const NewClassID classID() { return ClassName::_objectList.identity(); }; \
     27   static inline const NewClassID& classID() { return ClassName::_objectList.identity(); }; \
    2828  private: \
    2929   static NewObjectList<ClassName> _objectList
  • branches/new_class_id/src/lib/network/data_stream.cc

    r9690 r9691  
    2727DataStream::DataStream()
    2828{
    29   this->setClassID(CL_DATA_STREAM, "DataStream");
    3029  this->upBuffer = new byte[DATA_STREAM_BUFFER_SIZE];
    3130  this->downBuffer = new byte[DATA_STREAM_BUFFER_SIZE];
     
    3736DataStream::DataStream(DataStream& inStream, DataStream& outStream)
    3837{
    39     this->setClassID(CL_DATA_STREAM, "DataStream");
     38  this->registerObject(this, DataStream::_objectList);
    4039    this->downStream = &outStream;
    4140    this->upStream = &inStream;
  • branches/new_class_id/src/lib/network/handshake.cc

    r9690 r9691  
    3030{
    3131  /* set the class id for the base object */
    32   this->setClassID(CL_HANDSHAKE, "Handshake");
     32  this->registerObject(this, Handshake::_objectList);
    3333
    3434
  • branches/new_class_id/src/lib/network/message_manager.cc

    r9690 r9691  
    3737MessageManager::MessageManager ()
    3838{
    39   this->setClassID( CL_MESSAGE_MANAGER, "MessageManager" );
     39  this->registerObject(this, MessageManager::_objectList);
    4040  newNumber = 1;
    4141  setSynchronized( true );
  • branches/new_class_id/src/lib/network/monitor/connection_monitor.cc

    r9690 r9691  
    3131{
    3232  /* set the class id for the base object and add ist to class list*/
    33   this->setClassID(CL_CONNECTION_MONITOR, "ConnectionMonitor");
     33  this->registerObject(this, ConnectionMonitor::_objectList);
    3434
    3535  this->userId = userId;
  • branches/new_class_id/src/lib/network/monitor/network_monitor.cc

    r9690 r9691  
    4646  : Synchronizeable()
    4747{
    48   this->setClassID(CL_NETWORK_MONITOR, "NetworkMonitor");
     48  this->registerObject(this, NetworkMonitor::_objectList);
    4949
    5050  this->networkStream = networkStream;
  • branches/new_class_id/src/lib/network/monitor/network_stats_widget.cc

    r9690 r9691  
    274274NetworkStatsWidget* NetworkStatsWidget::_statsWidget = NULL;
    275275
    276 #include "class_list.h"
    277 
    278276void NetworkStatsWidget::toggleGUI()
    279277{
    280   BaseObject* bo = NULL;
    281   const std::list<BaseObject*>* ls = ClassList::getList(CL_NETWORK_MONITOR);
    282   if (ls != NULL && !ls->empty())
    283     bo = ls->front();
    284 
    285   if (bo != NULL && NetworkStatsWidget::_statsWidget == NULL)
    286   {
    287     NetworkStatsWidget::_statsWidget = new NetworkStatsWidget(dynamic_cast<NetworkMonitor*> (bo));
     278  NetworkMonitor* monitor;
     279  if (!NetworkMonitor::objectList().empty())
     280    monitor = NetworkMonitor::objectList().front();
     281
     282  if (monitor != NULL && NetworkStatsWidget::_statsWidget == NULL)
     283  {
     284    NetworkStatsWidget::_statsWidget = new NetworkStatsWidget(monitor);
    288285    NetworkStatsWidget::_statsWidget->showAll();
    289286  }
  • branches/new_class_id/src/lib/network/monitor/network_stats_widget.h

    r9690 r9691  
    2020class HostWidget : public OrxGui::GLGuiBox
    2121{
    22   NewObjectListDeclaration(HostWidget);
    2322  public:
    2423    HostWidget(const std::string& name, const IP& ip);
     
    8281class NetworkStatsWidget : public OrxGui::GLGuiFixedpositionBox
    8382{
     83  NewObjectListDeclaration(NetworkStatsWidget);
    8484  public:
    8585    static void toggleGUI();
  • branches/new_class_id/src/lib/network/network_game_manager.cc

    r9690 r9691  
    2323#include "util/loading/factory.h"
    2424#include "state.h"
    25 #include "class_list.h"
    2625#include "debug.h"
    2726
     
    5958
    6059  /* set the class id for the base object */
    61   this->setClassID(CL_NETWORK_GAME_MANAGER, "NetworkGameManager");
     60  this->registerObject(this, NetworkGameManager::_objectList);
    6261
    6362  this->setSynchronized(true);
     
    9392  assert( SharedNetworkData::getInstance()->isMasterServer());
    9493  assert( State::getGameRules() );
    95   assert( State::getGameRules()->isA( CL_NETWORK_GAME_RULES ) );
     94  assert( State::getGameRules()->isA( NetworkGameRules::classID()) );
    9695
    9796  NetworkGameRules & rules = *(dynamic_cast<NetworkGameRules*>(State::getGameRules()));
    9897
    9998  int          team = rules.getTeamForNewUser();
    100   ClassID      playableClassId = rules.getPlayableClassId( userId, team );
     99  NewClassID   playableClassId = rules.getPlayableClassId( userId, team );
    101100  std::string  playableModel = rules.getPlayableModelFileName( userId, team, playableClassId );
    102101  std::string  playableTexture = rules.getPlayableModelFileName( userId, team, playableClassId );
     
    106105
    107106  assert( bo != NULL );
    108   assert( bo->isA( CL_PLAYABLE ) );
     107  assert( bo->isA( Playable::classID()) );
    109108
    110109  Playable & playable = *(dynamic_cast<Playable*>(bo));
     
    131130    stats->setNickName( Preferences::getInstance()->getString( "multiplayer", "nickname", "Server" ) );
    132131
    133   if ( rules.isA( CL_MULTIPLAYER_TEAM_DEATHMATCH ) )
     132  if ( rules.isA( MultiplayerTeamDeathmatch::classID()) )
    134133    dynamic_cast<MultiplayerTeamDeathmatch*>(&rules)->respawnPlayable( &playable, team, 0.0f );
    135134
     
    187186  }
    188187
    189   const std::list<BaseObject*> * list = ClassList::getList( CL_SYNCHRONIZEABLE );
    190 
    191   for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
    192   {
    193     if ( dynamic_cast<Synchronizeable*>(*it)->getUniqueID() == uniqueId )
     188  for (NewObjectList<Synchronizeable>::const_iterator it = Synchronizeable::objectList().begin();
     189       it != Synchronizeable::objectList().end();
     190      ++it)
     191  {
     192    if ( (*it)->getUniqueID() == uniqueId )
    194193    {
    195       if ( (*it)->isA(CL_PLAYABLE) )
     194      if ( (*it)->isA(Playable::classID()) )
    196195      {
    197196        getInstance()->playablesToDelete.push_back( dynamic_cast<Playable*>(*it) );
     
    199198      }
    200199
    201       delete dynamic_cast<Synchronizeable*>(*it);
     200      delete (*it);
    202201      return true;
    203202    }
     
    297296    if ( State::getPlayer()->getPlayable() != *it )
    298297    {
    299       const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYABLE );
    300 
    301       if ( list && std::find( list->begin(), list->end(), *it ) != list->end() )
     298      if ( std::find( Playable::objectList().begin(), Playable::objectList().end(), *it ) != Playable::objectList().end() )
    302299      {
    303300        PRINTF(0)("Delete unused playable: %s owner: %d\n", (*it)->getClassCName(), (*it)->getOwner() );
     
    324321
    325322  assert( State::getGameRules() );
    326   assert( State::getGameRules()->isA( CL_NETWORK_GAME_RULES ) );
     323  assert( State::getGameRules()->isA( NetworkGameRules::classID()) );
    327324
    328325  NetworkGameRules & rules = *(dynamic_cast<NetworkGameRules*>(State::getGameRules()));
  • branches/new_class_id/src/lib/network/network_manager.cc

    r9690 r9691  
    2020#define DEBUG_MODULE_NETWORK
    2121
    22 #include "class_list.h"
    2322#include "debug.h"
    2423#include "shell_command.h"
     
    5049{
    5150  /* set the class id for the base object */
    52   this->setClassID(CL_NETWORK_MANAGER, "NetworkManager");
     51  this->registerObject(this, NetworkManager::_objectList);
    5352  PRINTF(0)("START\n");
    5453
  • branches/new_class_id/src/lib/network/network_protocol.cc

    r9690 r9691  
    3535
    3636
    37 NewObjectListDefinition(NetworkManager);
     37NewObjectListDefinition(NetworkProtocol);
    3838/**
    3939  standard constructor
     
    4242{
    4343  /* set the class id for the base object */
    44   this->setClassID(CL_NETWORK_PROTOCOL, "NetworkProtocol");
     44  this->registerObject(this, NetworkProtocol::_objectList);
    4545  this->headerLength = INTSIZE+FLOATSIZE;
    4646}
  • branches/new_class_id/src/lib/network/network_stream.cc

    r9690 r9691  
    4545
    4646#include "debug.h"
    47 #include "class_list.h"
    48 #include <algorithm>
    49 
    5047
    5148#include "network_stream.h"
     
    118115{
    119116  /* set the class id for the base object */
    120   this->setClassID(CL_NETWORK_STREAM, "NetworkStream");
     117  this->registerObject(this, NetworkStream::_objectList);
    121118  this->clientSocket = NULL;
    122119  this->clientSoftSocket = NULL;
     
    970967
    971968      // if handshake not finished only sync handshake
    972       if ( peer->second.handshake && sync.getLeafClassID() != CL_HANDSHAKE )
     969      if ( peer->second.handshake && Handshake::classID() != sync.getLeafClassID())
    973970        continue;
    974971
     
    976973      if ( ( SharedNetworkData::getInstance()->isMasterServer() ||
    977974             SharedNetworkData::getInstance()->isProxyServerActive() &&  peer->second.isClient())
    978              && sync.getLeafClassID() == CL_HANDSHAKE && sync.getUniqueID() != peer->second.userId )
     975             && Handshake::classID() == sync.getLeafClassID() && sync.getUniqueID() != peer->second.userId )
    979976        continue;
    980977
    981978      /* list of synchronizeables that will never be synchronized over the network: */
    982979      // do not sync null parent
    983       if ( sync.getLeafClassID() == CL_NULL_PARENT )
     980      if ( NullParent::classID() == sync.getLeafClassID())
    984981        continue;
    985982
     
    11901187          /* These are some small exeptions in creation: Not all objects can/should be created via Factory */
    11911188          /* Exception 1: NullParent */
    1192           if( leafClassId == CL_NULL_PARENT || leafClassId == CL_SYNCHRONIZEABLE || leafClassId == CL_NETWORK_GAME_MANAGER )
     1189          if( NullParent::classID() == leafClassId || Synchronizeable::classID() == leafClassId || NetworkGameManager::classID() == leafClassId)
    11931190          {
    11941191            PRINTF(1)("Don't create Object with ID %x, ignored!\n", (int)leafClassId);
     
    11971194          }
    11981195          else
    1199             b = Factory::fabricate( (ClassID)leafClassId );
     1196            b = Factory::fabricate( leafClassId );
    12001197
    12011198          if ( !b )
     
    12061203          }
    12071204
    1208           if ( b->isA(CL_SYNCHRONIZEABLE) )
     1205          if ( b->isA(Synchronizeable::classID()) )
    12091206          {
    12101207            sync = dynamic_cast<Synchronizeable*>(b);
  • branches/new_class_id/src/lib/network/player_stats.cc

    r9690 r9691  
    1616#include "player_stats.h"
    1717
    18 #include "class_list.h"
    1918#include "src/lib/util/loading/factory.h"
    2019
    2120#include "player.h"
     21#include "playable.h"
    2222#include "state.h"
    2323#include "shared_network_data.h"
     
    5555void PlayerStats::init( )
    5656{
    57   this->setClassID( CL_PLAYER_STATS, "PlayerStats" );
     57  this->registerObject(this, PlayerStats::_objectList);
    5858
    5959  this->assignedUserId = 0;
     
    123123PlayerStats * PlayerStats::getStats( int userId )
    124124{
    125   const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYER_STATS );
    126 
    127   if ( !list )
    128   {
    129     return NULL;
    130   }
    131 
    132   for ( std::list<BaseObject*>::const_iterator it = list->
    133         begin();
    134         it != list->end();
    135         it++ )
    136   {
    137 
    138 
    139     if ( dynamic_cast<PlayerStats*>(*it)->getAssignedUserId() == userId )
     125  for (NewObjectList<PlayerStats>::const_iterator it = PlayerStats::objectList().begin();
     126       it != PlayerStats::objectList().end();
     127       ++it)
     128  {
     129    if ( (*it)->getAssignedUserId() == userId )
    140130    {
    141       return dynamic_cast<PlayerStats*>(*it);
     131      return (*it);
    142132    }
    143133  }
     
    151141void PlayerStats::setPlayableUniqueId( int uniqueId )
    152142{
    153   const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYABLE );
    154 
    155   if ( !list )
    156   {
    157     this->playableUniqueId = uniqueId;
    158     return;
    159   }
    160 
    161143  this->playable = NULL;
    162   for ( std::list<BaseObject*>::const_iterator it = list->
    163         begin();
    164         it != list->end();
    165         it++ )
    166   {
    167     if ( dynamic_cast<Playable*>(*it)->
    168          getUniqueID() == uniqueId )
     144  for (NewObjectList<Playable>::const_iterator it = Playable::objectList().begin();
     145       it != Playable::objectList().end();
     146       ++it)
     147  {
     148    if ( (*it)->getUniqueID() == uniqueId )
    169149    {
    170       this->playable = dynamic_cast<Playable*>(*it);
     150      this->playable = (*it);
    171151      //TODO when OM_PLAYERS is ticked add line:
    172152      //this->playable->toList( OM_PLAYERS );
     
    175155  }
    176156
    177   if ( this->playable && this->assignedUserId == SharedNetworkData::getInstance()
    178        ->getHostID() )
     157  if ( this->playable && this->assignedUserId == SharedNetworkData::getInstance()->getHostID() )
    179158  {
    180159    State::getPlayer()->setPlayable( this->playable );
     
    273252void PlayerStats::deleteAllPlayerStats( )
    274253{
    275   const std::list<BaseObject*> * list;
    276 
    277   while ( (list  = ClassList::getList( CL_PLAYER_STATS )) != NULL && list->begin() != list->end() )
    278     delete *list->begin();
     254
     255  while(!PlayerStats::objectList().empty())
     256    delete PlayerStats::objectList().front();
    279257}
    280258
     
    288266  ScoreList result;
    289267
    290   const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYER_STATS );
    291 
    292   if ( !list )
    293   {
    294     return result;
    295   }
    296 
    297   for ( std::list<BaseObject*>::const_iterator it = list->
    298         begin();
    299         it != list->end();
    300         it++ )
    301   {
    302     PlayerStats & stats = *dynamic_cast<PlayerStats*>(*it);
     268  for (NewObjectList<PlayerStats>::const_iterator it = PlayerStats::objectList().begin();
     269       it != PlayerStats::objectList().end();
     270       ++it)
     271  {
     272    PlayerStats& stats = *(*it);
    303273
    304274    TeamScoreList::iterator it = result[stats.getTeamId()].begin();
  • branches/new_class_id/src/lib/network/player_stats.h

    r9690 r9691  
    5858
    5959    inline int getPlayableClassId(){ return playableClassId; }
    60     void setPlayableClassId( int classId ){ this->playableClassId = classId; };
     60    void setPlayableClassId( const NewClassID& classId ){ this->playableClassId = classId.id(); };
    6161
    6262    inline int getPlayableUniqueId(){ return playableUniqueId; }
  • branches/new_class_id/src/lib/network/proxy/network_settings.cc

    r9690 r9691  
    3737{
    3838  /* set the class id for the base object */
    39   this->setClassID(CL_NETWORK_SETTINGS, "NetworkSettings");
     39  this->registerObject(this, NetworkSettings::_objectList);
    4040
    4141  // suggest a good standard max players value
  • branches/new_class_id/src/lib/network/proxy/proxy_control.cc

    r9690 r9691  
    1515#include "proxy_control.h"
    1616
    17 #include "class_list.h"
    1817#include "shell_command.h"
    1918
     
    4847ProxyControl::ProxyControl()
    4948{
    50   this->setClassID( CL_PROXY_CONTROL, "ProxyControl" );
     49  this->registerObject(this, ProxyControl::_objectList);
    5150
    5251  this->setSynchronized(false);
  • branches/new_class_id/src/lib/network/shared_network_data.cc

    r9690 r9691  
    3434{
    3535  /* set the class id for the base object */
    36   this->setClassID(CL_SHARED_NETWORK_DATA, "SharedNetworkData");
     36  this->registerObject(this, SharedNetworkData::_objectList);
    3737
    3838  this->nodeType = NET_MASTER_SERVER;
  • branches/new_class_id/src/lib/network/synchronizeable.cc

    r9690 r9691  
    7575    // remove the message manager only by the server
    7676    if ( (SharedNetworkData::getInstance()->isMasterServer() )
    77            && this->beSynchronized() && this->getUniqueID() > 0 && !this->isA( CL_MESSAGE_MANAGER ) )
     77          && this->beSynchronized() && this->getUniqueID() > 0 && !this->isA( MessageManager::classID() ) )
    7878      NetworkGameManager::getInstance()->removeSynchronizeable( this->getUniqueID() );
    7979  }
  • branches/new_class_id/src/lib/network/tcp_server_socket.cc

    r9690 r9691  
    4949{
    5050  /* set the class id for the base object */
    51   this->setClassID(CL_SERVER_SOCKET, "TcpServerSocket");
     51  this->registerObject(this, TcpServerSocket::_objectList);
    5252
    5353  terminateThread = false;
  • branches/new_class_id/src/lib/network/tcp_socket.cc

    r9690 r9691  
    6161{
    6262  /* set the class id for the base object */
    63   this->setClassID(CL_NETWORK_SOCKET, "TcpSocket");
     63  this->registerObject(this, TcpSocket::_objectList);
    6464
    6565  tcpSocket = NULL;
  • branches/new_class_id/src/lib/network/udp_broadcast.cc

    r9690 r9691  
    1818#include "udp_broadcast.h"
    1919
    20 NewObjectListDefinition(UdpBroadcast);
    2120/**
    2221 * standard constructor
  • branches/new_class_id/src/lib/network/udp_broadcast.h

    r9690 r9691  
    1515class UdpBroadcast
    1616{
    17   NewObjectListDeclaration(UdpBroadcast);
    1817  public:
    1918    UdpBroadcast();
  • branches/new_class_id/src/lib/util/loading/factory.cc

    r9686 r9691  
    165165  return NULL;
    166166}
     167
     168
     169/**
     170 * @brief Creates a new Object of type classID
     171 * @param classID the ClassID to match for the newly created Object
     172 * @returns a new Object of Type classID on match, NULL otherwise
     173 */
     174BaseObject* Factory::fabricate(const NewClassID& classID)
     175{
     176  Factory::fabricate(classID.id());
     177}
  • branches/new_class_id/src/lib/util/loading/factory.h

    r9686 r9691  
    4747
    4848  static  BaseObject* fabricate(const std::string& className);
     49  static  BaseObject* fabricate(const NewClassID& classID);
    4950  static  BaseObject* fabricate(int classID);
    5051  static  BaseObject* fabricate(const TiXmlElement* root = NULL);
  • branches/new_class_id/src/util/multiplayer_team_deathmatch.h

    r9235 r9691  
    3838
    3939    virtual int getTeamForNewUser();
    40     virtual ClassID getPlayableClassId( int userId, int team );
    41     virtual std::string getPlayableModelTextureFileName( int userId, int team, ClassID classId );
    42     virtual std::string getPlayableModelFileName( int userId, int team, ClassID classId );
    43     virtual float getPlayableScale( int userId, int team, ClassID classId );
     40    virtual const NewClassID& getPlayableClassId( int userId, int team );
     41    virtual std::string getPlayableModelTextureFileName( int userId, int team, const NewClassID& classId );
     42    virtual std::string getPlayableModelFileName( int userId, int team, const NewClassID& classId );
     43    virtual float getPlayableScale( int userId, int team, const NewClassID& classId );
    4444
    4545    virtual void registerSpawn( WorldEntity * we );
     
    5050    inline void setDeathPenaltyTimeout(float time) { this->deathTimeout = time; }
    5151    inline void setMaxKills(int kills) { this->maxKills = kills; }
    52    
     52
    5353    inline void setNumTeams( int numTeams ){ this->numTeams = numTeams; }
    5454    inline int getNumTeams(){ return this->numTeams; }
    55    
     55
    5656    int getRandomTeam();
    57    
     57
    5858    virtual void process(const Event &event);
    59    
     59
    6060    void onKill( WorldEntity * victim, WorldEntity * killer );
    6161    void onRespawn( int userId );
    62    
     62
    6363    virtual void handleChatMessage( int userId, const std::string & message, int messageType );
    64    
     64
    6565    void respawnPlayable( Playable * playable, int teamId, float delay );
    6666
     
    8484
    8585    OrxGui::GLGuiBox* box;
    86    
     86
    8787    OrxGui::GLGuiInputLine* input;
    88    
     88
    8989    void calculateTeamScore();
    9090    void nextGameState();
     
    9292    void teamChange( int userId );
    9393    void assignPlayable();
    94    
     94
    9595    void onButtonSpectator();
    9696    void onButtonRandom();
     
    9999    void onButtonCancel();
    100100    void onButtonExit();
    101    
     101
    102102    void onInputEnter( const std::string & text );
    103    
     103
    104104    OrxGui::GLGuiBox* statsBox;
    105105    OrxGui::GLGuiTable* table;
    106106    void tickStatsTable();
    107    
     107
    108108    void showStats();
    109109    void hideStats();
  • branches/new_class_id/src/util/network_game_rules.h

    r9235 r9691  
    1919    NetworkGameRules( const TiXmlElement* root );
    2020    virtual ~NetworkGameRules();
    21    
     21
    2222    virtual int getTeamForNewUser();
    23     virtual ClassID getPlayableClassId( int userId, int team );
    24     virtual std::string getPlayableModelFileName( int userId, int team, ClassID classId );
    25     virtual std::string getPlayableModelTextureFileName( int userId, int team, ClassID classId );
    26     virtual float getPlayableScale( int userId, int team, ClassID classId );
    27    
     23    virtual const NewClassID& getPlayableClassId( int userId, int team );
     24    virtual std::string getPlayableModelFileName( int userId, int team, const NewClassID& classId );
     25    virtual std::string getPlayableModelTextureFileName( int userId, int team, const NewClassID& classId );
     26    virtual float getPlayableScale( int userId, int team, const NewClassID& classId );
     27
    2828    virtual PlayerStats * getNewPlayerStats( int userId ){ return new PlayerStats( userId ); }
    29    
     29
    3030    virtual void handleChatMessage( int userId, const std::string & message, int messageType ) = 0;
    31    
     31
    3232    void shellSay( const std::string & message );
    3333
  • branches/new_class_id/src/world_entities/playable.cc

    r9656 r9691  
    4141SHELL_COMMAND_STATIC(orxoWeapon, Playable, Playable::addSomeWeapons_CHEAT)
    4242  ->setAlias("orxoWeapon");
    43 
     43NewObjectListDefinition(Playable)
    4444
    4545Playable::Playable()
     
    4848    playmode(Playable::Full3D)
    4949{
    50   this->setClassID(CL_PLAYABLE, "Playable");
     50  this->registerObject(this, Playable::_classID);
    5151  PRINTF(4)("PLAYABLE INIT\n");
    5252
  • branches/new_class_id/src/world_entities/playable.h

    r9656 r9691  
    2727class Playable : public WorldEntity, public Extendable
    2828{
     29  NewObjectListDeclaration(Playable);
    2930public:
    3031  //! Defines the Playmode of an Entity.
Note: See TracChangeset for help on using the changeset viewer.