Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_PlayerSupplyAllocationComponentSerializer.c
Go to the documentation of this file.
1
class
SCR_PlayerSupplyAllocationComponentSerializer
:
ScriptedComponentSerializer
2
{
3
//------------------------------------------------------------------------------------------------
4
override
static
typename
GetTargetType
()
5
{
6
return
SCR_PlayerSupplyAllocationComponent;
7
}
8
9
//------------------------------------------------------------------------------------------------
10
override
protected
ESerializeResult
Serialize
(notnull
IEntity
owner, notnull
GenericComponent
component, notnull
SaveContext
context)
11
{
12
auto
supplyAllocation = SCR_PlayerSupplyAllocationComponent.Cast(component);
13
14
const
int
maxAllocation = supplyAllocation.GetPlayerMilitarySupplyAllocation();
15
const
int
availableAllocation = supplyAllocation.GetPlayerAvailableAllocatedSupplies();
16
17
if
(maxAllocation == 0 && availableAllocation == 0)
18
return
ESerializeResult
.DEFAULT;
19
20
context.WriteValue(
"version"
, 1);
21
context.Write(maxAllocation);
22
context.Write(availableAllocation);
23
return
ESerializeResult
.OK;
24
}
25
26
//------------------------------------------------------------------------------------------------
27
override
protected
bool
Deserialize
(notnull
IEntity
owner, notnull
GenericComponent
component, notnull
LoadContext
context)
28
{
29
auto
supplyAllocation = SCR_PlayerSupplyAllocationComponent.Cast(component);
30
31
int
version;
32
context.Read(version);
33
34
int
maxAllocation;
35
if
(context.Read(maxAllocation))
36
supplyAllocation.SetPlayerMilitarySupplyAllocation(maxAllocation);
37
38
int
availableAllocation;
39
if
(context.Read(availableAllocation))
40
supplyAllocation.AddPlayerAvailableAllocatedSupplies(availableAllocation - supplyAllocation.GetPlayerAvailableAllocatedSupplies());
41
42
return
true
;
43
}
44
}
GetTargetType
class SCR_PersistentThreatSector GetTargetType()
Definition
AIControlComponentSerializer.c:12
GenericComponent
Definition
GenericComponent.c:13
IEntity
Definition
IEntity.c:13
LoadContext
Definition
LoadContext.c:17
SCR_PlayerSupplyAllocationComponentSerializer
Definition
SCR_PlayerSupplyAllocationComponentSerializer.c:2
SCR_PlayerSupplyAllocationComponentSerializer::Serialize
ESerializeResult Serialize(notnull IEntity owner, notnull GenericComponent component, notnull SaveContext context)
Definition
SCR_PlayerSupplyAllocationComponentSerializer.c:10
SCR_PlayerSupplyAllocationComponentSerializer::Deserialize
bool Deserialize(notnull IEntity owner, notnull GenericComponent component, notnull LoadContext context)
Definition
SCR_PlayerSupplyAllocationComponentSerializer.c:27
SaveContext
Definition
SaveContext.c:17
ScriptedComponentSerializer
Definition
ScriptedComponentSerializer.c:13
ESerializeResult
ESerializeResult
Definition
ESerializeResult.c:13
scripts
Game
Plugins
Persistence
System
Serializers
Components
PlayerController
SCR_PlayerSupplyAllocationComponentSerializer.c
Generated by
1.17.0