Project

General

Profile

Feature #785 » 0013-Unhardcode-wld.map-from-unit_can_help_build_wonder_h.patch

S3_2 - Marko Lindqvist, 08/11/2024 05:31 AM

View differences:

client/gui-gtk-3.22/menu.c
* get an eventual error message from the server if we try. */
menu_entry_set_sensitive("BUILD_CITY",
(can_units_do(punits, unit_can_add_or_build_city)
|| can_units_do(punits, unit_can_help_build_wonder_here)));
|| can_units_do_on_map(&(wld.map), punits, unit_can_help_build_wonder_here)));
menu_entry_set_sensitive("BUILD_ROAD",
(can_units_do_any_road(&(wld.map), punits)
|| can_units_do(punits,
client/gui-gtk-4.0/menu.c
* get an eventual error message from the server if we try. */
menu_entry_set_sensitive(map, "BUILD_CITY",
(can_units_do(punits, unit_can_add_or_build_city)
|| can_units_do(punits, unit_can_help_build_wonder_here)));
|| can_units_do_on_map(&(wld.map), punits,
unit_can_help_build_wonder_here)));
menu_entry_set_sensitive(map, "DO_ACTION",
units_can_do_action(punits, ACTION_ANY, TRUE));
client/gui-qt/menu.cpp
i.value()->setText(
QString(action_id_name_translation(ACTION_HELP_WONDER))
.replace("&", "&&"));
if (can_units_do(punits, unit_can_help_build_wonder_here)) {
if (can_units_do_on_map(&(wld.map), punits, unit_can_help_build_wonder_here)) {
i.value()->setEnabled(true);
}
break;
client/gui-sdl2/menu.c
set_wflag(order_build_add_to_city_button, WF_HIDDEN);
}
if (unit_can_help_build_wonder_here(punit)) {
if (unit_can_help_build_wonder_here(&(wld.map), punit)) {
local_show(ID_UNIT_ORDER_BUILD_WONDER);
} else {
local_hide(ID_UNIT_ORDER_BUILD_WONDER);
client/gui-sdl3/menu.c
set_wflag(order_build_add_to_city_button, WF_HIDDEN);
}
if (unit_can_help_build_wonder_here(punit)) {
if (unit_can_help_build_wonder_here(&(wld.map), punit)) {
local_show(ID_UNIT_ORDER_BUILD_WONDER);
} else {
local_hide(ID_UNIT_ORDER_BUILD_WONDER);
common/unit.c
Return TRUE unless it is known to be impossible to disband this unit at
its current position to get full shields for building a wonder.
**************************************************************************/
bool unit_can_help_build_wonder_here(const struct unit *punit)
bool unit_can_help_build_wonder_here(const struct civ_map *nmap,
const struct unit *punit)
{
struct city *pcity = tile_city(unit_tile(punit));
const struct civ_map *nmap = &(wld.map);
if (pcity == NULL) {
/* No city to help at this tile. */
common/unit.h
int unit_shield_value(const struct unit *punit,
const struct unit_type *punittype,
const struct action *paction);
bool unit_can_help_build_wonder_here(const struct unit *punit);
bool unit_can_help_build_wonder_here(const struct civ_map *nmap,
const struct unit *punit);
bool unit_can_est_trade_route_here(const struct unit *punit);
enum unit_airlift_result
test_unit_can_airlift_to(const struct civ_map *nmap,
(2-2/3)