Feature #568 » 0062-Unhardcode-wld.map-from-unit_can_airlift_to.patch
ai/default/daiunit.c | ||
---|---|---|
struct city *most_needed;
|
||
int comparison;
|
||
struct unit *transported;
|
||
const struct civ_map *nmap = &(wld.map);
|
||
do {
|
||
most_needed = find_neediest_airlift_city(ait, pplayer);
|
||
... | ... | |
if (city_data->urgency == 0
|
||
&& city_data->danger - DEFENSE_POWER(ptype) < comparison
|
||
&& unit_can_airlift_to(punit, most_needed)
|
||
&& unit_can_airlift_to(nmap, punit, most_needed)
|
||
&& DEFENSE_POWER(ptype) > 2
|
||
&& (unit_data->task == AIUNIT_NONE
|
||
|| unit_data->task == AIUNIT_DEFEND_HOME)
|
client/gui-gtk-3.22/gotodlg.c | ||
---|---|---|
if (pdestcity) {
|
||
unit_list_iterate(get_units_in_focus(), punit) {
|
||
if (unit_can_airlift_to(punit, pdestcity)) {
|
||
if (unit_can_airlift_to(&(wld.map), punit, pdestcity)) {
|
||
request_unit_airlift(punit, pdestcity);
|
||
}
|
||
} unit_list_iterate_end;
|
||
... | ... | |
/* Allow action if any of the selected units can airlift. */
|
||
unit_list_iterate(get_units_in_focus(), punit) {
|
||
if (unit_can_airlift_to(punit, pdestcity)) {
|
||
if (unit_can_airlift_to(&(wld.map), punit, pdestcity)) {
|
||
can_airlift = TRUE;
|
||
break;
|
||
}
|
client/gui-gtk-4.0/gotodlg.c | ||
---|---|---|
if (pdestcity) {
|
||
unit_list_iterate(get_units_in_focus(), punit) {
|
||
if (unit_can_airlift_to(punit, pdestcity)) {
|
||
if (unit_can_airlift_to(&(wld.map), punit, pdestcity)) {
|
||
request_unit_airlift(punit, pdestcity);
|
||
}
|
||
} unit_list_iterate_end;
|
||
... | ... | |
/* Allow action if any of the selected units can airlift. */
|
||
unit_list_iterate(get_units_in_focus(), punit) {
|
||
if (unit_can_airlift_to(punit, pdestcity)) {
|
||
if (unit_can_airlift_to(&(wld.map), punit, pdestcity)) {
|
||
can_airlift = TRUE;
|
||
break;
|
||
}
|
client/gui-gtk-5.0/gotodlg.c | ||
---|---|---|
if (pdestcity) {
|
||
unit_list_iterate(get_units_in_focus(), punit) {
|
||
if (unit_can_airlift_to(punit, pdestcity)) {
|
||
if (unit_can_airlift_to(&(wld.map), punit, pdestcity)) {
|
||
request_unit_airlift(punit, pdestcity);
|
||
}
|
||
} unit_list_iterate_end;
|
||
... | ... | |
/* Allow action if any of the selected units can airlift. */
|
||
unit_list_iterate(get_units_in_focus(), punit) {
|
||
if (unit_can_airlift_to(punit, pdestcity)) {
|
||
if (unit_can_airlift_to(&(wld.map), punit, pdestcity)) {
|
||
can_airlift = TRUE;
|
||
break;
|
||
}
|
client/gui-qt/gotodlg.cpp | ||
---|---|---|
center_tile_mapcanvas(city_tile(dest));
|
||
can_airlift = false;
|
||
unit_list_iterate(get_units_in_focus(), punit) {
|
||
if (unit_can_airlift_to(punit, dest)) {
|
||
if (unit_can_airlift_to(&(wld.map), punit, dest)) {
|
||
can_airlift = true;
|
||
break;
|
||
}
|
||
... | ... | |
0)->data(Qt::UserRole).toInt());
|
||
if (pdest) {
|
||
unit_list_iterate(get_units_in_focus(), punit) {
|
||
if (unit_can_airlift_to(punit, pdest)) {
|
||
if (unit_can_airlift_to(&(wld.map), punit, pdest)) {
|
||
request_unit_airlift(punit, pdest);
|
||
}
|
||
} unit_list_iterate_end;
|
common/unit.c | ||
---|---|---|
side of saying airlifting is possible even if it's not certain given
|
||
player knowledge.
|
||
**************************************************************************/
|
||
bool unit_can_airlift_to(const struct unit *punit,
|
||
bool unit_can_airlift_to(const struct civ_map *nmap,
|
||
const struct unit *punit,
|
||
const struct city *pdest_city)
|
||
{
|
||
const struct civ_map *nmap = &(wld.map);
|
||
fc_assert_ret_val(pdest_city, FALSE);
|
||
if (is_server()) {
|
||
return is_action_enabled_unit_on_city(nmap, ACTION_AIRLIFT,
|
||
punit, pdest_city);
|
common/unit.h | ||
---|---|---|
const struct player *restriction,
|
||
const struct unit *punit,
|
||
const struct city *pdest_city);
|
||
bool unit_can_airlift_to(const struct unit *punit, const struct city *pcity);
|
||
bool unit_can_airlift_to(const struct civ_map *nmap,
|
||
const struct unit *punit, const struct city *pcity)
|
||
fc__attribute((nonnull (3)));
|
||
bool unit_has_orders(const struct unit *punit);
|
||
bool could_unit_be_in_transport(const struct unit *pcargo,
|