Project

General

Profile

Feature #537 » 0018-Unhardcode-wld.map-from-city_can_be_built_here.patch

S3_1 - Marko Lindqvist, 05/03/2024 08:06 PM

View differences:

ai/default/daisettler.c
{
struct city *pcity = tile_city(ptile);
struct cityresult *cr = NULL;
const struct civ_map *nmap = &(wld.map);
fc_assert_ret_val(punit, NULL);
fc_assert_ret_val(pplayer, NULL);
if (!city_can_be_built_here(ptile, punit, FALSE)
if (!city_can_be_built_here(nmap, ptile, punit, FALSE)
|| (has_handicap(pplayer, H_MAP)
&& !map_is_known(ptile, pplayer))) {
return NULL;
......
/* Check that the mission is still possible. If the tile has become
* unavailable, call it off. */
if (!city_can_be_built_here(ptile, punit, FALSE)) {
if (!city_can_be_built_here(nmap, ptile, punit, FALSE)) {
dai_unit_new_task(ait, punit, AIUNIT_NONE, NULL);
set_unit_activity(punit, ACTIVITY_IDLE);
send_unit_info(NULL, punit);
client/gui-gtk-3.0/editprop.c
if (pplayer && hint_tiles) {
tile_list_iterate(hint_tiles, atile) {
if (!is_enemy_unit_tile(atile, pplayer)
&& city_can_be_built_here(atile, NULL, FALSE)) {
&& city_can_be_built_here(&(wld.map), atile,
NULL, FALSE)) {
ptile = atile;
break;
}
client/gui-gtk-3.22/editprop.c
if (pplayer && hint_tiles) {
tile_list_iterate(hint_tiles, atile) {
if (!is_enemy_unit_tile(atile, pplayer)
&& city_can_be_built_here(atile, NULL, FALSE)) {
&& city_can_be_built_here(&(wld.map), atile, NULL, FALSE)) {
ptile = atile;
break;
}
client/gui-gtk-4.0/editprop.c
if (pplayer && hint_tiles) {
tile_list_iterate(hint_tiles, atile) {
if (!is_enemy_unit_tile(atile, pplayer)
&& city_can_be_built_here(atile, NULL, FALSE)) {
&& city_can_be_built_here(&(wld.map), atile,
NULL, FALSE)) {
ptile = atile;
break;
}
client/mapview_common.c
if ((NULL == client.conn.playing
|| unit_owner(psettler) == client.conn.playing)
&& unit_can_do_action(psettler, ACTION_FOUND_CITY)
&& city_can_be_built_here(unit_tile(psettler), psettler, FALSE)) {
&& city_can_be_built_here(&(wld.map), unit_tile(psettler),
psettler, FALSE)) {
if (closest_settler == NULL) {
closest_settler = psettler;
}
client/tilespec.c
&& unit_is_cityfounder(punit)
&& !unit_has_orders(punit)
&& (client_tile_get_known(unit_tile(punit)) != TILE_UNKNOWN
&& city_can_be_built_here(unit_tile(punit), punit, FALSE))
&& city_can_be_built_here(&(wld.map), unit_tile(punit), punit, FALSE))
&& (!check_focus || unit_is_in_focus(punit));
}
common/city.c
punit is the founding unit. It may be NULL if a city is built out of the
blue (e.g., through editing).
**************************************************************************/
bool city_can_be_built_here(const struct tile *ptile,
bool city_can_be_built_here(const struct civ_map *nmap,
const struct tile *ptile,
const struct unit *punit,
bool hut_test)
{
struct civ_map *nmap = &(wld.map);
if (!city_can_be_built_tile_only(nmap, ptile)) {
return FALSE;
}
......
struct city *pcity)
{
struct unit_order *checked_orders;
const struct civ_map *nmap = &(wld.map);
if (pcity == NULL) {
/* Probably lost. */
......
pcity->rally_point.orders = NULL;
}
} else {
checked_orders = create_unit_orders(&(wld.map),
packet->length, packet->orders);
checked_orders = create_unit_orders(nmap, packet->length,
packet->orders);
if (!checked_orders) {
pcity->rally_point.length = 0;
log_error("invalid rally point orders for city number %d.",
common/city.h
bool citymindist_prevents_city_on_tile(const struct civ_map *nmap,
const struct tile *ptile);
bool city_can_be_built_here(const struct tile *ptile,
bool city_can_be_built_here(const struct civ_map *nmap,
const struct tile *ptile,
const struct unit *punit,
bool hut_test);
bool city_can_be_built_tile_only(const struct civ_map *nmap,
common/scriptcore/api_game_methods.c
**************************************************************************/
bool api_methods_unit_city_can_be_built_here(lua_State *L, Unit *punit)
{
const struct civ_map *nmap = &(wld.map);
LUASCRIPT_CHECK_STATE(L, FALSE);
LUASCRIPT_CHECK_SELF(L, punit, FALSE);
return city_can_be_built_here(unit_tile(punit), punit, TRUE);
return city_can_be_built_here(nmap, unit_tile(punit), punit, TRUE);
}
/**********************************************************************//**
server/citytools.c
bool create_city_for_player(struct player *pplayer, struct tile *ptile,
const char *name)
{
const struct civ_map *nmap = &(wld.map);
if (is_enemy_unit_tile(ptile, pplayer)
|| !city_can_be_built_here(ptile, NULL, FALSE)) {
|| !city_can_be_built_here(nmap, ptile, NULL, FALSE)) {
return FALSE;
}
(3-3/3)