VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
PlayerRef.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <cstdint>
4
5
namespace
VoltMod
6
{
7
8
/**
9
* @brief A storable reference to a player: the slot plus the SteamID that occupied it.
10
*
11
* @ref Controller and @ref Pawn are frame-local, and a bare slot number is not enough on its own -
12
* a slot changes hands, so work scheduled against one can land on whoever sits there next. Keep a
13
* PlayerRef instead and check both halves when it is resolved: the slot says where to look and the
14
* SteamID says whether it is still the same player.
15
*
16
* `SteamId == 0` means a bot, which no reference can pin down across a reconnect.
17
*/
18
struct
PlayerRef
19
{
20
int
Slot
= -1;
21
int64_t
SteamId
= 0;
22
23
explicit
operator
bool() const noexcept {
return
Slot
>= 0; }
24
bool
operator==
(
const
PlayerRef
&)
const
noexcept
=
default
;
25
};
26
27
}
// namespace VoltMod
VoltMod
Definition
Options.hpp:13
VoltMod::PlayerRef
A storable reference to a player: the slot plus the SteamID that occupied it.
Definition
PlayerRef.hpp:19
VoltMod::PlayerRef::Slot
int Slot
Definition
PlayerRef.hpp:20
VoltMod::PlayerRef::operator==
bool operator==(const PlayerRef &) const noexcept=default
VoltMod::PlayerRef::SteamId
int64_t SteamId
Definition
PlayerRef.hpp:21
include
VoltMod
Players
PlayerRef.hpp
Generated by
1.15.0