Restricted Infrastructure

Restricted Infrastructure, usually abbreviated as RestrictInfra, is a concept regulating movement over road types in Freeciv.
👉🏽 Restricted infra is transportation infrastructure on a tile that foreign units cannot use, if they are at war with the nation who owns the tile. If no nation owns the tile, then it's usable by all.
=== Road Types ===
In any Freeciv ruleset, some tile extras are road types. Road types are "transportation infrastructure" which have their own movement cost, generally much less than that of a tile's default movement cost for its given terrain type. Road types are not just roads -- they are any infrastructure that imparts a movement bonus over the terrain.
Examples of road types are:
* river
* road
* railroad
* maglev
* canal
* quay
* sea bridge
👉🏽 Road types can be either restricted infrastructure or unrestricted infrastructure.
=== RestrictInfra effect on move costs ===
If a tile has a road type that is RestrictInfra, it means that only units with some degree of peaceful relation to the tile's owner, can get move bonuses on the tile.
=== What determines whether a road type is restricted or unrestricted ===
There are two levels at which RestrictInfra can be specified and regulated:
# In the game settings, via the setting restrictinfra
#* In classical rulesets, if this setting is enabled, road types are only usable by those not at war with the tile's owner. "Friendly units" will get the move bonus, and other units will not. 
# In some advanced rulesets, each road type can be individually set to restricted or unrestricted infra. 
#* In such rulesets you will need to refer to the documentation for which types are restricted. (Typically railroads and some others.)
👉🏽 Because each game can have different rulesets and game settings, you will need to refer to the game settings and the ruleset documentation, to determine whether a road type in your game is RestrictInfra or not.
== Unrestricted Infrastructure ==
👉🏽 Unrestricted infra is transportation that any nation can use, regardless of whose territory it is.
A road type is unrestricted infrastructure by default, unless the game setting restrictinfra is enabled. If it's enabled, the road type may or may not be RestrictInfra, depending on how the ruleset is programmed. See this section for how game settings or the ruleset may specify this behavior.
== ReverseRestrictInfra flags ==
In some advanced rulesets, some road types may have the "ReverseRestrictInfra" flag. At this point, only some versions of the Freeciv server have implemented this flag.
RRI road types work in the opposite way of how standard RestrictInfra works: that is, units only access the move cost of a road when RestrictInfra is active for a unit. In other words, only non-allied units are charged the move cost for the road, whereas units allied to the tile's owner are not charged the move cost of the road. 
This property can have a variety of creative uses.
For example, a ruleset may implement a road type with a high move cost, where that high movement cost is only charged to unfriendly invader units. An example of this could be a road type such as a Trench, whose move cost is 100. Any non-allied unit moving onto a trench would be charged 100 move points if that road type is native to the unit type. Allied units and foreign units not native to that road type, would not be charged the extra move points to enter a tile with a ReverseRestrictInfra road type. 
Thus, one creative use of this flag is to allow ruleset designers to create "terrain obstacles" that slow enemy movement when the tile is entered by an unfriendly unit.
Examples of how ReverseRestrictInfra road types can be implemented:
* Terrain Walls
* Trenches
* Cheval de Frise
== HardExitRInfra and HardEntryRInfra flags ==
In some advanced rulesets, some road types may have the "HardExitRInfra" flag and/or the "HardEntryRInfra" flag. At this point, only some versions of the Freeciv server have implemented this flag.
These flags were created to make crossing a foreign river or foreign canal very difficult. For example, if a ruleset programs rivers to have both flags, entering a river tile would use up all moves, and exiting a river tile would use up all moves. Thus, two whole turns would be spent crossing the river, if both flags were on. If only one flag were on, one turn is lost when trying to cross a river. The movement penalty is only charged to units affected by RestrictInfra (not to allies, for example.)
=== HardExitRInfra ===
When exiting this road type to a tile which has no integrating road-type, a hard restrictinfra penalty is assessed which spends all remaining move points. Penalty not assessed if other road types provide transport at a lower cost. 
=== HardEntryRInfra ===
When entering this road type from a tile which has no integrating road type, a hard restrictinfra penalty is assessed which spends all remaining move points. Penalty not assessed if other road types provide transport at a lower cost.
== IMPORTANT VARIANTS IN IMPLEMENTATION ==
⭐️ Note: THERE ARE VARIATIONS in how different versions of Freeciv implement other details (FEB 2024):
* In most versions of Freeciv, such as freeciv.org, 
** Foreign civilian and military units can use restricted infra if they have Cease-Fire or better with the nation's infra owner. 
*** This allows a surprise invasion where military units use all your interior transportation infra, just prior to declaring war.
*** WARNING: Accepting Cease-Fire with any nation ipso facto grants a major military advantage against your nation.
* On other servers, such as freecivweb.org, foreign units can use restricted infra if they have Peace or better with the nation's infra owner. 
** Since Peace prohibits military units in foreign territory, this means:
*** Foreign civilian units may use foreign infra if at Peace.
*** Foreign military units may use foreign infra if in Alliance.