Complete.Org:
Mailing Lists:
Archives:
freeciv-dev:
December 2005: [Freeciv-Dev] (PR#14904) Bugs in AI diplomacy code |
[Freeciv-Dev] (PR#14904) Bugs in AI diplomacy code[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=14904 > (SVN revision 11364) At ai/advdiplomacy.c:307, there is some obviously non-sensical code: else if (adip->countdown >= 0 && adip->countdown < -1) I suppose the intent was to test for (adip->countdown != -1) instead (as is done at line 318), so that the AI player refuses a peace treaty when there is a countdown going on. At ai/advdiplomacy.c:1535, there is also wrong code: worth = ai_goldequiv_clause(pplayer, aplayer, &clause, ai, FALSE, CLAUSE_CEASEFIRE); clause.type = CLAUSE_CEASEFIRE; if (worth < 0) The code checks if a ceasefire is worth anything, but the diplomatic clause has not been initialized to ceasefire, so the game only checks garbage (and it is unfortunate no assertion failed). The code should follow the same coding style as at lines 1497 and 1514: no "worth" variable should be used and ai_gold_equiv should directly be in the conditional. This bug is responsible for the times the AI directly rejects a ceasefire it has itself suggested.(SVN revision 11364) At ai/advdiplomacy.c:307, there is some obviously non-sensical code: else if (adip->countdown >= 0 && adip->countdown < -1) I suppose the intent was to test for (adip->countdown != -1) instead (as is done at line 318), so that the AI player refuses a peace treaty when there is a countdown going on. At ai/advdiplomacy.c:1535, there is also wrong code: worth = ai_goldequiv_clause(pplayer, aplayer, &clause, ai, FALSE, CLAUSE_CEASEFIRE); clause.type = CLAUSE_CEASEFIRE; if (worth < 0) The code checks if a ceasefire is worth anything, but the diplomatic clause has not been initialized to ceasefire, so the game only checks garbage (and it is unfortunate no assertion failed). The code should follow the same coding style as at lines 1497 and 1514: no "worth" variable should be used and ai_gold_equiv should directly be in the conditional. This bug is responsible for the times the AI directly rejects a ceasefire it has itself suggested.
|