File: PeerDescriptor.h

package info (click to toggle)
jazz2-native 3.5.0-1
  • links: PTS, VCS
  • area: contrib
  • in suites:
  • size: 16,836 kB
  • sloc: cpp: 172,557; xml: 113; python: 36; makefile: 5; sh: 2
file content (92 lines) | stat: -rw-r--r-- 2,935 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#pragma once

#if defined(WITH_MULTIPLAYER) || defined(DOXYGEN_GENERATING_OUTPUT)

#include "Peer.h"
#include "../PlayerType.h"
#include "../PreferencesCache.h"
#include "../../nCine/Base/TimeStamp.h"

#include <Containers/String.h>

using namespace Death::Containers;
using namespace nCine;

namespace Jazz2::Actors::Multiplayer
{
	class MpPlayer;
}

namespace Jazz2::Multiplayer
{
	/** @brief Peer state in a level  */
	enum class PeerLevelState
	{
		Unknown,				/**< Unknown */
		ValidatingAssets,		/**< Peer received list of required assets, the server is waiting for response */
		StreamingMissingAssets,	/**< Missing assets are being streamed to peer */
		LevelLoaded,			/**< Peer finished loading of the level */
		LevelSynchronized,		/**< Peer finished synchronized entities in the level */
		Spectating,				/**< Peer is spectating */
		PlayerReady,			/**< Player is ready to spawn */
		PlayerSpawned			/**< Player is spawned */
	};

	/** @brief Peer descriptor */
	struct PeerDescriptor
	{
		/** @brief Remote peer if the peer is connected remotely */
		Peer RemotePeer;

		/** @brief Unique Player ID if the peer is connected remotely */
		Uuid UniquePlayerID;
		/** @brief Whether the peer is already successfully authenticated */
		bool IsAuthenticated;
		/** @brief Whether the peer has admin privileges */
		bool IsAdmin;
		/** @brief Whether ledge climbing is enabled by client */
		bool EnableLedgeClimb;
		/** @brief Whether the peer voted "yes" in the active poll */
		bool VotedYes;
		/** @brief Team ID */
		std::uint8_t Team;
		/** @brief Preferred player type selected by the peer */
		PlayerType PreferredPlayerType;
		/** @brief Player display name */
		String PlayerName;
		/** @brief Earned points in the current session (championship) */
		std::uint32_t Points;
		/** @brief Game mode specific points held by the player in a round */
		std::uint32_t PointsInRound;
		/** @brief Position in a round */
		std::uint32_t PositionInRound;
		/** @brief State of the player in the current level */
		PeerLevelState LevelState;
		/** @brief Spawned player in the current level */
		Actors::Multiplayer::MpPlayer* Player;
		/** @brief Last update of the player from client */
		std::uint64_t LastUpdated;

		/** @brief Deaths of the player in the current round */
		std::uint32_t Deaths;
		/** @brief Kills of the player in the current round */
		std::uint32_t Kills;
		/** @brief Laps of the player in the current round */
		std::uint32_t Laps;
		/** @brief Timestamp when the last lap started */
		TimeStamp LapStarted;
		/** @brief Treasure collected of the player in the current round */
		std::uint32_t TreasureCollected;

		/** @brief Elapsed frames when the player is idle */
		float IdleElapsedFrames;
		/** @brief Elapsed frames when the player lost all lives */
		float DeathElapsedFrames;
		/** @brief Elapsed frames of all completed laps */
		float LapsElapsedFrames;

		PeerDescriptor();
	};
}

#endif