Project

General

Profile

Feature #2313 » 0091-Add-Contact_Length_Pct-effect-type.patch

Marko Lindqvist, 10/25/2026 05:49 AM

View differences:

ai/default/daieffects.c
case EFT_SHIELD2GOLD_PCT:
case EFT_ARMISTICE_LENGTH_PCT:
case EFT_CEASEFIRE_LENGTH_PCT:
case EFT_CONTACT_LENGTH_PCT:
break;
/* This has no effect for AI */
case EFT_VISIBLE_WALLS:
data/alien/effects.ruleset
type = "Ceasefire_Length_Pct"
value = 100
[effect_contact_len_pct]
type = "Contact_Length_Pct"
value = 100
[effect_mood_center]
type = "Make_Content"
value = 3
data/civ1/effects.ruleset
type = "Ceasefire_Length_Pct"
value = 100
[effect_contact_len_pct]
type = "Contact_Length_Pct"
value = 100
; Cities can always work tiles
[effect_tile_workable]
type = "Tile_Workable"
data/civ2/effects.ruleset
type = "Ceasefire_Length_Pct"
value = 100
[effect_contact_len_pct]
type = "Contact_Length_Pct"
value = 100
; Cities can always work tiles
[effect_tile_workable]
type = "Tile_Workable"
data/civ2civ3/effects.ruleset
type = "Ceasefire_Length_Pct"
value = 100
[effect_contact_len_pct]
type = "Contact_Length_Pct"
value = 100
; Cities can always work tiles
[effect_tile_workable]
type = "Tile_Workable"
data/classic/effects.ruleset
type = "Ceasefire_Length_Pct"
value = 100
[effect_contact_len_pct]
type = "Contact_Length_Pct"
value = 100
; Cities can always work tiles
[effect_tile_workable]
type = "Tile_Workable"
data/goldkeep/effects.ruleset
type = "Ceasefire_Length_Pct"
value = 100
[effect_contact_len_pct]
type = "Contact_Length_Pct"
value = 100
; Cities can always work tiles
[effect_tile_workable]
type = "Tile_Workable"
data/granularity/effects.ruleset
type = "Ceasefire_Length_Pct"
value = 100
[effect_contact_len_pct]
type = "Contact_Length_Pct"
value = 100
[effect_tile_land_workable]
type = "Tile_Workable"
value = 1
data/multiplayer/effects.ruleset
type = "Ceasefire_Length_Pct"
value = 100
[effect_contact_len_pct]
type = "Contact_Length_Pct"
value = 100
; Cities can always work tiles
[effect_tile_workable]
type = "Tile_Workable"
data/sandbox/effects.ruleset
; Modifying this file:
d; Modifying this file:
; You should not modify this file except to make bugfixes or
; for other "maintenance". If you want to make custom changes,
; you should create a new datadir subdirectory and copy this file
......
type = "Ceasefire_Length_Pct"
value = 100
[effect_contact_len_pct]
type = "Contact_Length_Pct"
value = 100
; Cities can always work tiles
[effect_tile_workable]
type = "Tile_Workable"
data/stub/effects.ruleset
type = "Ceasefire_Length_Pct"
value = 100
[effect_contact_len_pct]
type = "Contact_Length_Pct"
value = 100
; Cities can always work tiles
[effect_tile_workable]
type = "Tile_Workable"
doc/README.effects
Percent chance that a player conquering a city learns a tech from the
former owner.
Contact_Length_Pct
How long a contact remains active after player's units last met.
The effect is evaluated for both sides, and the shorter of
the times applies.
Culture_Pct
Percent change to culture, both to current performance and to
the accumulating history.
gen_headers/enums/effects_enums.def
TILE_CLAIMABLE "Tile_Claimable"
ARMISTICE_LENGTH_PCT "Armistice_Length_Pct"
CEASEFIRE_LENGTH_PCT "Ceasefire_Length_Pct"
CONTACT_LENGTH_PCT "Contact_Length_Pct"
USER_EFFECT_1 "User_Effect_1"
USER_EFFECT_2 "User_Effect_2"
USER_EFFECT_3 "User_Effect_3"
server/plrhand.c
if (get_player_bonus(pplayer1, EFT_NO_DIPLOMACY) <= 0
&& get_player_bonus(pplayer2, EFT_NO_DIPLOMACY) <= 0) {
ds_plr1plr2->contact_turns_left = game.server.contactturns;
ds_plr2plr1->contact_turns_left = game.server.contactturns;
int ct_1, ct_2;
int contact_turns;
if (game.server.contactturns == 0) {
contact_turns = 0;
} else {
ct_1 = get_target_bonus_effects(nullptr,
&(const struct req_context) {
.player = pplayer1,
},
&(const struct req_context) {
.player = pplayer2,
}, EFT_CONTACT_LENGTH_PCT);
ct_2 = get_target_bonus_effects(nullptr,
&(const struct req_context) {
.player = pplayer2,
},
&(const struct req_context) {
.player = pplayer1,
}, EFT_CONTACT_LENGTH_PCT);
contact_turns
= game.server.contactturns * MIN(ct_1, ct_2) / 100;
contact_turns = MAX(1, contact_turns);
}
ds_plr1plr2->contact_turns_left = contact_turns;
ds_plr2plr1->contact_turns_left = contact_turns;
}
if (ds_plr1plr2->type == DS_NO_CONTACT) {
enum diplstate_type new_state = get_default_diplstate(pplayer1,
server/ruleset/rscompat.c
/* Old behavior: Armistice and Ceasefire took full (!00%) time. */
effect_new(EFT_ARMISTICE_LENGTH_PCT, 100, nullptr);
effect_new(EFT_CEASEFIRE_LENGTH_PCT, 100, nullptr);
effect_new(EFT_CONTACT_LENGTH_PCT, 100, nullptr);
/* Make sure that all action enablers added or modified by the
* compatibility post processing fulfills all hard action requirements. */
server/ruleset/rssanity.c
{
EFT_ARMISTICE_LENGTH_PCT,
EFT_CEASEFIRE_LENGTH_PCT,
EFT_CONTACT_LENGTH_PCT,
EFT_COUNT
};
server/settings.c
N_("Turns until player contact is lost"),
N_("Players may meet for diplomacy this number of turns "
"after their units have last met, even when they do not have "
"an embassy. If set to zero, then players cannot meet unless "
"an embassy. This is a base value, which ruleset may adjust. "
"If set to zero, then players cannot meet unless "
"they have an embassy."),
nullptr, nullptr, nullptr,
GAME_MIN_CONTACTTURNS, GAME_MAX_CONTACTTURNS,
(1-1/2)