[Freeciv-Dev] Re: (PR#14548) New treaties rules
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: |
[Freeciv-Dev] Re: (PR#14548) New treaties rules |
From: |
"Per I. Mathisen" <per@xxxxxxxxxxx> |
Date: |
Sat, 19 Nov 2005 04:38:44 -0800 |
Reply-to: |
bugs@xxxxxxxxxxx |
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=14548 >
This patch:
* Units can only enter a tile owned by yourself or a player you are at
war or in alliance with.
* Units can only build terrain improvements on a tile owned by yourself
or a player you are at war or in alliance with.
* Units can only pillage and transform your own tiles or those of a
player you are at war with.
* Units can only steal technology, incite cities and bribe units from
players you are at war with.
* The 'has_reason_to_cancel' concept is removed.
Next patch (after this is committed) will do this:
* When a Peace treaty kicks in, all military units belonging to
peace-treaty players inside your border are immediately disbanded.
* The AI will use Armistice to move its units out of enemy territory.
* A shortcut key cycles through units in enemy territory for easy mass
exodus.
- Per
Index: server/srv_main.c
===================================================================
--- server/srv_main.c (revision 11249)
+++ server/srv_main.c (working copy)
@@ -409,7 +409,6 @@
players_iterate(plr2) {
struct player_diplstate *state = &plr1->diplstates[plr2->player_no];
- state->has_reason_to_cancel = MAX(state->has_reason_to_cancel - 1, 0);
state->contact_turns_left = MAX(state->contact_turns_left - 1, 0);
if (state->type == DS_ARMISTICE) {
Index: server/diplomats.c
===================================================================
--- server/diplomats.c (revision 11248)
+++ server/diplomats.c (working copy)
@@ -50,8 +50,6 @@
struct unit *pdiplomat, struct tile
*ptile);
static void diplomat_escape(struct player *pplayer, struct unit *pdiplomat,
const struct city *pcity);
-static void maybe_cause_incident(enum diplomat_actions action, struct player
*offender,
- struct unit *victim_unit, struct city
*victim_city);
/******************************************************************************
Poison a city's water supply.
@@ -118,9 +116,6 @@
city_refresh (pcity);
send_city_info(NULL, pcity);
- /* this may cause a diplomatic incident */
- maybe_cause_incident(SPY_POISON, pplayer, NULL, pcity);
-
/* Now lets see if the spy survives. */
diplomat_escape(pplayer, pdiplomat, pcity);
}
@@ -184,9 +179,6 @@
pdiplomat->moves_left = 0;
}
- /* this may cause a diplomatic incident */
- maybe_cause_incident(DIPLOMAT_INVESTIGATE, pplayer, NULL, pcity);
-
/* Spies always survive. Diplomats never do. */
if (!unit_flag (pdiplomat, F_SPY)) {
wipe_unit(pdiplomat);
@@ -223,9 +215,6 @@
packet.diplomat_id = pdiplomat->id;
packet.city_id = pcity->id;
lsend_packet_city_sabotage_list(player_reply_dest(pplayer), &packet);
-
- /* this may cause a diplomatic incident */
- maybe_cause_incident(SPY_GET_SABOTAGE_LIST, pplayer, NULL, pcity);
}
/******************************************************************************
@@ -301,9 +290,6 @@
pdiplomat->moves_left = 0;
}
- /* this may cause a diplomatic incident */
- maybe_cause_incident(DIPLOMAT_EMBASSY, pplayer, NULL, pcity);
-
/* Spies always survive. Diplomats never do. */
if (!unit_flag (pdiplomat, F_SPY)) {
wipe_unit(pdiplomat);
@@ -376,9 +362,6 @@
_("Your %s was sabotaged by %s!"),
unit_name(pvictim->type), pplayer->name);
- /* this may cause a diplomatic incident */
- maybe_cause_incident(SPY_SABOTAGE_UNIT, pplayer, pvictim, NULL);
-
/* Now lets see if the spy survives. */
diplomat_escape(pplayer, pdiplomat, NULL);
}
@@ -478,9 +461,6 @@
/* This costs! */
pplayer->economic.gold -= pvictim->bribe_cost;
- /* This may cause a diplomatic incident */
- maybe_cause_incident(DIPLOMAT_BRIBE, pplayer, pvictim, NULL);
-
/* Be sure to wipe the converted unit! */
victim_tile = pvictim->tile;
wipe_unit(pvictim);
@@ -614,8 +594,6 @@
notify_player(cplayer, pcity->tile, E_ENEMY_DIPLOMAT_FAILED,
_("%s's %s failed to steal technology from %s."),
pplayer->name, unit_name(pdiplomat->type), pcity->name);
- /* this may cause a diplomatic incident */
- maybe_cause_incident(DIPLOMAT_STEAL, pplayer, NULL, pcity);
wipe_unit(pdiplomat);
return;
}
@@ -637,9 +615,6 @@
/* Record the theft. */
(pcity->steal)++;
- /* this may cause a diplomatic incident */
- maybe_cause_incident(DIPLOMAT_STEAL, pplayer, NULL, pcity);
-
/* Check if a spy survives her mission. Diplomats never do. */
diplomat_escape(pplayer, pdiplomat, pcity);
}
@@ -748,9 +723,6 @@
/* You get a technology advance, too! */
steal_a_tech (pplayer, cplayer, A_UNSET);
- /* this may cause a diplomatic incident */
- maybe_cause_incident(DIPLOMAT_INCITE, pplayer, NULL, pcity);
-
/* Transfer city and units supported by this city (that
are within one square of the city) to the new owner.
Remember that pcity is destroyed as part of the transfer,
@@ -992,9 +964,6 @@
/* Update clients. */
send_city_info(NULL, pcity);
- /* this may cause a diplomatic incident */
- maybe_cause_incident(DIPLOMAT_SABOTAGE, pplayer, NULL, pcity);
-
/* Check if a spy survives her mission. Diplomats never do. */
diplomat_escape(pplayer, pdiplomat, pcity);
}
@@ -1214,80 +1183,6 @@
}
/**************************************************************************
-...
-**************************************************************************/
-static void maybe_cause_incident(enum diplomat_actions action, struct player
*offender,
- struct unit *victim_unit, struct city
*victim_city)
-{
- struct player *victim_player = 0;
- struct tile *victim_tile = NULL;
-
- if (victim_city) {
- victim_tile = victim_city->tile;
- victim_player = city_owner(victim_city);
- } else if (victim_unit) {
- victim_tile = victim_unit->tile;
- victim_player = unit_owner(victim_unit);
- } else {
- die("No victim in call to maybe_cause_incident()");
- }
-
- if (!pplayers_at_war(offender, victim_player)) {
- switch (action) {
- case DIPLOMAT_BRIBE:
- notify_player(offender, victim_tile, E_DIPLOMATIC_INCIDENT,
- _("You have caused an incident while bribing "
- "%s's %s."),
- victim_player->name,
- unit_name(victim_unit->type));
- notify_player(victim_player, victim_tile, E_DIPLOMATIC_INCIDENT,
- _("%s has caused an incident while bribing "
- "your %s."),
- offender->name,
- unit_name(victim_unit->type));
- break;
- case DIPLOMAT_STEAL:
- notify_player(offender, victim_tile, E_DIPLOMATIC_INCIDENT,
- _("You have caused an incident while stealing "
- "tech from %s."),
- victim_player->name);
- notify_player(victim_player, victim_tile, E_DIPLOMATIC_INCIDENT,
- _("%s has caused an incident while stealing "
- "tech from you."),
- offender->name);
- break;
- case DIPLOMAT_INCITE:
- notify_player(offender, victim_tile, E_DIPLOMATIC_INCIDENT,
- _("You have caused an incident while inciting a "
- "revolt in %s."), victim_city->name);
- notify_player(victim_player, victim_tile, E_DIPLOMATIC_INCIDENT,
- _("%s have caused an incident while inciting a "
- "revolt in %s."), offender->name, victim_city->name);
- break;
- case DIPLOMAT_MOVE:
- case DIPLOMAT_EMBASSY:
- case DIPLOMAT_INVESTIGATE:
- case SPY_GET_SABOTAGE_LIST:
- return; /* These are not considered offences */
- case DIPLOMAT_ANY_ACTION:
- case SPY_POISON:
- case SPY_SABOTAGE_UNIT:
- case DIPLOMAT_SABOTAGE:
- /* You can only do these when you are at war, so we should never
- get inside this "if" */
- die("Bug in maybe_cause_incident()");
- }
- victim_player->diplstates[offender->player_no].has_reason_to_cancel = 2;
- ai_incident_diplomat(offender, victim_player);
- send_player_info(offender, NULL);
- send_player_info(victim_player, NULL);
- }
-
- return;
-}
-
-
-/**************************************************************************
calculate how expensive it is to bribe the unit
depends on distance to the capital, and government form
settlers are half price
Index: server/unithand.c
===================================================================
--- server/unithand.c (revision 11248)
+++ server/unithand.c (working copy)
@@ -993,13 +993,19 @@
return FALSE;
}
-
if (punit->moves_left<=0) {
notify_player(pplayer, punit->tile, E_BAD_COMMAND,
_("This unit has no moves left."));
return FALSE;
}
+ if (is_unit_prohibited_by_borders(punit, pdesttile)) {
+ notify_player(pplayer, punit->tile, E_BAD_COMMAND,
+ _("You are not allowed to enter the borders of %s."),
+ pplayer->name);
+ return FALSE;
+ }
+
/*** Phase 2: Special abilities checks ***/
/* Caravans. If city is allied (inc. ours) we would have a popup
Index: server/savegame.c
===================================================================
--- server/savegame.c (revision 11249)
+++ server/savegame.c (working copy)
@@ -2011,10 +2011,6 @@
plr->diplstates[i].turns_left =
secfile_lookup_int_default(file, -2,
"player%d.diplstate%d.turns_left", plrno, i);
- plr->diplstates[i].has_reason_to_cancel =
- secfile_lookup_int_default(file, 0,
- "player%d.diplstate%d.has_reason_to_cancel",
- plrno, i);
plr->diplstates[i].contact_turns_left =
secfile_lookup_int_default(file, 0,
"player%d.diplstate%d.contact_turns_left", plrno, i);
@@ -2027,9 +2023,6 @@
secfile_lookup_int_default(file, 0,
"player%d.diplstate%d.turns_left", plrno, i);
secfile_lookup_int_default(file, 0,
- "player%d.diplstate%d.has_reason_to_cancel",
- plrno, i);
- secfile_lookup_int_default(file, 0,
"player%d.diplstate%d.contact_turns_left", plrno, i);
}
@@ -2673,8 +2666,6 @@
"player%d.diplstate%d.first_contact_turn", plrno, i);
secfile_insert_int(file, plr->diplstates[i].turns_left,
"player%d.diplstate%d.turns_left", plrno, i);
- secfile_insert_int(file, plr->diplstates[i].has_reason_to_cancel,
- "player%d.diplstate%d.has_reason_to_cancel", plrno, i);
secfile_insert_int(file, plr->diplstates[i].contact_turns_left,
"player%d.diplstate%d.contact_turns_left", plrno, i);
}
Index: server/plrhand.c
===================================================================
--- server/plrhand.c (revision 11249)
+++ server/plrhand.c (working copy)
@@ -498,7 +498,6 @@
enum diplstate_type old_type;
enum diplstate_type new_type;
struct player *pplayer2;
- bool repeat = FALSE;
enum dipl_reason diplcheck;
if (!is_valid_player_id(other_player_id)) {
@@ -573,18 +572,11 @@
update_players_after_alliance_breakup(pplayer, pplayer2);
}
- /* if there's a reason to cancel the pact, do it without penalty */
- /* FIXME: in the current implementation if you break more than one
- * treaty simultaneously it may partially succed: the first treaty-breaking
- * will happen but the second one will fail. */
- if (get_player_bonus(pplayer, EFT_HAS_SENATE) > 0 && !repeat) {
- if (pplayer->diplstates[pplayer2->player_no].has_reason_to_cancel > 0) {
+ if (get_player_bonus(pplayer, EFT_HAS_SENATE) > 0) {
+ /* This can happen if, for instance, you have a wonder that
+ * allows immediate government change. */
+ if (new_type == DS_WAR) {
notify_player(pplayer, NULL, E_TREATY_BROKEN,
- _("The senate passes your bill because of the "
- "constant provocations of the %s."),
- get_nation_name_plural(pplayer2->nation));
- } else if (new_type == DS_WAR) {
- notify_player(pplayer, NULL, E_TREATY_BROKEN,
_("The senate refuses to break treaty with the %s, "
"but you have no trouble finding a new senate."),
get_nation_name_plural(pplayer2->nation));
@@ -593,7 +585,6 @@
if (new_type == DS_WAR) {
ai_incident_war(pplayer, pplayer2);
}
- pplayer->diplstates[pplayer2->player_no].has_reason_to_cancel = 0;
send_player_info(pplayer, NULL);
send_player_info(pplayer2, NULL);
@@ -643,7 +634,6 @@
_("%s has attacked your ally %s! "
"You cancel your alliance to the aggressor."),
pplayer->name, pplayer2->name);
- other->diplstates[pplayer->player_no].has_reason_to_cancel = 1;
handle_diplomacy_cancel_pact(pplayer, other->player_no,
CLAUSE_ALLIANCE);
} else {
@@ -944,7 +934,6 @@
packet->diplstates[i].turns_left = plr->diplstates[i].turns_left;
packet->diplstates[i].contact_turns_left =
plr->diplstates[i].contact_turns_left;
- packet->diplstates[i].has_reason_to_cancel =
plr->diplstates[i].has_reason_to_cancel;
}
} else {
packet->target_government = packet->government;
@@ -961,7 +950,6 @@
for (i = 0; i < MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS; i++) {
packet->diplstates[i].type = DS_WAR;
packet->diplstates[i].turns_left = 0;
- packet->diplstates[i].has_reason_to_cancel = 0;
packet->diplstates[i].contact_turns_left = 0;
}
/* We always know the player's relation to us */
@@ -972,8 +960,6 @@
packet->diplstates[p_no].turns_left = plr->diplstates[p_no].turns_left;
packet->diplstates[p_no].contact_turns_left =
plr->diplstates[p_no].contact_turns_left;
- packet->diplstates[p_no].has_reason_to_cancel =
- plr->diplstates[p_no].has_reason_to_cancel;
}
}
@@ -1463,10 +1449,8 @@
other_player->diplstates[cplayer->player_no].type = DS_NO_CONTACT;
}
- cplayer->diplstates[other_player->player_no].has_reason_to_cancel = 0;
cplayer->diplstates[other_player->player_no].turns_left = 0;
cplayer->diplstates[other_player->player_no].contact_turns_left = 0;
- other_player->diplstates[cplayer->player_no].has_reason_to_cancel = 0;
other_player->diplstates[cplayer->player_no].turns_left = 0;
other_player->diplstates[cplayer->player_no].contact_turns_left = 0;
Index: common/unit.c
===================================================================
--- common/unit.c (revision 11248)
+++ common/unit.c (working copy)
@@ -100,11 +100,13 @@
return pplayers_at_war(unit_owner(pdiplomat), city_owner(pcity));
if(action==DIPLOMAT_INVESTIGATE)
return TRUE;
- if (action == DIPLOMAT_STEAL && !is_barbarian(city_owner(pcity))) {
+ if (action == DIPLOMAT_STEAL
+ && !is_barbarian(city_owner(pcity))
+ && pplayers_at_war(unit_owner(pdiplomat), city_owner(pcity))) {
return TRUE;
}
if(action==DIPLOMAT_INCITE)
- return !pplayers_allied(city_owner(pcity), unit_owner(pdiplomat));
+ return pplayers_at_war(city_owner(pcity), unit_owner(pdiplomat));
if(action==DIPLOMAT_ANY_ACTION)
return TRUE;
if (action==SPY_GET_SABOTAGE_LIST && unit_flag(pdiplomat, F_SPY))
@@ -128,7 +130,7 @@
if ((action == DIPLOMAT_BRIBE || action == DIPLOMAT_ANY_ACTION)
&& unit_list_size(ptile->units) == 1) {
punit = unit_list_get(ptile->units, 0);
- if (!pplayers_allied(unit_owner(punit), unit_owner(pdiplomat))) {
+ if (pplayers_at_war(unit_owner(punit), unit_owner(pdiplomat))) {
return TRUE;
}
}
@@ -747,7 +749,14 @@
{
struct player *pplayer = unit_owner(punit);
struct terrain *pterrain = ptile->terrain;
+ enum diplstate_type ds;
+ if (ptile->owner && ptile->owner != punit->owner) {
+ ds = pplayer_get_diplstate(punit->owner, ptile->owner)->type;
+ } else {
+ ds = DS_WAR; /* Can do anything */
+ }
+
switch(activity) {
case ACTIVITY_IDLE:
case ACTIVITY_GOTO:
@@ -766,6 +775,7 @@
&& unit_flag(punit, F_SETTLERS)
&& !tile_has_special(ptile, S_ROAD)
&& pterrain->road_time != 0
+ && (ds == DS_WAR || ds == DS_ALLIANCE)
&& (!tile_has_special(ptile, S_RIVER)
|| player_knows_techs_with_flag(pplayer, TF_BRIDGE)));
@@ -778,6 +788,7 @@
&& !tile_has_special(ptile, S_MINE))
|| (ptile->terrain != pterrain->mining_result
&& pterrain->mining_result != T_NONE
+ && (ds == DS_WAR || ds == DS_ALLIANCE)
&& (!is_ocean(ptile->terrain)
|| is_ocean(pterrain->mining_result)
|| can_reclaim_ocean(ptile))
@@ -808,6 +819,7 @@
&& is_water_adjacent_to_tile(ptile))
|| (ptile->terrain != pterrain->irrigation_result
&& pterrain->irrigation_result != T_NONE
+ && (ds == DS_WAR || ds == DS_ALLIANCE)
&& (!is_ocean(ptile->terrain)
|| is_ocean(pterrain->irrigation_result)
|| can_reclaim_ocean(ptile))
@@ -840,12 +852,14 @@
&& !tile_get_city(ptile)
&& player_knows_techs_with_flag(pplayer, TF_FORTRESS)
&& !tile_has_special(ptile, S_FORTRESS)
+ && (ds == DS_WAR || ds == DS_ALLIANCE)
&& !is_ocean(ptile->terrain));
case ACTIVITY_AIRBASE:
return (unit_flag(punit, F_AIRBASE)
&& player_knows_techs_with_flag(pplayer, TF_AIRBASE)
&& !tile_has_special(ptile, S_AIRBASE)
+ && (ds == DS_WAR || ds == DS_ALLIANCE)
&& !is_ocean(ptile->terrain));
case ACTIVITY_SENTRY:
@@ -862,6 +876,7 @@
&& unit_flag(punit, F_SETTLERS)
&& tile_has_special(ptile, S_ROAD)
&& !tile_has_special(ptile, S_RAILROAD)
+ && (ds == DS_WAR || ds == DS_ALLIANCE)
&& player_knows_techs_with_flag(pplayer, TF_RAILROAD));
case ACTIVITY_PILLAGE:
@@ -873,6 +888,9 @@
bv_special psworking;
int i;
+ if (ds != DS_WAR && ptile->owner != punit->owner) {
+ return FALSE;
+ }
if (ptile->city && (target == S_ROAD || target == S_RAILROAD)) {
return FALSE;
}
@@ -908,6 +926,7 @@
return (terrain_control.may_transform
&& pterrain->transform_result != T_NONE
&& ptile->terrain != pterrain->transform_result
+ && (ptile->owner == punit->owner || ds == DS_WAR)
&& (!is_ocean(ptile->terrain)
|| is_ocean(pterrain->transform_result)
|| can_reclaim_ocean(ptile))
@@ -1657,3 +1676,33 @@
return result;
}
+
+/**************************************************************************
+ Is there a border to stop us from entering this tile?
+**************************************************************************/
+bool is_unit_prohibited_by_borders(const struct unit *punit,
+ const struct tile *ptile)
+{
+ enum diplstate_type ds;
+
+ if (ptile->owner && ptile->owner != punit->owner) {
+ ds = pplayer_get_diplstate(punit->owner, ptile->owner)->type;
+ } else {
+ return FALSE; /* No owner, or we own it. */
+ }
+
+ /* Acceptable to move between tiles owned by the same player */
+ if (punit->tile->owner == ptile->owner) {
+ return FALSE;
+ }
+
+ if (!is_military_unit(punit)) {
+ return FALSE;
+ }
+
+ if (ds == DS_WAR || ds == DS_ALLIANCE) {
+ return FALSE;
+ }
+
+ return TRUE; /* Prohibited */
+}
Index: common/unit.h
===================================================================
--- common/unit.h (revision 11248)
+++ common/unit.h (working copy)
@@ -340,4 +340,7 @@
enum unit_upgrade_result get_unit_upgrade_info(char *buf, size_t bufsz,
const struct unit *punit);
+bool is_unit_prohibited_by_borders(const struct unit *punit,
+ const struct tile *ptile);
+
#endif /* FC__UNIT_H */
Index: common/dataio.c
===================================================================
--- common/dataio.c (revision 11248)
+++ common/dataio.c (working copy)
@@ -702,7 +702,6 @@
dio_get_uint8(din, (int *) &pds->type);
dio_get_uint16(din, &pds->turns_left);
dio_get_uint16(din, &pds->contact_turns_left);
- dio_get_uint8(din, &pds->has_reason_to_cancel);
}
void dio_put_diplstate(struct data_out *dout,
@@ -711,7 +710,6 @@
dio_put_uint8(dout, pds->type);
dio_put_uint16(dout, pds->turns_left);
dio_put_uint16(dout, pds->contact_turns_left);
- dio_put_uint8(dout, pds->has_reason_to_cancel);
}
/**************************************************************************
Index: common/player.c
===================================================================
--- common/player.c (revision 11249)
+++ common/player.c (working copy)
@@ -53,8 +53,7 @@
&& ds == DS_ALLIANCE) {
return DIPL_ERROR;
}
- if (p1->diplstates[p2->player_no].has_reason_to_cancel == 0
- && ds != DS_TEAM
+ if (ds != DS_TEAM
&& get_player_bonus(p1, EFT_HAS_SENATE) > 0
&& get_player_bonus(p1, EFT_ANY_GOVERNMENT) == 0) {
return DIPL_SENATE_BLOCKING;
@@ -196,7 +195,6 @@
BV_CLR_ALL(plr->embassy);
for(i = 0; i < MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS; i++) {
plr->diplstates[i].type = DS_NO_CONTACT;
- plr->diplstates[i].has_reason_to_cancel = 0;
plr->diplstates[i].contact_turns_left = 0;
}
plr->city_style=0; /* should be first basic style */
@@ -777,7 +775,6 @@
const struct player_diplstate *pds2)
{
return (pds1->type == pds2->type && pds1->turns_left == pds2->turns_left
- && pds1->has_reason_to_cancel == pds2->has_reason_to_cancel
&& pds1->contact_turns_left == pds2->contact_turns_left);
}
Index: common/player.h
===================================================================
--- common/player.h (revision 11249)
+++ common/player.h (working copy)
@@ -139,7 +139,6 @@
enum diplstate_type max_state; /* maximum treaty level ever had */
int first_contact_turn; /* turn we had first contact with this player */
int turns_left; /* until pact (e.g., cease-fire) ends */
- int has_reason_to_cancel; /* 0: no, 1: this turn, 2: this or next turn */
int contact_turns_left; /* until contact ends */
};
Index: ai/aitools.c
===================================================================
--- ai/aitools.c (revision 11249)
+++ ai/aitools.c (working copy)
@@ -144,10 +144,6 @@
return TRUE;
}
- if (pplayer->diplstates[aplayer->player_no].has_reason_to_cancel > 0) {
- return TRUE;
- }
-
if (pplayer->ai.love[aplayer->player_no] < MAX_AI_LOVE / 10) {
/* We don't trust players who we don't like. Note that
* aplayer's units inside pplayer's borders decreases AI's love */
Index: ai/advdiplomacy.c
===================================================================
--- ai/advdiplomacy.c (revision 11249)
+++ ai/advdiplomacy.c (working copy)
@@ -728,8 +728,6 @@
* excuses we have to do so. FIXME: We only consider immediate
* allies, but we might trigger a wider chain reaction. */
players_iterate(eplayer) {
- bool cancel_excuse =
- pplayer->diplstates[eplayer->player_no].has_reason_to_cancel != 0;
enum diplstate_type ds = pplayer_get_diplstate(pplayer, eplayer)->type;
if (eplayer == pplayer || !eplayer->is_alive) {
@@ -737,7 +735,7 @@
}
/* Remember: pplayers_allied() returns true when target == eplayer */
- if (!cancel_excuse && pplayers_allied(target, eplayer)) {
+ if (pplayers_allied(target, eplayer)) {
if (ds == DS_ARMISTICE) {
want -= abs(want) / 10; /* 10% off */
} else if (ds == DS_CEASEFIRE) {
@@ -853,7 +851,6 @@
}
if ((pplayers_non_attack(pplayer, aplayer)
|| pplayers_allied(pplayer, aplayer))
- && pplayer->diplstates[a].has_reason_to_cancel == 0
&& adip->countdown == -1
&& !adip->is_allied_with_enemy
&& !adip->at_war_with_ally
@@ -875,15 +872,6 @@
amount -= ai->diplomacy.love_incr / 2;
pplayer->ai.love[aplayer->player_no] += amount;
DIPLO_LOG(LOG_DEBUG, pplayer, aplayer, "%d love lost to war", amount);
- } else if (pplayer->diplstates[a].has_reason_to_cancel != 0) {
- /* Provoked in time of peace */
- if (pplayer->ai.love[aplayer->player_no] > 0) {
- amount -= pplayer->ai.love[aplayer->player_no] / 2;
- }
- amount -= ai->diplomacy.love_incr * 6;
- pplayer->ai.love[aplayer->player_no] += amount;
- DIPLO_LOG(LOG_DEBUG, pplayer, aplayer, "Provoked! %d love lost!",
- amount);
}
if (pplayer->ai.love[aplayer->player_no] > MAX_AI_LOVE * 8 / 10
&& !pplayers_allied(pplayer, aplayer)) {
@@ -1066,11 +1054,6 @@
notify(target, _("*%s (AI)* Space will never be yours. "), pplayer->name);
adip->countdown = -10;
break;
- case WAR_REASON_BEHAVIOUR:
- notify(target, _("*%s (AI)* I have tolerated your vicious antics "
- "long enough! To war!"), pplayer->name);
- adip->countdown = -20;
- break;
case WAR_REASON_NONE:
notify(target, _("*%s (AI)* Peace in ... some other time."),
pplayer->name);
@@ -1082,11 +1065,6 @@
pplayer->name);
adip->countdown = -20;
break;
- case WAR_REASON_EXCUSE:
- notify(target, _("*%s (AI)* Your covert hostilities brought "
- "this war upon you!"), pplayer->name);
- adip->countdown = -20;
- break;
case WAR_REASON_ALLIANCE:
if (adip->at_war_with_ally) {
notify(target, _("*%s (AI)* Your aggression against %s was "
@@ -1172,13 +1150,6 @@
notify(ally, _("*%s (AI)* Your aid in this matter will be expected. "
"Long live our glorious alliance!"), pplayer->name);
break;
- case WAR_REASON_BEHAVIOUR:
- case WAR_REASON_EXCUSE:
- notify(ally, _("*%s (AI)* %s has grossly violated his treaties with us "
- "for own gain. We will answer in force in %d turns "
- "and expect you to honour your alliance with us and do "
- "likewise!"), pplayer->name, target->name, countdown);
- break;
case WAR_REASON_NONE:
notify(ally, _("*%s (AI)* We intend to pillage and plunder the rich "
"civilization of %s. We declare war in %d turns."),
@@ -1230,17 +1201,6 @@
return;
}
- /*** If we are greviously insulted, go to war immediately. ***/
-
- players_iterate(aplayer) {
- if (pplayer->ai.love[aplayer->player_no] < 0
- && pplayer->diplstates[aplayer->player_no].has_reason_to_cancel >= 2
- && ai->diplomacy.player_intel[aplayer->player_no].countdown == -1) {
- DIPLO_LOG(LOG_DIPL2, pplayer, aplayer, "Plans war in revenge");
- war_countdown(pplayer, aplayer, map.size, WAR_REASON_BEHAVIOUR);
- }
- } players_iterate_end;
-
/*** Stop other players from winning by space race ***/
if (ai->diplomacy.strategy != WIN_SPACE) {
@@ -1317,10 +1277,7 @@
if (pplayers_allied(pplayer, target)) {
DIPLO_LOG(LOG_DEBUG, pplayer, target, "Plans war against an ally!");
}
- if (pplayer->diplstates[target->player_no].has_reason_to_cancel > 0) {
- /* We have good reason */
- war_reason = WAR_REASON_EXCUSE;
- } if (pplayer->ai.love[target->player_no] < 0) {
+ if (pplayer->ai.love[target->player_no] < 0) {
/* We have a reason of sorts from way back, maybe? */
war_reason = WAR_REASON_HATRED;
} else {
@@ -1609,26 +1566,6 @@
}
/**********************************************************************
- Diplomat caused an incident.
-***********************************************************************/
-void ai_incident_diplomat(struct player *violator, struct player *victim)
-{
- players_iterate(pplayer) {
- if (!pplayer->ai.control) {
- continue;
- }
-
- if (pplayer != violator) {
- /* Dislike backstabbing bastards */
- pplayer->ai.love[violator->player_no] -= MAX_AI_LOVE / 100;
- if (victim == pplayer) {
- pplayer->ai.love[violator->player_no] -= MAX_AI_LOVE / 7;
- }
- }
- } players_iterate_end;
-}
-
-/**********************************************************************
War declared against a player. We apply a penalty because this
means he is seen as untrustworthy, especially if past relations
with the victim have been cordial (betrayal).
Index: ai/advdiplomacy.h
===================================================================
--- ai/advdiplomacy.h (revision 11249)
+++ ai/advdiplomacy.h (working copy)
@@ -21,8 +21,10 @@
struct ai_data;
enum war_reason {
- WAR_REASON_BEHAVIOUR, WAR_REASON_SPACE, WAR_REASON_EXCUSE,
- WAR_REASON_HATRED, WAR_REASON_ALLIANCE, WAR_REASON_NONE
+ WAR_REASON_SPACE,
+ WAR_REASON_HATRED,
+ WAR_REASON_ALLIANCE,
+ WAR_REASON_NONE
};
void ai_diplomacy_begin_new_phase(struct player *pplayer,
@@ -35,7 +37,6 @@
struct Treaty *ptreaty);
void ai_incident_war(struct player *violator, struct player *victim);
-void ai_incident_diplomat(struct player *violator, struct player *victim);
void ai_incident_nuclear(struct player *violator, struct player *victim);
void ai_incident_pillage(struct player *violator, struct player *victim);
Index: client/packhand.c
===================================================================
--- client/packhand.c (revision 11248)
+++ client/packhand.c (working copy)
@@ -1490,8 +1490,6 @@
pinfo->diplstates[i].turns_left;
pplayer->diplstates[i].contact_turns_left =
pinfo->diplstates[i].contact_turns_left;
- pplayer->diplstates[i].has_reason_to_cancel =
- pinfo->diplstates[i].has_reason_to_cancel;
}
pplayer->is_connected = pinfo->is_connected;
- [Freeciv-Dev] Re: (PR#14548) New treaties rules,
Per I. Mathisen <=
|
|