Starshatter_Open
Open source Starshatter engine
Main Page
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
NetGame.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: NetGame.h
7
AUTHOR: John DiCamillo
8
9
10
OVERVIEW
11
========
12
Network Game Manager class
13
*/
14
15
#ifndef NetGame_h
16
#define NetGame_h
17
18
#include "
Types.h
"
19
#include "
Geometry.h
"
20
#include "
NetLink.h
"
21
#include "
Director.h
"
22
#include "
List.h
"
23
24
// +--------------------------------------------------------------------+
25
26
class
Sim
;
27
class
Ship
;
28
class
Shot
;
29
class
NetData
;
30
class
NetMsg
;
31
class
NetPlayer
;
32
33
// +--------------------------------------------------------------------+
34
35
class
NetGame
36
{
37
public
:
38
static
const
char
*
TYPENAME
() {
return
"NetGame"
; }
39
40
enum
{
SHIP
,
SHOT
};
41
42
NetGame
();
43
virtual
~NetGame
();
44
45
virtual
bool
IsClient
()
const
{
return
false
; }
46
virtual
bool
IsServer
()
const
{
return
false
; }
47
virtual
bool
IsActive
()
const
{
return
active
; }
48
49
virtual
DWORD
GetNetID
()
const
{
return
netid
; }
50
virtual
DWORD
GetObjID
()
const
;
51
52
virtual
void
ExecFrame
();
53
virtual
void
Recv
();
54
virtual
void
Send
();
55
56
virtual
void
SendData
(
NetData
* data) { }
57
58
virtual
NetPlayer
*
FindPlayerByName
(
const
char
* name);
59
virtual
NetPlayer
*
FindPlayerByNetID
(DWORD
netid
);
60
virtual
NetPlayer
*
FindPlayerByObjID
(DWORD
objid
);
61
virtual
Ship
*
FindShipByObjID
(DWORD
objid
);
62
virtual
Shot
*
FindShotByObjID
(DWORD
objid
);
63
64
virtual
NetPeer
*
GetPeer
(
NetPlayer
* player);
65
66
virtual
void
Respawn
(DWORD
objid
,
Ship
* spawn);
67
68
static
NetGame
*
Create
();
69
static
NetGame
*
GetInstance
();
70
static
bool
IsNetGame
();
71
static
bool
IsNetGameClient
();
72
static
bool
IsNetGameServer
();
73
static
int
NumPlayers
();
74
75
static
DWORD
GetNextObjID
(
int
type=
SHIP
);
76
77
protected
:
78
virtual
void
DoJoinRequest
(
NetMsg
* msg) { }
79
virtual
void
DoJoinAnnounce
(
NetMsg
* msg) { }
80
virtual
void
DoQuitRequest
(
NetMsg
* msg) { }
81
virtual
void
DoQuitAnnounce
(
NetMsg
* msg) { }
82
virtual
void
DoGameOver
(
NetMsg
* msg) { }
83
virtual
void
DoDisconnect
(
NetMsg
* msg) { }
84
85
virtual
void
DoObjLoc
(
NetMsg
* msg) { }
86
virtual
void
DoObjDamage
(
NetMsg
* msg) { }
87
virtual
void
DoObjKill
(
NetMsg
* msg) { }
88
virtual
void
DoObjSpawn
(
NetMsg
* msg) { }
89
virtual
void
DoObjHyper
(
NetMsg
* msg) { }
90
virtual
void
DoObjTarget
(
NetMsg
* msg) { }
91
virtual
void
DoObjEmcon
(
NetMsg
* msg) { }
92
virtual
void
DoSysDamage
(
NetMsg
* msg) { }
93
virtual
void
DoSysStatus
(
NetMsg
* msg) { }
94
95
virtual
void
DoElemCreate
(
NetMsg
* msg) { }
96
virtual
void
DoElemRequest
(
NetMsg
* msg) { }
97
virtual
void
DoShipLaunch
(
NetMsg
* msg) { }
98
virtual
void
DoNavData
(
NetMsg
* msg) { }
99
virtual
void
DoNavDelete
(
NetMsg
* msg) { }
100
101
virtual
void
DoWepTrigger
(
NetMsg
* msg) { }
102
virtual
void
DoWepRelease
(
NetMsg
* msg) { }
103
virtual
void
DoWepDestroy
(
NetMsg
* msg) { }
104
105
virtual
void
DoCommMsg
(
NetMsg
* msg) { }
106
virtual
void
DoChatMsg
(
NetMsg
* msg) { }
107
virtual
void
DoSelfDestruct
(
NetMsg
* msg) { }
108
109
List<NetPlayer>
players
;
110
NetLink
*
link
;
111
112
DWORD
objid
;
113
DWORD
netid
;
114
Ship
*
local_player
;
115
Text
player_name
;
116
Text
player_pass
;
117
Ship
*
target
;
118
Sim
*
sim
;
119
bool
active
;
120
121
DWORD
last_send_time
;
122
};
123
124
// +--------------------------------------------------------------------+
125
126
#endif NetGame_h
127
Stars45
NetGame.h
Generated on Tue Jun 5 2012 20:47:04 for Starshatter_Open by
1.8.1