Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
NetPlayer.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: NetPlayer.h
7  AUTHOR: John DiCamillo
8 
9 
10  OVERVIEW
11  ========
12  Network Player (Director) class
13 */
14 
15 #ifndef NetPlayer_h
16 #define NetPlayer_h
17 
18 #include "Types.h"
19 #include "Geometry.h"
20 #include "Director.h"
21 #include "SimObject.h"
22 #include "List.h"
23 #include "Text.h"
24 
25 // +--------------------------------------------------------------------+
26 
27 class Sim;
28 class Ship;
29 class NetMsg;
30 class NetObjLoc;
31 class NetObjHyper;
32 class NetObjTarget;
33 class NetObjEmcon;
34 class NetSysDamage;
35 class NetSysStatus;
36 class NetWepTrigger;
37 class NetWepRelease;
38 class NetWepDestroy;
39 class NetCommMsg;
40 
41 // +--------------------------------------------------------------------+
42 
43 class NetPlayer : public Director, public SimObserver
44 {
45 public:
46  static const char* TYPENAME() { return "NetPlayer"; }
47 
48  NetPlayer(DWORD nid) : netid(nid), objid(0), ship(0), iff(0) { }
49  ~NetPlayer();
50 
51  int operator == (const NetPlayer& p) const { return netid == p.netid; }
52 
53  DWORD GetNetID() const { return netid; }
54  DWORD GetObjID() const { return objid; }
55  void SetObjID(DWORD o) { objid = o; }
56 
57  int GetIFF() const { return iff; }
58  Ship* GetShip() const { return ship; }
59  void SetShip(Ship* s);
60 
61  const char* Name() const { return name; }
62  void SetName(const char* n) { name = n; }
63  const char* SerialNumber() const { return serno; }
64  void SetSerialNumber(const char* n) { serno = n; }
65 
66  virtual void ExecFrame(double seconds);
67 
68  bool DoObjLoc(NetObjLoc* obj_loc);
69  bool DoObjHyper(NetObjHyper* obj_hyper);
70  bool DoObjTarget(NetObjTarget* obj_target);
71  bool DoObjEmcon(NetObjEmcon* obj_emcon);
72  bool DoWepTrigger(NetWepTrigger* trigger);
73  bool DoWepRelease(NetWepRelease* release);
74  bool DoCommMessage(NetCommMsg* comm_msg);
75  bool DoSysDamage(NetSysDamage* sys_damage);
76  bool DoSysStatus(NetSysStatus* sys_status);
77 
78  virtual int Type() const { return 2; }
79 
80  virtual bool Update(SimObject* obj);
81  virtual const char* GetObserverName() const;
82 
83 protected:
84  DWORD netid;
85  DWORD objid;
89  int iff;
90 
92  double bleed_time;
93 };
94 
95 // +--------------------------------------------------------------------+
96 
97 #endif NetPlayer_h
98