23 "msg_access_refused_title",
24 m.to, m.from, dcon::nation_id{},
38 "msg_alliance_declined_title",
39 m.to, m.from, dcon::nation_id{},
48 auto was_defensive =
false;
49 for(
auto wp : state.world.war_get_war_participant(m.data.war)) {
50 if(wp.get_nation() == m.from) {
51 was_defensive = !wp.get_is_attacker();
56 auto rel = state.world.get_diplomatic_relation_by_diplomatic_pair(m.from, m.to);
57 if(rel && state.world.diplomatic_relation_get_are_allied(rel)) {
58 state.world.diplomatic_relation_set_are_allied(rel,
false);
64 "msg_alliance_ends_title",
65 m.to, m.from, dcon::nation_id{},
72 [from = m.from, to = m.to, pa = state.world.war_get_primary_attacker(m.data.war), pd = state.world.war_get_primary_defender(m.data.war), name = state.world.war_get_name(m.data.war), tag = state.world.war_get_over_tag(m.data.war), st = state.world.war_get_over_state(m.data.war)](
sys::state& state,
text::layout_base& contents) {
73 text::substitution_map sub;
74 text::add_to_substitution_map(sub, text::variable_type::order, std::string_view(
""));
75 text::add_to_substitution_map(sub, text::variable_type::second, text::get_adjective(state, pd));
76 text::add_to_substitution_map(sub, text::variable_type::second_country, pd);
77 text::add_to_substitution_map(sub, text::variable_type::first, text::get_adjective(state, pa));
78 text::add_to_substitution_map(sub, text::variable_type::third, tag);
79 text::add_to_substitution_map(sub, text::variable_type::state, st);
81 std::string resolved_war_name = text::resolve_string_substitution(state, name, sub);
82 text::add_line(state, contents,
"msg_ally_call_decline_1", text::variable_type::x, to, text::variable_type::y, from, text::variable_type::val, std::string_view{resolved_war_name});
84 "msg_ally_call_declined_title",
85 m.to, m.from, dcon::nation_id{},
106 "msg_crisis_joffer_rejected",
107 m.to, m.from, dcon::nation_id{},
117 state.crisis_temperature += state.defines.crisis_temperature_on_offer_decline;
125 "msg_crisis_not_settled_title",
126 m.to, m.from, dcon::nation_id{},
139 if(from != state.primary_crisis_attacker && from != state.primary_crisis_defender)
146 for(
auto& par : state.crisis_participants) {
151 if(par.merely_interested ==
false)
158 for(
auto& par : state.crisis_participants) {
163 if(par.merely_interested)
165 if(par.supports_attacker && from == state.primary_crisis_attacker)
167 if(!par.supports_attacker && from == state.primary_crisis_defender)
174 auto cb_type = state.world.cb_type_get_type_bits(offer.
cb);
189 for(
auto& par : state.crisis_participants) {
194 par.merely_interested =
false;
195 par.supports_attacker = (from == state.primary_crisis_attacker);
196 if(par.supports_attacker) {
207 state.defines.crisis_wargoal_infamy_mult;
208 state.world.nation_get_infamy(from) += infamy;
214 if(from != state.primary_crisis_attacker && from != state.primary_crisis_defender)
216 if(to != state.primary_crisis_attacker && to != state.primary_crisis_defender)
222 for(
auto wg : state.world.peace_offer_get_peace_offer_item(peace)) {
224 for(
auto par : state.crisis_attacker_wargoals) {
225 if(par.added_by == wg.get_wargoal().get_added_by()) {
226 if(wg.get_wargoal().get_associated_state() == par.state &&
227 wg.get_wargoal().get_associated_tag() == par.wg_tag &&
228 wg.get_wargoal().get_secondary_nation() == par.secondary_nation &&
229 wg.get_wargoal().get_target_nation() == par.target_nation &&
230 wg.get_wargoal().get_type() == par.cb)
234 for(
auto par : state.crisis_defender_wargoals) {
235 if(par.added_by == wg.get_wargoal().get_added_by()) {
236 if(wg.get_wargoal().get_associated_state() == par.state &&
237 wg.get_wargoal().get_associated_tag() == par.wg_tag &&
238 wg.get_wargoal().get_secondary_nation() == par.secondary_nation &&
239 wg.get_wargoal().get_target_nation() == par.target_nation &&
240 wg.get_wargoal().get_type() == par.cb)
258 case type::access_request:
260 case type::alliance_request:
262 case type::call_ally_request:
264 case type::be_crisis_primary_attacker:
265 case type::be_crisis_primary_defender:
266 case type::peace_offer:
268 case type::take_crisis_side_offer:
270 case type::crisis_peace_offer:
272 case type::state_transfer:
285 case type::access_request: {
287 auto rel = state.world.get_unilateral_relationship_by_unilateral_pair(m.to, m.from);
289 rel = state.world.force_create_unilateral_relationship(m.to, m.from);
291 state.world.unilateral_relationship_set_military_access(rel,
true);
297 "msg_access_granted_title",
298 m.to, m.from, dcon::nation_id{},
303 case type::alliance_request: {
308 case type::call_ally_request: {
312 [from = m.from, to = m.to, pa = state.world.war_get_primary_attacker(m.data.war), pd = state.world.war_get_primary_defender(m.data.war), name = state.world.war_get_name(m.data.war), tag = state.world.war_get_over_tag(m.data.war), st = state.world.war_get_over_state(m.data.war)](
sys::state& state,
text::layout_base& contents) {
313 text::substitution_map sub;
314 text::add_to_substitution_map(sub, text::variable_type::order, std::string_view(
""));
315 text::add_to_substitution_map(sub, text::variable_type::second, text::get_adjective(state, pd));
316 text::add_to_substitution_map(sub, text::variable_type::second_country, pd);
317 text::add_to_substitution_map(sub, text::variable_type::first, text::get_adjective(state, pa));
318 text::add_to_substitution_map(sub, text::variable_type::third, tag);
319 text::add_to_substitution_map(sub, text::variable_type::state, st);
321 std::string resolved_war_name = text::resolve_string_substitution(state, name, sub);
322 text::add_line(state, contents,
"msg_ally_call_accepted_1", text::variable_type::x, to, text::variable_type::y, from, text::variable_type::val, std::string_view{resolved_war_name});
324 "msg_ally_call_accepted_title",
325 m.to, m.from, dcon::nation_id{},
331 case type::be_crisis_primary_attacker:
334 case type::be_crisis_primary_defender:
337 case type::peace_offer:
340 case type::take_crisis_side_offer:
347 "msg_crisis_joffer_accepted",
348 m.to, m.from, dcon::nation_id{},
352 case type::crisis_peace_offer:
358 "msg_crisis_settled_title",
359 m.to, m.from, dcon::nation_id{},
363 case type::state_transfer:
364 for(
const auto ab : state.world.state_definition_get_abstract_state_membership(m.data.state)) {
365 if(ab.get_province().get_province_ownership().get_nation() == m.from) {
383 if(state.world.nation_get_is_player_controlled(m.from) && state.cheat_data.always_accept_deals)
390 case type::access_request:
392 case type::alliance_request:
394 case type::call_ally_request:
398 case type::be_crisis_primary_defender:
400 case type::be_crisis_primary_attacker:
402 case type::peace_offer:
404 case type::take_crisis_side_offer:
406 case type::crisis_peace_offer:
408 case type::state_transfer:
409 auto rel = state.world.nation_get_overlord_as_subject(m.to);
410 auto overlord = state.world.overlord_get_ruler(rel);
411 if(overlord == m.from) {
414 static std::vector<dcon::state_instance_id> target_states;
417 for(
auto sid : target_states) {
418 if(state.world.state_instance_get_definition(sid) == m.data.state) {
433 if(state.world.nation_get_is_player_controlled(m.to) ==
false) {
442 for(
auto& i : state.pending_messages) {
443 if(i.type == type::none) {
444 std::memcpy(&i, &m,
sizeof(
message));
445 i.when = state.current_date;
447 if(i.to == state.local_player_nation) {
448 state.new_requests.push(i);
457 for(
auto& m : state.pending_messages) {
bool ai_will_accept_alliance(sys::state &state, dcon::nation_id target, dcon::nation_id from)
bool will_accept_peace_offer(sys::state &state, dcon::nation_id n, dcon::nation_id from, dcon::peace_offer_id p)
void state_target_list(std::vector< dcon::state_instance_id > &result, sys::state &state, dcon::nation_id for_nation, dcon::nation_id within)
bool ai_will_grant_access(sys::state &state, dcon::nation_id target, dcon::nation_id from)
bool will_be_crisis_primary_attacker(sys::state &state, dcon::nation_id n)
bool will_join_crisis_with_offer(sys::state &state, dcon::nation_id n, sys::full_wg offer)
bool will_join_war(sys::state &state, dcon::nation_id n, dcon::war_id w, bool as_attacker)
bool will_be_crisis_primary_defender(sys::state &state, dcon::nation_id n)
bool will_accept_crisis_peace_offer(sys::state &state, dcon::nation_id to, bool is_concession, bool missing_wg)
bool can_state_transfer(sys::state &state, dcon::nation_id asker, dcon::nation_id target, dcon::state_definition_id sid)
bool can_call_to_arms(sys::state &state, dcon::nation_id asker, dcon::nation_id target, dcon::war_id w, bool ignore_cost)
bool can_ask_for_access(sys::state &state, dcon::nation_id asker, dcon::nation_id target, bool ignore_cost)
bool can_ask_for_alliance(sys::state &state, dcon::nation_id asker, dcon::nation_id target, bool ignore_cost)
constexpr int32_t expiration_in_days
bool can_accept(sys::state &state, message const &m)
void decline(sys::state &state, message const &m)
void update_pending(sys::state &state)
void accept(sys::state &state, message const &m)
@ be_crisis_primary_attacker
@ be_crisis_primary_defender
void post(sys::state &state, message const &m)
Pushes a diplomatic message to the list of pending diplomatic requests for the specified recipient (m...
bool can_accept_crisis_peace_offer(sys::state &state, dcon::nation_id from, dcon::nation_id to, dcon::peace_offer_id peace)
bool ai_will_accept(sys::state &state, message const &m)
Returns the appropriate acceptance evaluation for a given diplomatic message. It is required to defin...
bool can_accept_crisis_offer(sys::state &state, dcon::nation_id from, dcon::nation_id to, sys::full_wg offer)
void add_to_crisis_with_offer(sys::state &state, dcon::nation_id from, dcon::nation_id to, sys::full_wg offer)
constexpr uint32_t is_not_constructing_cb
constexpr uint32_t always
float crisis_cb_addition_infamy_cost(sys::state &state, dcon::cb_type_id type, dcon::nation_id from, dcon::nation_id target, dcon::state_definition_id cb_state)
void add_to_war(sys::state &state, dcon::war_id w, dcon::nation_id n, bool as_attacker, bool on_war_creation)
void reject_peace_offer(sys::state &state, dcon::peace_offer_id offer)
war_role get_role(sys::state const &state, dcon::war_id w, dcon::nation_id n)
bool is_attacker(sys::state &state, dcon::war_id w, dcon::nation_id n)
bool cb_instance_conditions_satisfied(sys::state &state, dcon::nation_id actor, dcon::nation_id target, dcon::cb_type_id cb, dcon::state_definition_id st, dcon::national_identity_id tag, dcon::nation_id secondary)
void implement_peace_offer(sys::state &state, dcon::peace_offer_id offer)
void cleanup_crisis_peace_offer(sys::state &state, dcon::peace_offer_id peace)
void accept_crisis_peace_offer(sys::state &state, dcon::nation_id from, dcon::nation_id to, dcon::peace_offer_id peace)
void reject_crisis_participation(sys::state &state)
void make_alliance(sys::state &state, dcon::nation_id a, dcon::nation_id b)
void crisis_add_wargoal(std::vector< sys::full_wg > &list, sys::full_wg wg)
void add_as_primary_crisis_defender(sys::state &state, dcon::nation_id n)
void add_as_primary_crisis_attacker(sys::state &state, dcon::nation_id n)
void update_cached_values(sys::state &state)
void adjust_relationship(sys::state &state, dcon::nation_id a, dcon::nation_id b, float delta)
void post(sys::state &state, message &&m)
void update_connected_regions(sys::state &state)
void update_cached_values(sys::state &state)
void change_province_owner(sys::state &state, dcon::province_id id, dcon::nation_id new_owner)
@ crisis_join_offer_accepted
@ crisis_join_offer_declined
@ crisis_resolution_declined
@ crisis_resolution_accepted
void add_line(sys::state &state, layout_base &dest, dcon::text_key txt, int32_t indent)
Holds data regarding a diplomatic message between two specified nations at a certain date,...
dcon::nation_id target_nation
dcon::nation_id secondary_nation
dcon::national_identity_id wg_tag
dcon::state_definition_id state
Holds important data about the game world, state, and other data regarding windowing,...