Project

General

Profile

Feature #1470 ยป 0092-Add-internal-city-action-type-Finish-Building.patch

Marko Lindqvist, 05/29/2025 03:32 AM

View differences:

common/actions.c
actions[ACTION_FINISH_UNIT] =
city_action_new(ACTION_FINISH_UNIT, ACTRES_ENABLER_CHECK);
actions[ACTION_FINISH_BUILDING] =
city_action_new(ACTION_FINISH_BUILDING, ACTRES_ENABLER_CHECK);
/* The structure even for these need to be created, for
* the action_id_rule_name() to work on iterations. */
......
case ACTION_ESCAPE:
case ACTION_CIVIL_WAR:
case ACTION_FINISH_UNIT:
case ACTION_FINISH_BUILDING:
fc_assert(!action_id_is_internal(act)); /* Fail always */
break;
case ACTION_COUNT:
......
case ACTION_CIVIL_WAR:
return N_("%sCivil War%s");
case ACTION_FINISH_UNIT:
return N_("%sFinish Unit%s");
return N_("Finish %sUnit%s");
case ACTION_FINISH_BUILDING:
return N_("Finish %sUnit%s");
case ACTION_COUNT:
fc_assert(act != ACTION_COUNT);
break;
......
case ACTION_ESCAPE:
case ACTION_CIVIL_WAR:
case ACTION_FINISH_UNIT:
case ACTION_FINISH_BUILDING:
/* Min range is not ruleset changeable */
return NULL;
case ACTION_NUKE:
......
case ACTION_ESCAPE:
case ACTION_CIVIL_WAR:
case ACTION_FINISH_UNIT:
case ACTION_FINISH_BUILDING:
/* Max range is not ruleset changeable */
return NULL;
case ACTION_HELP_WONDER:
......
case ACTION_ESCAPE:
case ACTION_CIVIL_WAR:
case ACTION_FINISH_UNIT:
case ACTION_FINISH_BUILDING:
/* Target kind is not ruleset changeable */
return NULL;
case ACTION_NUKE:
......
case ACTION_ESCAPE:
case ACTION_CIVIL_WAR:
case ACTION_FINISH_UNIT:
case ACTION_FINISH_BUILDING:
/* Actor consuming always is not ruleset changeable */
return NULL;
case ACTION_FOUND_CITY:
......
case ACTION_GAIN_VETERANCY:
case ACTION_CIVIL_WAR:
case ACTION_FINISH_UNIT:
case ACTION_FINISH_BUILDING:
case ACTION_ESCAPE:
case ACTION_USER_ACTION1:
case ACTION_USER_ACTION2:
......
case ACTION_ESCAPE:
case ACTION_CIVIL_WAR:
case ACTION_FINISH_UNIT:
case ACTION_FINISH_BUILDING:
case ACTION_USER_ACTION1:
case ACTION_USER_ACTION2:
case ACTION_USER_ACTION3:
data/alien/actions.ruleset
actor_reqs =
{ "type", "name", "range", "present"
}
[enabler_finish_building]
action = "Finish Building"
actor_reqs =
{ "type", "name", "range", "present"
}
data/civ1/actions.ruleset
actor_reqs =
{ "type", "name", "range", "present"
}
[enabler_finish_building]
action = "Finish Building"
actor_reqs =
{ "type", "name", "range", "present"
}
data/civ2/actions.ruleset
actor_reqs =
{ "type", "name", "range", "present"
}
[enabler_finish_building]
action = "Finish Building"
actor_reqs =
{ "type", "name", "range", "present"
}
data/civ2civ3/actions.ruleset
actor_reqs =
{ "type", "name", "range", "present"
}
[enabler_finish_building]
action = "Finish Building"
actor_reqs =
{ "type", "name", "range", "present"
}
data/classic/actions.ruleset
actor_reqs =
{ "type", "name", "range", "present"
}
[enabler_finish_building]
action = "Finish Building"
actor_reqs =
{ "type", "name", "range", "present"
}
data/goldkeep/actions.ruleset
actor_reqs =
{ "type", "name", "range", "present"
}
[enabler_finish_building]
action = "Finish Building"
actor_reqs =
{ "type", "name", "range", "present"
}
data/granularity/actions.ruleset
actor_reqs =
{ "type", "name", "range", "present"
}
[enabler_finish_building]
action = "Finish Building"
actor_reqs =
{ "type", "name", "range", "present"
}
data/multiplayer/actions.ruleset
actor_reqs =
{ "type", "name", "range", "present"
}
[enabler_finish_building]
action = "Finish Building"
actor_reqs =
{ "type", "name", "range", "present"
}
data/sandbox/actions.ruleset
actor_reqs =
{ "type", "name", "range", "present"
}
[enabler_finish_building]
action = "Finish Building"
actor_reqs =
{ "type", "name", "range", "present"
}
data/webperimental/actions.ruleset
actor_reqs =
{ "type", "name", "range", "present"
}
[enabler_finish_building]
action = "Finish Building"
actor_reqs =
{ "type", "name", "range", "present"
}
doc/README.actions
"Finish Unit" - city can finish building a unit
"Finish Building" - city can finish building a building
Ruleset defined actions
=======================
User actions are "blank". The ruleset does everything they do. The following
gen_headers/enums/actions_enums.def
ACTION_ESCAPE "Escape"
ACTION_CIVIL_WAR "Civil War"
ACTION_FINISH_UNIT "Finish Unit"
ACTION_FINISH_BUILDING "Finish Building"
# User actions
ACTION_USER_ACTION1 "User Action 1"
server/cityturn.c
int mod;
const struct impr_type *pimprove;
int saved_id = pcity->id;
const struct civ_map *nmap = &(wld.map);
if (is_convert_improvement(pcity->production.value.building)) {
/* Coinage-like improvements that convert production */
......
"unavailable");
return TRUE;
}
if (pcity->shield_stock >= impr_build_shield_cost(pcity, pimprove)) {
if (pcity->shield_stock >= impr_build_shield_cost(pcity, pimprove)
&& is_action_enabled_city(nmap, ACTION_FINISH_BUILDING, pcity)) {
int cost;
if (is_small_wonder(pimprove)) {
server/ruleset/rscompat.c
enabler->action = ACTION_FINISH_UNIT;
action_enabler_add(enabler);
enabler = action_enabler_new();
enabler->action = ACTION_FINISH_BUILDING;
action_enabler_add(enabler);
/* Upgrade existing effects. Done before new effects are added to prevent
* the new effects from being upgraded by accident. */
iterate_effect_cache(effect_list_compat_cb, info);
    (1-1/1)