99 struct city *pcity,
struct tile *ptile,
100 int cindex,
struct unit_list *units,
107 bool potential_worst_worked =
FALSE;
117 && orig_value < state->worst_worked) {
120 potential_worst_worked =
TRUE;
124 bool consider =
TRUE;
125 bool possible =
FALSE;
127 enum extra_cause cause;
128 enum extra_rmcause rmcause;
169 if ((value - orig_value) *
TWMP > worked->
want) {
170 worked->
want =
TWMP * (value - orig_value);
171 worked->
ptile = ptile;
190 potential_worst_worked =
FALSE;
195 if (value > orig_value && value > state->
uw_max) {
198 unworked->
want =
TWMP * (value - orig_value);
199 unworked->
ptile = ptile;
201 unworked->
tgt = NULL;
220 struct action *paction = NULL;
257 if (paction != NULL) {
261 bool consider =
TRUE;
288 int mc_multiplier = 1;
315 mc_multiplier += old_move_cost;
328 value = base_value + extra;
331 if ((value - orig_value) *
TWMP > worked->
want) {
332 worked->
want =
TWMP * (value - orig_value);
333 worked->
ptile = ptile;
352 potential_worst_worked =
FALSE;
357 if (value > orig_value && value > state->
uw_max) {
360 unworked->
want =
TWMP * (value - orig_value);
361 unworked->
ptile = ptile;
382 if (potential_worst_worked) {
397 struct worker_task worked = { .
ptile = NULL, .want = 0, .act = ACTIVITY_IDLE, .tgt = NULL };
398 struct worker_task unworked = { .
ptile = NULL, .want = 0, .act = ACTIVITY_IDLE, .tgt = NULL };
400 .orig_worst_worked = 0, .old_worst_worked =
FC_INFINITY };
401 struct unit_list *units = NULL;
406 units = pplayer->
units;
410 units = unit_list_new();
426 if (worked.
ptile == NULL
433 selected = &unworked;
442 unit_list_destroy(units);
445 if (selected->
ptile != NULL) {
448 if (selected->
tgt == NULL) {
461 target = selected->
tgt;
465 task->
act = selected->
act;
492 worker_task_list_append(pcity->
task_reqs, ptask);
495 log_debug(
"%s storing req for act %d at (%d,%d)",
bool action_prob_possible(const struct act_prob probability)
enum unit_activity actres_get_activity(enum action_result result)
struct act_prob action_speculate_unit_on_tile(const struct civ_map *nmap, action_id act_id, const struct unit *actor, const struct city *actor_home, const struct tile *actor_tile, bool omniscient_cheat, const struct tile *target_tile, const struct extra_type *target_extra)
enum action_target_kind action_get_target_kind(const struct action *paction)
static struct action * action_by_number(action_id act_id)
#define action_id_get_activity(act_id)
adv_want adv_settlers_road_bonus(const struct civ_map *nmap, struct tile *ptile, struct road_type *proad)
#define as_transform_action_iterate_end
#define as_rmextra_action_iterate(_act_)
#define as_rmextra_action_iterate_end
#define as_extra_action_iterate_end
#define as_extra_action_iterate(_act_)
#define as_transform_action_iterate(_act_)
int city_map_radius_sq_get(const struct city *pcity)
bool can_city_build_unit_now(const struct civ_map *nmap, const struct city *pcity, const struct unit_type *punittype)
bool city_can_work_tile(const struct city *pcity, const struct tile *ptile)
#define city_tile(_pcity_)
#define city_tile_iterate_index(_nmap, _radius_sq, _city_tile, _tile, _index)
#define city_owner(_pcity_)
#define city_tile_iterate_end
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit * punit
struct city * game_city_by_number(int id)
adv_want adv_city_worker_act_get(const struct city *pcity, int city_tile_index, enum unit_activity act_id)
int adv_city_worker_extra_get(const struct city *pcity, int city_tile_index, const struct extra_type *pextra)
int adv_city_worker_rmextra_get(const struct city *pcity, int city_tile_index, const struct extra_type *pextra)
adv_want city_tile_value(const struct city *pcity, const struct tile *ptile, int foodneed, int prodneed)
#define fc_assert_action(condition, action)
#define log_debug(message,...)
struct terrain_misc terrain_control
bool road_provides_move_bonus(const struct road_type *proad)
enum action_result result
struct worker_task_list * task_reqs
enum unit_activity activity
void tai_city_worker_requests_create(struct ai_type *ait, struct player *pplayer, struct city *pcity)
static int dummy_wants[U_LAST]
void tai_req_worker_task_rcv(struct tai_req *req)
tai_worker_task_limitation
static bool tai_city_worker_task_select(struct ai_type *ait, struct player *pplayer, struct city *pcity, struct worker_task *task, enum tai_worker_task_limitation limit)
static void tai_tile_worker_task_select(struct player *pplayer, struct city *pcity, struct tile *ptile, int cindex, struct unit_list *units, struct worker_task *worked, struct worker_task *unworked, struct tai_tile_state *state, enum tai_worker_task_limitation limit)
void tai_send_req(enum taireqtype type, struct player *pplayer, void *data)
#define tile_worked(_tile)
#define tile_terrain(_tile)
#define tile_has_extra(ptile, pextra)
struct unit * unit_virtual_create(struct player *pplayer, struct city *pcity, const struct unit_type *punittype, int veteran_level)
void unit_virtual_destroy(struct unit *punit)
#define unit_list_iterate(unitlist, punit)
#define unit_list_iterate_end
const struct unit_type * unit_type_get(const struct unit *punit)
bool unit_has_type_flag(const struct unit *punit, enum unit_type_flag_id flag)
Unit_type_id utype_index(const struct unit_type *punittype)
#define unit_type_iterate(_p)
#define unit_type_iterate_end
void worker_task_init(struct worker_task *ptask)