FastEngine 0.9.3
A multiplayer oriented 2D engine made with Vulkan.
Loading...
Searching...
No Matches
C_client.inl
1/*
2 * Copyright 2024 Guillaume Guillet
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17namespace fge::net
18{
19
20inline std::shared_ptr<TransmissionPacket> TransmissionPacket::create(ProtocolPacket::Header header)
21{
22 return std::shared_ptr<TransmissionPacket>{new TransmissionPacket(header, 0, 0)};
23}
24inline std::shared_ptr<TransmissionPacket> TransmissionPacket::create(Packet&& packet)
25{
26 return std::shared_ptr<TransmissionPacket>{new TransmissionPacket(std::move(packet))};
27}
28
29inline TransmissionPacket::TransmissionPacket(ProtocolPacket::Header header,
30 ProtocolPacket::Realm realmId,
31 ProtocolPacket::CountId countId) :
32 g_packet(header, realmId, countId)
33{}
34inline TransmissionPacket::TransmissionPacket(ProtocolPacket&& packet) :
35 g_packet(std::move(packet))
36{}
37
38inline ProtocolPacket const& TransmissionPacket::packet() const
39{
40 return this->g_packet;
41}
42inline ProtocolPacket& TransmissionPacket::packet()
43{
44 return this->g_packet;
45}
46inline std::vector<TransmissionPacket::Option> const& TransmissionPacket::options() const
47{
48 return this->g_options;
49}
50inline std::vector<TransmissionPacket::Option>& TransmissionPacket::options()
51{
52 return this->g_options;
53}
54
55inline TransmissionPacket& TransmissionPacket::doNotDiscard()
56{
57 this->g_packet.addHeaderFlags(FGE_NET_HEADER_DO_NOT_DISCARD_FLAG);
58 return *this;
59}
60inline TransmissionPacket& TransmissionPacket::doNotReorder()
61{
62 this->g_packet.addHeaderFlags(FGE_NET_HEADER_DO_NOT_REORDER_FLAG);
63 return *this;
64}
65
66} // namespace fge::net