Feature #1945 ยป 0040-Pass-enum-req_problem_type-to-can_city_build_now.patch
| client/citydlg_common.c | ||
|---|---|---|
|
}
|
||
|
/* If it can be built... */
|
||
|
if (can_city_build_now(&(wld.map), pcity, &target)) {
|
||
|
if (can_city_build_now(&(wld.map), pcity, &target, RPT_CERTAIN)) {
|
||
|
/* ...but we're not yet building it, then switch. */
|
||
|
if (!same_as_current_build) {
|
||
|
/* Change the current target */
|
||
| ... | ... | |
|
struct universal old = pcity->production;
|
||
|
/* Insert as current production. */
|
||
|
if (!can_city_build_direct(nmap, pcity, item)) {
|
||
|
if (!can_city_build_direct(nmap, pcity, item, RPT_CERTAIN)) {
|
||
|
return FALSE;
|
||
|
}
|
||
| client/climisc.c | ||
|---|---|---|
|
connection_do_buffer(&client.conn);
|
||
|
city_list_iterate (client.conn.playing->cities, pcity) {
|
||
|
if (are_universals_equal(&pcity->production, from)
|
||
|
&& can_city_build_now(&(wld.map), pcity, to)) {
|
||
|
&& can_city_build_now(&(wld.map), pcity, to, RPT_CERTAIN)) {
|
||
|
city_change_production(pcity, to);
|
||
|
}
|
||
|
} city_list_iterate_end;
|
||
| ... | ... | |
|
bool can_city_build_now_client(const struct city *pcity,
|
||
|
const struct universal *target)
|
||
|
{
|
||
|
return can_city_build_now(&(wld.map), pcity, target);
|
||
|
return can_city_build_now(&(wld.map), pcity, target, RPT_CERTAIN);
|
||
|
}
|
||
|
/**********************************************************************//**
|
||
| client/gui-gtk-3.22/citydlg.c | ||
|---|---|---|
|
name_and_sort_items(targets, targets_used, items, FALSE, pcity);
|
||
|
for (item = 0; item < targets_used; item++) {
|
||
|
if (can_city_build_now(&(wld.map), pcity, &items[item].item)) {
|
||
|
if (can_city_build_now(&(wld.map), pcity, &items[item].item,
|
||
|
RPT_CERTAIN)) {
|
||
|
const char *name;
|
||
|
struct sprite* sprite;
|
||
|
GdkPixbuf *pix;
|
||
| client/gui-gtk-4.0/citydlg.c | ||
|---|---|---|
|
name_and_sort_items(targets, targets_used, items, FALSE, pcity);
|
||
|
for (item = 0; item < targets_used; item++) {
|
||
|
if (can_city_build_now(&(wld.map), pcity, &items[item].item)) {
|
||
|
if (can_city_build_now(&(wld.map), pcity, &items[item].item,
|
||
|
RPT_CERTAIN)) {
|
||
|
const char *name;
|
||
|
struct sprite *sprite;
|
||
|
GdkPixbuf *pix;
|
||
| client/gui-gtk-5.0/citydlg.c | ||
|---|---|---|
|
name_and_sort_items(targets, targets_used, items, FALSE, pcity);
|
||
|
for (item = 0; item < targets_used; item++) {
|
||
|
if (can_city_build_now(&(wld.map), pcity, &items[item].item)) {
|
||
|
if (can_city_build_now(&(wld.map), pcity, &items[item].item,
|
||
|
RPT_CERTAIN)) {
|
||
|
const char *name;
|
||
|
struct sprite *sprite;
|
||
|
GdkPixbuf *pix;
|
||
| client/gui-qt/citydlg.cpp | ||
|---|---|---|
|
name_and_sort_items(targets, targets_used, items, false, dlgcity);
|
||
|
for (item = 0; item < targets_used; item++) {
|
||
|
if (can_city_build_now(&(wld.map), dlgcity, &items[item].item)) {
|
||
|
if (can_city_build_now(&(wld.map), dlgcity, &items[item].item,
|
||
|
RPT_CERTAIN)) {
|
||
|
prod_list << cid_encode(items[item].item);
|
||
|
}
|
||
|
}
|
||
| ... | ... | |
|
name_and_sort_items(targets, targets_used, items, false, mcity);
|
||
|
for (item = 0; item < targets_used; item++) {
|
||
|
if (future_t || can_city_build_now(&(wld.map), mcity, &items[item].item)) {
|
||
|
if (future_t || can_city_build_now(&(wld.map), mcity, &items[item].item,
|
||
|
RPT_CERTAIN)) {
|
||
|
renegade = new universal(items[item].item);
|
||
|
// Renegade deleted in production_item destructor
|
||
| client/gui-qt/cityrep.cpp | ||
|---|---|---|
|
clearSelection();
|
||
|
}
|
||
|
need_clear = false;
|
||
|
if (can_city_build_now(&(wld.map), iter_city, &target)) {
|
||
|
if (can_city_build_now(&(wld.map), iter_city, &target,
|
||
|
RPT_CERTAIN)) {
|
||
|
select_city(iter_city);
|
||
|
}
|
||
|
break;
|
||
| ... | ... | |
|
clearSelection();
|
||
|
}
|
||
|
need_clear = false;
|
||
|
if (can_city_build_now(&(wld.map), iter_city, &target)) {
|
||
|
if (can_city_build_now(&(wld.map), iter_city, &target,
|
||
|
RPT_CERTAIN)) {
|
||
|
select_city(iter_city);
|
||
|
}
|
||
|
break;
|
||
| ... | ... | |
|
clearSelection();
|
||
|
}
|
||
|
need_clear = false;
|
||
|
if (can_city_build_now(&(wld.map), iter_city, &target)) {
|
||
|
if (can_city_build_now(&(wld.map), iter_city, &target,
|
||
|
RPT_CERTAIN)) {
|
||
|
select_city(iter_city);
|
||
|
}
|
||
|
break;
|
||
| client/mapctrl_common.c | ||
|---|---|---|
|
static void clipboard_send_production_packet(struct city *pcity)
|
||
|
{
|
||
|
if (are_universals_equal(&pcity->production, &clipboard)
|
||
|
|| !can_city_build_now(&(wld.map), pcity, &clipboard)) {
|
||
|
|| !can_city_build_now(&(wld.map), pcity, &clipboard, RPT_CERTAIN)) {
|
||
|
return;
|
||
|
}
|
||
| common/city.c | ||
|---|---|---|
|
**************************************************************************/
|
||
|
bool can_city_build_direct(const struct civ_map *nmap,
|
||
|
const struct city *pcity,
|
||
|
const struct universal *target)
|
||
|
const struct universal *target,
|
||
|
const enum req_problem_type prob_type)
|
||
|
{
|
||
|
switch (target->kind) {
|
||
|
case VUT_UTYPE:
|
||
|
return can_city_build_unit_direct(nmap, pcity, target->value.utype,
|
||
|
RPT_CERTAIN);
|
||
|
prob_type);
|
||
|
case VUT_IMPROVEMENT:
|
||
|
return can_city_build_improvement_direct(pcity, target->value.building,
|
||
|
RPT_CERTAIN);
|
||
|
prob_type);
|
||
|
default:
|
||
|
break;
|
||
|
};
|
||
| ... | ... | |
|
**************************************************************************/
|
||
|
bool can_city_build_now(const struct civ_map *nmap,
|
||
|
const struct city *pcity,
|
||
|
const struct universal *target)
|
||
|
const struct universal *target,
|
||
|
const enum req_problem_type prob_type)
|
||
|
{
|
||
|
switch (target->kind) {
|
||
|
case VUT_UTYPE:
|
||
|
return can_city_build_unit_now(nmap, pcity, target->value.utype,
|
||
|
RPT_CERTAIN);
|
||
|
prob_type);
|
||
|
case VUT_IMPROVEMENT:
|
||
|
return can_city_build_improvement_now(pcity, target->value.building,
|
||
|
RPT_CERTAIN);
|
||
|
prob_type);
|
||
|
default:
|
||
|
break;
|
||
|
};
|
||
| common/city.h | ||
|---|---|---|
|
bool can_city_build_direct(const struct civ_map *nmap,
|
||
|
const struct city *pcity,
|
||
|
const struct universal *target);
|
||
|
const struct universal *target,
|
||
|
const enum req_problem_type prob_type);
|
||
|
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,
|
||
|
const struct universal *target);
|
||
|
const struct universal *target,
|
||
|
const enum req_problem_type prob_type);
|
||
|
int city_unit_slots_available(const struct city *pcity);
|
||
|
bool city_can_use_specialist(const struct city *pcity,
|
||
| server/cityhand.c | ||
|---|---|---|
|
return;
|
||
|
}
|
||
|
if (!can_city_build_now(nmap, pcity, &prod)) {
|
||
|
if (!can_city_build_now(nmap, pcity, &prod, RPT_CERTAIN)) {
|
||
|
return;
|
||
|
}
|
||
|
if (!city_can_change_build(pcity)) {
|
||
| server/citytools.c | ||
|---|---|---|
|
/* Set production to something valid for pplayer, if not.
|
||
|
* (previously allowed building obsolete units.) */
|
||
|
if (!can_city_build_now(nmap, pcity, &pcity->production)) {
|
||
|
if (!can_city_build_now(nmap, pcity, &pcity->production, RPT_CERTAIN)) {
|
||
|
advisor_choose_build(ptaker, pcity);
|
||
|
}
|
||
| server/cityturn.c | ||
|---|---|---|
|
}
|
||
|
if (worklist_peek_ith(pwl, &target, i)) {
|
||
|
success = can_city_build_now(nmap, pcity, &target);
|
||
|
success = can_city_build_now(nmap, pcity, &target, RPT_CERTAIN);
|
||
|
} else {
|
||
|
success = FALSE;
|
||
|
}
|
||