[freeciv-ai] (PR#10997) AI can sell his last cities
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: |
[freeciv-ai] (PR#10997) AI can sell his last cities |
From: |
"Mateusz Stefek" <mstefek@xxxxxxxxx> |
Date: |
Sat, 13 Nov 2004 01:55:00 -0800 |
Reply-to: |
rt@xxxxxxxxxxx |
<URL: http://rt.freeciv.org/Ticket/Display.html?id=10997 >
http://forum.freeciv.org/viewtopic.php?t=486
Someone mentioned on the forum that the AI can sell all his cities
except capital. This is of course wrong. This patch makes last 8 cities
very expensive.
--
mateusz
Index: advdiplomacy.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/advdiplomacy.c,v
retrieving revision 1.48
diff -u -r1.48 advdiplomacy.c
--- advdiplomacy.c 31 Oct 2004 22:14:46 -0000 1.48
+++ advdiplomacy.c 13 Nov 2004 09:53:41 -0000
@@ -474,6 +474,7 @@
bool has_treaty = FALSE;
bool only_gifts = TRUE;
struct ai_data *ai = ai_data_get(pplayer);
+ int given_cities = 0;
assert(!is_barbarian(pplayer));
@@ -483,6 +484,9 @@
if (is_pact_clause(pclause->type)) {
has_treaty = TRUE;
}
+ if (pclause->type == CLAUSE_CITY && pclause->from == pplayer) {
+ given_cities++;
+ }
if (pclause->type != CLAUSE_GOLD && pclause->type != CLAUSE_MAP
&& pclause->type != CLAUSE_SEAMAP && pclause->type != CLAUSE_VISION
&& (pclause->type != CLAUSE_ADVANCE
@@ -503,6 +507,12 @@
return;
}
+ /* Last 8 cities should be sold only for much gold */
+ if (given_cities > 0) {
+ total_balance -=
+ MAX(0, 8 - (city_list_size(&pplayer->cities) - given_cities)) * 10000;
+ }
+
/* Accept if balance is good */
if (total_balance >= 0) {
handle_diplomacy_accept_treaty_req(pplayer, aplayer->player_no);
@@ -560,7 +570,6 @@
/* Evaluate clauses */
clause_list_iterate(ptreaty->clauses, pclause) {
int balance = ai_goldequiv_clause(pplayer, aplayer, pclause, ai, TRUE);
-
total_balance += balance;
gift = (gift && (balance >= 0));
ai_treaty_react(pplayer, aplayer, pclause);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freeciv-ai] (PR#10997) AI can sell his last cities,
Mateusz Stefek <=
|
|