* The organisation signs a diplomatic rift treaty (either to neutral or alliance state) * @param other - other organisation * @param bribe - sum of the bribe by other org * @param forceAlliance - whenether relationships go straight to maximum */
| 932 | * @param forceAlliance - whenether relationships go straight to maximum |
| 933 | */ |
| 934 | void Organisation::signTreatyWith(GameState &state, StateRef<Organisation> other, int bribe, |
| 935 | bool forceAlliance) |
| 936 | { |
| 937 | // it's either an alliance offer or we have some sort of bribe |
| 938 | if (bribe <= 0 && !forceAlliance) |
| 939 | { |
| 940 | return; |
| 941 | } |
| 942 | |
| 943 | StateRef<Organisation> currentOrg{&state, id}; |
| 944 | const float myRelation = this->getRelationTo(other); |
| 945 | const float newValue = (forceAlliance) ? 100.0f |
| 946 | : (myRelation > 0) ? std::max(myRelation + 25, 100.0f) |
| 947 | : 0; |
| 948 | |
| 949 | current_relations[other] = newValue; |
| 950 | other->current_relations[currentOrg] = std::max(newValue, other->getRelationTo(currentOrg)); |
| 951 | |
| 952 | balance += bribe; |
| 953 | other->balance -= bribe; |
| 954 | } |
| 955 | |
| 956 | template <> |
| 957 | sp<Organisation> StateObject<Organisation>::get(const GameState &state, const UString &id) |
no test coverage detected