aboutsummaryrefslogtreecommitdiff
path: root/src/parsec_server/include/e_simplayerinfo.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/parsec_server/include/e_simplayerinfo.h')
-rwxr-xr-xsrc/parsec_server/include/e_simplayerinfo.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/src/parsec_server/include/e_simplayerinfo.h b/src/parsec_server/include/e_simplayerinfo.h
new file mode 100755
index 0000000..19e5afa
--- /dev/null
+++ b/src/parsec_server/include/e_simplayerinfo.h
@@ -0,0 +1,67 @@
+#ifndef E_SIMPLAYERINFO_H_
+#define E_SIMPLAYERINFO_H_
+
+
+// class holding all simulation specific player information -------------------
+//
+class E_SimPlayerInfo
+{
+protected:
+ int m_Status; // status of the player (inactive,connected,joined)
+ int m_objclass; // the objectclass selected as ship when joined
+
+ ShipObject* m_pShip;
+ int m_nShipID;
+ int m_nClientID;
+
+ int m_IgnoreJoinUntilUnjoinFromClient;
+public:
+ E_SimPlayerInfo()
+ {
+ Reset();
+ }
+
+ // reset all player fields to defaults ( not connected )
+ void Reset();
+
+ // check whether a player is disconnected
+ bool_t IsPlayerDisconnected() { return ( m_Status == PLAYER_INACTIVE ); }
+
+ // check whether a player is connected
+ bool_t IsPlayerConnected() { return ( m_Status == PLAYER_CONNECTED ); }
+
+ // check whether a player is joined in the game
+ bool_t IsPlayerJoined() { return ( m_Status == PLAYER_JOINED ); }
+
+ // set the desired player status ( inactive/joined/unjoined )
+ void SetDesiredPlayerStatus( RE_PlayerStatus* playerstatus );
+
+ // update tables and create ship for newly joined player
+ void PerformJoin( RE_PlayerStatus* pas_status );
+
+ // update tables and delete ship of player who unjoined
+ void PerformUnjoin( RE_PlayerStatus* playerstatus );
+
+ // set the player status to connected
+ void Connect( int nClientID );
+
+ // set the player status to disconnected
+ void Disconnect();
+
+ // set flag to ignore all joins until we get an unjoin from the client
+ void IgnoreJoinUntilUnjoinFromClient()
+ {
+ m_IgnoreJoinUntilUnjoinFromClient = TRUE;
+ }
+
+ // get a pointer to the ship object
+ ShipObject* GetShipObject() { return m_pShip; }
+
+ // get the object class of the ship
+ int GetShipObjectClass() { return m_objclass; }
+
+ // return the status of the player
+ int GetStatus() { return m_Status; }
+};
+
+#endif // E_SIMPLAYERINFO_H_