Author: cazfi Date: Mon Aug 10 18:29:22 2015 New Revision: 29442 URL: http://svn.gna.org/viewcvs/freeciv?rev=29442&view=rev Log: Hard, experimental, and Cheating level AIs are no longer forced to propose cease-fire on first contact, though they consider it.
See patch #6203 Modified: trunk/ai/default/advdiplomacy.c trunk/ai/difficulty.c trunk/ai/handicaps.h Modified: trunk/ai/default/advdiplomacy.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/advdiplomacy.c?rev=29442&r1=29441&r2=29442&view=diff ============================================================================== --- trunk/ai/default/advdiplomacy.c (original) +++ trunk/ai/default/advdiplomacy.c Mon Aug 10 18:29:22 2015 @@ -917,15 +917,40 @@ void dai_diplomacy_first_contact(struct ai_type *ait, struct player *pplayer, struct player *aplayer) { - if (pplayer->ai_controlled && !has_handicap(pplayer, H_AWAY) + bool wants_ceasefire = FALSE; + + if (pplayer->ai_controlled && player_diplstate_get(pplayer, aplayer)->type == DS_WAR && could_meet_with_player(pplayer, aplayer)) { + if (has_handicap(pplayer, H_CEASEFIRE)) { + fc_assert(!has_handicap(pplayer, H_AWAY)); + wants_ceasefire = TRUE; + } else if (!has_handicap(pplayer, H_AWAY)) { + struct Clause clause; + + clause.from = pplayer; + clause.value = 0; + clause.type = CLAUSE_CEASEFIRE; + + if (dai_goldequiv_clause(ait, pplayer, aplayer, &clause, + FALSE, DS_CEASEFIRE) > 0) { + wants_ceasefire = TRUE; + } + } + } + + if (wants_ceasefire) { notify(aplayer, _("*%s (AI)* Greetings %s! May we suggest a ceasefire " - "while we get to know each other better?"), + "while we get to know each other better?"), player_name(pplayer), player_name(aplayer)); clear_old_treaty(pplayer, aplayer); dai_diplomacy_suggest(pplayer, aplayer, CLAUSE_CEASEFIRE, FALSE, 0); + } else { + notify(aplayer, _("*%s (AI)* I found you %s! Now make it worth letting " + "you live, or get crushed."), + player_name(pplayer), + player_name(aplayer)); } } Modified: trunk/ai/difficulty.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/ai/difficulty.c?rev=29442&r1=29441&r2=29442&view=diff ============================================================================== --- trunk/ai/difficulty.c (original) +++ trunk/ai/difficulty.c Mon Aug 10 18:29:22 2015 @@ -76,6 +76,7 @@ BV_SET(handicap, H_REVOLUTION); BV_SET(handicap, H_EXPANSION); BV_SET(handicap, H_DANGER); + BV_SET(handicap, H_CEASEFIRE); break; case AI_LEVEL_EASY: BV_SET(handicap, H_RATES); @@ -88,12 +89,14 @@ BV_SET(handicap, H_DIPLOMACY); BV_SET(handicap, H_REVOLUTION); BV_SET(handicap, H_EXPANSION); + BV_SET(handicap, H_CEASEFIRE); break; case AI_LEVEL_NORMAL: BV_SET(handicap, H_RATES); BV_SET(handicap, H_TARGETS); BV_SET(handicap, H_HUTS); BV_SET(handicap, H_DIPLOMAT); + BV_SET(handicap, H_CEASEFIRE); break; #ifdef DEBUG Modified: trunk/ai/handicaps.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/ai/handicaps.h?rev=29442&r1=29441&r2=29442&view=diff ============================================================================== --- trunk/ai/handicaps.h (original) +++ trunk/ai/handicaps.h Mon Aug 10 18:29:22 2015 @@ -29,6 +29,7 @@ H_REVOLUTION, /* Cannot skip anarchy */ H_EXPANSION, /* Don't like being much larger than human */ H_DANGER, /* Always thinks its city is in danger */ + H_CEASEFIRE, /* Has to offer cease-fire on first contact */ H_LAST }; _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits