Changeset 2710 for code/trunk/src/network
- Timestamp:
- Feb 28, 2009, 7:46:37 PM (16 years ago)
- Location:
- code/trunk
- Files:
-
- 3 deleted
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:ignore deleted
- Property svn:mergeinfo changed
-
code/trunk/src/network/CMakeLists.txt
r2662 r2710 1 SET( NETWORK_SRC_FILES 1 # 2 # ORXONOX - the hottest 3D action shooter ever to exist 3 # > www.orxonox.net < 4 # 5 # This program is free software; you can redistribute it and/or 6 # modify it under the terms of the GNU General Public License 7 # as published by the Free Software Foundation; either version 2 8 # of the License, or (at your option) any later version. 9 # 10 # This program is distributed in the hope that it will be useful, 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 # GNU General Public License for more details. 14 # 15 # You should have received a copy of the GNU General Public License along 16 # with this program; if not, write to the Free Software Foundation, 17 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 # 19 20 SET_SOURCE_FILES(NETWORK_SRC_FILES 2 21 ChatListener.cc 3 22 Client.cc … … 14 33 Host.cc 15 34 ) 35 ADD_SUBDIRECTORY(packet) 36 ADD_SUBDIRECTORY(synchronisable) 37 GET_ALL_HEADER_FILES(NETWORK_HDR_FILES) 38 SET(NETWORK_FILES ${NETWORK_SRC_FILES} ${NETWORK_HDR_FILES}) 16 39 17 ADD_SOURCE_DIRECTORY(NETWORK_SRC_FILES packet) 18 ADD_SOURCE_DIRECTORY(NETWORK_SRC_FILES synchronisable) 40 GENERATE_SOURCE_GROUPS(${NETWORK_FILES}) 19 41 20 21 IF(WIN32) 22 ADD_LIBRARY( network ${NETWORK_SRC_FILES} ) 23 ELSE(WIN32) 24 ADD_LIBRARY( network SHARED ${NETWORK_SRC_FILES} ) 25 ENDIF(WIN32) 26 27 TARGET_LINK_LIBRARIES( network 42 ADD_LIBRARY(network SHARED ${NETWORK_FILES}) 43 SET_TARGET_PROPERTIES(network PROPERTIES DEFINE_SYMBOL "NETWORK_SHARED_BUILD") 44 TARGET_LINK_LIBRARIES(network 28 45 ${ZLIB_LIBRARY} 29 ${ENet_LIBRARY} 30 ${Boost_thread_LIBRARIES} 46 ${ENET_LIBRARY} 47 ${Boost_THREAD_LIBRARY} 48 util 31 49 core 32 50 ) 33 51 52 ORXONOX_INSTALL(network) 34 53 35 54 # build those parts only on request. 36 55 IF(NETWORK_TESTING_ENABLED) 37 56 ##### test for gamestate stuff ##### 38 SET( 57 SET(TEST_SRC_FILES 39 58 ${NETWORK_SRC_FILES} 40 59 ) 41 60 ADD_EXECUTABLE(networktest ${TEST_SRC_FILES}) 42 TARGET_LINK_LIBRARIES( 43 ${OGRE_LIBRAR IES}61 TARGET_LINK_LIBRARIES(networktest 62 ${OGRE_LIBRARY} 44 63 network 45 ${EN et_LIBRARY}64 ${ENET_LIBRARY} 46 65 ${ZLIB_LIBRARY} 47 ${WINDOWS_ENET_DEPENDENCIES}48 66 ) 49 67 ##### end test for gamestate stuff ##### -
code/trunk/src/network/GamestateManager.cc
r2662 r2710 118 118 return 0; 119 119 gs = reference->doSelection(clientID, 10000); 120 // gs = new packet::Gamestate(*reference);121 120 // save the (undiffed) gamestate in the clients gamestate map 122 121 gamestateMap_[clientID][gs->getID()]=gs; -
code/trunk/src/network/NetworkPrereqs.h
r2662 r2710 35 35 #define _NetworkPrereqs_H__ 36 36 37 #include " util/OrxonoxPlatform.h"37 #include "OrxonoxConfig.h" 38 38 39 39 //----------------------------------------------------------------------- 40 40 // Shared library settings 41 41 //----------------------------------------------------------------------- 42 #if (ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32) && !defined( NETWORK_STATIC_BUILD )42 #if defined(ORXONOX_PLATFORM_WINDOWS) && !defined( NETWORK_STATIC_BUILD ) 43 43 # ifdef NETWORK_SHARED_BUILD 44 44 # define _NetworkExport __declspec(dllexport) … … 55 55 # define _NetworkExport 56 56 #endif 57 58 //-----------------------------------------------------------------------59 // Includes60 //-----------------------------------------------------------------------61 #include "util/Integers.h"62 57 63 58 //----------------------------------------------------------------------- -
code/trunk/src/network/TrafficControl.h
r2662 r2710 36 36 #include <utility> 37 37 #include <algorithm> 38 #include "util/Integers.h"39 38 #include "core/OrxonoxClass.h" 40 39 #include "network/ClientConnectionListener.h" -
code/trunk/src/network/packet/Acknowledgement.cc
r2662 r2710 64 64 65 65 bool Acknowledgement::process(){ 66 COUT( 0) << "processing ACK with ID: " << getAckID() << endl;66 COUT(6) << "processing ACK with ID: " << getAckID() << endl; 67 67 bool b = GamestateHandler::ackGamestate(getAckID(), clientID_); 68 68 delete this; -
code/trunk/src/network/packet/CMakeLists.txt
r2131 r2710 1 SET(SRC_FILES1 ADD_SOURCE_FILES(NETWORK_SRC_FILES 2 2 Packet.cc 3 3 Chat.cc … … 8 8 DeleteObjects.cc 9 9 ) 10 11 ADD_SOURCE_FILES(SRC_FILES) -
code/trunk/src/network/packet/Gamestate.cc
r2662 r2710 110 110 for(it = ObjectList<Synchronisable>::begin(); it; ++it){ 111 111 112 tempsize=it->getSize(id, mode); 112 113 #ifndef NDEBUG 113 tempsize=it->getSize(id, mode);114 114 if(currentsize+tempsize > size){ 115 115 assert(0); // if we don't use multithreading this part shouldn't be neccessary … … 184 184 { 185 185 bool b = s->updateData(mem, mode); 186 // if(!b) 187 // COUT(0) << "data could not be updated" << endl; 186 188 assert(b); 187 189 } -
code/trunk/src/network/packet/Packet.cc
r2662 r2710 167 167 assert(ClientInformation::findClient(&peer->address)->getID() != (unsigned int)-2 || !Host::isServer()); 168 168 unsigned int clientID = ClientInformation::findClient(&peer->address)->getID(); 169 Packet *p ;169 Packet *p = 0; 170 170 COUT(5) << "packet type: " << *(ENUM::Type *)&data[_PACKETID] << std::endl; 171 171 switch( *(ENUM::Type *)(data + _PACKETID) ) -
code/trunk/src/network/packet/Packet.h
r2171 r2710 34 34 #include <enet/enet.h> 35 35 #include <boost/thread/recursive_mutex.hpp> 36 37 #include "util/Integers.h"38 36 39 37 namespace orxonox { -
code/trunk/src/network/synchronisable/CMakeLists.txt
r2662 r2710 1 SET(SRC_FILES1 ADD_SOURCE_FILES(NETWORK_SRC_FILES 2 2 NetworkCallbackManager.cc 3 3 Synchronisable.cc … … 5 5 SynchronisableVariable.cc 6 6 ) 7 8 ADD_SOURCE_FILES(SRC_FILES) -
code/trunk/src/network/synchronisable/NetworkCallback.h
- Property svn:mergeinfo changed (with no actual effect on merging)
-
code/trunk/src/network/synchronisable/Synchronisable.cc
- Property svn:mergeinfo changed
/code/branches/buildsystem3/src/network/synchronisable/Synchronisable.cc (added) merged: 2706
r2662 r2710 236 236 return NULL; 237 237 } 238 239 240 /**241 * This function is used to register a variable to be synchronized242 * also counts the total datasize needed to save the variables243 * @param var pointer to the variable244 * @param size size of the datatype the variable consists of245 * @param t the type of the variable (DATA or STRING246 * @param mode same as in getData247 * @param cb callback object that should get called, if the value of the variable changes248 */249 250 /* void Synchronisable::registerVariable(void *var, int size, variableType t, uint8_t mode, NetworkCallbackBase *cb){251 assert( mode==variableDirection::toclient || mode==variableDirection::toserver || mode==variableDirection::serverMaster || mode==variableDirection::clientMaster);252 // create temporary synch.Var struct253 synchronisableVariable *temp = new synchronisableVariable;254 temp->size = size;255 temp->var = var;256 temp->mode = mode;257 temp->type = t;258 temp->callback = cb;259 if( ( mode & variableDirection::bidirectional ) )260 {261 if(t!=STRING)262 {263 temp->varBuffer = new uint8_t[size];264 memcpy(temp->varBuffer, temp->var, size); //now fill the buffer for the first time265 }266 else267 {268 temp->varBuffer=new std::string( *static_cast<std::string*>(var) );269 }270 temp->varReference = 0;271 }272 COUT(5) << "Syncronisable::registering var with size: " << temp->size << " and type: " << temp->type << std::endl;273 //std::cout << "push temp to syncList (at the bottom) " << datasize << std::endl;274 COUT(5) << "Syncronisable::objectID: " << objectID << " this: " << this << " name: " << this->getIdentifier()->getName() << " networkID: " << this->getIdentifier()->getNetworkID() << std::endl;275 syncList->push_back(temp);276 #ifndef NDEBUG277 std::list<synchronisableVariable *>::iterator it = syncList->begin();278 while(it!=syncList->end()){279 assert(*it!=var);280 it++;281 }282 #endif283 }*/284 238 285 239 - Property svn:mergeinfo changed
-
code/trunk/src/network/synchronisable/Synchronisable.h
- Property svn:mergeinfo changed
/code/branches/buildsystem3/src/network/synchronisable/Synchronisable.h (added) merged: 2671
r2662 r2710 153 153 uint32_t getSize(int32_t id, uint8_t mode=0x0); 154 154 bool updateData(uint8_t*& mem, uint8_t mode=0x0, bool forceCallback=false); 155 inlinebool isMyData(uint8_t* mem);156 inlinebool doSync(int32_t id, uint8_t mode=0x0);155 bool isMyData(uint8_t* mem); 156 bool doSync(int32_t id, uint8_t mode=0x0); 157 157 158 158 uint32_t objectID; - Property svn:mergeinfo changed
-
code/trunk/src/network/synchronisable/SynchronisableVariable.cc
r2662 r2710 362 362 { 363 363 double temp; 364 *(uint64_t*)(&temp) = *(uint64_t*)(mem);364 memcpy(&temp, mem, sizeof(uint64_t)); 365 365 *(long double*)(&this->variable_) = static_cast<const long double>(temp); 366 366 mem += SynchronisableVariable<const long double>::returnSize(); … … 370 370 { 371 371 double temp = static_cast<double>(this->variable_); 372 *(uint64_t*)(mem) = *(uint64_t*)(&temp);372 memcpy(mem, &temp, sizeof(uint64_t)); 373 373 mem += SynchronisableVariable<const long double>::returnSize(); 374 374 } … … 377 377 { 378 378 double temp = static_cast<double>(this->variable_); 379 return *(uint64_t*)(mem) == *(uint64_t*)(&temp);379 return memcmp(&temp, mem, sizeof(uint64_t))==0; 380 380 } 381 381 -
code/trunk/src/network/synchronisable/SynchronisableVariable.h
r2662 r2710 35 35 #include <string> 36 36 #include <cassert> 37 #include "util/Integers.h"38 37 #include "core/Core.h" 39 38 #include "core/CoreIncludes.h"
Note: See TracChangeset
for help on using the changeset viewer.