1 | /* |
---|
2 | orxonox - the future of 3D-vertical-scrollers |
---|
3 | |
---|
4 | Copyright (C) 2004 orx |
---|
5 | |
---|
6 | This program is free software; you can redistribute it and/or modify |
---|
7 | it under the terms of the GNU General Public License as published by |
---|
8 | the Free Software Foundation; either version 2, or (at your option) |
---|
9 | any later version. |
---|
10 | |
---|
11 | ### File Specific: |
---|
12 | main-programmer: christoph |
---|
13 | co-programmer: |
---|
14 | */ |
---|
15 | |
---|
16 | |
---|
17 | /* this is for debug output. It just says, that all calls to PRINT() belong to the DEBUG_MODULE_NETWORK module |
---|
18 | For more information refere to https://www.orxonox.net/cgi-bin/trac.cgi/wiki/DebugOutput |
---|
19 | */ |
---|
20 | #define DEBUG_MODULE_NETWORK |
---|
21 | |
---|
22 | #include "handshake.h" |
---|
23 | |
---|
24 | #include <cassert> |
---|
25 | |
---|
26 | Handshake::Handshake( bool server, int clientId, int networkGameManagerId ) |
---|
27 | : Synchronizeable() |
---|
28 | { |
---|
29 | /* set the class id for the base object */ |
---|
30 | this->setClassID(CL_HANDSHAKE, "Handshake"); |
---|
31 | |
---|
32 | this->setIsServer(server); |
---|
33 | this->localState.hostId = clientId; |
---|
34 | this->localState.networkManagerId = networkGameManagerId; |
---|
35 | |
---|
36 | orxId_handler = registerVarId( new SynchronizeableInt( &localState.orxId, &remoteState.orxId, "orxonoxId" ) ); |
---|
37 | version_handler = registerVarId( new SynchronizeableInt( &localState.version, &remoteState.version, "version" ) ); |
---|
38 | netManId_handler = registerVarId( new SynchronizeableInt( &localState.networkManagerId, &remoteState.networkManagerId, "networkManagerId" ) ); |
---|
39 | hostId_handler = registerVarId( new SynchronizeableInt( &localState.hostId, &remoteState.hostId, "hostId" ) ); |
---|
40 | completed_handler = registerVarId( new SynchronizeableInt( &localState.completed, &remoteState.completed, "completed" ) ); |
---|
41 | error_handler = registerVarId( new SynchronizeableInt( &localState.error, &remoteState.error, "error" ) ); |
---|
42 | errorString_handler = registerVarId( new SynchronizeableString( &localState.errorString, &remoteState.errorString, "errorString" ) ); |
---|
43 | |
---|
44 | |
---|
45 | this->setSynchronized(true); |
---|
46 | PRINTF(5)("Handshake created clientId = %d\n", clientId); |
---|
47 | } |
---|
48 | |
---|
49 | /** |
---|
50 | * handler for changes in synced vars |
---|
51 | * @param id id's which have changed |
---|
52 | */ |
---|
53 | void Handshake::varChangeHandler( std::list< int > & id ) |
---|
54 | { |
---|
55 | } |
---|
56 | |
---|