Feature #1960 ยป 0023-Make-city-build-target-checks-RPT_POSSIBLE-at-client.patch
| client/citydlg_common.c | ||
|---|---|---|
|
}
|
||
|
/* If it can be built... */
|
||
|
if (can_city_build_now(&(wld.map), pcity, &target, RPT_CERTAIN)) {
|
||
|
if (can_city_build_now(&(wld.map), pcity, &target, RPT_POSSIBLE)) {
|
||
|
/* ...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, RPT_CERTAIN)) {
|
||
|
if (!can_city_build_direct(nmap, pcity, item, RPT_POSSIBLE)) {
|
||
|
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, RPT_CERTAIN)) {
|
||
|
&& can_city_build_now(&(wld.map), pcity, to, RPT_POSSIBLE)) {
|
||
|
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, RPT_CERTAIN);
|
||
|
return can_city_build_now(&(wld.map), pcity, target, RPT_POSSIBLE);
|
||
|
}
|
||
|
/**********************************************************************//**
|
||
| ... | ... | |
|
improvement_iterate(pimprove) {
|
||
|
if (can_player_build_improvement_now(client.conn.playing, pimprove,
|
||
|
RPT_CERTAIN)) {
|
||
|
RPT_POSSIBLE)) {
|
||
|
targets[cids_used].kind = VUT_IMPROVEMENT;
|
||
|
targets[cids_used].value.building = pimprove;
|
||
|
cids_used++;
|
||
| ... | ... | |
|
unit_type_iterate(punittype) {
|
||
|
if (can_player_build_unit_now(client.conn.playing, punittype,
|
||
|
RPT_CERTAIN)) {
|
||
|
RPT_POSSIBLE)) {
|
||
|
targets[cids_used].kind = VUT_UTYPE;
|
||
|
targets[cids_used].value.utype = punittype;
|
||
|
cids_used++;
|
||
| ... | ... | |
|
if (NULL != pcity) {
|
||
|
/* Can the city build? */
|
||
|
can_build = can_city_build_improvement_now(pcity, pimprove,
|
||
|
RPT_CERTAIN);
|
||
|
RPT_POSSIBLE);
|
||
|
can_eventually_build = can_city_build_improvement_later(pcity,
|
||
|
pimprove);
|
||
|
} else if (NULL != pplayer) {
|
||
|
/* Can our player build? */
|
||
|
can_build = can_player_build_improvement_now(pplayer, pimprove,
|
||
|
RPT_CERTAIN);
|
||
|
RPT_POSSIBLE);
|
||
|
can_eventually_build = can_player_build_improvement_later(pplayer,
|
||
|
pimprove);
|
||
|
} else {
|
||
| ... | ... | |
|
can_build = FALSE;
|
||
|
players_iterate(aplayer) {
|
||
|
if (can_player_build_improvement_now(aplayer, pimprove,
|
||
|
RPT_CERTAIN)) {
|
||
|
RPT_POSSIBLE)) {
|
||
|
can_build = TRUE;
|
||
|
break;
|
||
|
}
|
||
| ... | ... | |
|
if (NULL != pcity) {
|
||
|
/* Can the city build? */
|
||
|
can_build = can_city_build_unit_now(nmap, pcity, punittype, RPT_CERTAIN);
|
||
|
can_build = can_city_build_unit_now(nmap, pcity, punittype, RPT_POSSIBLE);
|
||
|
can_eventually_build = can_city_build_unit_later(nmap, pcity, punittype);
|
||
|
} else if (NULL != pplayer) {
|
||
|
/* Can our player build? */
|
||
|
can_build = can_player_build_unit_now(pplayer, punittype, RPT_CERTAIN);
|
||
|
can_build = can_player_build_unit_now(pplayer, punittype, RPT_POSSIBLE);
|
||
|
can_eventually_build = can_player_build_unit_later(pplayer, punittype);
|
||
|
} else {
|
||
|
/* Global observer case: can any player build? */
|
||
|
can_build = FALSE;
|
||
|
players_iterate(aplayer) {
|
||
|
if (can_player_build_unit_now(aplayer, punittype, RPT_CERTAIN)) {
|
||
|
if (can_player_build_unit_now(aplayer, punittype, RPT_POSSIBLE)) {
|
||
|
can_build = TRUE;
|
||
|
break;
|
||
|
}
|
||
| client/gui-gtk-3.22/citydlg.c | ||
|---|---|---|
|
for (item = 0; item < targets_used; item++) {
|
||
|
if (can_city_build_now(&(wld.map), pcity, &items[item].item,
|
||
|
RPT_CERTAIN)) {
|
||
|
RPT_POSSIBLE)) {
|
||
|
const char *name;
|
||
|
struct sprite* sprite;
|
||
|
GdkPixbuf *pix;
|
||
| client/gui-gtk-4.0/citydlg.c | ||
|---|---|---|
|
for (item = 0; item < targets_used; item++) {
|
||
|
if (can_city_build_now(&(wld.map), pcity, &items[item].item,
|
||
|
RPT_CERTAIN)) {
|
||
|
RPT_POSSIBLE)) {
|
||
|
const char *name;
|
||
|
struct sprite *sprite;
|
||
|
GdkPixbuf *pix;
|
||
| client/gui-gtk-5.0/citydlg.c | ||
|---|---|---|
|
for (item = 0; item < targets_used; item++) {
|
||
|
if (can_city_build_now(&(wld.map), pcity, &items[item].item,
|
||
|
RPT_CERTAIN)) {
|
||
|
RPT_POSSIBLE)) {
|
||
|
const char *name;
|
||
|
struct sprite *sprite;
|
||
|
GdkPixbuf *pix;
|
||
| client/gui-qt/citydlg.cpp | ||
|---|---|---|
|
for (item = 0; item < targets_used; item++) {
|
||
|
if (can_city_build_now(&(wld.map), dlgcity, &items[item].item,
|
||
|
RPT_CERTAIN)) {
|
||
|
RPT_POSSIBLE)) {
|
||
|
prod_list << cid_encode(items[item].item);
|
||
|
}
|
||
|
}
|
||
| ... | ... | |
|
for (item = 0; item < targets_used; item++) {
|
||
|
if (future_t || can_city_build_now(&(wld.map), mcity, &items[item].item,
|
||
|
RPT_CERTAIN)) {
|
||
|
RPT_POSSIBLE)) {
|
||
|
renegade = new universal(items[item].item);
|
||
|
// Renegade deleted in production_item destructor
|
||
| client/gui-qt/cityrep.cpp | ||
|---|---|---|
|
}
|
||
|
need_clear = false;
|
||
|
if (can_city_build_now(&(wld.map), iter_city, &target,
|
||
|
RPT_CERTAIN)) {
|
||
|
RPT_POSSIBLE)) {
|
||
|
select_city(iter_city);
|
||
|
}
|
||
|
break;
|
||
| ... | ... | |
|
}
|
||
|
need_clear = false;
|
||
|
if (can_city_build_now(&(wld.map), iter_city, &target,
|
||
|
RPT_CERTAIN)) {
|
||
|
RPT_POSSIBLE)) {
|
||
|
select_city(iter_city);
|
||
|
}
|
||
|
break;
|
||
| ... | ... | |
|
}
|
||
|
need_clear = false;
|
||
|
if (can_city_build_now(&(wld.map), iter_city, &target,
|
||
|
RPT_CERTAIN)) {
|
||
|
RPT_POSSIBLE)) {
|
||
|
select_city(iter_city);
|
||
|
}
|
||
|
break;
|
||
| client/gui-sdl2/wldlg.c | ||
|---|---|---|
|
improvement_iterate(pimprove) {
|
||
|
can_build = can_player_build_improvement_now(client.conn.playing, pimprove,
|
||
|
RPT_CERTAIN);
|
||
|
can_eventually_build =
|
||
|
can_player_build_improvement_later(client.conn.playing, pimprove);
|
||
|
RPT_POSSIBLE);
|
||
|
can_eventually_build
|
||
|
= can_player_build_improvement_later(client.conn.playing, pimprove);
|
||
|
/* If there's a city, can the city build the improvement? */
|
||
|
if (pcity) {
|
||
|
can_build = can_build && can_city_build_improvement_now(pcity, pimprove,
|
||
|
RPT_CERTAIN);
|
||
|
RPT_POSSIBLE);
|
||
|
can_eventually_build = can_eventually_build
|
||
|
&& can_city_build_improvement_later(pcity, pimprove);
|
||
|
}
|
||
| ... | ... | |
|
/* ------------------------------ */
|
||
|
unit_type_iterate(un) {
|
||
|
can_build = can_player_build_unit_now(client.conn.playing, un, RPT_CERTAIN);
|
||
|
can_build = can_player_build_unit_now(client.conn.playing, un, RPT_POSSIBLE);
|
||
|
can_eventually_build
|
||
|
= can_player_build_unit_later(client.conn.playing, un);
|
||
|
/* If there's a city, can the city build the unit? */
|
||
|
if (pcity) {
|
||
|
can_build = can_build && can_city_build_unit_now(nmap, pcity, un,
|
||
|
RPT_CERTAIN);
|
||
|
RPT_POSSIBLE);
|
||
|
can_eventually_build = can_eventually_build
|
||
|
&& can_city_build_unit_later(nmap, pcity, un);
|
||
|
}
|
||
| client/gui-sdl3/wldlg.c | ||
|---|---|---|
|
improvement_iterate(pimprove) {
|
||
|
can_build = can_player_build_improvement_now(client.conn.playing, pimprove,
|
||
|
RPT_CERTAIN);
|
||
|
can_eventually_build =
|
||
|
can_player_build_improvement_later(client.conn.playing, pimprove);
|
||
|
RPT_POSSIBLE);
|
||
|
can_eventually_build
|
||
|
= can_player_build_improvement_later(client.conn.playing, pimprove);
|
||
|
/* If there's a city, can the city build the improvement? */
|
||
|
if (pcity) {
|
||
|
can_build = can_build && can_city_build_improvement_now(pcity, pimprove,
|
||
|
RPT_CERTAIN);
|
||
|
RPT_POSSIBLE);
|
||
|
can_eventually_build = can_eventually_build
|
||
|
&& can_city_build_improvement_later(pcity, pimprove);
|
||
|
}
|
||
| ... | ... | |
|
/* ------------------------------ */
|
||
|
unit_type_iterate(un) {
|
||
|
can_build = can_player_build_unit_now(client.conn.playing, un, RPT_CERTAIN);
|
||
|
can_build = can_player_build_unit_now(client.conn.playing, un, RPT_POSSIBLE);
|
||
|
can_eventually_build
|
||
|
= can_player_build_unit_later(client.conn.playing, un);
|
||
|
/* If there's a city, can the city build the unit? */
|
||
|
if (pcity) {
|
||
|
can_build = can_build && can_city_build_unit_now(nmap, pcity, un,
|
||
|
RPT_CERTAIN);
|
||
|
RPT_POSSIBLE);
|
||
|
can_eventually_build = can_eventually_build
|
||
|
&& can_city_build_unit_later(nmap, pcity, un);
|
||
|
}
|
||
| client/mapctrl_common.c | ||
|---|---|---|
|
if (!can_player_build_unit_direct(client.conn.playing,
|
||
|
unit_type_get(punit),
|
||
|
RPT_CERTAIN,
|
||
|
RPT_POSSIBLE,
|
||
|
FALSE)) {
|
||
|
create_event(ptile, E_BAD_COMMAND, ftc_client,
|
||
|
_("You don't know how to build %s!"),
|
||
| ... | ... | |
|
static void clipboard_send_production_packet(struct city *pcity)
|
||
|
{
|
||
|
if (are_universals_equal(&pcity->production, &clipboard)
|
||
|
|| !can_city_build_now(&(wld.map), pcity, &clipboard, RPT_CERTAIN)) {
|
||
|
|| !can_city_build_now(&(wld.map), pcity, &clipboard, RPT_POSSIBLE)) {
|
||
|
return;
|
||
|
}
|
||