Project

General

Profile

Feature #839 » 0031-Unhardcode-wld.map-from-action_speculate_unit_on_cit.patch

main - Marko Lindqvist, 09/08/2024 12:59 PM

View differences:

common/actions.c
performing the chosen action on the target city given the specified
game state changes.
**************************************************************************/
struct act_prob action_speculate_unit_on_city(const action_id act_id,
struct act_prob action_speculate_unit_on_city(const struct civ_map *nmap,
const action_id act_id,
const struct unit *actor,
const struct city *actor_home,
const struct tile *actor_tile,
......
* current position rather than on actor_tile. Maybe this function should
* return ACTPROB_NOT_IMPLEMENTED when one of those is detected and no
* other requirement makes the action ACTPROB_IMPOSSIBLE? */
const struct civ_map *nmap = &(wld.map);
if (omniscient_cheat) {
if (is_action_enabled_unit_on_city_full(nmap, act_id,
common/actions.h
const struct extra_type *sub_tgt);
struct act_prob
action_speculate_unit_on_city(action_id act_id,
action_speculate_unit_on_city(const struct civ_map *nmap,
action_id act_id,
const struct unit *actor,
const struct city *actor_home,
const struct tile *actor_tile,
common/aicore/caravan.c
bool consider_trade;
bool consider_windfall;
struct goods_type *pgood;
const struct civ_map *nmap = &(wld.map);
/* if no foreign trade is allowed, just quit. */
if (!does_foreign_trade_param_allow(parameter, pplayer_src, pplayer_dest)) {
......
consider_wonder = parameter->consider_wonders
&& action_prob_possible(
action_speculate_unit_on_city(ACTION_HELP_WONDER,
action_speculate_unit_on_city(nmap, ACTION_HELP_WONDER,
caravan, src, city_tile(dest),
TRUE, dest));
consider_trade = parameter->consider_trade
&& action_prob_possible(
action_speculate_unit_on_city(ACTION_TRADE_ROUTE,
action_speculate_unit_on_city(nmap, ACTION_TRADE_ROUTE,
caravan, src, city_tile(dest),
TRUE, dest));
consider_windfall = parameter->consider_windfall
&& action_prob_possible(
action_speculate_unit_on_city(ACTION_MARKETPLACE,
action_speculate_unit_on_city(nmap, ACTION_MARKETPLACE,
caravan, src, city_tile(dest),
TRUE, dest));
server/advisors/autoworkers.c
struct extra_type *target,
const struct tile *ptile)
{
const struct civ_map *nmap = &(wld.map);
action_by_activity_iterate(paction, activity) {
if (action_get_actor_kind(paction) != AAK_UNIT) {
/* Not relevant. */
......
switch (action_get_target_kind(paction)) {
case ATK_CITY:
return action_prob_possible(action_speculate_unit_on_city(
paction->id,
nmap, paction->id,
punit, unit_home(punit), ptile,
omniscient_cheat,
tile_city(ptile)));
(1-1/2)