Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
NetLobbyServer.h
Go to the documentation of this file.
1 /* Project Starshatter 4.5
2  Destroyer Studios LLC
3  Copyright © 1997-2004. All Rights Reserved.
4 
5  SUBSYSTEM: Stars.exe
6  FILE: NetLobbyServer.h
7  AUTHOR: John DiCamillo
8 
9 
10  OVERVIEW
11  ========
12  UDP Server Engine for Multiplayer Lobby
13 */
14 
15 
16 #ifndef NetLobbyServer_h
17 #define NetLobbyServer_h
18 
19 // FOR NETWORK MENU TESTING (extra latency in msec):
20 // #define EXTRA_LATENCY 300
21 
22 #include "NetLobby.h"
23 
24 // +-------------------------------------------------------------------+
25 
26 class Mission;
27 class MissionElement;
28 class NetChatEntry;
29 class NetServerConfig;
30 class NetUser;
31 class NetUnitEntry;
32 
33 // +-------------------------------------------------------------------+
34 
35 class NetLobbyServer : public NetLobby
36 {
37 public:
39  virtual ~NetLobbyServer();
40 
41  int operator == (const NetLobbyServer& s) const { return this == &s; }
42 
43  virtual void ExecFrame();
44  virtual bool IsHost() const { return true; }
45  virtual bool IsServer() const { return true; }
46 
47  virtual void BanUser(NetUser* user);
48  virtual void AddUser(NetUser* user);
49  virtual void DelUser(NetUser* user);
50  virtual void SendUsers();
51  virtual void RequestAuth(NetUser* user);
52 
53  virtual void AddChat(NetUser* user, const char* msg, bool route=true);
54  virtual void ClearChat();
55  virtual void SaveChat();
56 
57  virtual List<NetUnitEntry>&
58  GetUnitMap();
59  virtual void MapUnit(int n, const char* user, bool lock=false);
60  virtual void UnmapUnit(const char* user);
61  virtual void SendUnits();
62 
63  virtual void SelectMission(DWORD id);
64  virtual Text Serialize(Mission* m, NetUser* u=0);
65  virtual Mission* GetSelectedMission();
66 
67  virtual Text GetServerName() const { return server_name; }
68  virtual void SetServerName(const char* s) { server_name = s; }
69  virtual Text GetServerMission() const { return server_mission; }
70  virtual void SetServerMission(const char* script)
71  { server_mission = script; }
72 
73  virtual void GameStart();
74  virtual void GameStop();
75 
76  virtual void GameOn();
77  virtual void GameOff();
78 
79  // singleton locator:
80  static NetLobbyServer* GetInstance();
81 
82 protected:
83  virtual void CheckSessions();
84 
85  virtual void SendData(NetUser* dst, int type, Text msg);
86  virtual void DoPing(NetPeer* peer, Text msg);
87  virtual void DoServerInfo(NetPeer* peer, Text msg);
88  virtual void DoServerMods(NetPeer* peer, Text msg);
89  virtual void DoLogin(NetPeer* peer, Text msg);
90  virtual void DoLogout(NetPeer* peer, Text msg);
91  virtual void DoUserAuth(NetPeer* peer, Text msg);
92  virtual void DoChat(NetPeer* peer, Text msg);
93  virtual void DoUserList(NetPeer* peer, Text msg);
94  virtual void DoBanUser(NetPeer* peer, Text msg);
95  virtual void DoMissionList(NetPeer* peer, Text msg);
96  virtual void DoMissionSelect(NetPeer* peer, Text msg);
97  virtual void DoMissionData(NetPeer* peer, Text msg);
98  virtual void DoUnitList(NetPeer* peer, Text msg);
99  virtual void DoMapUnit(NetPeer* peer, Text msg);
100  virtual void DoGameStart(NetPeer* peer, Text msg);
101  virtual void DoGameStop(NetPeer* peer, Text msg);
102 
103  virtual void LoadMOTD();
104  virtual void SendMOTD(NetUser* user);
105  virtual void SendMods(NetUser* user);
106 
113 
115 };
116 
117 // +-------------------------------------------------------------------+
118 
119 #endif NetLobbyServer_h