Last change
on this file since 1740 was
1735,
checked in by scheusso, 16 years ago
|
network branch merged into trunk
|
-
Property svn:eol-style set to
native
|
File size:
976 bytes
|
Line | |
---|
1 | #include <assert.h> |
---|
2 | |
---|
3 | #include "Host.h" |
---|
4 | #include "packet/Packet.h" |
---|
5 | |
---|
6 | namespace network { |
---|
7 | |
---|
8 | Host *Host::instance_=0; |
---|
9 | |
---|
10 | Host::Host() |
---|
11 | { |
---|
12 | assert(instance_==0); |
---|
13 | instance_=this; |
---|
14 | } |
---|
15 | |
---|
16 | |
---|
17 | Host::~Host() |
---|
18 | { |
---|
19 | instance_=0; |
---|
20 | } |
---|
21 | |
---|
22 | bool Host::addPacket(ENetPacket *packet, int clientID){ |
---|
23 | if(instance_) |
---|
24 | return instance_->queuePacket(packet, clientID); |
---|
25 | else |
---|
26 | return false; |
---|
27 | } |
---|
28 | |
---|
29 | |
---|
30 | // bool Host::chat(std::string& message){ |
---|
31 | // if(!instance_) |
---|
32 | // return false; |
---|
33 | // packet::Chat *c = new packet::Chat(message, getPlayerID()); |
---|
34 | // return instance_->sendChat(c); |
---|
35 | // } |
---|
36 | |
---|
37 | // bool Host::receiveChat(network::packet::Chat *message, unsigned int clientID){ |
---|
38 | // if(instance_) |
---|
39 | // return instance_->processChat(message, clientID); |
---|
40 | // else |
---|
41 | // return false; |
---|
42 | // } |
---|
43 | |
---|
44 | int Host::getPlayerID(){ |
---|
45 | if(!instance_) |
---|
46 | return 0; |
---|
47 | return instance_->playerID(); |
---|
48 | } |
---|
49 | |
---|
50 | // unsigned int Host::getShipID(){ |
---|
51 | // if(!instance_) |
---|
52 | // assert(0); |
---|
53 | // return instance_->shipID(); |
---|
54 | // } |
---|
55 | |
---|
56 | }//namespace network |
---|
Note: See
TracBrowser
for help on using the repository browser.