Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/new_class_id/src/lib/network/shared_network_data.cc @ 9690

Last change on this file since 9690 was 9690, checked in by bensch, 18 years ago

some network-stuff

File size: 1.8 KB
Line 
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: Patrick Boenzli
13*/
14
15
16#define DEBUG_MODULE_NETWORK
17
18#include "shared_network_data.h"
19#include "netdefs.h"
20#include "state.h"
21
22#include "network_stream.h"
23
24#include "debug.h"
25
26
27NewObjectListDefinition(SharedNetworkData);
28SharedNetworkData* SharedNetworkData::singletonRef = NULL;
29
30/**
31 * Standard constructor
32 */
33SharedNetworkData::SharedNetworkData()
34{
35  /* set the class id for the base object */
36  this->setClassID(CL_SHARED_NETWORK_DATA, "SharedNetworkData");
37
38  this->nodeType = NET_MASTER_SERVER;
39  this->hostID = -1;
40  this->defaultSyncStream = NULL;
41
42  // setUniqueID( maxCon+2 ) because we need one id for every handshake
43  // and one for handshake to reject client maxCon+1
44  this->newUniqueID = 2;
45}
46
47
48/**
49 * Standard destructor
50 */
51SharedNetworkData::~SharedNetworkData()
52{
53  SharedNetworkData::singletonRef = NULL;
54}
55
56
57
58/** @return true if this user is connected to the local host */
59bool SharedNetworkData::isUserLocal( int userID)
60{
61  return this->defaultSyncStream->isUserLocal(userID);
62}
63
64
65/** @returns true if this user is a master server */
66bool SharedNetworkData::isUserMasterServer( int userID )
67{
68  return this->defaultSyncStream->isUserMasterServer(userID);
69}
70
71
72/** @returns true if this user is a proxy server */
73bool SharedNetworkData::isUserProxyServerActive( int userID )
74{
75   return this->defaultSyncStream->isUserProxyServerActive(userID);
76}
77
78
79/** @returns true if this user is a client */
80bool SharedNetworkData::isUserClient( int userID )
81{
82  return this->defaultSyncStream->isUserClient(userID);
83}
Note: See TracBrowser for help on using the repository browser.