Symphony Of Empires
action.hpp
Go to the documentation of this file.
1 // Symphony of Empires
2 // Copyright (C) 2021, Symphony of Empires contributors
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <https://www.gnu.org/licenses/>.
16 //
17 // ----------------------------------------------------------------------------
18 // Name:
19 // action.hpp
20 //
21 // Abstract:
22 // Does some important stuff.
23 // ----------------------------------------------------------------------------
24 
25 #pragma once
26 
27 #include <vector>
28 #include "eng3d/network.hpp"
29 #include "eng3d/freelist.hpp"
30 #include "objects.hpp"
31 
32 enum ActionType {
33  BAD, // Error
37  CONNECT, // Chat
41  PROVINCE_UPDATE, // Province
43  NATION_UPDATE, // Nation
46  UNIT_UPDATE, // Unit
51  BUILDING_UPDATE, // Building
58  DIPLO_EMBARGO, // Diplomacy
61  FOCUS_TECH, // Technology
62 };
63 template<>
65 
66 struct Product;
67 class Nation;
68 class Province;
69 struct Building;
70 struct BuildingType;
71 class Unit;
72 struct UnitType;
73 struct Decision;
74 struct Event;
75 struct Technology;
76 
77 namespace Action {
78  struct DiploDeclareWar {
79  static Eng3D::Networking::Packet form_packet(const Nation& nation);
80  };
81 
82  struct ProvinceUpdate {
83  static Eng3D::Networking::Packet form_packet(const std::vector<Province>& list);
84  };
85 
86  struct NationUpdate {
87  static Eng3D::Networking::Packet form_packet(const std::vector<Nation>& list);
88  };
89 
90  struct SelectNation {
91  static Eng3D::Networking::Packet form_packet(const Nation& nation);
92  };
93 
95  static Eng3D::Networking::Packet form_packet(const Province& province, const BuildingType& building_type, const Nation& nation, const UnitType& unit_type);
96  };
97 
98  struct BuildingAdd {
99  static Eng3D::Networking::Packet form_packet(const Province& province, const BuildingType& building_type);
100  };
101 
102  struct FocusTech {
103  static Eng3D::Networking::Packet form_packet(const Technology& technology);
104  };
105 
107  static Eng3D::Networking::Packet form_packet(const Event& event, const Decision& decision);
108  };
109 
110  struct UnitAdd {
111  static Eng3D::Networking::Packet form_packet(const Unit& unit);
112  };
113 
114  struct UnitUpdate {
116  };
117 
118  struct UnitRemove {
119  static Eng3D::Networking::Packet form_packet(const Unit& unit);
120  };
121 
122  struct UnitMove {
123  static Eng3D::Networking::Packet form_packet(const Unit& unit, const Province& province);
124  };
125 }
ActionType
Definition: action.hpp:32
@ DIPLO_DECLARE_WAR
Definition: action.hpp:59
@ SET_USERNAME
Definition: action.hpp:36
@ CHAT_MESSAGE
Definition: action.hpp:39
@ CONNECT
Definition: action.hpp:37
@ WORLD_TICK
Definition: action.hpp:34
@ PROVINCE_COLONIZE
Definition: action.hpp:42
@ DIPLO_EMBARGO
Definition: action.hpp:58
@ DISCONNECT
Definition: action.hpp:38
@ UNIT_MOVE
Definition: action.hpp:50
@ FOCUS_TECH
Definition: action.hpp:61
@ BUILDING_UPDATE
Definition: action.hpp:51
@ TREATY_ADD
Definition: action.hpp:57
@ BUILDING_ADD
Definition: action.hpp:52
@ DIPLO_ALLOW_MIL_ACCESS
Definition: action.hpp:60
@ NATION_TAKE_DECISION
Definition: action.hpp:45
@ NATION_UPDATE
Definition: action.hpp:43
@ DRAFT_TREATY
Definition: action.hpp:56
@ UNIT_CHANGE_TARGET
Definition: action.hpp:49
@ BUILDING_REMOVE
Definition: action.hpp:53
@ UNIT_REMOVE
Definition: action.hpp:48
@ SELECT_NATION
Definition: action.hpp:35
@ UNIT_UPDATE
Definition: action.hpp:46
@ UNIT_ADD
Definition: action.hpp:47
@ CHAT_NICKNAME
Definition: action.hpp:40
@ CHANGE_TREATY_APPROVAL
Definition: action.hpp:55
@ PROVINCE_UPDATE
Definition: action.hpp:41
@ BUILDING_START_BUILDING_UNIT
Definition: action.hpp:54
@ NATION_ENACT_POLICY
Definition: action.hpp:44
@ BAD
Definition: action.hpp:33
A single province, which is used to simulate economy in a "bulk-tiles" way instead of doing economica...
Definition: province.hpp:48
Roughly a batallion, consisting of approximately 500 soldiers each.
Definition: unit.hpp:80
static Eng3D::Networking::Packet form_packet(const Province &province, const BuildingType &building_type)
Definition: action.cpp:90
static Eng3D::Networking::Packet form_packet(const Province &province, const BuildingType &building_type, const Nation &nation, const UnitType &unit_type)
Definition: action.cpp:81
static Eng3D::Networking::Packet form_packet(const Nation &nation)
Definition: action.cpp:49
static Eng3D::Networking::Packet form_packet(const Technology &technology)
Definition: action.cpp:97
static Eng3D::Networking::Packet form_packet(const Event &event, const Decision &decision)
Definition: action.cpp:103
static Eng3D::Networking::Packet form_packet(const std::vector< Nation > &list)
Definition: action.cpp:64
static Eng3D::Networking::Packet form_packet(const std::vector< Province > &list)
Definition: action.cpp:55
static Eng3D::Networking::Packet form_packet(const Nation &nation)
Definition: action.cpp:73
static Eng3D::Networking::Packet form_packet(const Unit &unit)
Definition: action.cpp:110
static Eng3D::Networking::Packet form_packet(const Unit &unit, const Province &province)
Definition: action.cpp:136
static Eng3D::Networking::Packet form_packet(const Unit &unit)
Definition: action.cpp:130
static Eng3D::Networking::Packet form_packet(const Eng3D::Freelist< Unit > &units)
Definition: action.cpp:117
A military outpost, on land serves as a "spawn" place for units When adjacent to a water tile this se...
Definition: building.hpp:90
Type for military outposts.
Definition: building.hpp:38
A serializer (base class) which can be used to serialize objects and create per-object optimized clas...
Definition: serializer.hpp:111
A serializer optimized to memcpy directly the element into the byte stream use only when the object c...
Definition: serializer.hpp:162
Definition: event.hpp:54
A product (based off a Commodity) which can be bought by POPs, converted by factories and transported...
Definition: product.hpp:54
Defines a type of unit, it can be a tank, garrison, infantry, etc this is moddable via a lua script a...
Definition: unit.hpp:44