14 return state.world.nation_get_in_sphere_of(b) == a;
16 return bool(
state.world.get_nation_adjacency_by_nation_adjacency_pair(a, b));
21 return (
state.world.gp_relationship_get_status(
state.world.get_gp_relationship_by_gp_influence_pair(b, a))
23 &&
state.world.nation_get_in_sphere_of(b) != a;
25 for(
const auto sub :
state.world.nation_get_overlord_as_ruler(b)) {
26 if(
state.world.get_nation_adjacency_by_nation_adjacency_pair(a, sub.get_subject()))
29 return !
state.world.overlord_get_ruler(
state.world.nation_get_overlord_as_subject(b))
30 &&
state.world.get_nation_adjacency_by_nation_adjacency_pair(a, b);
39 auto f = [&](dcon::nation_id a, dcon::nation_id b) {
42 return a_name < b_name;
44 std::stable_sort(list.begin(), list.end(), f);
48 auto f = [&](dcon::nation_id a, dcon::nation_id b) {
49 return state.world.nation_get_industrial_rank(a) <
state.world.nation_get_industrial_rank(b);
51 std::stable_sort(list.begin(), list.end(), f);
55 auto f = [&](dcon::nation_id a, dcon::nation_id b) {
56 return state.world.nation_get_military_rank(a) <
state.world.nation_get_military_rank(b);
58 std::stable_sort(list.begin(), list.end(), f);
62 auto f = [&](dcon::nation_id a, dcon::nation_id b) {
63 return state.world.nation_get_prestige_rank(a) <
state.world.nation_get_prestige_rank(b);
65 std::stable_sort(list.begin(), list.end(), f);
69 auto f = [&](dcon::nation_id a, dcon::nation_id b) {
70 return state.world.nation_get_rank(a) <
state.world.nation_get_rank(b);
72 std::stable_sort(list.begin(), list.end(), f);
76 auto f = [&](dcon::nation_id a, dcon::nation_id b) {
77 auto rid_a =
state.world.get_diplomatic_relation_by_diplomatic_pair(
state.local_player_nation, a);
78 auto va = bool(rid_a) ?
state.world.diplomatic_relation_get_value(rid_a) : 0;
79 auto rid_b =
state.world.get_diplomatic_relation_by_diplomatic_pair(
state.local_player_nation, b);
80 auto vb = bool(rid_b) ?
state.world.diplomatic_relation_get_value(rid_b) : 0;
83 std::stable_sort(list.begin(), list.end(), f);
87 auto f = [&](dcon::nation_id a, dcon::nation_id b) {
88 auto grid_a =
state.world.get_gp_relationship_by_gp_influence_pair(a,
state.local_player_nation);
89 auto va = bool(grid_a) ?
state.world.gp_relationship_get_status(grid_a) : 0;
90 auto grid_b =
state.world.get_gp_relationship_by_gp_influence_pair(b,
state.local_player_nation);
91 auto vb = bool(grid_b) ?
state.world.gp_relationship_get_status(grid_b) : 0;
95 std::stable_sort(list.begin(), list.end(), f);
99 auto f = [&](dcon::nation_id a, dcon::nation_id b) {
100 auto rel_a =
state.world.get_gp_relationship_by_gp_influence_pair(a,
state.local_player_nation);
101 uint8_t rel_flags_a = bool(rel_a) ?
state.world.gp_relationship_get_status(rel_a) : 0;
102 auto rel_b =
state.world.get_gp_relationship_by_gp_influence_pair(b,
state.local_player_nation);
103 uint8_t rel_flags_b = bool(rel_b) ?
state.world.gp_relationship_get_status(rel_b) : 0;
106 std::stable_sort(list.begin(), list.end(), f);
110 auto f = [&](dcon::nation_id a, dcon::nation_id b) {
111 return state.world.nation_get_in_sphere_of(a).id.index() >
state.world.nation_get_in_sphere_of(b).id.index();
113 std::stable_sort(list.begin(), list.end(), f);
117 auto f = [&](dcon::nation_id a, dcon::nation_id b) {
118 auto rel_a =
state.world.get_gp_relationship_by_gp_influence_pair(a,
state.local_player_nation);
119 auto rel_b =
state.world.get_gp_relationship_by_gp_influence_pair(b,
state.local_player_nation);
120 return state.world.gp_relationship_get_influence(rel_a) >
state.world.gp_relationship_get_influence(rel_b);
122 std::stable_sort(list.begin(), list.end(), f);
125 auto f = [&](dcon::nation_id a, dcon::nation_id b) {
126 auto urel_a =
state.world.get_unilateral_relationship_by_unilateral_pair(a,
state.local_player_nation);
127 auto urel_b =
state.world.get_unilateral_relationship_by_unilateral_pair(b,
state.local_player_nation);
128 return state.world.unilateral_relationship_get_foreign_investment(urel_a) >
129 state.world.unilateral_relationship_get_foreign_investment(urel_b);
131 std::stable_sort(list.begin(), list.end(), f);
134 auto num_factories = [&](dcon::nation_id n) {
136 for(
auto p :
state.world.nation_get_province_ownership(n)) {
137 auto fac = p.get_province().get_factory_location();
138 total += int32_t(fac.end() - fac.begin());
142 auto f = [&](dcon::nation_id a, dcon::nation_id b) {
143 return num_factories(a) > num_factories(b);
145 std::stable_sort(list.begin(), list.end(), f);
152 auto f = [&](dcon::nation_id a, dcon::nation_id b) {
153 auto rel_a =
state.world.get_gp_relationship_by_gp_influence_pair(a, gp);
154 auto rel_b =
state.world.get_gp_relationship_by_gp_influence_pair(b, gp);
155 return state.world.gp_relationship_get_influence(rel_a) >
state.world.gp_relationship_get_influence(rel_b);
157 std::sort(list.begin(), list.end(), f);
159 auto f = [&](dcon::nation_id a, dcon::nation_id b) {
160 auto urel_a =
state.world.get_unilateral_relationship_by_unilateral_pair(a, gp);
161 auto urel_b =
state.world.get_unilateral_relationship_by_unilateral_pair(b, gp);
162 return state.world.unilateral_relationship_get_foreign_investment(urel_a) >
163 state.world.unilateral_relationship_get_foreign_investment(urel_b);
165 std::stable_sort(list.begin(), list.end(), f);
173 std::reverse(list.begin(), list.end());
#define assert(condition)
bool ai_will_accept_alliance(sys::state &state, dcon::nation_id target, dcon::nation_id from)
bool can_ask_for_alliance(sys::state &state, dcon::nation_id asker, dcon::nation_id target, bool ignore_cost)
bool are_at_war(sys::state const &state, dcon::nation_id a, dcon::nation_id b)
constexpr uint8_t priority_zero
constexpr uint8_t priority_mask
constexpr uint8_t level_mask
bool is_influence_level_greater(int32_t l, int32_t r)
status get_status(sys::state &state, dcon::nation_id n)
bool are_allied(sys::state &state, dcon::nation_id a, dcon::nation_id b)
dcon::nation_id get_nth_great_power(sys::state const &state, uint16_t n)
std::string produce_simple_string(sys::state const &state, dcon::text_key id)
dcon::text_key get_name(sys::state &state, dcon::nation_id id)
void sort_countries(sys::state &state, std::vector< dcon::nation_id > &list, country_list_sort sort, bool sort_ascend)
std::string get_status_text(sys::state &state, dcon::nation_id nation_id)
bool country_category_filter_check(sys::state &state, country_list_filter filt, dcon::nation_id a, dcon::nation_id b)