123#define SPECLIST_TAG cityimpr
124#define SPECLIST_TYPE struct cityimpr
127#define cityimpr_list_iterate(cityimprlist, pcityimpr) \
128 TYPED_LIST_ITERATE(struct cityimpr, cityimprlist, pcityimpr)
129#define cityimpr_list_iterate_end LIST_ITERATE_END
132 struct cityimpr_list *imprs);
134 struct unit_list *punitlist);
154 struct city *pcity_to);
222 if (pcity->server.needs_refresh) {
250 PL_(
"%s is selling %s (obsolete) for %d.",
251 "%s is selling %s (obsolete) for %d.",
260 if (sold && refresh) {
301 if (pwork == pcity) {
350 cmp->happy_factor = 0;
373 bool broadcast_needed;
425 _(
"The citizen governor can't fulfill the requirements "
426 "for %s. Passing back control."),
439 cmp.minimal_surplus[o] = 0;
450 cmp.minimal_surplus[o] =
MIN(
cmp.minimal_surplus[o],
474 log_error(
"%s radius changed when already arranged workers.",
481 if (broadcast_needed) {
495 const struct impr_type *pimprove = pcity->production.value.building;
497 if (VUT_IMPROVEMENT == pcity->production.kind
503 _(
"Notice: Wonder %s in %s will be finished next turn."),
514 struct conn_list *dest,
515 const struct player *cache_for_player)
519 int turns_growth, turns_granary;
534 if (5 > turns_growth && 5 > turns_granary
535 && turns_growth < turns_granary) {
538 _(
"Suggest throttling growth in %s to use %s "
539 "(being built) more effectively."),
543 if (NULL != cache_for_player) {
553 _(
"%s may soon grow to size %i."),
556 if (NULL != cache_for_player) {
565 _(
"Warning: Famine feared in %s."),
city_link(pcity));
567 if (NULL != cache_for_player) {
583 if (NULL != pplayer) {
611 n = city_list_size(pplayer->
cities);
630 if (proute->dir != RDIR_FROM &&
goods_has_flag(proute->goods, GF_DEPLETES)
683 case GOLD_UPKEEP_CITY:
685 case GOLD_UPKEEP_MIXED:
689 case GOLD_UPKEEP_NATION:
705 _(
"WARNING, we're LOW on FUNDS %s."),
711 if (pplayer->got_tech && pplayer->research->researched > 0) {
712 pplayer->research->researched = 0;
732 enum unit_loss_reason wipe_reason,
733 bool wipe_in_the_end)
749 NULL, NULL, NULL, NULL);
776 return change - want;
792 ptile, _index, _x, _y) {
799 return change - want;
808 struct player *destroyer,
const char *reason)
843 if (loss_remain > 0) {
845#ifndef FREECIV_NDEBUG
864 "city_reduce_size() has remaining"
865 "%d of %d for \"%s\"[%d]",
866 loss_remain, pop_loss,
880 if (reason != NULL) {
884 (lua_Integer)(-pop_loss), reason);
900 }
else if (change < 0) {
904#ifndef FREECIV_NDEBUG
911 "city_repair_size() has remaining %d of %d for \"%s\"[%d]",
927 return CLIP(0, savings, 100);
953 bool have_square =
FALSE;
965 _(
"%s needs %s (being built) to grow beyond size %d."),
971 _(
"%s needs an improvement to grow beyond size %d."),
998 ptile, _index, _x, _y) {
1027 struct player *nationality)
1049 _(
"%s grows to size %d."),
1061 struct player *nationality,
const char *reason)
1085 real_change = current_size - old_size;
1087 if (real_change != 0 && reason != NULL) {
1089 (lua_Integer)real_change, reason);
1095 }
else if (change < 0) {
1113 int saved_id = pcity->
id;
1121 _(
"A recent plague outbreak prevents growth in %s."),
1134 (lua_Integer)1,
"growth");
1153 _(
"Famine feared in %s, %s lost!"),
1167 _(
"Famine causes population loss in %s."),
1172 _(
"Famine destroys %s entirely."),
1191 const void *ptarget;
1192 const char *tgt_name;
1193 const struct requirement_vector *build_reqs;
1194 const char *signal_name;
1205 switch (target->
kind) {
1210 signal_name =
"unit_cant_be_built";
1212 case VUT_IMPROVEMENT:
1216 signal_name =
"building_cant_be_built";
1228 switch (preq->source.kind) {
1230 if (preq->present) {
1233 _(
"%s can't build %s from the worklist; "
1234 "tech %s not yet available. Postponing..."),
1238 (preq->source.value.advance));
1240 pcity,
"need_tech");
1247 if (preq->present) {
1250 _(
"%s can't build %s from the worklist; "
1251 "no tech with flag \"%s\" yet available. "
1255 tech_flag_id_name(preq->source.value.techflag));
1257 pcity,
"need_techflag");
1263 case VUT_IMPROVEMENT:
1264 if (preq->range == REQ_RANGE_LOCAL) {
1268 if (preq->present) {
1271 _(
"%s can't build %s from the worklist; "
1272 "need to have %s first. Postponing..."),
1276 preq->source.value.building));
1278 pcity,
"need_building");
1282 _(
"%s can't build %s from the worklist; "
1283 "need to not have %s. Postponing..."),
1287 preq->source.value.building));
1289 pcity,
"have_building");
1293 case VUT_IMPR_GENUS:
1294 if (preq->range == REQ_RANGE_LOCAL) {
1298 if (preq->present) {
1301 _(
"%s can't build %s from the worklist; "
1302 "need to have %s first. Postponing..."),
1305 impr_genus_id_translated_name(
1306 preq->source.value.impr_genus));
1308 pcity,
"need_building_genus");
1312 _(
"%s can't build %s from the worklist; "
1313 "need to not have %s. Postponing..."),
1316 impr_genus_id_translated_name(
1317 preq->source.value.impr_genus));
1319 pcity,
"have_building_genus");
1323 case VUT_GOVERNMENT:
1324 if (preq->present) {
1327 _(
"%s can't build %s from the worklist; "
1328 "it needs %s government. Postponing..."),
1333 pcity,
"need_government");
1337 _(
"%s can't build %s from the worklist; "
1338 "it cannot have %s government. Postponing..."),
1343 pcity,
"have_government");
1346 case VUT_ACHIEVEMENT:
1347 if (preq->present) {
1350 _(
"%s can't build %s from the worklist; "
1351 "it needs \"%s\" achievement. Postponing..."),
1356 pcity,
"need_achievement");
1363 if (preq->present) {
1366 Q_(
"?extra:%s can't build %s from the worklist; "
1367 "%s is required. Postponing..."),
1372 pcity,
"need_extra");
1376 Q_(
"?extra:%s can't build %s from the worklist; "
1377 "%s is prohibited. Postponing..."),
1382 pcity,
"have_extra");
1386 if (preq->present) {
1389 Q_(
"?extra:%s can't build %s from the worklist; "
1390 "%s is required. Postponing..."),
1395 pcity,
"need_good");
1399 Q_(
"?extra:%s can't build %s from the worklist; "
1400 "%s is prohibited. Postponing..."),
1405 pcity,
"have_good");
1409 if (preq->present) {
1412 Q_(
"?terrain:%s can't build %s from the worklist; "
1413 "%s terrain is required. Postponing..."),
1418 pcity,
"need_terrain");
1422 Q_(
"?terrain:%s can't build %s from the worklist; "
1423 "%s terrain is prohibited. Postponing..."),
1428 pcity,
"have_terrain");
1432 if (preq->range < REQ_RANGE_TRADE_ROUTE
1433 || preq->range == REQ_RANGE_PLAYER) {
1437 if (preq->present) {
1441 Q_(
"?nation:%s can't build %s from the worklist; "
1442 "%s nation is required. Postponing..."),
1447 pcity,
"need_nation");
1451 Q_(
"?nation:%s can't build %s from the worklist; "
1452 "%s nation is prohibited. Postponing..."),
1457 pcity,
"have_nation");
1461 case VUT_NATIONGROUP:
1462 if (preq->range < REQ_RANGE_TRADE_ROUTE
1463 || preq->range == REQ_RANGE_PLAYER) {
1467 if (preq->present) {
1471 Q_(
"?ngroup:%s can't build %s from the worklist; "
1472 "%s nation is required. Postponing..."),
1477 pcity,
"need_nationgroup");
1481 Q_(
"?ngroup:%s can't build %s from the worklist; "
1482 "%s nation is prohibited. Postponing..."),
1487 pcity,
"have_nationgroup");
1495 if (preq->present) {
1498 _(
"%s can't build %s from the worklist; "
1499 "only %s style cities may build this. Postponing..."),
1504 pcity,
"need_style");
1508 _(
"%s can't build %s from the worklist; "
1509 "%s style cities may not build this. Postponing..."),
1514 pcity,
"have_style");
1517 case VUT_NATIONALITY:
1520 if (preq->present) {
1524 _(
"%s can't build %s from the worklist; "
1525 "only city with %s may build this. Postponing..."),
1530 pcity,
"need_nationality");
1535 _(
"%s can't build %s from the worklist; "
1536 "only city without %s may build this. Postponing..."),
1541 pcity,
"have_nationality");
1545 case VUT_DIPLREL_TILE:
1546 case VUT_DIPLREL_TILE_O:
1547 if (preq->present) {
1555 _(
"%s can't build %s from the worklist; "
1556 "the relationship '%s' is required."
1561 preq->source.value.diplrel));
1563 if (preq->source.kind == VUT_DIPLREL_TILE) {
1564 reason =
"need_diplrel_tile";
1565 }
else if (preq->source.kind == VUT_DIPLREL_TILE_O) {
1566 reason =
"need_diplrel_tile_o";
1568 fc_assert(preq->source.kind == VUT_DIPLREL);
1569 reason =
"need_diplrel";
1579 _(
"%s can't build %s from the worklist; "
1580 "the relationship '%s' is prohibited."
1585 preq->source.value.diplrel));
1587 if (preq->source.kind == VUT_DIPLREL_TILE) {
1588 reason =
"have_diplrel_tile";
1589 }
else if (preq->source.kind == VUT_DIPLREL_TILE_O) {
1590 reason =
"have_diplrel_tile_o";
1592 fc_assert(preq->source.kind == VUT_DIPLREL);
1593 reason =
"have_diplrel";
1600 case VUT_DIPLREL_UNITANY:
1601 case VUT_DIPLREL_UNITANY_O:
1602 if (preq->present) {
1610 _(
"%s can't build %s from the worklist; "
1611 "unit with the relationship '%s' is required."
1616 preq->source.value.diplrel));
1618 if (preq->source.kind == VUT_DIPLREL_UNITANY) {
1619 reason =
"need_diplrel_unitany";
1621 fc_assert(preq->source.kind == VUT_DIPLREL_UNITANY_O);
1622 reason =
"need_diplrel_unitany_o";
1632 _(
"%s can't build %s from the worklist; "
1633 "unit with the relationship '%s' is prohibited."
1638 preq->source.value.diplrel));
1640 if (preq->source.kind == VUT_DIPLREL_UNITANY) {
1641 reason =
"have_diplrel_unitany";
1643 fc_assert(preq->source.kind == VUT_DIPLREL_UNITANY_O);
1644 reason =
"have_diplrel_unitany_o";
1652 if (preq->present) {
1655 _(
"%s can't build %s from the worklist; "
1656 "city must be of size %d or larger. "
1660 preq->source.value.minsize);
1662 pcity,
"need_minsize");
1666 _(
"%s can't build %s from the worklist; "
1667 "city must be of size %d or smaller."
1671 (preq->source.value.minsize - 1));
1673 pcity,
"need_minsize");
1676 case VUT_MINCULTURE:
1677 if (preq->present) {
1680 _(
"%s can't build %s from the worklist; "
1681 "city must have culture of %d. Postponing..."),
1684 preq->source.value.minculture);
1686 pcity,
"need_minculture");
1692 case VUT_MINFOREIGNPCT:
1693 if (preq->present) {
1696 _(
"%s can't build %s from the worklist; "
1697 "city must have %d%% foreign population. Postponing..."),
1700 preq->source.value.minforeignpct);
1702 pcity,
"need_minforeignpct");
1706 _(
"%s can't build %s from the worklist; "
1707 "city must have %d%% native population. Postponing..."),
1710 100 - preq->source.value.minforeignpct);
1712 pcity,
"need_minforeignpct");
1716 if (preq->present) {
1719 _(
"%s can't build %s from the worklist; "
1720 "%d techs must be known. Postponing..."),
1723 preq->source.value.min_techs);
1725 pcity,
"need_mintechs");
1730 case VUT_MAXTILEUNITS:
1731 if (preq->present) {
1734 PL_(
"%s can't build %s from the worklist; "
1735 "more than %d unit on tile."
1737 "%s can't build %s from the worklist; "
1738 "more than %d units on tile."
1740 preq->source.value.max_tile_units),
1743 preq->source.value.max_tile_units);
1745 pcity,
"need_tileunits");
1749 PL_(
"%s can't build %s from the worklist; "
1750 "fewer than %d unit on tile."
1752 "%s can't build %s from the worklist; "
1753 "fewer than %d units on tile."
1755 preq->source.value.max_tile_units + 1),
1758 preq->source.value.max_tile_units + 1);
1760 pcity,
"need_tileunits");
1767 case VUT_TERRAINCLASS:
1773 if (preq->present) {
1776 _(
"%s can't build %s from the worklist; "
1777 "terrain with \"%s\" flag is required. "
1781 terrain_flag_id_name(preq->source.value.terrainflag));
1783 pcity,
"need_terrainflag");
1787 _(
"%s can't build %s from the worklist; "
1788 "terrain with \"%s\" flag is prohibited. "
1792 terrain_flag_id_name(preq->source.value.terrainflag));
1794 pcity,
"have_terrainflag");
1798 if (preq->present) {
1801 _(
"%s can't build %s from the worklist; "
1802 "road with \"%s\" flag is required. "
1806 road_flag_id_name(preq->source.value.roadflag));
1808 pcity,
"need_roadflag");
1812 _(
"%s can't build %s from the worklist; "
1813 "road with \"%s\" flag is prohibited. "
1817 road_flag_id_name(preq->source.value.roadflag));
1819 pcity,
"have_roadflag");
1823 if (preq->present) {
1826 _(
"%s can't build %s from the worklist; "
1827 "extra with \"%s\" flag is required. "
1831 extra_flag_id_translated_name(preq->source.value.extraflag));
1833 pcity,
"need_extraflag");
1837 _(
"%s can't build %s from the worklist; "
1838 "extra with \"%s\" flag is prohibited. "
1842 extra_flag_id_translated_name(preq->source.value.extraflag));
1844 pcity,
"have_extraflag");
1851 case VUT_MINVETERAN:
1858 case VUT_SPECIALIST:
1859 case VUT_TERRAINALTER:
1862 log_error(
"worklist_change_build_target() has bogus preq");
1864 case VUT_CITYSTATUS:
1865 if (preq->source.value.citystatus == CITYS_OWNED_BY_ORIGINAL) {
1866 if (preq->range == REQ_RANGE_CITY) {
1870 if (preq->present) {
1874 _(
"%s can't build %s from the worklist; "
1875 "only available when city in range %s \"%s\". "
1878 tgt_name, req_range_name(preq->range),
1879 citystatus_type_name(preq->source.value.citystatus));
1881 pcity,
"need_citystatus");
1886 _(
"%s can't build %s from the worklist; "
1887 "not available when city in range %s is \"%s\". "
1890 tgt_name, req_range_name(preq->range),
1891 citystatus_type_name(preq->source.value.citystatus));
1893 pcity,
"have_citystatus");
1898 log_error(
"worklist_change_build_target() has bogus citystatus preq");
1902 if (preq->present) {
1906 _(
"%s can't build %s from the worklist; "
1907 "only available from %s. Postponing..."),
1910 textyear(preq->source.value.minyear));
1912 pcity,
"need_minyear");
1918 case VUT_MINCALFRAG:
1921 if (preq->present) {
1926 _(
"%s can't build %s from the worklist; "
1927 "only available from %s. Postponing..."),
1932 pcity,
"need_mincalfrag");
1939 _(
"%s can't build %s from the worklist; "
1940 "not available after %s. Postponing..."),
1945 pcity,
"have_mincalfrag");
1949 if (preq->present) {
1954 _(
"%s can't build %s from the worklist; "
1955 "only available in worlds with %s map."),
1958 _(topo_flag_name(preq->source.value.topo_property)));
1960 pcity,
"need_topo");
1964 case VUT_SERVERSETTING:
1972 _(
"%s can't build %s from the worklist; "
1973 "only available when the server setting "
1980 pcity,
"need_setting");
1985 if (preq->present) {
1988 _(
"%s can't build %s from the worklist; "
1989 "only available once %d turns old. Postponing..."),
1992 preq->source.value.age);
2003 "worklist_change_build_target() "
2004 "called with invalid preq");
2041 bool success =
FALSE;
2043 int saved_id = pcity->
id;
2044 bool city_checked =
TRUE;
2055 if (!city_checked) {
2061 city_checked =
TRUE;
2075 switch (target.
kind) {
2091 _(
"%s can't build %s from the worklist; "
2092 "tech %s not yet available. Postponing..."),
2102 city_checked =
FALSE;
2112 _(
"%s can't build %s from the worklist. Purging..."),
2121 city_checked =
TRUE;
2126 city_checked =
FALSE;
2131 _(
"Production of %s is upgraded to %s in %s."),
2139 case VUT_IMPROVEMENT:
2164 city_checked =
TRUE;
2166 }
else if (success) {
2169 _(
"Production of %s is upgraded to %s in %s."),
2180 _(
"%s can't build %s from the worklist. Purging..."),
2186 city_checked =
TRUE;
2191 city_checked =
FALSE;
2198 log_error(
"worklist_change_build_target() has unrecognized "
2199 "target kind (%d)", target.
kind);
2218 _(
"The %s worklist is now empty."),
2249 case VUT_IMPROVEMENT:
2263 log_debug(
"Trying advisor_choose_build.");
2265 log_debug(
"Advisor_choose_build didn't kill us.");
2276 const struct impr_type *check = pimprove;
2277 const struct impr_type *best_upgrade = NULL;
2284 best_upgrade = check;
2288 return best_upgrade;
2302 _(
"Production of %s is upgraded to %s in %s."),
2322 const struct unit_type *check = punittype;
2330 best_upgrade = check;
2334 return best_upgrade;
2348 _(
"Production of %s is upgraded to %s in %s."),
2366 int size_reduction = 0;
2367 struct unit *sacrifizer;
2382 _(
"%s can't upkeep %s, unit disbanded."),
2418 if (size_reduction > 0) {
2419 if (size_reduction == 1) {
2422 _(
"Citizens in %s perish for their failure to "
2428 _(
"Citizens in %s perish for their failure to "
2449 int saved_id = pcity->
id;
2471 _(
"%s is building %s, which is no longer available."),
2511 _(
"The %s have finished building %s in %s."),
2518 _(
"%s has finished building %s."),
2539 PL_(
"%s boosts research; you gain %d immediate "
2541 "%s boosts research; you gain %d immediate "
2543 mod), provider, mod);
2546 for (i = 0; i < mod; i++) {
2553 Q_(
"?frombldg:Acquired %s from %s."), adv_name,
2559 Q_(
"?frombldg:The %s have acquired %s "
2561 research_name, adv_name, provider);
2566 _(
"The %s have started building a spaceship!"),
2653 int unit_shield_cost, num_units, i;
2654 int saved_city_id = pcity->
id;
2676 _(
"%s is building %s, which is no longer available."),
2680 log_verbose(
"%s %s tried to build %s, which is not available.",
2701 _(
"%s can't build %s yet. "
2702 "(city size: %d, unit population cost: %d)"),
2721 for (i = 0; i < num_units; i++) {
2736 _(
"%s is finished building %s."),
2760 log_normal(
"City %s (%s) has built %s but has no %d shields "
2773 PL_(
"%s cost %d population. %s shrinks to size %d.",
2774 "%s cost %d population. %s shrinks to size %d.",
2814 case VUT_IMPROVEMENT:
2837 struct cityimpr_list *imprs)
2844 if (!imprs || cityimpr_list_size(imprs) == 0) {
2848 r =
fc_rand(cityimpr_list_size(imprs));
2849 pcityimpr = cityimpr_list_get(imprs, r);
2853 _(
"Can't afford to maintain %s in %s, building sold!"),
2861 cityimpr_list_remove(imprs, pcityimpr);
2924 unit_list_destroy(punitlist);
2940 struct unit_list *punitlist)
2944 struct unit_list *cargo;
2948 if (!punitlist || unit_list_size(punitlist) == 0) {
2952 r =
fc_rand(unit_list_size(punitlist));
2953 punit = unit_list_get(punitlist, r);
2955 cargo = unit_list_new();
2965 if (pcargo->server.upkeep_paid[
O_GOLD] > 0) {
2968 unit_list_append(cargo, pcargo);
2974 if (unit_list_size(cargo) > 0) {
2980 unit_list_destroy(cargo);
2982 unit_list_remove(punitlist, ret);
2987 unit_list_destroy(cargo);
2998 unit_list_remove(punitlist,
punit);
3004 _(
"Not enough gold. %s disbanded."),
3014 unit_list_remove(punitlist,
punit);
3025 struct cityimpr_list *pimprlist;
3026 bool sell_unit =
TRUE;
3032 pimprlist = cityimpr_list_new();
3042 cityimpr_list_append(pimprlist, ci);
3054 && (cityimpr_list_size(pimprlist) > 0
3056 if ((!sell_unit && cityimpr_list_size(pimprlist) > 0)
3062 sell_unit = !sell_unit;
3077 cityimpr_list_destroy(pimprlist);
3125 struct cityimpr_list *pimprlist;
3132 pimprlist = cityimpr_list_new();
3141 cityimpr_list_append(pimprlist, ci);
3156 cityimpr_list_destroy(pimprlist);
3320 int cost_per_citizen =
cost / pcity->
size;
3323 int third_party = pcity->
size - natives - tgt_cit;
3325 cost = cost_per_citizen * (natives + 0.7 * third_party + 0.5 * tgt_cit);
3354 log_debug(
"In %s, building %s. Beg of Turn shields = %d",
3386 bool is_celebrating;
3405 int revolution_turns;
3422 _(
"Celebrations in your honor in %s."),
3428 _(
"Celebrations canceled in %s."),
3452 saved_id = pcity->
id;
3496 case GOLD_UPKEEP_CITY:
3497 case GOLD_UPKEEP_MIXED:
3503 case GOLD_UPKEEP_NATION:
3508 revolution_turns =
get_city_bonus(pcity, EFT_REVOLUTION_UNHAPPINESS);
3510 const char *revomsg;
3513 if (pcity->
anarchy == revolution_turns) {
3517 revomsg =
_(
" Unrest threatens to spread beyond the city.");
3524 _(
"Civil disorder in %s.%s"),
3529 _(
"CIVIL DISORDER CONTINUES in %s.%s"),
3535 _(
"Order restored in %s."),
3544 if (revolution_turns > 0 && pcity->
anarchy > revolution_turns) {
3547 _(
"The people have overthrown your %s, "
3548 "your country is in turmoil."),
3579 struct city *rcity=NULL;
3582 int saved_id = pcity->
id;
3591 _(
"%s can't build %s yet, "
3592 "as we can't disband our only city."),
3620 _(
"%s is disbanded into %s."),
3690 int build_shield_cost = 0;
3691 bool has_wonder =
FALSE;
3719 score *= (1 + (1 - exp(- (
float)
MAX(0, build_shield_cost) / 1000)) / 5);
3753 score *= (1.0 +
get_city_bonus(pcity, EFT_MIGRATION_PCT) / 100.0);
3772 struct city *pcity_to)
3774 struct player *pplayer_from, *pplayer_to, *pplayer_citizen;
3775 struct tile *ptile_from, *ptile_to;
3777 const char *nation_from, *nation_to;
3778 struct city *rcity = NULL;
3779 int to_id = pcity_to->
id;
3782 if (!pcity_from || !pcity_to) {
3787 pplayer_citizen = pplayer_from;
3799 bool migration =
FALSE;
3806 int max_food_tile = -1;
3814 max_food_tile =
MAX(max_food_tile,
3818 if (max_food_tile >= 0
3826 if (pplayer_from == pplayer_to) {
3830 _(
"Migrants from %s can't go to %s because there is "
3831 "not enough food available!"),
3832 name_from, name_to);
3837 _(
"Migrants from %s can't go to %s (%s) because there "
3838 "is not enough food available!"),
3839 name_from, name_to, nation_to);
3842 _(
"Migrants from %s (%s) can't go to %s because there "
3843 "is not enough food available!"),
3844 name_from, nation_from, name_to);
3853 if (pplayer_from == pplayer_to) {
3857 _(
"Migrants from %s can't go to %s because it needs "
3858 "an improvement to grow!"),
3859 name_from, name_to);
3864 _(
"Migrants from %s can't go to %s (%s) because it "
3865 "needs an improvement to grow!"),
3866 name_from, name_to, nation_to);
3869 _(
"Migrants from %s (%s) can't go to %s because it "
3870 "needs an improvement to grow!"),
3871 name_from, nation_from, name_to);
3897 int id = pcity_from->
id;
3906 (lua_Integer)(-1),
"migration_from");
3910 pcity_from->
owner, NULL);
3918 _(
"%s was disbanded by its citizens."),
3933 pplayer_citizen = pplayer_to;
3952 if (pplayer_from == pplayer_to) {
3956 _(
"Migrants from %s moved to %s in search of a better "
3957 "life."), name_from, name_to);
3962 _(
"Migrants from %s moved to %s (%s) in search of a "
3964 name_from, name_to, nation_to);
3967 _(
"Migrants from %s (%s) moved to %s in search of a "
3969 name_from, nation_from, name_to);
3984 (lua_Integer)1,
"migration_to");
3989 log_debug(
"[M] T%d migration successful (%s -> %s)",
4018 bool internat =
FALSE;
4032 if (!pplayer->cities) {
4059 _(
"All stored food destroyed in %s."),
city_link(pcity));
4074 bool had_internal_effect =
FALSE;
4088 had_internal_effect =
TRUE;
4096 had_internal_effect =
TRUE;
4102 && pcity->
size > 1)) {
4106 _(
"%s destroys %s entirely."),
4112 _(
"%s causes population loss in %s."),
4116 had_internal_effect =
TRUE;
4126 imprs[total++] = pimprove;
4137 _(
"%s destroys %s in %s."),
4142 had_internal_effect =
TRUE;
4148 had_internal_effect =
TRUE;
4162 _(
"Production of %s in %s destroyed."),
4165 had_internal_effect =
TRUE;
4170 had_internal_effect);
4195 if (result < probability) {
4217 float best_city_player_score, best_city_world_score;
4218 struct city *best_city_player, *best_city_world, *acity;
4219 float score_from, score_tmp, weight;
4221 bool internat =
FALSE;
4241 best_city_player_score = 0.0;
4242 best_city_world_score = 0.0;
4243 best_city_player = NULL;
4244 best_city_world = NULL;
4250 log_debug(
"[M] T%d check city: %s score: %6.3f (%s)",
4260 if (!acity || acity == pcity) {
4275 if (dist > mgr_dist) {
4281 weight = ((float) (mgr_dist + 1 - dist) / (float) (mgr_dist + 1));
4284 log_debug(
"[M] T%d - compare city: %s (%s) dist: %d mgr_dist: %d "
4290 if (score_tmp > score_from && score_tmp > best_city_player_score) {
4292 best_city_player_score = score_tmp;
4293 best_city_player = acity;
4295 log_debug(
"[M] T%d - best city (player): %s (%s) score: "
4298 best_city_player_score, score_from);
4311 if (score_tmp > score_from && score_tmp > best_city_world_score) {
4313 best_city_world_score = score_tmp;
4314 best_city_world = acity;
4316 log_debug(
"[M] T%d - best city (world): %s (%s) score: "
4320 best_city_world_score, score_from);
4325 if (best_city_player != NULL) {
4332 _(
"Citizens of %s are thinking about migrating to %s "
4333 "for a better life."),
4334 city_link_text,
city_link(best_city_player));
4343 if (best_city_world != NULL) {
4354 _(
"Citizens of %s are thinking about migrating to %s "
4355 "(%s) for a better life."),
4356 city_link_text,
city_link(best_city_world), nname);
4386 bool changed =
FALSE;
4390 if (ptile->worked == pcity
const char * achievement_name_translation(struct achievement *pach)
void advisor_choose_build(struct player *pplayer, struct city *pcity)
int tile_border_source_radius_sq(struct tile *ptile)
const char * textcalfrag(int frag)
const char * textyear(int year)
struct player_slot * citizens_random(const struct city *pcity)
void citizens_nation_add(struct city *pcity, const struct player_slot *pslot, int add)
citizens citizens_nation_get(const struct city *pcity, const struct player_slot *pslot)
struct player * citizens_unit_nationality(const struct city *pcity, int pop_cost, struct citizens_reduction *pchange)
void citizens_reduction_apply(struct city *pcity, const struct citizens_reduction *pchange)
void citizens_convert(struct city *pcity)
void citizens_update(struct city *pcity, struct player *plr)
const char * city_improvement_name_translation(const struct city *pcity, const struct impr_type *pimprove)
bool can_city_build_unit_later(const struct city *pcity, const struct unit_type *punittype)
int city_granary_size(int city_size)
bool can_city_build_now(const struct city *pcity, const struct universal *target)
struct tile * city_map_to_tile(const struct civ_map *nmap, const struct tile *city_center, int city_radius_sq, int city_map_x, int city_map_y)
bool city_has_building(const struct city *pcity, const struct impr_type *pimprove)
bool is_capital(const struct city *pcity)
const char * city_name_get(const struct city *pcity)
void city_remove_improvement(struct city *pcity, const struct impr_type *pimprove)
int city_improvement_upkeep(const struct city *pcity, const struct impr_type *b)
int city_airlift_max(const struct city *pcity)
struct output_type * get_output_type(Output_type_id output)
bool is_city_option_set(const struct city *pcity, enum city_options option)
void city_size_add(struct city *pcity, int add)
bool city_production_has_flag(const struct city *pcity, enum impr_flag_id flag)
void city_refresh_from_main_map(struct city *pcity, bool *workers_map)
int city_production_unit_veteran_level(struct city *pcity, const struct unit_type *punittype)
bool can_city_build_improvement_now(const struct city *pcity, const struct impr_type *pimprove)
bool city_tile_index_to_xy(int *city_map_x, int *city_map_y, int city_tile_index, int city_radius_sq)
bool city_rapture_grow(const struct city *pcity)
int city_production_turns_to_build(const struct city *pcity, bool include_shield_stock)
bool city_unhappy(const struct city *pcity)
Specialist_type_id best_specialist(Output_type_id otype, const struct city *pcity)
struct city * city_list_find_number(struct city_list *This, int id)
bool city_celebrating(const struct city *pcity)
bool can_city_build_improvement_direct(const struct city *pcity, const struct impr_type *pimprove)
int city_illness_calc(const struct city *pcity, int *ill_base, int *ill_size, int *ill_trade, int *ill_pollution)
bool city_can_grow_to(const struct city *pcity, int pop_size)
bool city_happy(const struct city *pcity)
void city_add_improvement(struct city *pcity, const struct impr_type *pimprove)
int city_map_radius_sq_get(const struct city *pcity)
static int cmp(int v1, int v2)
int city_tile_output(const struct city *pcity, const struct tile *ptile, bool is_celebrating, Output_type_id otype)
int city_map_tiles(int city_radius_sq)
bool can_city_build_unit_direct(const struct city *pcity, const struct unit_type *punittype)
bool city_can_work_tile(const struct city *pcity, const struct tile *ptile)
bool city_production_build_units(const struct city *pcity, bool add_production, int *num_units)
void city_rally_point_clear(struct city *pcity)
bool can_city_build_improvement_later(const struct city *pcity, const struct impr_type *pimprove)
bool city_had_recent_plague(const struct city *pcity)
bool city_can_change_build(const struct city *pcity)
int city_total_unit_gold_upkeep(const struct city *pcity)
int city_total_impr_gold_upkeep(const struct city *pcity)
bool can_city_build_unit_now(const struct city *pcity, const struct unit_type *punittype)
#define cities_iterate_end
#define city_list_iterate_safe(citylist, _city)
#define city_list_iterate(citylist, pcity)
#define city_tile(_pcity_)
#define cities_iterate(pcity)
static citizens city_size_get(const struct city *pcity)
#define city_tile_iterate_skip_free_worked(_nmap, _radius_sq, _city_tile, _tile, _index, _x, _y)
#define output_type_iterate(output)
#define INCITE_IMPOSSIBLE_COST
#define city_owner(_pcity_)
#define city_tile_iterate_skip_free_worked_end
#define city_list_iterate_end
#define city_tile_iterate(_nmap, _radius_sq, _city_tile, _tile)
#define city_list_iterate_safe_end
#define city_tile_iterate_end
#define CITY_MAP_MAX_RADIUS
#define city_built_iterate(_pcity, _p)
#define city_built_iterate_end
#define output_type_iterate_end
static bool city_illness_check(const struct city *pcity)
static void uk_rem_gold_append(struct unit *punit)
static bool worklist_change_build_target(struct player *pplayer, struct city *pcity)
void remove_obsolete_buildings(struct player *pplayer)
static bool city_build_stuff(struct player *pplayer, struct city *pcity)
static void city_reset_foodbox(struct city *pcity, int new_size)
static void apply_disaster(struct city *pcity, struct disaster_type *pdis)
static bool city_distribute_surplus_shields(struct player *pplayer, struct city *pcity)
int city_granary_savings(const struct city *pcity)
static void unit_list_referred_destroy(struct unit_list *punitlist)
static bool place_pollution(struct city *pcity, enum extra_cause cause)
void choose_build_target(struct player *pplayer, struct city *pcity)
static void uk_rem_gold_callback(struct unit *punit)
void auto_arrange_workers(struct city *pcity)
void city_refresh_queue_add(struct city *pcity)
static struct unit_list * uk_rem_gold
static bool city_balance_treasury_buildings(struct city *pcity)
static void update_city_activity(struct city *pcity)
static void upgrade_unit_prod(struct city *pcity)
static float city_migration_score(struct city *pcity)
void nullify_prechange_production(struct city *pcity)
bool city_empty_food_stock(struct city *pcity)
bool check_city_migrations(void)
static void upgrade_building_prod(struct city *pcity)
bool city_change_size(struct city *pcity, citizens size, struct player *nationality, const char *reason)
static citizens city_reduce_specialists(struct city *pcity, citizens change)
static void city_global_turn_notify(struct conn_list *dest)
static void city_populate(struct city *pcity, struct player *nationality)
static void city_refresh_after_city_size_increase(struct city *pcity, struct player *nationality)
static void define_orig_production_values(struct city *pcity)
void city_repair_size(struct city *pcity, int change)
#define cityimpr_list_iterate(cityimprlist, pcityimpr)
static bool upkeep_kill_unit(struct unit *punit, Output_type_id outp, enum unit_loss_reason wipe_reason, bool wipe_in_the_end)
static bool city_build_building(struct player *pplayer, struct city *pcity)
static struct unit static const struct impr_type * building_upgrades_to(struct city *pcity, const struct impr_type *pimprove)
void send_city_turn_notifications(struct connection *pconn)
static struct unit * sell_random_unit(struct player *pplayer, struct unit_list *punitlist)
int city_incite_cost(struct player *pplayer, struct city *pcity)
static void nullify_caravan_and_disband_plus(struct city *pcity)
static bool sell_random_building(struct player *pplayer, struct cityimpr_list *imprs)
static bool disband_city(struct city *pcity)
void update_city_activities(struct player *pplayer)
bool city_reduce_size(struct city *pcity, citizens pop_loss, struct player *destroyer, const char *reason)
#define cityimpr_list_iterate_end
bool city_refresh(struct city *pcity)
static void city_turn_notify(const struct city *pcity, struct conn_list *dest, const struct player *cache_for_player)
static bool city_increase_size(struct city *pcity)
void apply_cmresult_to_city(struct city *pcity, const struct cm_result *cmr)
void city_style_refresh(struct city *pcity)
static bool city_balance_treasury_units(struct city *pcity)
static const struct unit_type * unit_upgrades_to(struct city *pcity, const struct unit_type *id)
static bool do_city_migration(struct city *pcity_from, struct city *pcity_to)
static struct city_list * city_refresh_queue
void city_refresh_for_player(struct player *pplayer)
void city_tc_effect_refresh(struct player *pplayer)
static void check_pollution(struct city *pcity)
void check_disasters(void)
static void set_default_city_manager(struct cm_parameter *cmp, struct city *pcity)
static citizens city_reduce_workers(struct city *pcity, citizens change)
static bool worklist_item_postpone_req_vec(struct universal *target, struct city *pcity, struct player *pplayer, int saved_id)
static struct unit * city_create_unit(struct city *pcity, const struct unit_type *utype, struct citizens_reduction *red) fc__attribute((nonnull(1
static bool player_balance_treasury_units_and_buildings(struct player *pplayer)
void city_refresh_queue_processing(void)
void remove_obsolete_buildings_city(struct city *pcity, bool refresh)
static bool check_city_migrations_player(const struct player *pplayer)
static bool city_build_unit(struct player *pplayer, struct city *pcity)
static bool player_balance_treasury_units(struct player *pplayer)
void cm_clear_cache(struct city *pcity)
void cm_init_parameter(struct cm_parameter *dest)
struct cm_result * cm_result_new(struct city *pcity)
void cm_result_destroy(struct cm_result *result)
void cm_print_result(const struct cm_result *result)
void cm_query_result(struct city *pcity, const struct cm_parameter *param, struct cm_result *result, bool negative_ok)
void cm_init_emergency_parameter(struct cm_parameter *dest)
void cm_print_city(const struct city *pcity)
struct player * conn_get_player(const struct connection *pconn)
void conn_list_do_unbuffer(struct conn_list *dest)
void conn_list_do_buffer(struct conn_list *dest)
int city_culture(const struct city *pcity)
int city_history_gain(const struct city *pcity)
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit * punit
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit int cost
const char * disaster_rule_name(struct disaster_type *pdis)
bool can_disaster_happen(const struct disaster_type *pdis, const struct city *pcity)
const char * disaster_name_translation(struct disaster_type *pdis)
bool disaster_has_effect(const struct disaster_type *pdis, enum disaster_effect_id effect)
#define disaster_type_iterate(_p)
#define DISASTER_BASE_RARITY
#define disaster_type_iterate_end
int get_city_bonus(const struct city *pcity, enum effect_type effect_type)
int get_current_construction_bonus(const struct city *pcity, enum effect_type effect_type, const enum req_problem_type prob_type)
int get_city_tile_output_bonus(const struct city *pcity, const struct tile *ptile, const struct output_type *poutput, enum effect_type effect_type)
#define MAX_CITY_NATIONALITIES
enum output_type_id Output_type_id
#define PL_(String1, String2, n)
const char * city_tile_link(const struct city *pcity)
const struct ft_color ftc_server
const char * city_link(const struct city *pcity)
const char * unit_link(const struct unit *punit)
const char * unit_tile_link(const struct unit *punit)
struct city * game_city_by_number(int id)
#define GAME_MAX_MGR_DISTANCE
const char * government_name_translation(const struct government *pgovern)
const char * ruler_title_for_player(const struct player *pplayer, char *buf, size_t buf_len)
struct government * government_of_city(const struct city *pcity)
Government_type_id government_number(const struct government *pgovern)
void handle_player_change_government(struct player *pplayer, Government_type_id government)
const struct impr_type * valid_improvement(const struct impr_type *pimprove)
int impr_sell_gold(const struct impr_type *pimprove)
bool can_city_sell_building(const struct city *pcity, const struct impr_type *pimprove)
bool is_improvement(const struct impr_type *pimprove)
const char * improvement_rule_name(const struct impr_type *pimprove)
int impr_build_shield_cost(const struct city *pcity, const struct impr_type *pimprove)
bool is_wonder(const struct impr_type *pimprove)
bool is_great_wonder(const struct impr_type *pimprove)
bool improvement_obsolete(const struct player *pplayer, const struct impr_type *pimprove, const struct city *pcity)
bool improvement_has_flag(const struct impr_type *pimprove, enum impr_flag_id flag)
const char * improvement_name_translation(const struct impr_type *pimprove)
bool is_small_wonder(const struct impr_type *pimprove)
const struct impr_type * improvement_replacement(const struct impr_type *pimprove)
#define fc_assert_msg(condition, message,...)
#define fc_assert_ret(condition)
#define log_verbose(message,...)
#define fc_assert(condition)
#define fc_assert_ret_msg(condition, message,...)
#define fc_assert_ret_val(condition, val)
#define fc_assert_action(condition, action)
#define log_debug(message,...)
#define log_normal(message,...)
#define log_base(level, message,...)
#define log_error(message,...)
#define fc_assert_ret_val_msg(condition, val, message,...)
int real_map_distance(const struct tile *tile0, const struct tile *tile1)
int map_distance(const struct tile *tile0, const struct tile *tile1)
#define iterate_outward(nmap, start_tile, max_dist, itr_tile)
#define iterate_outward_end
void map_update_border(struct tile *ptile, struct player *owner, int old_radius_sq, int new_radius_sq)
void map_claim_border(struct tile *ptile, struct player *owner, int radius_sq)
void update_tile_knowledge(struct tile *ptile)
const char * nation_rule_name(const struct nation_type *pnation)
const char * nation_adjective_for_player(const struct player *pplayer)
const char * nation_adjective_translation(const struct nation_type *pnation)
struct nation_type * nation_of_city(const struct city *pcity)
const char * nation_group_name_translation(const struct nation_group *pgroup)
const char * nation_plural_translation(const struct nation_type *pnation)
const char * nation_plural_for_player(const struct player *pplayer)
void notify_research(const struct research *presearch, const struct player *exclude, enum event_type event, const struct ft_color color, const char *format,...)
void notify_player(const struct player *pplayer, const struct tile *ptile, enum event_type event, const struct ft_color color, const char *format,...)
void notify_research_embassies(const struct research *presearch, const struct player *exclude, enum event_type event, const struct ft_color color, const char *format,...)
void notify_conn(struct conn_list *dest, const struct tile *ptile, enum event_type event, const struct ft_color color, const char *format,...)
void package_event(struct packet_chat_msg *packet, const struct tile *ptile, enum event_type event, const struct ft_color color, const char *format,...)
void event_cache_add_for_player(const struct packet_chat_msg *packet, const struct player *pplayer)
void lsend_packet_chat_msg(struct conn_list *dest, const struct packet_chat_msg *packet)
struct city_list * cities
int player_number(const struct player *pplayer)
const char * player_name(const struct player *pplayer)
struct city * player_city_by_number(const struct player *pplayer, int city_id)
const char * diplrel_name_translation(int value)
struct player * player_slot_get_player(const struct player_slot *pslot)
#define players_iterate_end
#define players_iterate(_pplayer)
static bool is_barbarian(const struct player *pplayer)
void send_player_info_c(struct player *src, struct conn_list *dest)
bool is_req_active(const struct req_context *context, const struct player *other_player, const struct requirement *req, const enum req_problem_type prob_type)
const char * universal_rule_name(const struct universal *psource)
const char * universal_name_translation(const struct universal *psource, char *buf, size_t bufsz)
#define requirement_vector_iterate_end
#define requirement_vector_iterate(req_vec, preq)
const char * research_advance_name_translation(const struct research *presearch, Tech_type_id tech)
struct research * research_get(const struct player *pplayer)
enum tech_state research_invention_state(const struct research *presearch, Tech_type_id tech)
int research_pretty_name(const struct research *presearch, char *buf, size_t buf_len)
#define sanity_check_city(x)
void script_server_signal_emit(const char *signal_name,...)
const char * ssetv_human_readable(ssetv val, bool present)
static struct setting settings[]
#define CLIP(lower, current, upper)
void send_spaceship_info(struct player *src, struct conn_list *dest)
#define specialist_type_iterate_end
#define specialist_type_iterate(sp)
#define DEFAULT_SPECIALIST
#define CITY_LOG(loglevel, pcity, msg,...)
#define TIMING_LOG(timer, activity)
int last_turns_shield_surplus
enum city_needs_arrange needs_arrange
struct universal production
struct unit_order * orders
struct city::@16 rally_point
int before_change_shields
citizens feel[CITIZEN_LAST][FEELING_LAST]
citizens specialists[SP_MAX]
struct city::@17::@19 server
struct cm_parameter * cm_parameter
struct universal changed_from
struct unit_list * units_supported
struct impr_type * pimprove
struct civ_game::@30::@34 server
struct conn_list * est_connections
struct packet_game_info info
int incite_improvement_factor
citizens specialists[SP_MAX]
struct requirement_vector reqs
enum gold_upkeep_style gold_upkeep_style
int culture_migration_pml
enum spaceship_state state
struct city_list * cities
struct conn_list * connections
struct player_economic economic
struct player_spaceship spaceship
struct player_score score
struct player_slot * slot
struct player::@69::@71 server
const struct player * player
struct requirement_vector build_reqs
const struct unit_type * obsoleted_by
struct advance * require_advance
struct unit::@80::@83 server
const struct unit_type * utype
int city_style(struct city *pcity)
const char * style_name_translation(const struct nation_style *pstyle)
#define sz_strlcpy(dest, src)
const char * advance_name_translation(const struct advance *padvance)
Tech_type_id advance_number(const struct advance *padvance)
const char * terrain_name_translation(const struct terrain *pterrain)
void tile_add_extra(struct tile *ptile, const struct extra_type *pextra)
struct city * tile_city(const struct tile *ptile)
#define tile_worked(_tile)
#define tile_has_extra(ptile, pextra)
bool can_cities_trade(const struct city *pc1, const struct city *pc2)
enum trade_route_type cities_trade_route_type(const struct city *pcity1, const struct city *pcity2)
bool goods_has_flag(const struct goods_type *pgood, enum goods_flag_id flag)
struct trade_route_settings * trade_route_settings_by_type(enum trade_route_type type)
const char * goods_name_translation(struct goods_type *pgood)
bool goods_can_be_provided(struct city *pcity, struct goods_type *pgood, struct unit *punit)
#define trade_routes_iterate_safe_end
#define trade_routes_iterate_safe(c, proute)
#define trade_partners_iterate_end
#define trade_partners_iterate(c, p)
const struct unit_type * utype
const struct impr_type * building
bool unit_is_alive(int id)
#define unit_cargo_iterate_end
#define unit_cargo_iterate(_ptrans, _pcargo)
#define unit_list_iterate(unitlist, punit)
#define unit_list_iterate_safe(unitlist, _unit)
#define unit_list_iterate_end
#define unit_list_iterate_safe_end
const struct unit_type * unit_type_get(const struct unit *punit)
int unit_build_shield_cost(const struct city *pcity, const struct unit *punit)
int utype_upkeep_cost(const struct unit_type *ut, struct player *pplayer, Output_type_id otype)
const char * unit_rule_name(const struct unit *punit)
const char * utype_rule_name(const struct unit_type *punittype)
int utype_pop_value(const struct unit_type *punittype, const struct city *pcity)
int utype_build_shield_cost(const struct city *pcity, const struct player *pplayer, const struct unit_type *punittype)
const char * utype_name_translation(const struct unit_type *punittype)
static bool utype_has_flag(const struct unit_type *punittype, int flag)
bool worklist_peek_ith(const struct worklist *pwl, struct universal *prod, int idx)
bool worklist_is_empty(const struct worklist *pwl)
void worklist_remove(struct worklist *pwl, int idx)
int worklist_length(const struct worklist *pwl)