Project

Profile

Help

HostedRedmine.com has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. *Read more...*

Feature #750400 ยป action-base.patch

Sveinung Kvilhaugsvik, 2018-05-07 07:13 PM

View differences:

ai/default/aicity.c
case ACTION_FORTIFY:
case ACTION_ROAD:
case ACTION_CONVERT:
case ACTION_BASE:
case ACTION_COUNT:
fc_assert_msg(action_id_get_target_kind(action_id) == ATK_CITY,
"Action not aimed at cities");
client/packhand.c
case ACTION_MINE_TF:
case ACTION_PILLAGE:
case ACTION_ROAD:
case ACTION_BASE:
/* An interesting non attack action has been found. */
return ACTION_NONE;
break;
common/actions.c
action_new(ACTION_CONVERT, ATK_SELF,
FALSE, FALSE, TRUE, FALSE,
0, 0, FALSE);
actions[ACTION_BASE] =
action_new(ACTION_BASE, ATK_TILE,
FALSE, TRUE, TRUE, FALSE,
0, 0, FALSE);
}
/**********************************************************************//**
......
case ACTION_IRRIGATE_TF:
case ACTION_MINE_TF:
case ACTION_ROAD:
case ACTION_BASE:
if (!utype_has_flag(actor_unittype, UTYF_SETTLERS)) {
/* Reason: Must have "Settlers" flag. */
return FALSE;
......
case ACTION_PILLAGE:
case ACTION_FORTIFY:
case ACTION_ROAD:
case ACTION_BASE:
/* No hard unit type requirements. */
break;
......
}
break;
case ACTION_BASE:
if (target_extra == NULL) {
return TRI_NO;
}
if (!is_extra_caused_by(target_extra, EC_BASE)) {
/* Reason: This is not a base. */
return TRI_NO;
}
if (!can_build_base(actor_unit,
extra_base_get(target_extra), target_tile)) {
return TRI_NO;
}
break;
case ACTION_PILLAGE:
pterrain = tile_terrain(target_tile);
if (pterrain->pillage_time == 0) {
......
case ACTION_FORTIFY:
case ACTION_ROAD:
case ACTION_CONVERT:
case ACTION_BASE:
chance = ACTPROB_CERTAIN;
break;
case ACTION_COUNT:
......
case ACTION_CONVERT:
/* TRANS: _Convert Unit (100% chance of success). */
return N_("%sConvert Unit%s");
case ACTION_BASE:
/* TRANS: _Build Base (100% chance of success). */
return N_("%sBuild Base%s");
}
return NULL;
common/actions.h
#define SPECENUM_VALUE49NAME "Road"
#define SPECENUM_VALUE50 ACTION_CONVERT
#define SPECENUM_VALUE50NAME "Convert Unit"
#define SPECENUM_VALUE51 ACTION_BASE
#define SPECENUM_VALUE51NAME "Build Base"
#define SPECENUM_BITVECTOR bv_actions
/* Limited by what values num2char() can store in unit orders in
* savegames. */
common/unit.c
return FALSE;
case ACTIVITY_BASE:
if (target == NULL) {
return FALSE;
}
return can_build_base(punit, extra_base_get(target), ptile);
return is_action_enabled_unit_on_tile(ACTION_BASE,
punit, ptile, target);
case ACTIVITY_GEN_ROAD:
return is_action_enabled_unit_on_tile(ACTION_ROAD,
data/alien/game.ruleset
; /* TRANS: Build _Road (100% chance of success). */
ui_name_road = _("Build %sRoad%s")
; /* TRANS: _Build Base (100% chance of success). */
ui_name_build_base = _("%sBuild Base%s")
; Suppress automatic help text generation about what enables and/or
; disables the following actions.
;
......
"UnitFlag", "Settlers", "Local"
}
[actionenabler_base]
action = "Build Base"
actor_reqs =
{ "type", "name", "range"
"UnitFlag", "Settlers", "Local"
}
[borders]
; Base border radius from city.
radius_sq_city = 4
data/civ1/game.ruleset
; /* TRANS: Build _Road (100% chance of success). */
ui_name_road = _("Build %sRoad%s")
; /* TRANS: _Build Base (100% chance of success). */
ui_name_build_base = _("%sBuild Base%s")
; Suppress automatic help text generation about what enables and/or
; disables the following actions.
;
......
"UnitFlag", "Settlers", "Local"
}
[actionenabler_base]
action = "Build Base"
actor_reqs =
{ "type", "name", "range"
"UnitFlag", "Settlers", "Local"
}
[borders]
; Base border radius from city.
radius_sq_city = 17
data/civ2/game.ruleset
; /* TRANS: Build _Road (100% chance of success). */
ui_name_road = _("Build %sRoad%s")
; /* TRANS: _Build Base (100% chance of success). */
ui_name_build_base = _("%sBuild Base%s")
; Suppress automatic help text generation about what enables and/or
; disables the following actions.
;
......
"UnitFlag", "Settlers", "Local"
}
[actionenabler_base]
action = "Build Base"
actor_reqs =
{ "type", "name", "range"
"UnitFlag", "Settlers", "Local"
}
[borders]
; Base border radius from city.
radius_sq_city = 17
data/civ2civ3/game.ruleset
; /* TRANS: Build _Road (100% chance of success). */
ui_name_road = _("Build %sRoad%s")
; /* TRANS: _Build Base (100% chance of success). */
ui_name_build_base = _("%sBuild Base%s")
; Suppress automatic help text generation about what enables and/or
; disables the following actions.
;
......
"UnitFlag", "Settlers", "Local"
}
[actionenabler_base]
action = "Build Base"
actor_reqs =
{ "type", "name", "range"
"UnitFlag", "Settlers", "Local"
}
[borders]
; Base border radius from city.
radius_sq_city = 5
data/classic/game.ruleset
; /* TRANS: Build _Road (100% chance of success). */
ui_name_road = _("Build %sRoad%s")
; /* TRANS: _Build Base (100% chance of success). */
ui_name_build_base = _("%sBuild Base%s")
; Suppress automatic help text generation about what enables and/or
; disables the following actions.
;
......
"UnitFlag", "Settlers", "Local"
}
[actionenabler_base]
action = "Build Base"
actor_reqs =
{ "type", "name", "range"
"UnitFlag", "Settlers", "Local"
}
[borders]
; Base border radius from city.
radius_sq_city = 17
data/experimental/game.ruleset
; /* TRANS: Build _Road (100% chance of success). */
ui_name_road = _("Build %sRoad%s")
; /* TRANS: _Build Base (100% chance of success). */
ui_name_build_base = _("%sBuild Base%s")
; Suppress automatic help text generation about what enables and/or
; disables the following actions.
;
......
"UnitFlag", "Settlers", "Local"
}
[actionenabler_base]
action = "Build Base"
actor_reqs =
{ "type", "name", "range"
"UnitFlag", "Settlers", "Local"
}
[borders]
; Base border radius from city.
radius_sq_city = 17
data/multiplayer/game.ruleset
; /* TRANS: Build _Road (100% chance of success). */
ui_name_road = _("Build %sRoad%s")
; /* TRANS: _Build Base (100% chance of success). */
ui_name_build_base = _("%sBuild Base%s")
; Suppress automatic help text generation about what enables and/or
; disables the following actions.
;
......
"UnitFlag", "Settlers", "Local"
}
[actionenabler_base]
action = "Build Base"
actor_reqs =
{ "type", "name", "range"
"UnitFlag", "Settlers", "Local"
}
[borders]
; Base border radius from city.
radius_sq_city = 17
data/sandbox/game.ruleset
; /* TRANS: Build _Road (100% chance of success). */
ui_name_road = _("Build %sRoad%s")
; /* TRANS: _Build Base (100% chance of success). */
ui_name_build_base = _("%sBuild Base%s")
; Suppress automatic help text generation about what enables and/or
; disables the following actions.
;
......
"UnitFlag", "Settlers", "Local"
}
[actionenabler_base]
action = "Build Base"
actor_reqs =
{ "type", "name", "range"
"UnitFlag", "Settlers", "Local"
}
[borders]
; Base border radius from city.
radius_sq_city = 5
data/webperimental/game.ruleset
; /* TRANS: Build _Road (100% chance of success). */
ui_name_road = _("Build %sRoad%s")
; /* TRANS: _Build Base (100% chance of success). */
ui_name_build_base = _("%sBuild Base%s")
; Suppress automatic help text generation about what enables and/or
; disables the following actions.
;
......
"UnitFlag", "Settlers", "Local"
}
[actionenabler_base]
action = "Build Base"
actor_reqs =
{ "type", "name", "range"
"UnitFlag", "Settlers", "Local"
}
[borders]
; Base border radius from city.
radius_sq_city = 17
doc/README.actions
* the actor unit has "CanPillage" unit class flag
* terrain type must be one where pillaging is possible
"Build Base" - Build base at the target tile.
* UI name can be set using ui_name_build_base
* the actor unit has the "Settlers" unit type flag
* the target tile can't have an extra that the target extra must bridge
over (see extra type's bridged_over) unless the actor player knows a
tech with the "Bridge" tech flag
* the target extra (the extra to be built) is an base
* the target tile doesn't already have the target extra
* the target extra is buildable (see extra type's buildable)
* the target tile's terrain's base_time isn't 0
* the target extra can't claim land (see base type's border_sq) if the
target tile has a city
* if the target extra is both a road and a base the target tile's terrain's
road_time isn't 0
* the build requirements of the target extra (see extra type's reqs) must
be fulfilled
Actions done by a unit to it self
=================================
"Disband Unit" - Disband the unit.
server/advisors/advdata.c
case ACTION_HEAL_UNIT:
case ACTION_ROAD:
case ACTION_CONVERT:
case ACTION_BASE:
/* Could be good. An embassy gives permanent contact. A trade
* route gives gold per turn. Join city gives population. Help
* wonder gives shields. */
server/rscompat.c
enabler->action = ACTION_CONVERT;
action_enabler_add(enabler);
enabler = action_enabler_new();
enabler->action = ACTION_BASE;
e_req = req_from_values(VUT_UTFLAG, REQ_RANGE_LOCAL, FALSE, TRUE, FALSE,
UTYF_SETTLERS);
requirement_vector_append(&enabler->actor_reqs, e_req);
action_enabler_add(enabler);
/* Update action enablers. */
action_enablers_iterate(ae) {
if (action_enabler_obligatory_reqs_missing(ae)) {
server/ruleset.c
load_action_ui_name(file, ACTION_FORTIFY, "ui_name_fortify");
load_action_ui_name(file, ACTION_ROAD, "ui_name_road");
load_action_ui_name(file, ACTION_CONVERT, "ui_name_convert_unit");
load_action_ui_name(file, ACTION_BASE, "ui_name_build_base");
/* The quiet (don't auto generate help for) property of all actions
* live in a single enum vector. This avoids generic action
server/savegame3.c
break;
case ACTION_PILLAGE:
case ACTION_ROAD:
case ACTION_BASE:
/* Target is a tile, has also extra target */
order->target = order_tgt;
order->extra = order_extra;
server/unithand.c
case ACTION_FORTIFY:
case ACTION_CONVERT:
case ACTION_ROAD:
case ACTION_BASE:
/* No special help. */
break;
case ACTION_COUNT:
......
ACTIVITY_GEN_ROAD,
&target_extra));
break;
case ACTION_BASE:
ACTION_STARTED_UNIT_TILE(action_type, actor_unit, target_tile,
unit_activity_handling_targeted(actor_unit,
ACTIVITY_BASE,
&target_extra));
break;
case ACTION_COUNT:
log_error("handle_unit_do_action() %s (%d) ordered to perform an "
"invalid action.",
......
case ACTION_FORTIFY:
case ACTION_ROAD:
case ACTION_CONVERT:
case ACTION_BASE:
/* No validation required. */
break;
/* Invalid action. Should have been caught above. */
tools/ruleutil/rulesave.c
"ui_name_road");
save_action_ui_name(sfile, ACTION_CONVERT,
"ui_name_convert_unit");
save_action_ui_name(sfile, ACTION_BASE,
"ui_name_build_base");
i = 0;
action_iterate(act) {
    (1-1/1)