Project

Profile

Help

HostedRedmine.com has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. *Read more...*

Feature #818935 ยป 0002-Improve-city_improvement_upkeep-coding-style.patch

Marko Lindqvist, 2019-05-29 05:03 PM

View differences:

common/city.c
}
city_built_iterate(pcity, pimprove) {
gold_needed += city_improvement_upkeep(pcity, pimprove);
gold_needed += city_improvement_upkeep(pcity, pimprove);
} city_built_iterate_end;
return gold_needed;
......
Return TRUE iff the city has this building in it.
**************************************************************************/
bool city_has_building(const struct city *pcity,
const struct impr_type *pimprove)
const struct impr_type *pimprove)
{
if (NULL == pimprove) {
/* callers should ensure that any external data is tested with
/* Callers should ensure that any external data is tested with
* valid_improvement_by_number() */
return FALSE;
}
......
in the given city.
**************************************************************************/
int city_improvement_upkeep(const struct city *pcity,
const struct impr_type *b)
const struct impr_type *b)
{
int upkeep;
if (NULL == b)
if (NULL == b) {
return 0;
if (is_wonder(b))
}
if (is_wonder(b)) {
return 0;
}
upkeep = b->upkeep;
if (upkeep <= get_building_bonus(pcity, b, EFT_UPKEEP_FREE)) {
return 0;
}
return upkeep;
}
......
This can be used to calculate the benefits celebration would give.
**************************************************************************/
int city_tile_output(const struct city *pcity, const struct tile *ptile,
bool is_celebrating, Output_type_id otype)
bool is_celebrating, Output_type_id otype)
{
int prod;
struct terrain *pterrain = tile_terrain(ptile);
......
O_SHIELD, or O_TRADE).
**************************************************************************/
int city_tile_output_now(const struct city *pcity, const struct tile *ptile,
Output_type_id otype)
Output_type_id otype)
{
return city_tile_output(pcity, ptile, city_celebrating(pcity), otype);
}
    (1-1/1)