32 #include "eng3d/log.hpp"
71 return this->run ==
true;
90 for(
size_t i = 0; i < static_cast<size_t>(size); i++) {
93 auto& nation = gs.
world->nations.at(nation_id);
102 auto& nation = gs.
world->nations.at(nation_id);
103 nation.set_policy(policy);
109 for(
size_t i = 0; i < static_cast<size_t>(size); i++) {
112 auto& province = gs.
world->provinces.at(province_id);
114 auto old_owner_id = province.owner_id;
115 auto old_controller_id = province.controller_id;
117 if(province.owner_id != old_owner_id)
119 if(province.controller_id != old_controller_id)
126 for(
size_t i = 0; i < static_cast<size_t>(size); i++) {
155 auto& province = gs.
world->provinces.at(province_id);
158 province.buildings.at(building_type_id).level += 1.f;
163 auto& province = gs.
world->provinces.at(province_id);
166 province.buildings.at(building_type_id).level -= 1.f;
184 gs.
ui_ctx.
prompt(
"Network",
"Desynchronized from server, oops!");
189 auto& province = gs.
world->provinces.at(province_id);
195 auto& nation = gs.
world->nations.at(nation_id);
207 while(!has_snapshot) {
214 if(this->net_thread.joinable())
215 this->net_thread.join();
void wait_for_snapshot()
Waits to receive the server initial world snapshot.
Client(GameState &gs, std::string host, const unsigned port)
void do_netloop(std::function< bool()> cond, std::function< void(const Packet &packet, Eng3D::Deser::Archive &ar)> handler)
std::atomic< bool > update_tick
void mark_province_control_changed(ProvinceId province_id)
void mark_province_owner_changed(ProvinceId province_id)
void prompt(const std::string &title, const std::string &text)
Roughly a batallion, consisting of approximately 500 soldiers each.
void add_unit(Unit unit, ProvinceId unit_current_province)
Eng3D::Freelist< Unit > units
void move_unit(UnitId unit, ProvinceId target_province)
void remove_unit(UnitId unit)
ProvinceManager province_manager
void deserialize(Eng3D::Deser::Archive &ar, T &obj)
void serialize(Eng3D::Deser::Archive &ar, const T &obj)
void debug(const std::string_view category, const std::string_view msg)
std::string translate_format(const std::string_view format, Args &&... args)
String formatter, with translation.
Base class that serves as archiver, stores (in memory) the data required for serialization/deserializ...
std::vector< std::pair< NationId, TreatyApproval > > approval_status