Feature #563 » 0070-Add-improvement-flag-Infra.patch
| ai/default/daicity.c | ||
|---|---|---|
|
*/
|
||
|
if (improvement_has_flag(pimprove, IF_GOLD)) {
|
||
|
v += TRADE_WEIGHTING / 10;
|
||
|
} else if (improvement_has_flag(pimprove, IF_INFRA)) {
|
||
|
v += INFRA_WEIGHTING / 10;
|
||
|
}
|
||
|
/* Without relevant flags, base want remains 0. */
|
||
|
} else {
|
||
| client/citydlg_common.c | ||
|---|---|---|
|
}
|
||
|
if (city_production_is_genus(pcity, IG_CONVERT)) {
|
||
|
if (city_production_has_flag(pcity, IF_GOLD)) {
|
||
|
int gold = MAX(0, pcity->surplus[O_SHIELD]);
|
||
|
int output = MAX(0, pcity->surplus[O_SHIELD]);
|
||
|
if (city_production_has_flag(pcity, IF_GOLD)) {
|
||
|
fc_snprintf(buffer, buffer_len,
|
||
|
PL_("%3d gold per turn", "%3d gold per turn", output),
|
||
|
output);
|
||
|
} else if (city_production_has_flag(pcity, IF_INFRA)) {
|
||
|
fc_snprintf(buffer, buffer_len,
|
||
|
PL_("%3d gold per turn", "%3d gold per turn", gold),
|
||
|
gold);
|
||
|
PL_("%3d infrapoint per turn", "%3d infrapoints per turn", output),
|
||
|
output);
|
||
|
} else {
|
||
|
fc_strlcpy(buffer, "---", buffer_len);
|
||
|
}
|
||
| ... | ... | |
|
if (is_convert_improvement(target->value.building)) {
|
||
|
fc_strlcat(buffer, " (--) ", buffer_len);
|
||
|
if (improvement_has_flag(target->value.building, IF_GOLD)) {
|
||
|
if (improvement_has_flag(target->value.building, IF_GOLD)
|
||
|
|| improvement_has_flag(target->value.building, IF_INFRA)) {
|
||
|
cat_snprintf(buffer, buffer_len, _("%d/turn"),
|
||
|
MAX(0, pcity->surplus[O_SHIELD]));
|
||
|
} else {
|
||
| ... | ... | |
|
if (VUT_IMPROVEMENT == target->kind
|
||
|
&& is_convert_improvement(target->value.building)) {
|
||
|
/* Coinage-like improvements: print yield-per-turn instead */
|
||
|
if (improvement_has_flag(target->value.building, IF_GOLD)) {
|
||
|
if (improvement_has_flag(target->value.building, IF_GOLD)
|
||
|
|| improvement_has_flag(target->value.building, IF_INFRA)) {
|
||
|
fc_snprintf(buf[3], column_size, _("%d/turn"),
|
||
|
MAX(0, pcity->surplus[O_SHIELD]));
|
||
|
} else {
|
||
| client/cityrepdata.c | ||
|---|---|---|
|
gui_options.concise_city_production ? "+" : _("(worklist)");
|
||
|
if (city_production_is_genus(pcity, IG_CONVERT)) {
|
||
|
if (city_production_has_flag(pcity, IF_GOLD)) {
|
||
|
if (city_production_has_flag(pcity, IF_GOLD)
|
||
|
|| city_production_has_flag(pcity, IF_INFRA)) {
|
||
|
fc_snprintf(buf, sizeof(buf), "%s (%d)%s",
|
||
|
city_production_name_translation(pcity),
|
||
|
MAX(0, pcity->surplus[O_SHIELD]), from_worklist);
|
||
| client/gui-qt/citydlg.cpp | ||
|---|---|---|
|
QRect rect2;
|
||
|
struct sprite *sprite;
|
||
|
bool useless = false;
|
||
|
bool is_coinage = false;
|
||
|
bool is_convert = false;
|
||
|
bool is_neutral = false;
|
||
|
bool is_sea = false;
|
||
|
bool is_flying = false;
|
||
| ... | ... | |
|
name = improvement_name_translation(target->value.building);
|
||
|
sprite = get_building_sprite(tileset, target->value.building);
|
||
|
useless = is_improvement_redundant(pcity, target->value.building);
|
||
|
is_coinage = improvement_has_flag(target->value.building, IF_GOLD);
|
||
|
is_convert = (target->value.building->genus == IG_CONVERT);
|
||
|
}
|
||
|
if (sprite != nullptr) {
|
||
| ... | ... | |
|
QItemDelegate::drawDecoration(painter, option, option.rect, pix_dec);
|
||
|
}
|
||
|
if (is_coinage) {
|
||
|
if (is_convert) {
|
||
|
pix_dec.fill(QColor(255, 255, 0, 70));
|
||
|
QItemDelegate::drawDecoration(painter, option, option.rect, pix_dec);
|
||
|
}
|
||
| client/gui-sdl2/wldlg.c | ||
|---|---|---|
|
editor->currently_building, &cost);
|
||
|
if (convert_prod) {
|
||
|
int output = MAX(0, editor->pcity->surplus[O_SHIELD]);
|
||
|
if (improvement_has_flag(editor->currently_building.value.building,
|
||
|
IF_GOLD)) {
|
||
|
int gold = MAX(0, editor->pcity->surplus[O_SHIELD]);
|
||
|
fc_snprintf(cbuf, sizeof(cbuf),
|
||
|
PL_("%s\n%d gold per turn",
|
||
|
"%s\n%d gold per turn", gold),
|
||
|
name, gold);
|
||
|
"%s\n%d gold per turn", output),
|
||
|
name, output);
|
||
|
} else if (improvement_has_flag(editor->currently_building.value.building,
|
||
|
IF_INFRA)) {
|
||
|
fc_snprintf(cbuf, sizeof(cbuf),
|
||
|
PL_("%s\n%d infrapoint per turn",
|
||
|
"%s\n%d infrapoints per turn", output),
|
||
|
name, output);
|
||
|
} else {
|
||
|
fc_snprintf(cbuf, sizeof(cbuf), "%s\n-", name);
|
||
|
}
|
||
| ... | ... | |
|
count = city_production_build_shield_cost(pcity);
|
||
|
if (convert_prod) {
|
||
|
if (city_production_has_flag(pcity, IF_GOLD)) {
|
||
|
int gold = MAX(0, pcity->surplus[O_SHIELD]);
|
||
|
int output = MAX(0, pcity->surplus[O_SHIELD]);
|
||
|
if (city_production_has_flag(pcity, IF_GOLD)) {
|
||
|
fc_snprintf(cbuf, sizeof(cbuf),
|
||
|
PL_("%s\n%d gold per turn",
|
||
|
"%s\n%d gold per turn", gold),
|
||
|
name, gold);
|
||
|
"%s\n%d gold per turn", output),
|
||
|
name, output);
|
||
|
} else if (city_production_has_flag(pcity, IF_INFRA)) {
|
||
|
fc_snprintf(cbuf, sizeof(cbuf),
|
||
|
PL_("%s\n%d infrapoint per turn",
|
||
|
"%s\n%d infrapoints per turn", output),
|
||
|
name, output);
|
||
|
} else {
|
||
|
fc_snprintf(cbuf, sizeof(cbuf), "%s\n-", name);
|
||
|
}
|
||
| ... | ... | |
|
}
|
||
|
}
|
||
|
} else {
|
||
|
/* coinage-like */
|
||
|
if (improvement_has_flag(pimprove, IF_GOLD)) {
|
||
|
int gold = MAX(0, pcity->surplus[O_SHIELD]);
|
||
|
int output = MAX(0, pcity->surplus[O_SHIELD]);
|
||
|
/* Coinage-like */
|
||
|
if (improvement_has_flag(pimprove, IF_GOLD)) {
|
||
|
fc_snprintf(cbuf, sizeof(cbuf), PL_("%d gold per turn",
|
||
|
"%d gold per turn", gold),
|
||
|
gold);
|
||
|
"%d gold per turn", output),
|
||
|
output);
|
||
|
} else if (improvement_has_flag(pimprove, IF_INFRA)) {
|
||
|
fc_snprintf(cbuf, sizeof(cbuf), PL_("%d infrapoint per turn",
|
||
|
"%d infrapoints per turn", output),
|
||
|
output);
|
||
|
} else {
|
||
|
fc_strlcpy(cbuf, "-", sizeof(cbuf));
|
||
|
}
|
||
|
}
|
||
|
} else {
|
||
|
/* non city mode */
|
||
|
/* Non city mode */
|
||
|
if (!is_convert_improvement(pimprove)) {
|
||
|
int cost = impr_build_shield_cost(NULL, pimprove);
|
||
| ... | ... | |
|
} else {
|
||
|
if (improvement_has_flag(pimprove, IF_GOLD)) {
|
||
|
fc_strlcpy(cbuf, _("shields into gold"), sizeof(cbuf));
|
||
|
} else if (improvement_has_flag(pimprove, IF_INFRA)) {
|
||
|
fc_strlcpy(cbuf, _("shields into infrapoints"), sizeof(cbuf));
|
||
|
} else {
|
||
|
fc_strlcpy(cbuf, "-", sizeof(cbuf));
|
||
|
}
|
||
| client/gui-sdl3/wldlg.c | ||
|---|---|---|
|
editor->currently_building, &cost);
|
||
|
if (convert_prod) {
|
||
|
int output = MAX(0, editor->pcity->surplus[O_SHIELD]);
|
||
|
if (improvement_has_flag(editor->currently_building.value.building,
|
||
|
IF_GOLD)) {
|
||
|
int gold = MAX(0, editor->pcity->surplus[O_SHIELD]);
|
||
|
fc_snprintf(cbuf, sizeof(cbuf),
|
||
|
PL_("%s\n%d gold per turn",
|
||
|
"%s\n%d gold per turn", gold),
|
||
|
name, gold);
|
||
|
"%s\n%d gold per turn", output),
|
||
|
name, output);
|
||
|
} else if (improvement_has_flag(editor->currently_building.value.building,
|
||
|
IF_INFRA)) {
|
||
|
fc_snprintf(cbuf, sizeof(cbuf),
|
||
|
PL_("%s\n%d infrapoint per turn",
|
||
|
"%s\n%d infrapoints per turn", output),
|
||
|
name, output);
|
||
|
} else {
|
||
|
fc_snprintf(cbuf, sizeof(cbuf), "%s\n-", name);
|
||
|
}
|
||
| ... | ... | |
|
count = city_production_build_shield_cost(pcity);
|
||
|
if (convert_prod) {
|
||
|
if (city_production_has_flag(pcity, IF_GOLD)) {
|
||
|
int gold = MAX(0, pcity->surplus[O_SHIELD]);
|
||
|
int output = MAX(0, pcity->surplus[O_SHIELD]);
|
||
|
if (city_production_has_flag(pcity, IF_GOLD)) {
|
||
|
fc_snprintf(cbuf, sizeof(cbuf),
|
||
|
PL_("%s\n%d gold per turn",
|
||
|
"%s\n%d gold per turn", gold),
|
||
|
name, gold);
|
||
|
"%s\n%d gold per turn", output),
|
||
|
name, output);
|
||
|
} else if (city_production_has_flag(pcity, IF_INFRA)) {
|
||
|
fc_snprintf(cbuf, sizeof(cbuf),
|
||
|
PL_("%s\n%d infrapoint per turn",
|
||
|
"%s\n%d infrapoints per turn", output),
|
||
|
name, output);
|
||
|
} else {
|
||
|
fc_snprintf(cbuf, sizeof(cbuf), "%s\n-", name);
|
||
|
}
|
||
| ... | ... | |
|
}
|
||
|
}
|
||
|
} else {
|
||
|
/* coinage-like */
|
||
|
if (improvement_has_flag(pimprove, IF_GOLD)) {
|
||
|
int gold = MAX(0, pcity->surplus[O_SHIELD]);
|
||
|
int output = MAX(0, pcity->surplus[O_SHIELD]);
|
||
|
/* Coinage-like */
|
||
|
if (improvement_has_flag(pimprove, IF_GOLD)) {
|
||
|
fc_snprintf(cbuf, sizeof(cbuf), PL_("%d gold per turn",
|
||
|
"%d gold per turn", gold),
|
||
|
gold);
|
||
|
"%d gold per turn", output),
|
||
|
output);
|
||
|
} else if (improvement_has_flag(pimprove, IF_INFRA)) {
|
||
|
fc_snprintf(cbuf, sizeof(cbuf), PL_("%d infrapoint per turn",
|
||
|
"%d infrapoints per turn", output),
|
||
|
output);
|
||
|
} else {
|
||
|
fc_strlcpy(cbuf, "-", sizeof(cbuf));
|
||
|
}
|
||
|
}
|
||
|
} else {
|
||
|
/* non city mode */
|
||
|
/* Non city mode */
|
||
|
if (!is_convert_improvement(pimprove)) {
|
||
|
int cost = impr_build_shield_cost(NULL, pimprove);
|
||
| ... | ... | |
|
} else {
|
||
|
if (improvement_has_flag(pimprove, IF_GOLD)) {
|
||
|
fc_strlcpy(cbuf, _("shields into gold"), sizeof(cbuf));
|
||
|
} else if (improvement_has_flag(pimprove, IF_INFRA)) {
|
||
|
fc_strlcpy(cbuf, _("shields into infrapoints"), sizeof(cbuf));
|
||
|
} else {
|
||
|
fc_strlcpy(cbuf, "-", sizeof(cbuf));
|
||
|
}
|
||
| common/improvement.c | ||
|---|---|---|
|
{
|
||
|
return (!improvement_obsolete(city_owner(pcity), pimprove, pcity)
|
||
|
&& (improvement_has_flag(pimprove, IF_GOLD)
|
||
|
|| improvement_has_flag(pimprove, IF_INFRA)
|
||
|
|| improvement_has_side_effects(pcity, pimprove)
|
||
|
|| improvement_has_effects(pcity, pimprove)));
|
||
|
}
|
||
| ... | ... | |
|
- all of its effects (if any) are provided by other means, or it's
|
||
|
obsolete (and thus assumed to have no effect); and
|
||
|
- it's not enabling the city to build some kind of units; and
|
||
|
- it's not Coinage (IF_GOLD).
|
||
|
- it's not convert production (IF_GOLD or IF_INFRA).
|
||
|
(Note that it's not impossible that this improvement could become useful
|
||
|
if circumstances changed, say if a new government enabled the building
|
||
|
of its special units.)
|
||
| ... | ... | |
|
if (improvement_has_flag(pimprove, IF_GOLD)) {
|
||
|
return FALSE;
|
||
|
}
|
||
|
if (improvement_has_flag(pimprove, IF_INFRA)) {
|
||
|
return FALSE;
|
||
|
}
|
||
|
/* If an improvement has side effects, don't claim it's redundant. */
|
||
|
if (improvement_has_side_effects(pcity, pimprove)) {
|
||
| gen_headers/enums/fc_types_enums.def | ||
|---|---|---|
|
SAVE_SMALL_WONDER "SaveSmallWonder"
|
||
|
/* When built, gives gold */
|
||
|
GOLD "Gold"
|
||
|
/* When built, gives infrapoints */
|
||
|
INFRA "Infra"
|
||
|
/* Never destroyed by disasters */
|
||
|
DISASTER_PROOF "DisasterProof"
|
||
|
/* Never destroyed by a surgical strike */
|
||
| server/cityturn.c | ||
|---|---|---|
|
* this turn. */
|
||
|
if (city_production_has_flag(pcity, IF_GOLD)) {
|
||
|
pplayer->economic.gold += pcity->before_change_shields;
|
||
|
} else if (city_production_has_flag(pcity, IF_INFRA)) {
|
||
|
pplayer->economic.infra_points += pcity->before_change_shields;
|
||
|
}
|
||
|
pcity->before_change_shields = 0;
|
||
| server/ruleset/rssanity.c | ||
|---|---|---|
|
{
|
||
|
/* Special Genus */
|
||
|
improvement_re_active_iterate(pimprove) {
|
||
|
if (improvement_has_flag(pimprove, IF_GOLD)
|
||
|
&& pimprove->genus != IG_CONVERT) {
|
||
|
if (improvement_has_flag(pimprove, IF_GOLD)) {
|
||
|
if (pimprove->genus != IG_CONVERT) {
|
||
|
ruleset_error(logger, LOG_ERROR,
|
||
|
_("Gold producing improvement %s with genus other than \"Convert\""),
|
||
|
improvement_rule_name(pimprove));
|
||
|
return FALSE;
|
||
|
}
|
||
|
if (improvement_has_flag(pimprove, IF_INFRA)) {
|
||
|
ruleset_error(logger, LOG_ERROR,
|
||
|
_("The same improvement has both \"Gold\" and \"Infra\" flags"));
|
||
|
return FALSE;
|
||
|
}
|
||
|
} else if (improvement_has_flag(pimprove, IF_INFRA)) {
|
||
|
if (pimprove->genus != IG_CONVERT) {
|
||
|
ruleset_error(logger, LOG_ERROR,
|
||
|
_("Infrapoints producing improvement %s with genus other than \"Convert\""),
|
||
|
improvement_rule_name(pimprove));
|
||
|
return FALSE;
|
||
|
}
|
||
|
} else if (pimprove->genus == IG_CONVERT) {
|
||
|
ruleset_error(logger, LOG_ERROR,
|
||
|
_("Gold producing improvement %s with genus other than \"Convert\""),
|
||
|
_("Improvement %s with no conversion target with genus \"Convert\""),
|
||
|
improvement_rule_name(pimprove));
|
||
|
return FALSE;
|
||
|
}
|
||
|
if (improvement_has_flag(pimprove, IF_DISASTER_PROOF)
|
||
|
&& pimprove->genus != IG_IMPROVEMENT) {
|
||
|
ruleset_error(logger, LOG_ERROR,
|
||