VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
SchemaFields.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <schemasystem/schematypes.h>
4
#include <string_view>
5
6
namespace
VoltMod::Schema
7
{
8
9
/** The owner link field a replicated component carries. */
10
inline
constexpr
std::string_view
ChainField
=
"__m_pChainEntity"
;
11
12
/**
13
* Find @p field on @p klass or its first bases, most-derived first. Schema offsets flatten single
14
* inheritance, so a base field's offset works on the derived object.
15
*/
16
inline
const
SchemaClassFieldData_t
*
FindField
(
const
CSchemaClassInfo
*
klass
, std::string_view
field
)
17
{
18
for
(;
klass
;
klass
=
klass
->m_nBaseClassCount > 0 ?
klass
->m_pBaseClasses[0].m_pClass :
nullptr
)
19
{
20
for
(
uint16_t
i
= 0;
i
<
klass
->m_nFieldCount; ++
i
)
21
{
22
const
char
* name =
klass
->m_pFields[
i
].m_pszName;
23
if
(name &&
field
== name)
24
{
25
return
&
klass
->m_pFields[
i
];
26
}
27
}
28
}
29
return
nullptr
;
30
}
31
32
}
// namespace VoltMod::Schema
VoltMod::Schema
Definition
CBaseAnimGraph.hpp:10
VoltMod::Schema::FindField
const SchemaClassFieldData_t * FindField(const CSchemaClassInfo *klass, std::string_view field)
Definition
SchemaFields.hpp:16
VoltMod::Schema::ChainField
constexpr std::string_view ChainField
Definition
SchemaFields.hpp:10
VoltMod::ReadFile
static std::string ReadFile(const std::filesystem::path &path)
Definition
Loader.cpp:56
src
Host
Schema
SchemaFields.hpp
Generated by
1.9.8