Feature #1022 » 0059-Unhardcode-wld.map-from-can_city_build_later.patch
client/citydlg_common.c | ||
---|---|---|
static bool base_city_queue_insert(struct city *pcity, int position,
|
||
struct universal *item)
|
||
{
|
||
const struct civ_map *nmap = &(wld.map);
|
||
if (position == 0) {
|
||
struct universal old = pcity->production;
|
||
/* Insert as current production. */
|
||
if (!can_city_build_direct(&(wld.map), pcity, item)) {
|
||
if (!can_city_build_direct(nmap, pcity, item)) {
|
||
return FALSE;
|
||
}
|
||
... | ... | |
} else if (position >= 1
|
||
&& position <= worklist_length(&pcity->worklist)) {
|
||
/* Insert into middle. */
|
||
if (!can_city_build_later(pcity, item)) {
|
||
if (!can_city_build_later(nmap, pcity, item)) {
|
||
return FALSE;
|
||
}
|
||
if (!worklist_insert(&pcity->worklist, item, position - 1)) {
|
||
... | ... | |
}
|
||
} else {
|
||
/* Insert at end. */
|
||
if (!can_city_build_later(pcity, item)) {
|
||
if (!can_city_build_later(nmap, pcity, item)) {
|
||
return FALSE;
|
||
}
|
||
if (!worklist_append(&pcity->worklist, item)) {
|
client/gui-sdl2/wldlg.c | ||
---|---|---|
/* Global worklist can have targets unavilable in current state of game
|
||
then we must remove those targets from new city worklist */
|
||
if (!can_city_build_later(editor->pcity, &pworklist->entries[count])) {
|
||
if (!can_city_build_later(&(wld.map), editor->pcity, &pworklist->entries[count])) {
|
||
continue;
|
||
}
|
||
... | ... | |
for (count = 0; count < worklist_length(pworklist); count++) {
|
||
/* global worklist can have targets unavilable in current state of game
|
||
then we must remove those targets from new city worklist */
|
||
if (!can_city_build_later(editor->pcity, &pworklist->entries[count])) {
|
||
if (!can_city_build_later(&(wld.map), editor->pcity, &pworklist->entries[count])) {
|
||
continue;
|
||
}
|
||
client/gui-sdl3/wldlg.c | ||
---|---|---|
/* Global worklist can have targets unavilable in current state of game
|
||
then we must remove those targets from new city worklist */
|
||
if (!can_city_build_later(editor->pcity, &pworklist->entries[count])) {
|
||
if (!can_city_build_later(&(wld.map), editor->pcity, &pworklist->entries[count])) {
|
||
continue;
|
||
}
|
||
... | ... | |
for (count = 0; count < worklist_length(pworklist); count++) {
|
||
/* global worklist can have targets unavilable in current state of game
|
||
then we must remove those targets from new city worklist */
|
||
if (!can_city_build_later(editor->pcity, &pworklist->entries[count])) {
|
||
if (!can_city_build_later(&(wld.map), editor->pcity, &pworklist->entries[count])) {
|
||
continue;
|
||
}
|
||
common/city.c | ||
---|---|---|
/**********************************************************************//**
|
||
Returns whether city can ever build given target, unit or improvement.
|
||
**************************************************************************/
|
||
bool can_city_build_later(const struct city *pcity,
|
||
bool can_city_build_later(const struct civ_map *nmap,
|
||
const struct city *pcity,
|
||
const struct universal *target)
|
||
{
|
||
const struct civ_map *nmap = &(wld.map);
|
||
switch (target->kind) {
|
||
case VUT_UTYPE:
|
||
return can_city_build_unit_later(nmap, pcity, target->value.utype);
|
common/city.h | ||
---|---|---|
bool can_city_build_direct(const struct civ_map *nmap,
|
||
const struct city *pcity,
|
||
const struct universal *target);
|
||
bool can_city_build_later(const struct city *pcity,
|
||
bool can_city_build_later(const struct civ_map *nmap,
|
||
const struct city *pcity,
|
||
const struct universal *target);
|
||
bool can_city_build_now(const struct civ_map *nmap,
|
||
const struct city *pcity,
|