Skip to content

Commit

Permalink
Merge pull request #1253 from Nivaturimika/inter
Browse files Browse the repository at this point in the history
fix marking seeking alliance
  • Loading branch information
schombert authored Apr 8, 2024
2 parents 98ba5c4 + 79ee913 commit 33c442b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions assets/alice.csv
Original file line number Diff line number Diff line change
Expand Up @@ -1683,6 +1683,7 @@ alice_rgo_trade_prod_3;RGO Minting Production: $x$ ($y$)
alice_artisan_trade_prod;Artisan Production: $x$ ($y$)
alice_factory_trade_prod;Factory Production: $x$ ($y$)
alice_all_trade_prod;Total Production: $x$
alice_interested_in_alliance;(Only applies to AI nations) Mark that we're interested in an alliance with this country, and will immediately accept alliance offers
alice_merge_rally_point_why;Merge rally points are deprecated, rally points will now automatically merge
alice_mvcap_1;Moves the capital to this province
alice_mvcap_2;No ongoing crisis
Expand Down
2 changes: 1 addition & 1 deletion src/ai/ai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ static void internal_get_alliance_targets_by_adjacency(sys::state& state, dcon::
auto other = nb.get_connected_nations(0) != adj ? nb.get_connected_nations(0) : nb.get_connected_nations(1);

bool b = other.get_is_player_controlled()
? !state.world.unilateral_relationship_get_interested_in_alliance(state.world.get_unilateral_relationship_by_unilateral_pair(n, other))
? state.world.unilateral_relationship_get_interested_in_alliance(state.world.get_unilateral_relationship_by_unilateral_pair(n, other))
: ai_will_accept_alliance(state, other, n);
if(other != n && !(other.get_overlord_as_subject().get_ruler()) && !nations::are_allied(state, n, other) && !military::are_at_war(state, other, n) && b) {
alliance_targets.push_back(other.id);
Expand Down
8 changes: 7 additions & 1 deletion src/gui/topbar_subwindows/gui_diplomacy_window.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -569,12 +569,18 @@ class diplomacy_country_interested_in_alliance : public checkbox_button {
bool is_active(sys::state& state) noexcept override {
auto const n = retrieve<dcon::nation_id>(state, parent);
auto const rel = state.world.get_unilateral_relationship_by_unilateral_pair(n, state.local_player_nation);
return !state.world.unilateral_relationship_get_interested_in_alliance(rel);
return state.world.unilateral_relationship_get_interested_in_alliance(rel);
}
void button_action(sys::state& state) noexcept override {
auto const n = retrieve<dcon::nation_id>(state, parent);
command::toggle_interested_in_alliance(state, state.local_player_nation, n);
}
tooltip_behavior has_tooltip(sys::state& state) noexcept override {
return tooltip_behavior::variable_tooltip;
}
void update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept override {
text::add_line(state, contents, "alice_interested_in_alliance");
}
};

class diplomacy_country_info : public listbox_row_element_base<dcon::nation_id> {
Expand Down

0 comments on commit 33c442b

Please sign in to comment.