28 if (punit->id == unit_id) {
48 const struct unit *
const *ub)
50 return (*ua)->server.ord_map - (*ub)->server.ord_map;
59 const struct unit *
const *ub)
61 return (*ua)->server.ord_city - (*ub)->server.ord_city;
90 bool(can_fn)(
const struct unit *punit))
92 for (
const auto punit : units) {
111 for (
const auto punit : units) {
127 for (
const auto punit : units) {
141 for (
const auto punit : units) {
160 enum base_gui_type base_gui)
162 for (
const auto punit : units) {
182 enum unit_type_flag_id flag,
bool has_flag)
184 for (
const auto punit : units) {
202 for (
const auto punit : units) {
221 for (
const auto punit : units) {
235 for (
const auto punit : units) {
249 for (
const auto punit : units) {
263 for (
const auto punit : units) {
279 enum unit_activity activity)
281 for (
const auto punit : units) {
296 for (
const auto punit : units) {
310 for (
const auto punit : units) {
323 for (
const auto punit : units) {
334 struct tile *ptile =
nullptr;
336 for (
const auto punit :
units) {
340 if (punit->tile != ptile) {
struct base_type * get_base_by_gui_type(enum base_gui_type type, const struct unit *punit, const struct tile *ptile)
Get best gui_type base for given parameters.
bool is_server()
Is program type server?
#define fc_assert_ret(condition)
#define fc_assert_ret_val(condition, val)
bool can_unit_exist_at_tile(const struct civ_map *nmap, const struct unit *punit, const struct tile *ptile)
Return TRUE iff the unit can "exist" at this location.
bool unit_can_load(const struct unit *punit)
Return whether we can find a suitable transporter for given unit at current location.
bool can_build_road(struct road_type *proad, const struct unit *punit, const struct tile *ptile)
Tells if unit can build road on tile.
struct packet_scenario_info scenario
enum unit_activity activity
struct city * tile_city(const struct tile *ptile)
Return the city on this tile (or nullptr), checking for city center.
int get_transporter_occupancy(const struct unit *ptrans)
Return how many units are in the transport.
enum unit_upgrade_result unit_upgrade_test(const struct unit *punit, bool is_free)
Tests if the unit could be updated.
struct unit * unit_transport_get(const struct unit *pcargo)
Returns the transporter of the unit or nullptr if it is not transported.
bool is_unit_activity_on_tile(enum unit_activity activity, const struct tile *ptile)
Return whether any units on the tile are doing this activity.
bool unit_can_do_action(const struct unit *punit, const action_id act_id)
Return TRUE iff this unit can do the specified generalized (ruleset defined) action enabler controlle...
bool unit_can_convert(const struct unit *punit)
Tests if unit can be converted to another type.
bool can_unit_do_activity_targeted(const struct unit *punit, enum unit_activity activity, struct extra_type *target)
Return whether the unit can do the targeted activity at its current location.
bool can_unit_do_activity(const struct unit *punit, enum unit_activity activity)
Return TRUE iff the unit can do the given untargeted activity at its current location.
bool unit_transported(const struct unit *pcargo)
Returns TRUE iff the unit is transported.
bool can_unit_unload(const struct unit *pcargo, const struct unit *ptrans)
Return TRUE iff the given unit can be unloaded from its current transporter.
bool units_can_load(const std::vector< unit * > &units)
Returns TRUE iff any of these units can load.
static int compar_unit_ord_city(const struct unit *const *ua, const struct unit *const *ub)
Comparison function for unit_list_sort, sorting by ord_city: see above.
bool can_units_do_base_gui(const std::vector< unit * > &units, enum base_gui_type base_gui)
Returns TRUE if any of the units can build base with given gui_type.
bool can_units_do_any_road(const std::vector< unit * > &units)
Returns TRUE if any of the units can build any road.
bool units_can_do_action(const std::vector< unit * > &units, action_id act_id, bool can_do)
If has_flag is true, returns true iff any of the units are able to do the specified action.
bool any_unit_in_city(const std::vector< unit * > &units)
bool can_units_do(const std::vector< unit * > &units, bool(can_fn)(const struct unit *punit))
Return TRUE if the function returns true for any of the units.
void unit_list_sort_ord_map(struct unit_list *punitlist)
Sorts the unit list by punit->server.ord_map values.
bool can_units_do_activity_targeted(const std::vector< unit * > &units, enum unit_activity activity, struct extra_type *pextra)
Returns TRUE if any of the units can do the targeted activity.
bool units_are_occupied(const std::vector< unit * > &units)
Return TRUE iff any of the units is a transporter that is occupied.
bool units_can_unload(const std::vector< unit * > &units)
Return TRUE iff any of these units can unload.
static int compar_unit_ord_map(const struct unit *const *ua, const struct unit *const *ub)
Comparison function for unit_list_sort, sorting by ord_map: The indirection is a bit gory: Read from ...
bool units_contain_cityfounder(const std::vector< unit * > &units)
Does the list contain any cityfounder units.
bool can_units_do_activity(const std::vector< unit * > &units, enum unit_activity activity)
Returns TRUE if any of the units can do the activity.
bool units_have_activity_on_tile(const std::vector< unit * > &units, enum unit_activity activity)
Return TRUE iff any of the units' tiles have the activity running on them.
bool units_can_upgrade(const std::vector< unit * > &units)
Return TRUE iff any of the units can be upgraded to another unit type (for money)
bool units_can_convert(const std::vector< unit * > &units)
Return TRUE iff any of the units can convert to another unit type.
bool units_have_type_flag(const std::vector< unit * > &units, enum unit_type_flag_id flag, bool has_flag)
If has_flag is true, returns true iff any of the units have the flag.
struct unit * unit_list_find(const struct unit_list *punitlist, int unit_id)
Look for a unit with the given ID in the unit list.
bool units_on_the_same_tile(const std::vector< unit * > &units)
void unit_list_sort_ord_city(struct unit_list *punitlist)
Sorts the unit list by punit->server.ord_city values.
#define unit_list_iterate(unitlist, punit)
#define unit_list_iterate_end
const struct unit_type * unit_type_get(const struct unit *punit)
Return the unit type for this unit.
bool unit_has_type_flag(const struct unit *punit, enum unit_type_flag_id flag)
Return whether the unit has the given flag.
bool utype_can_do_action(const struct unit_type *putype, const action_id act_id)
Return TRUE iff units of the given type can do the specified generalized (ruleset defined) action ena...