Changeset 9691 in orxonox.OLD for branches/new_class_id/src
- Timestamp:
- Aug 22, 2006, 11:45:21 PM (18 years ago)
- 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 729 729 if (likely(PNode::nullParent == NULL)) 730 730 { 731 PNode::nullParent = new PNode(NULL, PNODE_PARENT_MODE_DEFAULT | PNODE_REPARENT_TO_NULL);731 PNode::nullParent = new NullParent(); 732 732 //PNode::nullParent->registerObject(, CL_NULL_PARENT); 733 733 PNode::nullParent->setName("NullParent"); … … 1105 1105 } 1106 1106 1107 1107 NewObjectListDefinition(NullParent); 1108 1109 NullParent::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 50 50 PNODE_REPARENT_DELETE_CHILDREN = 0x0040, //!< Deletes the Children of the node when This Node is Removed. (Use with care). 51 51 /// FIXME 52 52 PNODE_REPARENT_KEEP_POSITION = 0x0080, //!< Tries to keep the Position if the Node is reparented. 53 53 54 54 … … 73 73 74 74 //! 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 { 75 class PNode : virtual public BaseObject, virtual public Synchronizeable 76 { 76 77 NewObjectListDeclaration(PNode); 77 78 78 79 public: 79 80 PNode (PNode* parent = PNode::getNullParent(), long nodeFlags = PNODE_PARENT_MODE_DEFAULT); 80 81 virtual ~PNode (); … … 97 98 inline const Vector& getRelCoor () const { return this->prevRelCoordinate; }; 98 99 /** @returns the Relative Coordinate Destination */ 99 100 inline const Vector& getRelCoorSoft2D() const { return (this->toCoordinate)? *this->toCoordinate : this->relCoordinate; }; 100 101 void setAbsCoor (const Vector& absCoord); 101 102 void setAbsCoor (float x, float y, float z); … … 132 133 inline const Quaternion& getRelDir () const { return this->prevRelDirection; }; 133 134 /** @returns the Relative Directional Destination */ 134 135 inline const Quaternion& getRelDirSoft2D() const { return (this->toDirection)? *this->toDirection : this->relDirection; }; 135 136 /** @returns a Vector pointing into the relative Direction */ 136 137 inline Vector getRelDirV() const { return this->prevRelDirection.apply(Vector(0,1,0)); }; … … 180 181 void removeNodeFlags(unsigned short nodeFlags); 181 182 182 // NULL_PARENT //183 183 /** @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(); };184 static PNode* getNullParent() { return (PNode::nullParent != NULL) ? PNode::nullParent : PNode::createNullParent(); }; 185 185 186 186 // UPDATING // … … 197 197 float distance(const PNode* node) const { return (this->getAbsCoor() - node->getAbsCoor()).len(); }; 198 198 199 199 private: 200 200 /** tells the child that the parent's Coordinate has changed */ 201 201 inline void parentCoorChanged () { this->bRelCoorChanged = true; } 202 202 /** tells the child that the parent's Direction has changed */ 203 203 inline void parentDirChanged () { this->bRelDirChanged = true; } 204 204 public: 205 205 /** @returns the last calculated coordinate */ 206 206 inline Vector getLastAbsCoor() { return this->lastAbsCoordinate; } 207 207 private: 208 208 static PNode* createNullParent(); 209 209 void reparent(); … … 211 211 void eraseChild(PNode* child); 212 212 213 213 private: 214 214 bool bRelCoorChanged; //!< If Relative Coordinate has changed since last time we checked 215 215 bool bRelDirChanged; //!< If Relative Direction has changed since last time we checked … … 223 223 Vector lastAbsCoordinate; //!< this is used for speedcalculation, it stores the last coordinate 224 224 Quaternion prevRelDirection; //!< The last Relative Direciton from the last update-Cycle. 225 // Quaternion lastAbsDirection;225 // Quaternion lastAbsDirection; 226 226 227 227 Vector velocity; //!< Saves the velocity. … … 240 240 static PNode* nullParent; //!< The ROOT of the main PNode Tree. 241 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 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 ); 260 260 }; 261 261 262 // NULL_PARENT // 263 class NullParent : public PNode 264 { 265 NewObjectListDeclaration(NullParent); 266 friend class PNode; 267 NullParent(); 268 }; 269 270 262 271 #endif /* _P_NODE_H */ -
branches/new_class_id/src/lib/lang/base_object.cc
r9686 r9691 21 21 #include "util/loading/load_param.h" 22 22 23 NewObjectListDefinition(BaseObject); 24 23 25 /** 24 26 * @brief sets the name from a LoadXML-Element … … 26 28 */ 27 29 BaseObject::BaseObject(const std::string& objectName) 30 : _leafClassID(&BaseObject::classID()) 28 31 { 29 32 this->className = "BaseObject"; -
branches/new_class_id/src/lib/lang/base_object.h
r9686 r9691 26 26 class BaseObject : public sigslot::has_slots<> 27 27 { 28 28 NewObjectListDeclaration(BaseObject); 29 29 public: 30 30 BaseObject (const std::string& objectName = ""); … … 49 49 50 50 /** @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(); } 52 52 53 53 bool isA(const NewObjectListBase& objectList) const; … … 88 88 std::string className; //!< the name of the class 89 89 ClassList _classes; //!< All Classes this object is part of. 90 90 const NewClassID* _leafClassID; //!< Topmost ClassID. 91 91 }; 92 92 … … 104 104 inline void BaseObject::registerObject(T* object, NewObjectList<T>& objectList) 105 105 { 106 this->_leafClassID = &objectList.identity(); 106 107 this->_classes.push_front(ClassEntry(&objectList, objectList.registerObject(object))); 107 108 } -
branches/new_class_id/src/lib/lang/new_class_id.h
r9685 r9691 17 17 NewClassID(int id, const std::string& name) : _id(id), _name(name) { }; 18 18 // the copy constructor is also defined. 19 intid() const { return _id; };19 const int& id() const { return _id; }; 20 20 const std::string& name() const { return _name; }; 21 21 … … 23 23 bool operator==(int id) const { return _id == id; }; 24 24 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; }; 25 28 26 29 private: -
branches/new_class_id/src/lib/lang/new_object_list.h
r9686 r9691 25 25 public: \ 26 26 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(); }; \ 28 28 private: \ 29 29 static NewObjectList<ClassName> _objectList -
branches/new_class_id/src/lib/network/data_stream.cc
r9690 r9691 27 27 DataStream::DataStream() 28 28 { 29 this->setClassID(CL_DATA_STREAM, "DataStream");30 29 this->upBuffer = new byte[DATA_STREAM_BUFFER_SIZE]; 31 30 this->downBuffer = new byte[DATA_STREAM_BUFFER_SIZE]; … … 37 36 DataStream::DataStream(DataStream& inStream, DataStream& outStream) 38 37 { 39 this->setClassID(CL_DATA_STREAM, "DataStream");38 this->registerObject(this, DataStream::_objectList); 40 39 this->downStream = &outStream; 41 40 this->upStream = &inStream; -
branches/new_class_id/src/lib/network/handshake.cc
r9690 r9691 30 30 { 31 31 /* set the class id for the base object */ 32 this-> setClassID(CL_HANDSHAKE, "Handshake");32 this->registerObject(this, Handshake::_objectList); 33 33 34 34 -
branches/new_class_id/src/lib/network/message_manager.cc
r9690 r9691 37 37 MessageManager::MessageManager () 38 38 { 39 this-> setClassID( CL_MESSAGE_MANAGER, "MessageManager");39 this->registerObject(this, MessageManager::_objectList); 40 40 newNumber = 1; 41 41 setSynchronized( true ); -
branches/new_class_id/src/lib/network/monitor/connection_monitor.cc
r9690 r9691 31 31 { 32 32 /* 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); 34 34 35 35 this->userId = userId; -
branches/new_class_id/src/lib/network/monitor/network_monitor.cc
r9690 r9691 46 46 : Synchronizeable() 47 47 { 48 this-> setClassID(CL_NETWORK_MONITOR, "NetworkMonitor");48 this->registerObject(this, NetworkMonitor::_objectList); 49 49 50 50 this->networkStream = networkStream; -
branches/new_class_id/src/lib/network/monitor/network_stats_widget.cc
r9690 r9691 274 274 NetworkStatsWidget* NetworkStatsWidget::_statsWidget = NULL; 275 275 276 #include "class_list.h"277 278 276 void NetworkStatsWidget::toggleGUI() 279 277 { 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); 288 285 NetworkStatsWidget::_statsWidget->showAll(); 289 286 } -
branches/new_class_id/src/lib/network/monitor/network_stats_widget.h
r9690 r9691 20 20 class HostWidget : public OrxGui::GLGuiBox 21 21 { 22 NewObjectListDeclaration(HostWidget);23 22 public: 24 23 HostWidget(const std::string& name, const IP& ip); … … 82 81 class NetworkStatsWidget : public OrxGui::GLGuiFixedpositionBox 83 82 { 83 NewObjectListDeclaration(NetworkStatsWidget); 84 84 public: 85 85 static void toggleGUI(); -
branches/new_class_id/src/lib/network/network_game_manager.cc
r9690 r9691 23 23 #include "util/loading/factory.h" 24 24 #include "state.h" 25 #include "class_list.h"26 25 #include "debug.h" 27 26 … … 59 58 60 59 /* set the class id for the base object */ 61 this-> setClassID(CL_NETWORK_GAME_MANAGER, "NetworkGameManager");60 this->registerObject(this, NetworkGameManager::_objectList); 62 61 63 62 this->setSynchronized(true); … … 93 92 assert( SharedNetworkData::getInstance()->isMasterServer()); 94 93 assert( State::getGameRules() ); 95 assert( State::getGameRules()->isA( CL_NETWORK_GAME_RULES) );94 assert( State::getGameRules()->isA( NetworkGameRules::classID()) ); 96 95 97 96 NetworkGameRules & rules = *(dynamic_cast<NetworkGameRules*>(State::getGameRules())); 98 97 99 98 int team = rules.getTeamForNewUser(); 100 ClassIDplayableClassId = rules.getPlayableClassId( userId, team );99 NewClassID playableClassId = rules.getPlayableClassId( userId, team ); 101 100 std::string playableModel = rules.getPlayableModelFileName( userId, team, playableClassId ); 102 101 std::string playableTexture = rules.getPlayableModelFileName( userId, team, playableClassId ); … … 106 105 107 106 assert( bo != NULL ); 108 assert( bo->isA( CL_PLAYABLE) );107 assert( bo->isA( Playable::classID()) ); 109 108 110 109 Playable & playable = *(dynamic_cast<Playable*>(bo)); … … 131 130 stats->setNickName( Preferences::getInstance()->getString( "multiplayer", "nickname", "Server" ) ); 132 131 133 if ( rules.isA( CL_MULTIPLAYER_TEAM_DEATHMATCH) )132 if ( rules.isA( MultiplayerTeamDeathmatch::classID()) ) 134 133 dynamic_cast<MultiplayerTeamDeathmatch*>(&rules)->respawnPlayable( &playable, team, 0.0f ); 135 134 … … 187 186 } 188 187 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 ) 194 193 { 195 if ( (*it)->isA( CL_PLAYABLE) )194 if ( (*it)->isA(Playable::classID()) ) 196 195 { 197 196 getInstance()->playablesToDelete.push_back( dynamic_cast<Playable*>(*it) ); … … 199 198 } 200 199 201 delete dynamic_cast<Synchronizeable*>(*it);200 delete (*it); 202 201 return true; 203 202 } … … 297 296 if ( State::getPlayer()->getPlayable() != *it ) 298 297 { 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() ) 302 299 { 303 300 PRINTF(0)("Delete unused playable: %s owner: %d\n", (*it)->getClassCName(), (*it)->getOwner() ); … … 324 321 325 322 assert( State::getGameRules() ); 326 assert( State::getGameRules()->isA( CL_NETWORK_GAME_RULES) );323 assert( State::getGameRules()->isA( NetworkGameRules::classID()) ); 327 324 328 325 NetworkGameRules & rules = *(dynamic_cast<NetworkGameRules*>(State::getGameRules())); -
branches/new_class_id/src/lib/network/network_manager.cc
r9690 r9691 20 20 #define DEBUG_MODULE_NETWORK 21 21 22 #include "class_list.h"23 22 #include "debug.h" 24 23 #include "shell_command.h" … … 50 49 { 51 50 /* set the class id for the base object */ 52 this-> setClassID(CL_NETWORK_MANAGER, "NetworkManager");51 this->registerObject(this, NetworkManager::_objectList); 53 52 PRINTF(0)("START\n"); 54 53 -
branches/new_class_id/src/lib/network/network_protocol.cc
r9690 r9691 35 35 36 36 37 NewObjectListDefinition(Network Manager);37 NewObjectListDefinition(NetworkProtocol); 38 38 /** 39 39 standard constructor … … 42 42 { 43 43 /* set the class id for the base object */ 44 this-> setClassID(CL_NETWORK_PROTOCOL, "NetworkProtocol");44 this->registerObject(this, NetworkProtocol::_objectList); 45 45 this->headerLength = INTSIZE+FLOATSIZE; 46 46 } -
branches/new_class_id/src/lib/network/network_stream.cc
r9690 r9691 45 45 46 46 #include "debug.h" 47 #include "class_list.h"48 #include <algorithm>49 50 47 51 48 #include "network_stream.h" … … 118 115 { 119 116 /* set the class id for the base object */ 120 this-> setClassID(CL_NETWORK_STREAM, "NetworkStream");117 this->registerObject(this, NetworkStream::_objectList); 121 118 this->clientSocket = NULL; 122 119 this->clientSoftSocket = NULL; … … 970 967 971 968 // 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()) 973 970 continue; 974 971 … … 976 973 if ( ( SharedNetworkData::getInstance()->isMasterServer() || 977 974 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 ) 979 976 continue; 980 977 981 978 /* list of synchronizeables that will never be synchronized over the network: */ 982 979 // do not sync null parent 983 if ( sync.getLeafClassID() == CL_NULL_PARENT)980 if ( NullParent::classID() == sync.getLeafClassID()) 984 981 continue; 985 982 … … 1190 1187 /* These are some small exeptions in creation: Not all objects can/should be created via Factory */ 1191 1188 /* 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) 1193 1190 { 1194 1191 PRINTF(1)("Don't create Object with ID %x, ignored!\n", (int)leafClassId); … … 1197 1194 } 1198 1195 else 1199 b = Factory::fabricate( (ClassID)leafClassId );1196 b = Factory::fabricate( leafClassId ); 1200 1197 1201 1198 if ( !b ) … … 1206 1203 } 1207 1204 1208 if ( b->isA(CL_SYNCHRONIZEABLE) )1205 if ( b->isA(Synchronizeable::classID()) ) 1209 1206 { 1210 1207 sync = dynamic_cast<Synchronizeable*>(b); -
branches/new_class_id/src/lib/network/player_stats.cc
r9690 r9691 16 16 #include "player_stats.h" 17 17 18 #include "class_list.h"19 18 #include "src/lib/util/loading/factory.h" 20 19 21 20 #include "player.h" 21 #include "playable.h" 22 22 #include "state.h" 23 23 #include "shared_network_data.h" … … 55 55 void PlayerStats::init( ) 56 56 { 57 this-> setClassID( CL_PLAYER_STATS, "PlayerStats");57 this->registerObject(this, PlayerStats::_objectList); 58 58 59 59 this->assignedUserId = 0; … … 123 123 PlayerStats * PlayerStats::getStats( int userId ) 124 124 { 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 ) 140 130 { 141 return dynamic_cast<PlayerStats*>(*it);131 return (*it); 142 132 } 143 133 } … … 151 141 void PlayerStats::setPlayableUniqueId( int uniqueId ) 152 142 { 153 const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYABLE );154 155 if ( !list )156 {157 this->playableUniqueId = uniqueId;158 return;159 }160 161 143 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 ) 169 149 { 170 this->playable = dynamic_cast<Playable*>(*it);150 this->playable = (*it); 171 151 //TODO when OM_PLAYERS is ticked add line: 172 152 //this->playable->toList( OM_PLAYERS ); … … 175 155 } 176 156 177 if ( this->playable && this->assignedUserId == SharedNetworkData::getInstance() 178 ->getHostID() ) 157 if ( this->playable && this->assignedUserId == SharedNetworkData::getInstance()->getHostID() ) 179 158 { 180 159 State::getPlayer()->setPlayable( this->playable ); … … 273 252 void PlayerStats::deleteAllPlayerStats( ) 274 253 { 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(); 279 257 } 280 258 … … 288 266 ScoreList result; 289 267 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); 303 273 304 274 TeamScoreList::iterator it = result[stats.getTeamId()].begin(); -
branches/new_class_id/src/lib/network/player_stats.h
r9690 r9691 58 58 59 59 inline int getPlayableClassId(){ return playableClassId; } 60 void setPlayableClassId( int classId ){ this->playableClassId = classId; };60 void setPlayableClassId( const NewClassID& classId ){ this->playableClassId = classId.id(); }; 61 61 62 62 inline int getPlayableUniqueId(){ return playableUniqueId; } -
branches/new_class_id/src/lib/network/proxy/network_settings.cc
r9690 r9691 37 37 { 38 38 /* set the class id for the base object */ 39 this-> setClassID(CL_NETWORK_SETTINGS, "NetworkSettings");39 this->registerObject(this, NetworkSettings::_objectList); 40 40 41 41 // suggest a good standard max players value -
branches/new_class_id/src/lib/network/proxy/proxy_control.cc
r9690 r9691 15 15 #include "proxy_control.h" 16 16 17 #include "class_list.h"18 17 #include "shell_command.h" 19 18 … … 48 47 ProxyControl::ProxyControl() 49 48 { 50 this-> setClassID( CL_PROXY_CONTROL, "ProxyControl");49 this->registerObject(this, ProxyControl::_objectList); 51 50 52 51 this->setSynchronized(false); -
branches/new_class_id/src/lib/network/shared_network_data.cc
r9690 r9691 34 34 { 35 35 /* set the class id for the base object */ 36 this-> setClassID(CL_SHARED_NETWORK_DATA, "SharedNetworkData");36 this->registerObject(this, SharedNetworkData::_objectList); 37 37 38 38 this->nodeType = NET_MASTER_SERVER; -
branches/new_class_id/src/lib/network/synchronizeable.cc
r9690 r9691 75 75 // remove the message manager only by the server 76 76 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() ) ) 78 78 NetworkGameManager::getInstance()->removeSynchronizeable( this->getUniqueID() ); 79 79 } -
branches/new_class_id/src/lib/network/tcp_server_socket.cc
r9690 r9691 49 49 { 50 50 /* set the class id for the base object */ 51 this-> setClassID(CL_SERVER_SOCKET, "TcpServerSocket");51 this->registerObject(this, TcpServerSocket::_objectList); 52 52 53 53 terminateThread = false; -
branches/new_class_id/src/lib/network/tcp_socket.cc
r9690 r9691 61 61 { 62 62 /* set the class id for the base object */ 63 this-> setClassID(CL_NETWORK_SOCKET, "TcpSocket");63 this->registerObject(this, TcpSocket::_objectList); 64 64 65 65 tcpSocket = NULL; -
branches/new_class_id/src/lib/network/udp_broadcast.cc
r9690 r9691 18 18 #include "udp_broadcast.h" 19 19 20 NewObjectListDefinition(UdpBroadcast);21 20 /** 22 21 * standard constructor -
branches/new_class_id/src/lib/network/udp_broadcast.h
r9690 r9691 15 15 class UdpBroadcast 16 16 { 17 NewObjectListDeclaration(UdpBroadcast);18 17 public: 19 18 UdpBroadcast(); -
branches/new_class_id/src/lib/util/loading/factory.cc
r9686 r9691 165 165 return NULL; 166 166 } 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 */ 174 BaseObject* Factory::fabricate(const NewClassID& classID) 175 { 176 Factory::fabricate(classID.id()); 177 } -
branches/new_class_id/src/lib/util/loading/factory.h
r9686 r9691 47 47 48 48 static BaseObject* fabricate(const std::string& className); 49 static BaseObject* fabricate(const NewClassID& classID); 49 50 static BaseObject* fabricate(int classID); 50 51 static BaseObject* fabricate(const TiXmlElement* root = NULL); -
branches/new_class_id/src/util/multiplayer_team_deathmatch.h
r9235 r9691 38 38 39 39 virtual int getTeamForNewUser(); 40 virtual ClassIDgetPlayableClassId( int userId, int team );41 virtual std::string getPlayableModelTextureFileName( int userId, int team, ClassIDclassId );42 virtual std::string getPlayableModelFileName( int userId, int team, ClassIDclassId );43 virtual float getPlayableScale( int userId, int team, ClassIDclassId );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 ); 44 44 45 45 virtual void registerSpawn( WorldEntity * we ); … … 50 50 inline void setDeathPenaltyTimeout(float time) { this->deathTimeout = time; } 51 51 inline void setMaxKills(int kills) { this->maxKills = kills; } 52 52 53 53 inline void setNumTeams( int numTeams ){ this->numTeams = numTeams; } 54 54 inline int getNumTeams(){ return this->numTeams; } 55 55 56 56 int getRandomTeam(); 57 57 58 58 virtual void process(const Event &event); 59 59 60 60 void onKill( WorldEntity * victim, WorldEntity * killer ); 61 61 void onRespawn( int userId ); 62 62 63 63 virtual void handleChatMessage( int userId, const std::string & message, int messageType ); 64 64 65 65 void respawnPlayable( Playable * playable, int teamId, float delay ); 66 66 … … 84 84 85 85 OrxGui::GLGuiBox* box; 86 86 87 87 OrxGui::GLGuiInputLine* input; 88 88 89 89 void calculateTeamScore(); 90 90 void nextGameState(); … … 92 92 void teamChange( int userId ); 93 93 void assignPlayable(); 94 94 95 95 void onButtonSpectator(); 96 96 void onButtonRandom(); … … 99 99 void onButtonCancel(); 100 100 void onButtonExit(); 101 101 102 102 void onInputEnter( const std::string & text ); 103 103 104 104 OrxGui::GLGuiBox* statsBox; 105 105 OrxGui::GLGuiTable* table; 106 106 void tickStatsTable(); 107 107 108 108 void showStats(); 109 109 void hideStats(); -
branches/new_class_id/src/util/network_game_rules.h
r9235 r9691 19 19 NetworkGameRules( const TiXmlElement* root ); 20 20 virtual ~NetworkGameRules(); 21 21 22 22 virtual int getTeamForNewUser(); 23 virtual ClassIDgetPlayableClassId( int userId, int team );24 virtual std::string getPlayableModelFileName( int userId, int team, ClassIDclassId );25 virtual std::string getPlayableModelTextureFileName( int userId, int team, ClassIDclassId );26 virtual float getPlayableScale( int userId, int team, ClassIDclassId );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 28 28 virtual PlayerStats * getNewPlayerStats( int userId ){ return new PlayerStats( userId ); } 29 29 30 30 virtual void handleChatMessage( int userId, const std::string & message, int messageType ) = 0; 31 31 32 32 void shellSay( const std::string & message ); 33 33 -
branches/new_class_id/src/world_entities/playable.cc
r9656 r9691 41 41 SHELL_COMMAND_STATIC(orxoWeapon, Playable, Playable::addSomeWeapons_CHEAT) 42 42 ->setAlias("orxoWeapon"); 43 43 NewObjectListDefinition(Playable) 44 44 45 45 Playable::Playable() … … 48 48 playmode(Playable::Full3D) 49 49 { 50 this-> setClassID(CL_PLAYABLE, "Playable");50 this->registerObject(this, Playable::_classID); 51 51 PRINTF(4)("PLAYABLE INIT\n"); 52 52 -
branches/new_class_id/src/world_entities/playable.h
r9656 r9691 27 27 class Playable : public WorldEntity, public Extendable 28 28 { 29 NewObjectListDeclaration(Playable); 29 30 public: 30 31 //! Defines the Playmode of an Entity.
Note: See TracChangeset
for help on using the changeset viewer.