Freeciv21
Develop your civilization from humble roots to a global empire
autosettlers.h
Go to the documentation of this file.
1 /*__ ___ ***************************************
2 / \ / \ Copyright (c) 1996-2020 Freeciv21 and Freeciv
3 \_ \ / __/ contributors. This file is part of Freeciv21.
4  _\ \ / /__ Freeciv21 is free software: you can redistribute it
5  \___ \____/ __/ and/or modify it under the terms of the GNU General
6  \_ _/ Public License as published by the Free Software
7  | @ @ \_ Foundation, either version 3 of the License,
8  | or (at your option) any later version.
9  _/ /\ You should have received a copy of the GNU
10  /o) (o/\ \_ General Public License along with Freeciv21.
11  \_____/ / If not, see https://www.gnu.org/licenses/.
12  \____/ ********************************************************/
13 #pragma once
14 
15 // common
16 #include "fc_types.h"
17 #include "map.h"
18 
20 
21 struct settlermap;
22 class PFPath;
23 
24 void adv_settlers_free();
25 
26 void auto_settlers_player(struct player *pplayer);
27 
28 void auto_settler_findwork(struct player *pplayer, struct unit *punit,
29  struct settlermap *state, int recursion);
30 
31 bool auto_settler_setup_work(struct player *pplayer, struct unit *punit,
32  struct settlermap *state, int recursion,
33  PFPath *path, struct tile *best_tile,
34  enum unit_activity best_act,
35  struct extra_type **best_target,
36  int completion_time);
37 
38 adv_want settler_evaluate_improvements(unit *punit, unit_activity *best_act,
39  extra_type **best_target,
40  tile **best_tile, PFPath *path,
41  settlermap *state);
42 
43 struct city *settler_evaluate_city_requests(struct unit *punit,
44  struct worker_task **best_task,
45  PFPath *path,
46  struct settlermap *state);
47 
48 void adv_unit_new_task(struct unit *punit, enum adv_unit_task task,
49  struct tile *ptile);
50 
51 bool adv_settler_safe_tile(const struct player *pplayer, struct unit *punit,
52  struct tile *ptile);
53 
55  struct road_type *proad);
56 
57 bool auto_settlers_speculate_can_act_at(const struct unit *punit,
58  enum unit_activity activity,
59  bool omniscient_cheat,
60  struct extra_type *target,
61  const struct tile *ptile);
62 
64 
65 #define as_transform_action_iterate(_act_) \
66  { \
67  action_list_iterate(as_actions_transform, _act_)
68 
69 #define as_transform_action_iterate_end \
70  action_list_iterate_end \
71  }
72 
74 
75 #define as_extra_action_iterate(_act_) \
76  { \
77  action_list_iterate(as_actions_extra, _act_)
78 
79 #define as_extra_action_iterate_end \
80  action_list_iterate_end \
81  }
82 
84 
85 #define as_rmextra_action_iterate(_act_) \
86  { \
87  action_list_iterate(as_actions_rmextra, _act_)
88 
89 #define as_rmextra_action_iterate_end \
90  action_list_iterate_end \
91  }
#define MAX_NUM_ACTIONS
Definition: actions.h:223
bool adv_settler_safe_tile(const struct player *pplayer, struct unit *punit, struct tile *ptile)
Do we consider tile safe for autosettler to work?
action_id as_actions_rmextra[MAX_NUM_ACTIONS]
void adv_unit_new_task(struct unit *punit, enum adv_unit_task task, struct tile *ptile)
Change unit's advisor task.
action_id as_actions_transform[MAX_NUM_ACTIONS]
bool auto_settler_setup_work(struct player *pplayer, struct unit *punit, struct settlermap *state, int recursion, PFPath *path, struct tile *best_tile, enum unit_activity best_act, struct extra_type **best_target, int completion_time)
Setup our settler to do the work it has found.
adv_want adv_settlers_road_bonus(struct tile *ptile, struct road_type *proad)
Calculate the attractiveness of building a road/rail at the given tile.
void auto_settler_findwork(struct player *pplayer, struct unit *punit, struct settlermap *state, int recursion)
Find some work for our settlers and/or workers.
void auto_settlers_player(struct player *pplayer)
Run through all the players settlers and let those on ai.control work automagically.
void auto_settlers_ruleset_init()
Initialize auto settlers based on the ruleset.
action_id as_actions_extra[MAX_NUM_ACTIONS]
struct city * settler_evaluate_city_requests(struct unit *punit, struct worker_task **best_task, PFPath *path, struct settlermap *state)
Return best city request to fulfill.
void adv_settlers_free()
Free resources allocated for autosettlers system.
adv_want settler_evaluate_improvements(unit *punit, unit_activity *best_act, extra_type **best_target, tile **best_tile, PFPath *path, settlermap *state)
Finds tiles to improve, using punit.
bool auto_settlers_speculate_can_act_at(const struct unit *punit, enum unit_activity activity, bool omniscient_cheat, struct extra_type *target, const struct tile *ptile)
Returns TRUE iff the unit can do the targeted activity at the given location.
float adv_want
Definition: fc_types.h:1144
adv_unit_task
Definition: fc_types.h:287
int action_id
Definition: fc_types.h:306
static int recursion[AIT_LAST]
Definition: srv_log.cpp:35
Definition: city.h:291
Definition: player.h:231
Definition: road.h:54
Definition: tile.h:42
Definition: unit.h:134