25 #include "eng3d/serializer.hpp"
26 #include "eng3d/network.hpp"
39 template<
ActionType type,
typename Pred,
typename ...Targs>
43 Eng3D::Deser::serialize<ActionType>(ar, type);
45 packet.data(ar.get_buffer(), ar.size());
50 return action_handler_sr<ActionType::DIPLO_DECLARE_WAR>([&nation](
auto& ar) {
56 return action_handler_sr<ActionType::PROVINCE_UPDATE>([&list](
auto& ar) {
57 for(
const auto& province : list) {
65 return action_handler_sr<ActionType::NATION_UPDATE>([&list](
auto& ar) {
66 for(
const auto& nation : list) {
74 return action_handler_sr<ActionType::SELECT_NATION>([&nation](
auto& ar) {
82 return action_handler_sr<ActionType::BUILDING_START_BUILDING_UNIT>([&](
auto& ar) {
91 return action_handler_sr<ActionType::BUILDING_ADD>([&province, &building_type](
auto& ar) {
98 return action_handler_sr<ActionType::FOCUS_TECH>([&](
auto& ar) {
104 return action_handler_sr<ActionType::NATION_TAKE_DECISION>([&](
auto& ar) {
111 return action_handler_sr<ActionType::UNIT_ADD>([&](
auto& ar) {
113 Eng3D::Deser::serialize<ProvinceId>(ar, unit.
province_id());
118 return action_handler_sr<ActionType::UNIT_UPDATE>([&](
auto& ar) {
120 units.
for_each([&](
const auto& unit) {
123 Eng3D::Deser::serialize<UnitId>(ar,
UnitId(size));
124 units.
for_each([&](
const auto& unit) {
131 return action_handler_sr<ActionType::UNIT_REMOVE>([&](
auto& ar) {
132 Eng3D::Deser::serialize<UnitId>(ar, unit.
get_id());
137 return action_handler_sr<ActionType::UNIT_CHANGE_TARGET>([&](
auto& ar) {
138 Eng3D::Deser::serialize<UnitId>(ar, unit.
get_id());
139 Eng3D::Deser::serialize<ProvinceId>(ar, province.
get_id());
A single province, which is used to simulate economy in a "bulk-tiles" way instead of doing economica...
Roughly a batallion, consisting of approximately 500 soldiers each.
ProvinceId province_id() const
Eng3D::Networking::Packet action_handler_sr(Pred p)
void serialize(Eng3D::Deser::Archive &ar, const T &obj)
static Eng3D::Networking::Packet form_packet(const Province &province, const BuildingType &building_type)
static Eng3D::Networking::Packet form_packet(const Province &province, const BuildingType &building_type, const Nation &nation, const UnitType &unit_type)
static Eng3D::Networking::Packet form_packet(const Nation &nation)
static Eng3D::Networking::Packet form_packet(const Technology &technology)
static Eng3D::Networking::Packet form_packet(const Event &event, const Decision &decision)
static Eng3D::Networking::Packet form_packet(const std::vector< Nation > &list)
static Eng3D::Networking::Packet form_packet(const std::vector< Province > &list)
static Eng3D::Networking::Packet form_packet(const Nation &nation)
static Eng3D::Networking::Packet form_packet(const Unit &unit)
static Eng3D::Networking::Packet form_packet(const Unit &unit, const Province &province)
static Eng3D::Networking::Packet form_packet(const Unit &unit)
static Eng3D::Networking::Packet form_packet(const Eng3D::Freelist< Unit > &units)
Type for military outposts.
Base class that serves as archiver, stores (in memory) the data required for serialization/deserializ...
void for_each(const F &lambda) const
constexpr Id get_id() const
Eng3D::StringRef ref_name
Defines a type of unit, it can be a tank, garrison, infantry, etc this is moddable via a lua script a...