forked from citizenfx/fivem
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathArrayUpdate.h
More file actions
91 lines (82 loc) · 2.07 KB
/
ArrayUpdate.h
File metadata and controls
91 lines (82 loc) · 2.07 KB
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
#pragma once
#include "SerializableComponent.h"
#include "SerializableProperty.h"
#include "SerializableStorageType.h"
namespace net::packet
{
class ServerArrayUpdate : public SerializableComponent
{
public:
SerializableProperty<uint8_t> handler;
SerializableProperty<uint16_t> ownerNetId;
// todo: in future net version change to uint16_t like packet from client to server
SerializableProperty<uint32_t> index;
// todo: in future net version use ConstrainedStreamTail
SerializableProperty<Span<uint8_t>, storage_type::ConstrainedBigBytesArray<0, 128>> data;
template<typename T>
bool Process(T& stream)
{
return ProcessPropertiesInOrder<T>(
stream,
handler,
ownerNetId,
index,
data
);
}
};
/// <summary>
/// Announcement from the server to the client for updating the array handler
/// </summary>
class ServerArrayUpdatePacket : public SerializableComponent
{
public:
SerializableProperty<uint32_t> type{ net::force_consteval<uint32_t, HashRageString("msgArrayUpdate")> };
ServerArrayUpdate data;
template<typename T>
bool Process(T& stream)
{
return ProcessPropertiesInOrder<T>(
stream,
type,
data
);
}
};
class ClientArrayUpdate : public SerializableComponent
{
public:
SerializableProperty<uint8_t> handler;
SerializableProperty<uint16_t> index;
// todo: in future net version use ConstrainedStreamTail
SerializableProperty<Span<uint8_t>, storage_type::ConstrainedBytesArray<0, 128>> data;
template<typename T>
bool Process(T& stream)
{
return ProcessPropertiesInOrder<T>(
stream,
handler,
index,
data
);
}
};
/// <summary>
/// Request from the client to the server for updating the array handler
/// </summary>
class ClientArrayUpdatePacket : public SerializableComponent
{
public:
SerializableProperty<uint32_t> type{ net::force_consteval<uint32_t, HashRageString("msgArrayUpdate")> };
ClientArrayUpdate data;
template<typename T>
bool Process(T& stream)
{
return ProcessPropertiesInOrder<T>(
stream,
type,
data
);
}
};
}