Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/network/Host.cc @ 1740

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
RevLine 
[1666]1#include <assert.h>
2
3#include "Host.h"
4#include "packet/Packet.h"
5
6namespace network {
7
8Host *Host::instance_=0;
9 
10Host::Host()
11{
12  assert(instance_==0);
13  instance_=this;
14}
15
16
17Host::~Host()
18{
19  instance_=0;
20}
21
22bool Host::addPacket(ENetPacket *packet, int clientID){
23  if(instance_)
24    return instance_->queuePacket(packet, clientID);
25  else
26    return false;
27}
28
29
[1711]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// }
[1666]36
[1711]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// }
[1666]43
44int Host::getPlayerID(){ 
45  if(!instance_)
46    return 0;
47  return instance_->playerID();
48}
49
[1732]50// unsigned int Host::getShipID(){
51//   if(!instance_)
52//     assert(0);
53//   return instance_->shipID();
54// }
[1666]55
56}//namespace network
Note: See TracBrowser for help on using the repository browser.