19 #include <fc_config.h>
55 #define CATLSTR(_b, _s, _t) fc_strlcat(_b, _t, _s)
59 "(Any)",
"(Text)",
"Units",
"Improvements",
"Wonders",
60 "Techs",
"Terrain",
"Extras",
"Goods",
"Specialists",
61 "Governments",
"Ruleset",
"Tileset",
"Nations",
"Multipliers",
64 typedef QList<const struct help_item *>
helpList;
78 for (
const auto *ptmp : qAsConst(*
help_nodes)) {
94 const char *intro,
const char *nolevels)
104 if (veteran->
levels == 1) {
107 CATLSTR(outbuf, outlen, nolevels);
116 CATLSTR(outbuf, outlen, intro);
117 CATLSTR(outbuf, outlen,
"\n\n");
125 _(
"Veteran level Power factor Move bonus\n"));
128 _(
"--------------------------------------------"));
129 for (i = 0; i < veteran->
levels; i++) {
135 outbuf, outlen,
"\n%s%*s %4d%% %12s",
name,
150 enum gen_action act,
int time,
154 if (from == to || to ==
T_NONE
174 if (0 == strcmp(
name,
"TerrainAlterations")) {
175 int clean_pollution_time = -1, clean_fallout_time = -1,
177 bool terrain_independent_extras =
false;
182 _(
"Terrain Cultivate Plant "
186 "-------------------------------------------------------------------"
195 pterrain->cultivate_time, pterrain, pterrain->irrigation_result);
197 pterrain->plant_time, pterrain,
198 pterrain->mining_result);
200 transform,
sizeof(transform), ACTION_TRANSFORM_TERRAIN,
201 pterrain->transform_time, pterrain, pterrain->transform_result);
208 outbuf, outlen,
"%s%*s %s%*s %s%*s %s\n",
terrain,
215 if (clean_pollution_time != 0
216 && pterrain->clean_pollution_time != 0) {
217 if (clean_pollution_time < 0) {
218 clean_pollution_time = pterrain->clean_pollution_time;
220 if (clean_pollution_time != pterrain->clean_pollution_time) {
221 clean_pollution_time = 0;
225 if (clean_fallout_time != 0 && pterrain->clean_fallout_time != 0) {
226 if (clean_fallout_time < 0) {
227 clean_fallout_time = pterrain->clean_fallout_time;
229 if (clean_fallout_time != pterrain->clean_fallout_time) {
230 clean_fallout_time = 0;
234 if (pillage_time != 0 && pterrain->pillage_time != 0) {
235 if (pillage_time < 0) {
236 pillage_time = pterrain->pillage_time;
238 if (pillage_time != pterrain->pillage_time) {
252 int time = -1, factor = -1;
256 if (pextra->removal_time == 0) {
258 factor = pextra->removal_time_factor;
259 }
else if (factor != pextra->removal_time_factor) {
264 time = pextra->removal_time;
265 }
else if (time != pextra->removal_time) {
274 clean_pollution_time = time;
276 clean_pollution_time = 0;
278 }
else if (clean_pollution_time != 0) {
281 if (time > 0 && factor > 0
282 && time != clean_pollution_time * factor) {
283 clean_pollution_time = 0;
284 }
else if (time >= 0) {
285 clean_pollution_time = time;
286 }
else if (factor >= 0) {
287 clean_pollution_time = clean_pollution_time * factor;
295 int time = -1, factor = -1;
299 if (pextra->removal_time == 0) {
301 factor = pextra->removal_time_factor;
302 }
else if (factor != pextra->removal_time_factor) {
307 time = pextra->removal_time;
308 }
else if (time != pextra->removal_time) {
317 clean_fallout_time = time;
319 clean_fallout_time = 0;
321 }
else if (clean_fallout_time != 0) {
324 if (time > 0 && factor > 0 && time != clean_fallout_time * factor) {
325 clean_fallout_time = 0;
326 }
else if (time >= 0) {
327 clean_fallout_time = time;
328 }
else if (factor >= 0) {
329 clean_fallout_time = clean_fallout_time * factor;
337 int time = -1, factor = -1;
341 if (pextra->removal_time == 0) {
343 factor = pextra->removal_time_factor;
344 }
else if (factor != pextra->removal_time_factor) {
349 time = pextra->removal_time;
350 }
else if (time != pextra->removal_time) {
363 }
else if (pillage_time != 0) {
366 if (time > 0 && factor > 0 && time != pillage_time * factor) {
368 }
else if (time >= 0) {
370 }
else if (factor >= 0) {
371 pillage_time = pillage_time * factor;
383 if (pextra->buildable && pextra->build_time > 0) {
384 terrain_independent_extras =
true;
389 if (!terrain_independent_extras) {
392 if (pextra->buildable && pextra->build_time > 0) {
393 terrain_independent_extras =
true;
400 if (clean_pollution_time > 0 || clean_fallout_time > 0
401 || pillage_time > 0 || terrain_independent_extras) {
404 _(
"Time taken for the following activities is independent of "
410 _(
"Activity Time\n"));
411 CATLSTR(outbuf, outlen,
"---------------------------");
412 if (clean_pollution_time > 0) {
414 clean_pollution_time);
416 if (clean_fallout_time > 0) {
420 if (pillage_time > 0) {
426 if (pextra->buildable && pextra->build_time > 0) {
431 "", pextra->build_time);
437 if (pextra->buildable && pextra->build_time > 0) {
442 "", pextra->build_time);
448 }
else if (0 == strcmp(
name,
"VeteranLevels")) {
451 _(
"In this ruleset, the following veteran levels are defined:"),
452 _(
"This ruleset has no default veteran levels defined."));
453 }
else if (0 == strcmp(
name,
"Freeciv21Version")) {
460 _(
"This is %s."), ver);
463 cat_snprintf(outbuf, outlen,
_(
"\nBuilt against Qt %s, using %s"),
464 QT_VERSION_STR, qVersion());
466 QString data_dirs_info =
"\n\n";
467 data_dirs_info +=
_(
"This instance of Freeciv21 searches the following "
468 "directories for data files:");
469 data_dirs_info +=
"\n\n";
471 QFileInfo info(path +
"/");
472 data_dirs_info +=
"* " + info.absolutePath() +
" ";
473 if (!info.exists()) {
475 data_dirs_info +=
_(
"(does not exist)");
476 }
else if (info.isWritable()) {
478 data_dirs_info +=
_(
"(user)");
481 data_dirs_info +=
_(
"(system)");
483 data_dirs_info +=
"\n";
485 data_dirs_info +=
"\n";
486 data_dirs_info +=
_(
"Note that for multiplayer games, the server may "
487 "use different paths.");
489 cat_snprintf(outbuf, outlen,
"%s", qUtf8Printable(data_dirs_info));
492 }
else if (0 == strcmp(
name,
"DefaultMetaserver")) {
497 qCritical(
"Unknown directive '$%s' in help",
name);
509 const requirement_vector *psubjreqs,
511 const char *
const *strs,
char *buf,
512 size_t bufsz,
const char *prefix)
516 char *buf2 =
new char[bufsz];
533 if (coreq->present) {
536 conoreqs.append(buf2);
542 if (0 < coreqs.count()) {
543 if (0 < conoreqs.count()) {
554 if (0 < conoreqs.count()) {
598 static const char *
const govstrs[] = {
600 N_(
"?gov:Allows %s (with %s but no %s)."),
602 N_(
"?gov:Allows %s (with %s)."),
604 N_(
"?gov:Allows %s (absent %s)."),
606 N_(
"?gov:Allows %s."),
608 N_(
"?gov:Prevents %s.")};
616 static const char *
const imprstrs[] = {
618 N_(
"?improvement:Allows %s (with %s but no %s)."),
620 N_(
"?improvement:Allows %s (with %s)."),
622 N_(
"?improvement:Allows %s (absent %s)."),
624 N_(
"?improvement:Allows %s."),
626 N_(
"?improvement:Prevents %s.")};
635 static const char *
const utstrs[] = {
637 N_(
"?unittype:Allows %s (with %s but no %s)."),
639 N_(
"?unittype:Allows %s (with %s)."),
641 N_(
"?unittype:Allows %s (absent %s)."),
643 N_(
"?unittype:Allows %s."),
645 N_(
"?unittype:Prevents %s.")};
659 pitem->
topic =
nullptr;
660 pitem->
text =
nullptr;
672 if (QString(v1->
topic) != QString(v2->
topic)) {
673 return QString(v1->
topic) < QString(v2->
topic);
685 static bool booted =
false;
690 struct section_list *sec;
694 char long_buffer[64000];
703 if (filename.isEmpty()) {
704 qCritical(
"Did not read help texts");
711 qCritical(
"failed reading help-texts from '%s':\n%s",
718 if (
nullptr != sec) {
727 int level = strspn(gen_str,
" ");
738 qCritical(
"bad help-generate category \"%s\"", gen_str);
750 sf, &ncats,
"%s.categories", sec_name);
751 delete[] delete_me_pls;
764 switch (current_type) {
772 pitem->
text = qstrdup(empty);
773 category_nodes.append(pitem);
786 pitem->
text = qstrdup(empty);
787 category_nodes.append(pitem);
800 pitem->
text = qstrdup(empty);
801 category_nodes.append(pitem);
815 bool include =
false;
816 const char *cat = extra_category_name(pextra->category);
819 for (ci = 0; ci < ncats; ci++) {
833 pitem->
text = qstrdup(empty);
834 category_nodes.append(pitem);
847 pitem->
text = qstrdup(empty);
848 category_nodes.append(pitem);
861 pitem->
text = qstrdup(empty);
862 category_nodes.append(pitem);
872 pitem->
text = qstrdup(empty);
873 category_nodes.append(pitem);
885 pitem->
text = qstrdup(empty);
886 category_nodes.append(pitem);
899 pitem->
text = qstrdup(empty);
900 category_nodes.append(pitem);
925 pitem->
text =
new char[
len + desc_len];
933 pitem->
text =
new char[
len + desc_len];
938 const char *nodesc =
_(
"Current ruleset contains no summary.");
943 + qstrlen(nodesc) + 1;
945 pitem->
text =
new char[
len + desc_len];
951 + qstrlen(nodesc) + 1;
953 pitem->
text =
new char[
len + desc_len];
974 for (
const auto &pnation :
nations) {
981 pitem->
text = qstrdup(empty);
982 category_nodes.append(pitem);
989 help_text_buffer[0] =
'\0';
994 if (pmul->helptext) {
995 const char *sep =
"";
996 for (
const auto &text : qAsConst(*pmul->helptext)) {
997 cat_snprintf(help_text_buffer,
sizeof(help_text_buffer),
998 "%s%s", sep, qUtf8Printable(text));
1002 pitem->
text = qstrdup(help_text_buffer);
1008 std::list<help_item *> effect_help;
1010 for (
int i = 0; i < EFT_COUNT; ++i) {
1012 if (effect_list_size(
effects) > 0) {
1015 effect_type_name(
static_cast<effect_type
>(i)));
1018 QString all_text =
_(
"The following rules contribute to the "
1019 "value of this effect:\n");
1022 if (requirement_vector_size(&peffect->reqs) == 0) {
1023 all_text += QString(
_(
"* %1 by default\n"))
1025 peffect->type, peffect->value));
1027 help_text_buffer[0] =
'\0';
1029 sizeof(help_text_buffer));
1030 all_text += QString(
_(
"* %1 with %2\n"))
1032 peffect->type, peffect->value))
1033 .arg(help_text_buffer);
1038 pitem->
text = qstrdup(qUtf8Printable(all_text));
1039 effect_help.push_back(pitem);
1044 for (
auto pitem : effect_help) {
1050 qCritical(
"Bad current_type: %d.", current_type);
1053 std::sort(category_nodes.begin(), category_nodes.end(),
1055 helpList::iterator it = category_nodes.begin();
1056 while (it != category_nodes.end()) {
1072 long_buffer[0] =
'\0';
1073 for (
int i = 0; i < npara; i++) {
1075 const char *para = paras[i];
1077 if (strncmp(para,
"$", 1) == 0) {
1084 if (inserted && i != npara - 1) {
1090 pitem->
text = qstrdup(long_buffer);
1095 section_list_destroy(sec);
1101 qDebug(
"Booted help texts ok");
1121 const struct help_item *pitem =
nullptr;
1123 static char vtopic[128];
1124 static char vtext[256];
1128 for (
const auto *ptmp : qAsConst(*
help_nodes)) {
1129 char *p = ptmp->
topic;
1134 if (strcmp(
name, p) == 0 && (htype ==
HELP_ANY || htype == ptmp->type)) {
1143 vitem.
topic = vtopic;
1147 fc_snprintf(vtext,
sizeof(vtext),
_(
"Sorry, no help topic for %s.\n"),
1152 _(
"Sorry, no help topic for %s.\n"
1153 "This page was auto-generated.\n\n"),
1182 const char *user_text,
1188 .kind = VUT_IMPROVEMENT};
1193 if (
nullptr == pimprove) {
1197 if (
nullptr != pimprove->
helptext) {
1198 for (
const auto &text : qAsConst(*pimprove->
helptext)) {
1199 cat_snprintf(buf, bufsz,
"%s\n\n",
_(qUtf8Printable(text)));
1217 if (VUT_ADVANCE == pobs->source.kind && pobs->present) {
1219 _(
"* The discovery of %s will make %s obsolete.\n"),
1223 if (VUT_IMPROVEMENT == pobs->source.kind && pobs->present) {
1226 _(
"* The presence of %s in the city will make %s "
1236 _(
"* A 'small wonder': at most one of your cities may "
1237 "possess this improvement.\n"));
1270 _(
"* Allows all players with knowledge of %s "
1271 "to build %s units.\n"),
1277 insert_allows(&source, buf + qstrlen(buf), bufsz - qstrlen(buf),
1285 bool demanded =
false;
1286 enum req_range max_range = REQ_RANGE_LOCAL;
1313 if (!preq->present) {
1319 if (preq->range > max_range) {
1321 max_range = preq->range;
1333 switch (max_range) {
1334 case REQ_RANGE_LOCAL:
1339 _(
"* Makes it possible to target the city building it "
1340 "with the action \'%s\'.\n"),
1343 case REQ_RANGE_CITY:
1348 _(
"* Makes it possible to target its city with the "
1349 "action \'%s\'.\n"),
1352 case REQ_RANGE_TRADEROUTE:
1357 _(
"* Makes it possible to target its city and its "
1358 "trade partners with the action \'%s\'.\n"),
1361 case REQ_RANGE_CONTINENT:
1366 _(
"* Makes it possible to target all cities with its "
1367 "owner on its continent with the action \'%s\'.\n"),
1370 case REQ_RANGE_PLAYER:
1375 _(
"* Makes it possible to target all cities with its "
1376 "owner with the action \'%s\'.\n"),
1379 case REQ_RANGE_TEAM:
1384 _(
"* Makes it possible to target all cities on the "
1385 "same team with the action \'%s\'.\n"),
1388 case REQ_RANGE_ALLIANCE:
1393 _(
"* Makes it possible to target all cities owned by "
1394 "or allied to its owner with the action \'%s\'.\n"),
1397 case REQ_RANGE_WORLD:
1402 _(
"* Makes it possible to target all cities with the "
1403 "action \'%s\'.\n"),
1406 case REQ_RANGE_CADJACENT:
1407 case REQ_RANGE_ADJACENT:
1408 case REQ_RANGE_COUNT:
1409 qCritical(
"The range %s is invalid for buildings.",
1410 req_range_name(max_range));
1421 bool vulnerable =
false;
1422 enum req_range min_range = REQ_RANGE_COUNT;
1443 &(enabler->target_reqs))) {
1447 enum req_range vector_max_range = REQ_RANGE_LOCAL;
1456 if (preq->present) {
1461 if (preq->range > vector_max_range) {
1463 vector_max_range = preq->range;
1468 if (vector_max_range < min_range) {
1470 min_range = vector_max_range;
1477 switch (min_range) {
1478 case REQ_RANGE_LOCAL:
1481 _(
"* Makes it impossible to do the action \'%s\' to "
1482 "the city building it.\n"),
1485 case REQ_RANGE_CITY:
1488 _(
"* Makes it impossible to do the action \'%s\' to "
1492 case REQ_RANGE_TRADEROUTE:
1495 _(
"* Makes it impossible to do the action \'%s\' to "
1496 "its city or to its city's trade partners.\n"),
1499 case REQ_RANGE_CONTINENT:
1502 _(
"* Makes it impossible to do the action \'%s\' to "
1503 "any city with its owner on its continent.\n"),
1506 case REQ_RANGE_PLAYER:
1509 _(
"* Makes it impossible to do the action \'%s\' to "
1510 "any city with its owner.\n"),
1513 case REQ_RANGE_TEAM:
1516 _(
"* Makes it impossible to do the action \'%s\' to "
1517 "any city on the same team.\n"),
1520 case REQ_RANGE_ALLIANCE:
1523 _(
"* Makes it impossible to do the action \'%s\' to "
1524 "any city allied to or owned by its owner.\n"),
1527 case REQ_RANGE_WORLD:
1530 _(
"* Makes it impossible to do the action \'%s\' to "
1531 "any city in the game.\n"),
1534 case REQ_RANGE_CADJACENT:
1535 case REQ_RANGE_ADJACENT:
1536 case REQ_RANGE_COUNT:
1537 qCritical(
"The range %s is invalid for buildings.",
1538 req_range_name(min_range));
1554 _(
"* All players start with this improvement in their "
1563 for (
const auto &pnation :
nations) {
1568 for (
int n : pnation.init_buildings) {
1574 _(
"* The %s start with this improvement in their "
1585 _(
"* If you lose the city containing this improvement, "
1586 "it will be rebuilt for free in another of your cities "
1587 "(if the 'savepalace' server setting is enabled).\n"));
1590 if (user_text && user_text[0] !=
'\0') {
1623 if (paction->
actor.
is_unit.moves_actor == MAK_ESCAPE) {
1640 const char *user_text,
const struct unit_type *utype,
1643 bool has_vet_levels;
1652 qCritical(
"Unknown unit!");
1665 for (
const auto &text : qAsConst(*pclass->
helptext)) {
1666 cat_snprintf(buf, bufsz,
"\n%s\n",
_(qUtf8Printable(text)));
1674 CATLSTR(buf, bufsz,
_(
" * Can occupy empty enemy cities.\n"));
1678 CATLSTR(buf, bufsz,
_(
" * Speed is not affected by terrain.\n"));
1683 _(
" * Does not get defense bonuses from terrain.\n"));
1687 CATLSTR(buf, bufsz,
_(
" * Not subject to zones of control.\n"));
1690 CATLSTR(buf, bufsz,
_(
" * Subject to zones of control.\n"));
1694 CATLSTR(buf, bufsz,
_(
" * Slowed down while damaged.\n"));
1698 {.
value = {.
utype = utype}, .kind = VUT_UTYPE},
1699 {.value = {.citytile = CITYT_CENTER}, .kind = VUT_CITYTILE},
1709 _(
" * Gets a %d%% defensive bonus while in cities.\n"),
1716 _(
" * Is unreachable. Most units cannot attack this one.\n"));
1720 _(
" * Doesn't prevent enemy units from attacking other "
1721 "units on its tile.\n"));
1728 _(
" * Doesn't prevent enemy cities from working the tile it's "
1734 _(
" * Can attack units on non-native tiles.\n"));
1737 if (
uclass_has_flag(pclass,
static_cast<unit_class_flag_id
>(flagid))) {
1738 const char *helptxt =
1741 if (helptxt !=
nullptr) {
1755 if (cbonus->quiet) {
1771 if (!against.isEmpty()) {
1772 switch (cbonus->type) {
1773 case CBONUS_DEFENSE_MULTIPLIER:
1776 _(
"* %d%% defense bonus if attacked by %s.\n"),
1777 cbonus->value * 100,
1780 case CBONUS_DEFENSE_DIVIDER:
1783 _(
"* Reduces target's defense to 1 / %d when "
1788 case CBONUS_FIREPOWER1:
1791 _(
"* Reduces target's fire power to 1 when "
1795 case CBONUS_DEFENSE_MULTIPLIER_PCT:
1798 _(
"* %d%% defense bonus if attacked by %s.\n"),
1802 case CBONUS_DEFENSE_DIVIDER_PCT:
1805 _(
"* Reduces target's defense to 1 / %.2f when "
1807 (
static_cast<float>(cbonus->value) + 100.0f) / 100.0f,
1824 CATLSTR(buf, bufsz,
_(
"* Can escape once stack defender is lost.\n"));
1827 CATLSTR(buf, bufsz,
_(
"* Can pursue escaping units and kill them.\n"));
1831 CATLSTR(buf, bufsz,
_(
"* May not be built in cities.\n"));
1834 CATLSTR(buf, bufsz,
_(
"* Only barbarians may build this.\n"));
1838 _(
"* Can only be built in games where new cities "
1843 _(
" - New cities are not allowed in the current "
1848 _(
" - New cities are allowed in the current "
1852 for (
const auto &pnation :
nations) {
1860 if (!pnation.init_units[i]) {
1862 }
else if (pnation.init_units[i] == utype) {
1869 PL_(
"* The %s start the game with %d of these units.\n",
1870 "* The %s start the game with %d of these units.\n",
1881 if (utype2->converted_to == utype
1887 if (!types.isEmpty()) {
1890 _(
"* May be obtained by conversion of %s.\n"),
1895 CATLSTR(buf, bufsz,
_(
"* Never has a home city.\n"));
1898 CATLSTR(buf, bufsz,
_(
"* Losing this unit will lose you the game!\n"));
1902 _(
"* Each player may only have one of this type of unit.\n"));
1906 const char *helptxt =
1909 if (helptxt !=
nullptr) {
1919 PL_(
"* Costs %d population to build.\n",
1920 "* Costs %d population to build.\n", utype->
pop_cost),
1937 PL_(
"* Can carry and refuel %d %s unit.\n",
1938 "* Can carry and refuel up to %d %s units.\n",
1944 bool has_restricted_load =
false, has_unrestricted_load =
false,
1945 has_restricted_unload =
false, has_unrestricted_unload =
false;
1950 has_unrestricted_load =
true;
1952 has_restricted_load =
true;
1955 has_unrestricted_unload =
true;
1957 has_restricted_unload =
true;
1962 if (has_restricted_load) {
1963 if (has_unrestricted_load) {
1968 _(
" * Some cargo cannot be loaded except in a city or a "
1969 "base native to this transport.\n"));
1974 _(
" * Cargo cannot be loaded except in a city or a "
1975 "base native to this transport.\n"));
1978 if (has_restricted_unload) {
1979 if (has_unrestricted_unload) {
1984 _(
" * Some cargo cannot be unloaded except in a city or a "
1985 "base native to this transport.\n"));
1990 _(
" * Cargo cannot be unloaded except in a city or a "
1991 "base native to this transport.\n"));
1997 CATLSTR(buf, bufsz,
_(
"* Must stay next to safe coast.\n"));
2002 QBitArray embarks, disembarks;
2015 if (!embarks.at(trans_class)
2023 embarks.setBit(trans_class);
2028 if (!disembarks.at(trans_class)
2036 disembarks.setBit(trans_class);
2057 if (embarks == disembarks) {
2062 _(
"* May load onto and unload from %s transports even "
2063 "when underway.\n"),
2064 qUtf8Printable(elist));
2070 _(
"* May load onto %s transports even when underway.\n"),
2071 qUtf8Printable(elist));
2074 if (
is_any_set(disembarks) && embarks != disembarks) {
2091 _(
"* May unload from %s transports even when underway.\n"),
2092 qUtf8Printable(dlist));
2097 CATLSTR(buf, bufsz,
_(
"* Strong in diplomatic battles.\n"));
2101 CATLSTR(buf, bufsz,
_(
"* Defends cities against diplomatic actions.\n"));
2105 _(
"* Will never lose a diplomat-versus-diplomat fight.\n"));
2109 CATLSTR(buf, bufsz,
_(
"* Will always survive a spy mission.\n"));
2111 if (utype->
vlayer == V_INVIS) {
2114 _(
"* Is invisible except when next to an enemy unit or city.\n"));
2117 CATLSTR(buf, bufsz,
_(
"* Can only attack units on native tiles.\n"));
2121 _(
"* Gets double firepower when attacking cities.\n"));
2127 _(
"* Ignores terrain effects (moving costs at most %s MP "
2132 CATLSTR(buf, bufsz,
_(
"* Never imposes a zone of control.\n"));
2135 _(
"* May impose a zone of control on its adjacent "
2140 _(
"* Not subject to zones of control imposed "
2141 "by other units.\n"));
2144 CATLSTR(buf, bufsz,
_(
"* A non-military unit:\n"));
2147 _(
" * Cannot attack.\n"));
2150 _(
" * Doesn't impose martial law.\n"));
2154 _(
" * Can enter foreign territory regardless of peace treaty.\n"));
2157 _(
" * Doesn't prevent enemy cities from working the tile it's "
2162 _(
"* A field unit: one unhappiness applies even when "
2163 "non-aggressive.\n"));
2169 _(
"* An enemy unit considering to auto attack this unit will "
2170 "choose to do so even if it has better odds when defending "
2171 "against it than when attacking it.\n"));
2179 _(
"* Under certain conditions the shield upkeep of this unit can "
2180 "be converted to gold upkeep.\n"));
2188 _(
"* Can attack against %s units, which are usually not "
2208 if (types.isEmpty()) {
2212 _(
"* Unit has to end each turn next to safe coast or"
2213 " in a city or a base.\n"));
2220 PL_(
"* Unit has to be next to safe coast, in a city or a base"
2221 " after %d turn.\n",
2222 "* Unit has to be next to safe coast, in a city or a base"
2223 " after %d turns.\n",
2229 PL_(
"* Unit has to be in a city or a base"
2230 " after %d turn.\n",
2231 "* Unit has to be in a city or a base"
2232 " after %d turns.\n",
2241 PL_(
"* Unit has to be next to safe coast, in a city, a base, or "
2243 " after %d turn.\n",
2244 "* Unit has to be next to safe coast, in a city, a base, or "
2246 " after %d turns.\n",
2252 PL_(
"* Unit has to be in a city, a base, or on a %s"
2253 " after %d turn.\n",
2254 "* Unit has to be in a city, a base, or on a %s"
2255 " after %d turns.\n",
2264 bool not_an_auto_attacker =
true;
2268 if (auto_action->cause != AAPC_UNIT_MOVED_ADJ) {
2275 not_an_auto_attacker =
false;
2281 if (not_an_auto_attacker) {
2283 _(
"* Will never be forced (by the autoattack server setting)"
2284 " to attack units moving to an adjacent tile.\n"));
2298 const char *target_adjective;
2299 char sub_target_text[100];
2307 _(
"* Can do the action \'%s\'.\n"),
2318 target_adjective =
_(
"domestic ");
2322 target_adjective =
_(
"foreign ");
2325 target_adjective =
"";
2328 sub_target_text[0] =
'\0';
2330 cat_snprintf(sub_target_text,
sizeof(sub_target_text),
_(
"%s "),
2331 _(action_sub_target_kind_name(
2341 _(
" * is done to %s%s%s.\n"), sub_target_text, target_adjective,
2349 _(
" * uses up the %s.\n"),
2357 _(
" * can lead to a %s against a defender.\n"),
2358 action_battle_kind_translated_name(
2369 _(
" * may fail because of a dice throw.\n"));
2378 _(
" * the %s may be captured while trying to"
2379 " escape after completing the mission.\n"),
2384 {.
value = {.
action = paction}, .kind = VUT_ACTION},
2385 {.value = {.utype = utype}, .kind = VUT_UTYPE},
2388 EFT_ACTION_SUCCESS_MOVE_COST, req_pattern,
2391 success_move_frag_cost +=
2420 _(
" * target must be at the same tile.\n"));
2425 PL_(
" * target must be exactly %d tile away.\n",
2426 " * target must be exactly %d tiles away.\n",
2437 _(
" * target can be anywhere.\n"));
2442 PL_(
" * target must be at least %d tile away.\n",
2443 " * target must be at least %d tiles away.\n",
2453 PL_(
" * target can be max %d tile away.\n",
2454 " * target can be max %d tiles away.\n",
2464 PL_(
" * target must be between %d and %d tile away.\n",
2465 " * target must be between %d and %d tiles away.\n",
2474 const enum effect_type eft;
2475 const char *hlp_text;
2478 {EFT_CASUS_BELLI_SUCCESS,
N_(
"successfully")},
2480 {EFT_CASUS_BELLI_CAUGHT,
N_(
"getting caught before")},
2484 {.
value = {.
action = paction}, .kind = VUT_ACTION},
2485 {.kind = VUT_DIPLREL, },
2490 for (i = 0; i <
ARRAY_SIZE(casus_belli); i++) {
2496 outrage_diplrel_names.reserve(DRO_LAST);
2497 victim_diplrel_names.reserve(DRO_LAST);
2500 for (diplrel = 0; diplrel < DS_NO_CONTACT; diplrel++) {
2501 int casus_belli_amount;
2511 casus_belli[i].eft, req_pattern,
ARRAY_SIZE(req_pattern));
2514 outrage_diplrel_names.append(
2523 if (!outrage_diplrel_names.isEmpty()) {
2527 _(
" * %s performing this action during %s causes"
2528 " international outrage: the whole world gets "
2529 "Casus Belli against you.\n"),
2530 _(casus_belli[i].hlp_text),
2533 if (!victim_diplrel_names.isEmpty()) {
2537 _(
" * %s performing this action during %s gives"
2538 " the victim Casus Belli against you.\n"),
2539 _(casus_belli[i].hlp_text),
2546 switch (paction->
result) {
2547 case ACTRES_HELP_WONDER:
2551 _(
" * adds %d production.\n"),
2554 case ACTRES_HEAL_UNIT:
2556 _(
" * restores up to 25%% of the target unit's"
2559 case ACTRES_FOUND_CITY:
2563 _(
" * is disabled in the current game.\n"));
2567 PL_(
" * initial population: %d.\n",
2568 " * initial population: %d.\n", utype->
city_size),
2571 case ACTRES_JOIN_CITY:
2575 PL_(
" * max target size: %d.\n",
" * max target size: %d.\n",
2580 PL_(
" * adds %d population.\n",
2581 " * adds %d population.\n",
2585 case ACTRES_BOMBARD:
2588 PL_(
" * %d round per action.\n",
2593 _(
" * These attacks will only damage (never kill)"
2594 " defenders, but damage all"
2595 " defenders on a tile, and have no risk for the"
2598 case ACTRES_UPGRADE_UNIT:
2601 _(
" * upgraded to %s or, when possible, to the unit "
2602 "type it upgrades to.\n"),
2608 _(
" * weaker when tired. If performed with less "
2609 "than a single move point left the attack power "
2610 "is reduced accordingly.\n"));
2613 case ACTRES_CONVERT:
2616 PL_(
" * is converted into %s (takes %d MP).\n",
2617 " * is converted into %s (takes %d MP).\n",
2622 case ACTRES_SPY_NUKE:
2624 case ACTRES_NUKE_CITY:
2625 case ACTRES_NUKE_UNITS:
2626 if (
game.
info.nuke_pop_loss_pct > 0) {
2629 _(
" * %d%% of the population of each city inside"
2630 " the nuclear blast dies.\n"),
2633 if (
game.
info.nuke_defender_survival_chance_pct > 0) {
2635 _(
" * all units caught in the open by the nuclear"
2639 _(
" * a unit caught in the nuclear blast while"
2640 " inside a city has a %d%% chance of survival.\n"),
2641 game.
info.nuke_defender_survival_chance_pct);
2644 _(
" * all units caught in the nuclear blast"
2650 case ACTRES_CULTIVATE:
2651 case ACTRES_TRANSFORM_TERRAIN:
2653 _(
" * converts target tile terrain to another"
2658 case ACTRES_IRRIGATE:
2669 if (extras_vec.count() > 0) {
2676 case ACTRES_CLEAN_POLLUTION:
2677 case ACTRES_CLEAN_FALLOUT: {
2688 if (extras_vec.count() > 0) {
2694 case ACTRES_PILLAGE: {
2705 if (extras_vec.count() > 0) {
2711 case ACTRES_FORTIFY: {
2714 struct universal unit_is_fortified[] = {
2716 .kind = VUT_ACTIVITY},
2717 {.value = {.utype = utype}, .kind = VUT_UTYPE},
2720 EFT_FORTIFY_DEFENSE_BONUS, unit_is_fortified,
2729 _(
" * to stay put. No defensive bonus.\n"));
2730 }
else if (bonus > 0) {
2734 _(
" * granting a %d%% defensive bonus.\n"), bonus);
2754 char *quoted =
new char[maxlen];
2760 blockers.append(quoted);
2765 if (!blockers.isEmpty()) {
2768 _(
" * can't be done if %s is legal.\n"),
2800 &(enabler->target_reqs))) {
2809 _(
"* Doing the action \'%s\' to this unit"
2810 " is impossible.\n"),
2815 if (!has_vet_levels) {
2818 CATLSTR(buf, bufsz,
_(
"* Will never achieve veteran status.\n"));
2824 bool veteran_through_combat =
2832 CATLSTR(buf, bufsz,
_(
"* May acquire veteran status.\n"));
2838 _(
" * Veterans have increased strength in combat.\n"));
2845 _(
" * Veterans have improved chances in diplomatic "
2850 _(
" * Veterans are more likely to survive missions.\n"));
2856 _(
" * Veterans work faster.\n"));
2860 if (strlen(buf) > 0) {
2863 if (has_vet_levels && utype->
veteran) {
2868 _(
"This type of unit has its own veteran levels:"),
nullptr)) {
2873 for (
const auto &text : qAsConst(*utype->
helptext)) {
2874 cat_snprintf(buf, bufsz,
"%s\n\n",
_(qUtf8Printable(text)));
2877 CATLSTR(buf, bufsz, user_text);
2887 const char *user_text,
int i,
2894 fc_assert_ret(
nullptr != buf && 0 < bufsz &&
nullptr != user_text);
2897 if (
nullptr == vap) {
2898 qCritical(
"Unknown tech %d.", i);
2903 if (vap->
tclass ==
nullptr) {
2904 cat_snprintf(buf, bufsz,
_(
"Belongs to the default tech class.\n\n"));
2906 cat_snprintf(buf, bufsz,
_(
"Belongs to tech class %s.\n\n"),
2911 if (
nullptr != pplayer) {
2919 PL_(
"Starting now, researching %s would need %d bulb.",
2920 "Starting now, researching %s would need %d bulbs.",
2933 PL_(
" The whole project will require %d bulb to complete.",
2934 " The whole project will require %d bulbs to complete.",
2939 PL_(
"To research %s you need to research %d other"
2940 " technology first.%s",
2941 "To research %s you need to research %d other"
2942 " technologies first.%s",
2947 CATLSTR(buf, bufsz,
_(
"You cannot research this technology."));
2953 _(
" This number may vary depending on what "
2954 "other players research.\n"));
2964 CATLSTR(buf, bufsz,
_(
"Requirements to research:\n"));
2973 insert_allows(&source, buf + qstrlen(buf), bufsz - qstrlen(buf),
2985 _(
"* All players start the game with knowledge of this "
2994 for (
const auto &pnation :
nations) {
3000 if (pnation.init_techs[j] ==
A_LAST) {
3002 }
else if (pnation.init_techs[j] == i) {
3005 _(
"* The %s start the game with knowledge of this "
3015 bv_techs roots, rootsofroots;
3052 root_techs.reserve(
A_LAST);
3066 _(
"* Only those who know %s can acquire this "
3067 "technology (by any means).\n"),
3074 _(
"* The first player to learn %s gets"
3075 " an immediate advance.\n"),
3079 for (flagid = TECH_USER_1; flagid <= TECH_USER_LAST; flagid++) {
3081 const char *helptxt =
3084 if (helptxt !=
nullptr) {
3096 if (
game.
info.tech_upkeep_style != TECH_UPKEEP_NONE) {
3098 _(
"* To preserve this technology for our nation some bulbs "
3099 "are needed each turn.\n"));
3103 if (strlen(buf) > 0) {
3106 for (
const auto &text : qAsConst(*vap->
helptext)) {
3107 cat_snprintf(buf, bufsz,
"%s\n\n",
_(qUtf8Printable(text)));
3116 const char *user_text,
struct terrain *pterrain)
3120 .kind = VUT_TERRAIN};
3127 qCritical(
"Unknown terrain!");
3131 insert_allows(&source, buf + qstrlen(buf), bufsz - qstrlen(buf),
3135 CATLSTR(buf, bufsz,
_(
"* You cannot build cities on this terrain."));
3142 if (pextra->buildable) {
3143 CATLSTR(buf, bufsz,
_(
"* Paths cannot be built on this terrain."));
3154 if (pextra->buildable) {
3155 CATLSTR(buf, bufsz,
_(
"* Bases cannot be built on this terrain."));
3164 CATLSTR(buf, bufsz,
_(
"* The coastline of this terrain is unsafe."));
3179 if (!classes.isEmpty()) {
3181 cat_snprintf(buf, bufsz,
_(
"* Can be traveled by %s units.\n"),
3187 _(
"* Units on this terrain neither impose zones of control "
3188 "nor are restricted by them.\n"));
3191 _(
"* Units on this terrain may impose a zone of control, or "
3192 "be restricted by one.\n"));
3194 for (flagid = TER_USER_1; flagid <= TER_USER_LAST; flagid++) {
3196 const char *helptxt =
3199 if (helptxt !=
nullptr) {
3208 if (
nullptr != pterrain->
helptext) {
3209 if (buf[0] !=
'\0') {
3212 for (
const auto &text : qAsConst(*pterrain->
helptext)) {
3213 cat_snprintf(buf, bufsz,
"%s\n\n",
_(qUtf8Printable(text)));
3216 if (user_text && user_text[0] !=
'\0') {
3218 CATLSTR(buf, bufsz, user_text);
3232 static char str[64];
3233 bool has_effect =
false;
3249 if (str[0] !=
'\0') {
3250 CATLSTR(str,
sizeof(str),
"/");
3252 if (incr == 0 && bonus == 0) {
3274 return has_effect ? str :
nullptr;
3284 struct terrain *pterrain,
int *bonus)
3287 {.
value = {.
extra = pextra}, .kind = VUT_EXTRA},
3288 {.value = {.terrain = pterrain}, .kind = VUT_TERRAIN},
3289 {.kind = VUT_OTYPE }};
3340 EFT_OUTPUT_ADD_TILE, req_pattern,
ARRAY_SIZE(req_pattern));
3343 if (bonus[o] > 0 || pterrain->
output[o] > 0) {
3345 EFT_OUTPUT_INC_TILE, req_pattern,
ARRAY_SIZE(req_pattern));
3363 enum unit_activity act)
3365 static char buffer[256];
3370 fc_snprintf(buffer,
sizeof(buffer),
PL_(
"%d turn",
"%d turns", btime),
3375 PL_(
", +%d food",
", +%d food", bonus[0]), bonus[0]);
3379 PL_(
", +%d shield",
", +%d shields", bonus[1]), bonus[1]);
3383 PL_(
", +%d trade",
", +%d trade", bonus[2]), bonus[2]);
3396 const char *user_text,
struct extra_type *pextra)
3409 qCritical(
"Unknown extra!");
3426 for (
const auto &text : qAsConst(*pextra->
helptext)) {
3427 cat_snprintf(buf, bufsz,
"%s\n\n",
_(qUtf8Printable(text)));
3433 group_start = qstrlen(buf);
3437 CATLSTR(buf, bufsz,
_(
"Build by issuing an \"irrigate\" order.\n"));
3440 CATLSTR(buf, bufsz,
_(
"Build by issuing a \"mine\" order.\n"));
3443 CATLSTR(buf, bufsz,
_(
"Build by issuing a \"road\" order.\n"));
3447 if (pbase->
gui_type == BASE_GUI_OTHER) {
3449 _(
"Build by issuing a \"build base\" order.\n"));
3451 const char *order =
"";
3454 case BASE_GUI_FORTRESS:
3457 case BASE_GUI_AIRBASE:
3466 _(
"Build by issuing a \"%s\" order.\n"), order);
3472 CATLSTR(buf, bufsz,
_(
"May randomly appear around polluting city.\n"));
3476 CATLSTR(buf, bufsz,
_(
"May randomly appear around nuclear blast.\n"));
3483 CATLSTR(buf, bufsz,
_(
"This resource is placed by map generator.\n"));
3487 CATLSTR(buf, bufsz,
_(
"Can be explored by certain units.\n"));
3491 CATLSTR(buf, bufsz,
_(
"May appear spontaneously.\n"));
3494 if (requirement_vector_size(&pextra->
reqs) > 0) {
3495 char reqsbuf[8192] =
"";
3504 buildable ?
Q_(
"?bullet:* ") :
"");
3507 if (reqsbuf[0] !=
'\0') {
3509 CATLSTR(buf, bufsz,
_(
"Requirements to build:\n"));
3515 if (buf[group_start] !=
'\0') {
3519 group_start = qstrlen(buf);
3522 int pillage_time = -1;
3529 int terr_pillage_time =
3532 if (terr_pillage_time != 0) {
3533 if (pillage_time < 0) {
3534 pillage_time = terr_pillage_time;
3535 }
else if (pillage_time != terr_pillage_time) {
3544 if (pillage_time < 0) {
3546 _(
"Can be pillaged by units (time is terrain-dependent).\n"));
3547 }
else if (pillage_time > 0) {
3549 PL_(
"Can be pillaged by units (takes %d turn).\n",
3550 "Can be pillaged by units (takes %d turns).\n",
3557 int clean_time = -1;
3564 int terr_clean_time = -1;
3567 && pterrain->clean_pollution_time != 0) {
3572 && pterrain->clean_fallout_time != 0) {
3573 int terr_clean_fall_time =
3575 if (terr_clean_time > 0
3576 && terr_clean_time != terr_clean_fall_time) {
3582 terr_clean_time = terr_clean_fall_time;
3584 if (clean_time < 0) {
3585 clean_time = terr_clean_time;
3586 }
else if (clean_time != terr_clean_time) {
3594 if (clean_time < 0) {
3596 _(
"Can be cleaned by units (time is terrain-dependent).\n"));
3597 }
else if (clean_time > 0) {
3599 PL_(
"Can be cleaned by units (takes %d turn).\n",
3600 "Can be cleaned by units (takes %d turns).\n",
3606 if (requirement_vector_size(&pextra->
rmreqs) > 0) {
3607 char reqsbuf[8192] =
"";
3615 if (reqsbuf[0] !=
'\0') {
3616 CATLSTR(buf, bufsz,
_(
"Requirements to remove:\n"));
3621 if (buf[group_start] !=
'\0') {
3627 group_start = qstrlen(buf);
3629 insert_allows(&source, buf + qstrlen(buf), bufsz - qstrlen(buf),
"");
3631 if (buf[group_start] !=
'\0') {
3641 vrbuf,
sizeof(vrbuf),
_(
"* Visible only if %s known.\n"),
3646 if (pextra->
eus == EUS_HIDDEN) {
3648 _(
"* Units inside are hidden from non-allied players.\n"));
3662 if (!classes.isEmpty()) {
3663 if (proad !=
nullptr) {
3665 cat_snprintf(buf, bufsz,
_(
"* Can be traveled by %s units.\n"),
3676 _(
" * Such units can move onto this tile even if it would "
3677 "not normally be suitable terrain.\n"));
3679 if (pbase !=
nullptr) {
3685 _(
" * Such units situated here are not considered aggressive "
3686 "if this tile is within 3 tiles of a friendly city.\n"));
3691 _(
" * Can be captured by such units if at war with the "
3692 "nation that currently owns it.\n"));
3698 _(
" * Such units get a %d%% defense bonus on this "
3707 CATLSTR(buf, bufsz,
_(
"* Allows infinite movement.\n"));
3712 _(
"* Movement cost along %s is %s MP.\n"),
3720 _(
"* Defeat of one unit does not cause death of all other units "
3721 "on this tile.\n"));
3723 if (pbase !=
nullptr) {
3726 _(
"* Extends national borders of the building nation.\n"));
3730 _(
"* Grants permanent vision of an area around the tile to "
3735 _(
"* Allows the owner to see normally invisible stealth units "
3736 "in an area around the tile.\n"));
3741 _(
"* Allows the owner to see normally invisible subsurface units "
3742 "in an area around the tile.\n"));
3746 if (
extra_has_flag(pextra,
static_cast<extra_flag_id
>(flagid))) {
3747 const char *helptxt =
3750 if (helptxt !=
nullptr) {
3760 if (proad !=
nullptr || pbase !=
nullptr) {
3761 bool road, do_time, do_bonus;
3763 road = (proad !=
nullptr);
3782 if (do_time || do_bonus) {
3783 if (do_time && do_bonus) {
3786 _(
"\nTime to build and output bonus depends on terrain:\n\n"));
3790 _(
"Terrain Time Bonus F/P/T\n"
3791 "----------------------------------\n"));
3792 }
else if (do_time) {
3793 CATLSTR(buf, bufsz,
_(
"\nTime to build depends on terrain:\n\n"));
3798 "------------------\n"));
3804 _(
"\nYields an output bonus with some terrains:\n\n"));
3806 _(
"Terrain Bonus F/P/T\n"
3807 "-------------------------\n"));
3815 const char *bonus_text =
3817 if (turns > 0 || bonus_text) {
3821 buf, bufsz,
"%s%*s ",
terrain,
3832 cat_snprintf(buf, bufsz,
" %s", bonus_text ? bonus_text :
"-");
3841 if (user_text && user_text[0] !=
'\0') {
3843 CATLSTR(buf, bufsz, user_text);
3854 const char *user_text,
struct goods_type *pgood)
3862 for (
const auto &text : qAsConst(*pgood->
helptext)) {
3863 cat_snprintf(buf, bufsz,
"%s\n\n",
_(qUtf8Printable(text)));
3870 _(
"There's no bonuses paid when traderoute is established.\n\n"));
3873 _(
"When traderoute is established, %d%% of the normal "
3874 "bonus is paid.\n"),
3878 _(
"Sending city enjoys %d%% income from the route.\n"),
3881 _(
"Receiving city enjoys %d%% income from the route.\n\n"),
3896 CATLSTR(buf, bufsz, user_text);
3906 const char *user_text,
struct specialist *pspec)
3914 for (
const auto &text : qAsConst(*pspec->
helptext)) {
3915 cat_snprintf(buf, bufsz,
"%s\n\n",
_(qUtf8Printable(text)));
3931 CATLSTR(buf, bufsz, user_text);
3943 const char *user_text,
struct government *gov)
3948 .kind = VUT_GOVERNMENT};
3954 for (
const auto &text : qAsConst(*gov->
helptext)) {
3955 cat_snprintf(buf, bufsz,
"%s\n\n",
_(qUtf8Printable(text)));
3972 CATLSTR(buf, bufsz,
_(
"Features:\n"));
3973 insert_allows(&source, buf + qstrlen(buf), bufsz - qstrlen(buf),
3980 const struct unit_type *unittype =
nullptr;
3981 enum unit_type_flag_id unitflag = unit_type_flag_id_invalid();
3983 QString or_outputs =
Q_(
"?outputlist: Nothing ");
3984 QString and_outputs =
Q_(
"?outputlist: Nothing ");
3985 bool too_complex =
false;
3986 bool world_value_valid =
true;
3995 if (!preq->present || preq->quiet) {
3999 switch (preq->source.kind) {
4011 unitclass = preq->source.value.uclass;
4013 world_value_valid =
false;
4017 unittype = preq->source.value.utype;
4020 if (!unit_type_flag_id_is_valid(unitflag)) {
4022 static_cast<unit_type_flag_id
>(preq->source.value.unitflag);
4024 world_value_valid =
false;
4032 case VUT_GOVERNMENT:
4036 fc_assert(preq->source.value.govern == gov);
4040 world_value_valid =
false;
4056 const bool playerwide =
4062 int world_value = -999, net_value = -999;
4063 if (world_value_valid) {
4069 nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
4070 unittype, potype,
nullptr,
nullptr, peffect->type);
4071 net_value = peffect->value + world_value;
4077 bool harvested_only =
true;
4079 if (peffect->type == EFT_UPKEEP_FACTOR
4080 || peffect->type == EFT_UNIT_UPKEEP_FREE_PER_CITY
4081 || peffect->type == EFT_OUTPUT_BONUS
4082 || peffect->type == EFT_OUTPUT_BONUS_2) {
4084 harvested_only =
false;
4092 if (!harvested_only || pot->
harvested) {
4093 outputs.append(
_(pot->
name));
4098 if (outputs.count()) {
4103 switch (peffect->type) {
4104 case EFT_UNHAPPY_FACTOR:
4110 PL_(
"* Military units away from home and field units"
4111 " will each cause %d citizen to become unhappy.\n",
4112 "* Military units away from home and field units"
4113 " will each cause %d citizens to become unhappy.\n",
4118 case EFT_ENEMY_CITIZEN_UNHAPPY_PCT:
4119 if (playerwide && net_value != world_value) {
4120 if (world_value > 0) {
4121 if (net_value > 0) {
4123 _(
"* Unhappiness from foreign citizens due to "
4124 "war with their home state is %d%% the usual "
4126 (net_value * 100) / world_value);
4129 _(
"* No unhappiness from foreign citizens even when "
4130 "at war with their home state.\n"));
4136 _(
"* Each foreign citizen causes %.2g unhappiness "
4137 "in their city while you are at war with their "
4139 static_cast<double>(net_value) / 100);
4143 case EFT_MAKE_CONTENT_MIL:
4146 PL_(
"* Each of your cities will avoid %d unhappiness"
4147 " caused by units.\n",
4148 "* Each of your cities will avoid %d unhappiness"
4149 " caused by units.\n",
4154 case EFT_MAKE_CONTENT:
4157 PL_(
"* Each of your cities will avoid %d unhappiness,"
4158 " not including that caused by aggression.\n",
4159 "* Each of your cities will avoid %d unhappiness,"
4160 " not including that caused by aggression.\n",
4165 case EFT_FORCE_CONTENT:
4168 PL_(
"* Each of your cities will avoid %d unhappiness,"
4169 " including that caused by aggression.\n",
4170 "* Each of your cities will avoid %d unhappiness,"
4171 " including that caused by aggression.\n",
4176 case EFT_UPKEEP_FACTOR:
4177 if (world_value_valid && !unittype) {
4178 if (net_value == 0) {
4183 _(
"* You pay no %s upkeep for your units.\n"),
4184 qUtf8Printable(or_outputs));
4187 _(
"* You pay no upkeep for your units.\n"));
4189 }
else if (net_value != world_value) {
4190 double ratio =
static_cast<double>(net_value) / world_value;
4196 _(
"* You pay %.2g times normal %s upkeep for your "
4198 ratio, qUtf8Printable(and_outputs));
4201 _(
"* You pay %.2g times normal upkeep for your "
4208 case EFT_UNIT_UPKEEP_FREE_PER_CITY:
4216 PL_(
"* Each of your cities will avoid paying %d %s"
4217 " upkeep for your units.\n",
4218 "* Each of your cities will avoid paying %d %s"
4219 " upkeep for your units.\n",
4221 peffect->value, qUtf8Printable(and_outputs));
4226 PL_(
"* Each of your cities will avoid paying %d"
4227 " upkeep for your units.\n",
4228 "* Each of your cities will avoid paying %d"
4229 " upkeep for your units.\n",
4235 case EFT_CIVIL_WAR_CHANCE:
4238 _(
"* If you lose your capital,"
4239 " the base chance of civil war is %d%%.\n"),
4243 case EFT_EMPIRE_SIZE_BASE:
4246 PL_(
"* You can have %d city before an "
4247 "additional unhappy citizen appears in each city "
4248 "due to civilization size.\n",
4249 "* You can have up to %d cities before an "
4250 "additional unhappy citizen appears in each city "
4251 "due to civilization size.\n",
4256 case EFT_EMPIRE_SIZE_STEP:
4260 PL_(
"* After the first unhappy citizen due to"
4261 " civilization size, for each %d additional city"
4262 " another unhappy citizen will appear.\n",
4263 "* After the first unhappy citizen due to"
4264 " civilization size, for each %d additional cities"
4265 " another unhappy citizen will appear.\n",
4271 if (playerwide &&
game.
info.changeable_budget) {
4272 if (net_value < 100) {
4274 _(
"* The maximum rate you can set for science,"
4275 " gold, or luxuries is %d%%.\n"),
4279 _(
"* Has unlimited science/gold/luxuries rates.\n"));
4283 case EFT_MARTIAL_LAW_EACH:
4286 PL_(
"* Your units may impose martial law."
4287 " Each military unit inside a city will force %d"
4288 " unhappy citizen to become content.\n",
4289 "* Your units may impose martial law."
4290 " Each military unit inside a city will force %d"
4291 " unhappy citizens to become content.\n",
4296 case EFT_MARTIAL_LAW_MAX:
4297 if (playerwide && net_value < 100) {
4299 PL_(
"* A maximum of %d unit in each city can enforce"
4301 "* A maximum of %d units in each city can enforce"
4307 case EFT_RAPTURE_GROW:
4308 if (playerwide && net_value > 0) {
4310 _(
"* You may grow your cities by means of "
4317 _(
" (Cities below size %d cannot grow in this way.)"),
4323 case EFT_REVOLUTION_UNHAPPINESS:
4327 PL_(
"* If a city is in disorder for more than %d turn "
4328 "in a row, government will fall into anarchy.\n",
4329 "* If a city is in disorder for more than %d turns "
4330 "in a row, government will fall into anarchy.\n",
4335 case EFT_HAS_SENATE:
4336 if (playerwide && net_value > 0) {
4339 _(
"* Has a senate that may prevent declaration of war.\n"));
4342 case EFT_INSPIRE_PARTISANS:
4343 if (playerwide && net_value > 0) {
4345 _(
"* Allows partisans when cities are taken by the "
4349 case EFT_HAPPINESS_TO_GOLD:
4350 if (playerwide && net_value > 0) {
4352 _(
"* Buildings that normally confer bonuses against"
4353 " unhappiness will instead give gold.\n"));
4357 if (playerwide && net_value > 0) {
4369 _(
"* Pays no upkeep for %s.\n"),
4373 case EFT_NO_UNHAPPY:
4374 if (playerwide && net_value > 0) {
4375 CATLSTR(buf, bufsz,
_(
"* Has no unhappy citizens.\n"));
4378 case EFT_VETERAN_BUILD: {
4386 if (unit_type_flag_id_is_valid(unitflag)) {
4389 if (conditions > 1) {
4399 Q_(
"?unitclass:* New %s units will be veteran.\n"),
4401 }
else if (unit_type_flag_id_is_valid(unitflag)) {
4405 Q_(
"?unitflag:* New %s units will be veteran.\n"),
4406 unit_type_flag_id_translated_name(unitflag));
4407 }
else if (unittype !=
nullptr) {
4408 if (world_value_valid && net_value > 0) {
4417 Q_(
"?unittype:* New %s units will have the rank "
4425 cat_snprintf(buf, bufsz,
_(
"* New units will be veteran.\n"));
4428 case EFT_OUTPUT_PENALTY_TILE:
4429 if (world_value_valid) {
4435 PL_(
"* Each worked tile that gives more than %d %s will"
4436 " suffer a -1 penalty, unless the city working it"
4438 "* Each worked tile that gives more than %d %s will"
4439 " suffer a -1 penalty, unless the city working it"
4442 net_value, qUtf8Printable(or_outputs));
4447 _(
" (Cities below size %d will not celebrate.)"),
4453 case EFT_OUTPUT_INC_TILE_CELEBRATE:
4456 PL_(
"* Each worked tile with at least 1 %s will yield"
4457 " %d more of it while the city working it is"
4459 "* Each worked tile with at least 1 %s will yield"
4460 " %d more of it while the city working it is"
4463 qUtf8Printable(or_outputs), peffect->value);
4468 _(
" (Cities below size %d will not celebrate.)"),
4473 case EFT_OUTPUT_INC_TILE:
4476 PL_(
"* Each worked tile with at least 1 %s will yield"
4477 " %d more of it.\n",
4478 "* Each worked tile with at least 1 %s will yield"
4479 " %d more of it.\n",
4481 qUtf8Printable(or_outputs), peffect->value);
4483 case EFT_OUTPUT_BONUS:
4484 case EFT_OUTPUT_BONUS_2:
4488 _(
"* %s production is increased %d%%.\n"),
4489 qUtf8Printable(and_outputs), peffect->value);
4491 case EFT_OUTPUT_WASTE:
4492 if (world_value_valid) {
4493 if (net_value > 30) {
4496 _(
"* %s production will suffer massive losses.\n"),
4497 qUtf8Printable(and_outputs));
4498 }
else if (net_value >= 15) {
4501 _(
"* %s production will suffer some losses.\n"),
4502 qUtf8Printable(and_outputs));
4503 }
else if (net_value > 0) {
4506 _(
"* %s production will suffer a small amount "
4508 qUtf8Printable(and_outputs));
4512 case EFT_HEALTH_PCT:
4514 if (peffect->value > 0) {
4516 _(
"* Increases the chance of plague"
4517 " within your cities.\n"));
4518 }
else if (peffect->value < 0) {
4520 _(
"* Decreases the chance of plague"
4521 " within your cities.\n"));
4525 case EFT_OUTPUT_WASTE_BY_REL_DISTANCE:
4529 net_value = (net_value + 39) / 40;
4531 case EFT_OUTPUT_WASTE_BY_DISTANCE:
4532 if (world_value_valid) {
4533 if (net_value >= 300) {
4536 _(
"* %s losses will increase quickly"
4537 " with distance from capital.\n"),
4538 qUtf8Printable(and_outputs));
4539 }
else if (net_value >= 200) {
4542 _(
"* %s losses will increase"
4543 " with distance from capital.\n"),
4544 qUtf8Printable(and_outputs));
4545 }
else if (net_value > 0) {
4548 _(
"* %s losses will increase slowly"
4549 " with distance from capital.\n"),
4550 qUtf8Printable(and_outputs));
4554 case EFT_MIGRATION_PCT:
4556 if (peffect->value > 0) {
4558 _(
"* Increases the chance of migration"
4559 " into your cities.\n"));
4560 }
else if (peffect->value < 0) {
4562 _(
"* Decreases the chance of migration"
4563 " into your cities.\n"));
4567 case EFT_BORDER_VISION:
4571 _(
"* All tiles inside your borders are"
4595 _(
"* Makes it impossible to do the action \'%s\'"
4603 if (user_text && user_text[0] !=
'\0') {
4613 static char buf[128];
4614 char *empty =
new char;
4619 qCritical(
"Unknown unit!");
4626 if (utype->
upkeep[o] > 0) {
4629 (any > 0 ?
Q_(
"?blistmore:, ") :
""), utype->
upkeep[o],
4638 (any > 0 ?
Q_(
"?blistmore:, ") :
""), utype->
happy_cost);
4654 const char *user_text)
4657 .kind = VUT_NATION};
4658 bool print_break =
true;
4660 #define PRINT_BREAK() \
4662 if (print_break) { \
4663 if (buf[0] != '\0') { \
4664 CATLSTR(buf, bufsz, "\n\n"); \
4666 print_break = false; \
4673 if (pnation->
legend[0] !=
'\0') {
4700 _(
"Starts with knowledge of %s in addition to the standard "
4701 "starting technologies.\n"),
4702 qUtf8Printable(list));
4706 _(
"Starts with knowledge of %s.\n"),
4707 qUtf8Printable(list));
4713 int i, j, n = 0, total = 0;
4720 for (j = 0; j < n; j++) {
4738 for (i = 0; i < n; i++) {
4743 utype_names.append(QString(
_(
"%1 (%2)"))
4745 QString::number(count[i])));
4758 PL_(
"Starts with the following additional unit: %s.\n",
4759 "Starts with the following additional units: %s.\n",
4761 qUtf8Printable(list));
4768 if (init_building ==
B_LAST) {
4779 _(
"First city will get %s for free in addition to the "
4780 "standard improvements.\n"),
4781 qUtf8Printable(list));
4785 _(
"First city will get %s for free.\n"),
4786 qUtf8Printable(list));
4790 if (buf[0] !=
'\0') {
4793 insert_allows(&source, buf + qstrlen(buf), bufsz - qstrlen(buf),
"");
4795 if (user_text && user_text[0] !=
'\0') {
4796 if (buf[0] !=
'\0') {
4799 CATLSTR(buf, bufsz, user_text);
bool action_removes_extra(const struct action *paction, const struct extra_type *pextra)
Returns TRUE iff the specified action can remove the specified extra.
enum action_actor_kind action_get_actor_kind(const struct action *paction)
Get the actor kind of an action.
void action_list_end(action_id *act_list, int size)
Terminate an action list of the specified size.
enum action_battle_kind action_get_battle_kind(const struct action *pact)
Get the battle kind that can prevent an action.
enum action_sub_target_kind action_get_sub_target_kind(const struct action *paction)
Get the sub target kind of an action.
bool action_immune_government(struct government *gov, action_id act)
Will a player with the government gov be immune to the action act?
int action_dice_roll_initial_odds(const struct action *paction)
Returns the initial odds of an action not failing its dice roll.
void action_list_add_all_by_result(action_id *act_list, int *position, enum action_result result)
Add all actions with the specified result to the specified action list starting at the specified posi...
const QString action_id_name_translation(action_id act_id)
Get the action name used when displaying the action in the UI.
struct action * action_by_number(action_id act_id)
Return the action with the given id.
bool action_has_result(const struct action *paction, enum action_result result)
Returns TRUE iff performing the specified action has the specified result.
bool action_creates_extra(const struct action *paction, const struct extra_type *pextra)
Returns TRUE iff the specified action can create the specified extra.
struct action_enabler_list * action_enablers_for_action(action_id action)
Get all enablers for an action in the current ruleset.
#define action_id_univs_not_blocking(act_id, act_uni, tgt_uni)
#define action_auto_perf_iterate_end
#define action_list_iterate_end
#define action_list_iterate(_act_list_, _act_id_)
#define action_enabler_list_iterate_end
#define action_id_get_role(act_id)
#define ACTION_DISTANCE_UNLIMITED
#define action_iterate_end
#define action_id_would_be_blocked_by(blocked_id, blocker_id)
#define action_enabler_list_iterate(action_enabler_list, aenabler)
#define action_iterate(_act_)
#define action_id_get_target_kind(act_id)
#define action_auto_perf_iterate(_act_perf_)
#define ACTION_ODDS_PCT_DICE_ROLL_NA
QString strvec_to_and_list(const QVector< QString > &psv)
QString strvec_to_or_list(const QVector< QString > &psv)
bool base_has_flag(const struct base_type *pbase, enum base_flag_id flag)
Check if base provides effect.
bool territory_claiming_base(const struct base_type *pbase)
Does this base type claim territory?
bool is_any_set(QBitArray &ba)
#define BV_CLR_ALL_FROM(vec_to, vec_from)
bool BV_ISSET(const BV &bv, int bit)
#define BV_ISSET_ANY(vec)
struct output_type * get_output_type(Output_type_id output)
Return the output type for this index.
const char * get_output_name(Output_type_id output)
Return a translated name for the output type.
#define output_type_iterate(output)
#define output_type_iterate_end
static void road(QVariant data1, QVariant data2)
Action "Build Road" for choice dialog.
static void cultivate(QVariant data1, QVariant data2)
Action "Cultivate" for choice dialog.
static void plant(QVariant data1, QVariant data2)
Action "Plant" for choice dialog.
int get_target_bonus_effects(struct effect_list *plist, const struct player *target_player, const struct player *other_player, const struct city *target_city, const struct impr_type *target_building, const struct tile *target_tile, const struct unit *target_unit, const struct unit_type *target_unittype, const struct output_type *target_output, const struct specialist *target_specialist, const struct action *target_action, enum effect_type effect_type, enum vision_layer vision_layer, enum national_intelligence nintel)
Returns the effect bonus of a given type for any target.
struct effect_list * effects[EFT_COUNT]
QString effect_type_unit_text(effect_type type, int value)
Returns a string describing an effect value as interpreted in the context of an effect_type,...
void get_effect_req_text(const struct effect *peffect, char *buf, size_t buf_len)
Make user-friendly text for the source.
struct effect_list * get_req_source_effects(struct universal *psource)
Get a list of effects with this requirement source.
const effect_list * get_effects()
Get a list of all effects.
int effect_value_from_universals(enum effect_type type, struct universal *unis, size_t n_unis)
Return the base value of a given effect that can always be expected from just the sources in the list...
int effect_cumulative_max(enum effect_type type, struct universal *for_uni)
Get the maximum effect value in this ruleset for the universal (that is, the sum of all positive effe...
bool building_has_effect(const struct impr_type *pimprove, enum effect_type effect_type)
Returns TRUE if the building has any effect bonuses of the given type.
#define effect_list_iterate_end
#define effect_list_iterate(effect_list, peffect)
#define MAX_NUM_BUILDING_LIST
#define CASUS_BELLI_OUTRAGE
#define CASUS_BELLI_VICTIM
#define MAX_NUM_UNIT_LIST
#define MAX_NUM_TECH_LIST
enum output_type_id Output_type_id
size_t get_internal_string_length(const char *text)
Return the length, in characters, of the string.
#define PL_(String1, String2, n)
std::vector< government > governments
const char * government_name_translation(const struct government *pgovern)
Return the (translated) name of the given government.
#define CATLSTR(_b, _s, _t)
This module is for generic handling of help data, independent of gui considerations.
static int help_item_compar(const struct help_item *v1, const struct help_item *v2)
For help_list_sort(); sort by topic via compare_strings() (sort topics with more leading spaces after...
static void extra_bonus_for_terrain(struct extra_type *pextra, struct terrain *pterrain, int *bonus)
Calculate any fixed food/prod/trade bonus that 'pextra' will always add to terrain type,...
static void insert_allows(struct universal *psource, char *buf, size_t bufsz, const char *prefix)
Generate text for what this requirement source allows.
static bool insert_generated_text(char *outbuf, size_t outlen, const char *name)
Insert generated text for the helpdata "name".
static void insert_allows_single(struct universal *psource, const requirement_vector *psubjreqs, const char *subjstr, const char *const *strs, char *buf, size_t bufsz, const char *prefix)
Append text to 'buf' if the given requirements list 'subjreqs' contains 'psource',...
void helptext_advance(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, int i, const nation_set *nations_to_show)
Append misc dynamic text for advance/technology.
static const char *const help_type_names[]
void helptext_government(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, struct government *gov)
Append text for government.
void helptext_extra(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, struct extra_type *pextra)
Append misc dynamic text for extras.
char * helptext_unit(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, const struct unit_type *utype, const nation_set *nations_to_show)
Append misc dynamic text for units.
static void format_change_terrain_string(char *buf, int bufsize, enum gen_action act, int time, terrain *from, const terrain *to)
Formats the number of turns to transform between terrains so it can be included in the terrain altera...
const char * helptext_road_bonus_str(const struct terrain *pterrain, const struct road_type *proad)
Return a textual representation of the F/P/T bonus a road provides to a terrain if supplied,...
const struct help_item * get_help_item_spec(const char *name, enum help_page_type htype, int *pos)
The following few functions are essentially wrappers for the help_nodes help_list.
char * helptext_unit_upkeep_str(const struct unit_type *utype)
Returns pointer to static string with eg: "1 shield, 1 unhappy".
char * helptext_building(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, const struct impr_type *pimprove, const nation_set *nations_to_show)
FIXME: Also, in principle these could be auto-generated once, inserted into pitem->text,...
static bool insert_veteran_help(char *outbuf, size_t outlen, const struct veteran_system *veteran, const char *intro, const char *nolevels)
Insert fixed-width table describing veteran system.
QList< const struct help_item * > helpList
void helptext_goods(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, struct goods_type *pgood)
Append misc dynamic text for goods.
struct help_item * new_help_item(help_page_type type)
Allocate and initialize new help item.
void free_help_texts()
Free all allocations associated with help_nodes.
const char * helptext_extra_for_terrain_str(struct extra_type *pextra, struct terrain *pterrain, enum unit_activity act)
Return a brief description specific to the extra and terrain, when extra is built by cause 'act'.
void boot_help_texts(const nation_set *nations_to_show, help_item *tileset_help)
pplayer may be nullptr.
static bool utype_may_do_escape_action(const struct unit_type *utype)
Returns TRUE iff the specified unit type is able to perform an action that allows it to escape to the...
void helptext_specialist(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, struct specialist *pspec)
Append misc dynamic text for specialists.
void helptext_terrain(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, struct terrain *pterrain)
Append text for terrain.
void helptext_nation(char *buf, size_t bufsz, struct nation_type *pnation, const char *user_text)
Returns nation legend and characteristics.
#define HELP_TILESET_ITEM
#define HELP_RULESET_ITEM
const struct impr_type * valid_improvement(const struct impr_type *pimprove)
Returns pointer when the improvement_type "exists" in this game, returns nullptr otherwise.
struct impr_type * improvement_by_number(const Impr_type_id id)
Returns the improvement type for the given index/ID.
bool is_great_wonder(const struct impr_type *pimprove)
Is this building a great wonder?
bool improvement_has_flag(const struct impr_type *pimprove, enum impr_flag_id flag)
Return TRUE if the impr has this flag otherwise FALSE.
const char * improvement_name_translation(const struct impr_type *pimprove)
Return the (translated) name of the given improvement.
bool is_small_wonder(const struct impr_type *pimprove)
Is this building a small wonder?
#define improvement_iterate_end
#define improvement_iterate(_p)
#define fc_assert_ret(condition)
#define fc_assert(condition)
#define fc_assert_ret_val(condition, val)
struct terrain_misc terrain_control
const char * move_points_text_full(int mp, bool reduce, const char *prefix, const char *none, bool align)
Render positive movement points as text, including fractional movement points, scaled by SINGLE_MOVE.
bool is_native_to_class(const struct unit_class *punitclass, const struct terrain *pterrain, const bv_extras *extras)
This terrain is native to unit class.
bool can_unit_type_transport(const struct unit_type *transporter, const struct unit_class *transported)
Return TRUE iff transporter type has ability to transport transported class.
bool can_attack_non_native(const struct unit_type *utype)
This unit can attack non-native tiles (eg.
const char * move_points_text(int mp, bool reduce)
Simple version of move_points_text_full() – render positive movement points as text without any prefi...
#define multipliers_iterate(_mul_)
#define multipliers_iterate_end
static const char * name_translation_get(const struct name_translation *ptrans)
std::vector< nation_type > nations
bool nation_is_in_set(const struct nation_type *pnation, const struct nation_set *pset)
Check if the given nation is in a given set.
const char * nation_plural_translation(const struct nation_type *pnation)
Return the (translated) plural noun of the given nation.
const char * diplrel_name_translation(int value)
Return the translated name of the given diplomatic relation.
struct section_file * secfile_load(const QString &filename, bool allow_duplicates)
Create a section file from a file.
const char * secfile_error()
Returns the last error which occurred in a string.
const char * section_name(const struct section *psection)
Returns the section name.
void secfile_destroy(struct section_file *secfile)
Free a section file.
void secfile_check_unused(const struct section_file *secfile)
Print log messages for any entries in the file which have not been looked up – ie,...
const char * secfile_lookup_str(const struct section_file *secfile, const char *path,...)
Lookup a string value in the secfile.
const char ** secfile_lookup_str_vec(const struct section_file *secfile, size_t *dim, const char *path,...)
Lookup a string vector in the secfile.
struct section_list * secfile_sections_by_name_prefix(const struct section_file *secfile, const char *prefix)
Returns the list of sections which match the name prefix.
#define section_list_iterate(seclist, psection)
#define section_list_iterate_end
bool req_text_insert_nl(char *buf, size_t bufsz, struct player *pplayer, const struct requirement *preq, enum rt_verbosity verb, const char *prefix)
Append text for the requirement.
bool universal_is_relevant_to_requirement(const struct requirement *req, const struct universal *source)
Returns TRUE iff the specified universal is relevant to fulfilling the specified requirement.
bool universal_fulfills_requirements(bool check_necessary, const struct requirement_vector *reqs, const struct universal *source)
Will the universal 'source' fulfill the requirements in the list? If 'check_necessary' is FALSE: are ...
const char * universal_name_translation(const struct universal *psource, char *buf, size_t bufsz)
Make user-friendly text for the source.
bool are_universals_equal(const struct universal *psource1, const struct universal *psource2)
Return TRUE iff the two sources are equivalent.
#define requirement_fulfilled_by_unit_type(_ut_, _rqs_)
#define requirement_fulfilled_by_improvement(_imp_, _rqs_)
#define requirement_vector_iterate_end
#define requirement_vector_iterate(req_vec, preq)
int research_goal_unknown_techs(const struct research *presearch, Tech_type_id goal)
Returns the number of technologies the player need to research to get the goal technology.
bool research_invention_reachable(const struct research *presearch, const Tech_type_id tech)
Returns TRUE iff the given tech is ever reachable via research by the players sharing the research by...
struct research * research_get(const struct player *pplayer)
Returns the research structure associated with the player.
int research_goal_bulbs_required(const struct research *presearch, Tech_type_id goal)
Function to determine cost (in bulbs) of reaching goal technology.
int research_total_bulbs_required(const struct research *presearch, Tech_type_id tech, bool loss_value)
Function to determine cost for technology.
enum tech_state research_invention_state(const struct research *presearch, Tech_type_id tech)
Returns state of the tech for current research.
bool road_has_flag(const struct road_type *proad, enum road_flag_id flag)
Check if road provides effect.
bool road_provides_move_bonus(const struct road_type *proad)
Does road type provide move bonus.
server_setting_id server_setting_by_name(const char *name)
Returns the server setting with the specified name.
bool server_setting_value_bool_get(server_setting_id id)
Returns the value of the server setting with the specified id.
struct setting_list * level[OLEVELS_NUM]
const QStringList & get_data_dirs()
Returns a list of data directory paths, in the order in which they should be searched.
QString fileinfoname(const QStringList &dirs, const QString &filename)
Returns a filename to access the specified file from a directory by searching all specified directori...
struct specialist * specialist_by_number(const Specialist_type_id id)
Return the specialist pointer for the given number.
const char * specialist_plural_translation(const struct specialist *sp)
Return the (translated, plural) name of the specialist type.
#define specialist_type_iterate_end
#define specialist_type_iterate(sp)
struct action::@10::@11 is_unit
enum action_result result
struct requirement_vector research_reqs
struct tech_class * tclass
QVector< QString > * helptext
enum base_gui_type gui_type
struct packet_ruleset_control control
struct civ_game::@28::@31 client
int global_init_techs[MAX_NUM_TECH_LIST]
struct packet_game_info info
int global_init_buildings[MAX_NUM_BUILDING_LIST]
struct packet_scenario_info scenario
char * ruleset_description
struct civ_game::@27 rgame
struct veteran_system * veteran
struct requirement_vector reqs
QVector< QString > * helptext
struct requirement_vector reqs
QVector< QString > * helptext
struct requirement_vector obsolete_by
struct requirement_vector reqs
QVector< QString > * helptext
Functions for handling the nations.
int init_buildings[MAX_NUM_BUILDING_LIST]
std::array< unit_type *, MAX_NUM_UNIT_LIST > init_units
int init_techs[MAX_NUM_TECH_LIST]
government * init_government
int tile_incr_const[O_LAST]
struct requirement_vector reqs
QVector< QString > * helptext
QVector< QString > * helptext
int road_output_incr_pct[O_LAST]
QVector< QString > * helptext
struct requirement_vector build_reqs
QVector< QString > * helptext
struct veteran_system * veteran
const struct unit_type * obsoleted_by
struct advance * require_advance
bv_unit_classes disembarks
const struct unit_type * converted_to
struct combat_bonus_list * bonuses
struct name_translation name
struct veteran_level * definitions
int fc_snprintf(char *str, size_t n, const char *format,...)
See also fc_utf8_snprintf_trunc(), fc_utf8_snprintf_rep().
size_t fc_strlcpy(char *dest, const char *src, size_t n)
fc_strlcpy() provides utf-8 version of (non-standard) function strlcpy() It is intended as more user-...
int fc_strcasecmp(const char *str0, const char *str1)
Compare strings like strcmp(), but ignoring case.
size_t fc_strlcat(char *dest, const char *src, size_t n)
fc_strlcat() provides utf-8 version of (non-standard) function strlcat() It is intended as more user-...
int cat_snprintf(char *str, size_t n, const char *format,...)
cat_snprintf is like a combination of fc_snprintf and fc_strlcat; it does snprintf to the end of an e...
#define sz_strlcpy(dest, src)
#define sz_strlcat(dest, src)
const char * tech_class_name_translation(const struct tech_class *ptclass)
Return the (translated) name of the given tech_class You must not free the return pointer.
bool advance_has_flag(Tech_type_id tech, enum tech_flag_id flag)
Return TRUE if the tech has this flag otherwise FALSE.
struct advance * advance_requires(const struct advance *padvance, enum tech_req require)
Accessor for requirements.
struct advance * advance_by_number(const Tech_type_id atype)
Return the advance for the given advance index.
const char * tech_flag_helptxt(enum tech_flag_id id)
Return the (untranslated) helptxt of the user tech flag.
struct advance * valid_advance_by_number(const Tech_type_id id)
Returns pointer when the advance "exists" in this game, returns nullptr otherwise.
bool techs_have_fixed_costs()
Returns true if the costs for the given technology will stay constant during the game.
Tech_type_id advance_number(const struct advance *padvance)
Return the advance index.
const char * advance_name_translation(const struct advance *padvance)
Return the (translated) name of the given advance/technology.
#define advance_index_iterate_end
#define advance_root_req_iterate_end
#define advance_index_iterate(_start, _index)
#define advance_root_req_iterate(_goal, _padvance)
const char * terrain_rule_name(const struct terrain *pterrain)
Return the (untranslated) rule name of the terrain.
const char * terrain_flag_helptxt(enum terrain_flag_id id)
Return the (untranslated) helptxt of the user terrain flag.
enum terrain_class terrain_type_terrain_class(const struct terrain *pterrain)
What terrain class terrain type belongs to.
const char * terrain_name_translation(const struct terrain *pterrain)
Return the (translated) name of the terrain.
int terrain_extra_build_time(const struct terrain *pterrain, enum unit_activity activity, const struct extra_type *tgt)
Time to complete the extra building activity on the given terrain.
#define terrain_type_iterate(_p)
#define terrain_type_iterate_end
#define terrain_has_flag(terr, flag)
help_item * tileset_help(const struct tileset *t)
Creates the help item for the given tileset.
const char * goods_name_translation(struct goods_type *pgood)
Return translated name of this goods type.
#define goods_type_iterate_end
#define goods_type_iterate(_p)
const struct unit_type * utype
struct extra_type * extra
struct nation_type * nation
struct government * govern
const struct impr_type * building
enum unit_activity activity
Output_type_id outputtype
int utype_pop_value(const struct unit_type *punittype)
How much city shrinks when it builds unit of this type.
const char * uclass_name_translation(const struct unit_class *pclass)
Return the (translated) name of the unit class.
int utype_pays_mp_for_action_base(const struct action *paction, const struct unit_type *putype)
Returns the amount of movement points successfully performing the specified action will consume in th...
bool utype_can_freely_unload(const struct unit_type *pcargotype, const struct unit_type *ptranstype)
Return TRUE iff the given cargo type has no restrictions on when it can unload from the given transpo...
const char * unit_class_flag_helptxt(enum unit_class_flag_id id)
Return the (untranslated) help text of the user unit class flag.
Unit_type_id utype_count()
Return the number of unit types.
int utype_build_shield_cost_base(const struct unit_type *punittype)
Returns the number of shields this unit type represents.
const char * unit_type_flag_helptxt(enum unit_type_flag_id id)
Return the (untranslated) helptxt of the user unit flag.
int num_role_units(int role)
How many unit types have specified role/flag.
bool utype_can_freely_load(const struct unit_type *pcargotype, const struct unit_type *ptranstype)
Return TRUE iff the given cargo type has no restrictions on when it can load onto the given transport...
Unit_Class_id uclass_count()
Return the unit_class count.
int utype_veteran_levels(const struct unit_type *punittype)
Return veteran levels of the given unit type.
bool utype_can_do_action_result(const struct unit_type *putype, enum action_result result)
Return TRUE iff units of the given type can do any enabler controlled action with the specified actio...
const struct veteran_system * utype_veteran_system(const struct unit_type *punittype)
Return veteran system used for this unit type.
const char * utype_name_translation(const struct unit_type *punittype)
Return the (translated) name of the unit type.
bool utype_is_consumed_by_action(const struct action *paction, const struct unit_type *utype)
Returns TRUE iff performing the specified action will consume an actor unit of the specified type.
bool utype_veteran_has_power_bonus(const struct unit_type *punittype)
Return whether this unit type's veteran system, if any, confers a power factor bonus at any level (it...
struct unit_type * get_role_unit(int role, int role_index)
Return index-th unit with specified role/flag.
bool can_utype_do_act_if_tgt_diplrel(const struct unit_type *punit_type, const action_id act_id, const int prop, const bool is_there)
Return TRUE iff the given (action enabler controlled) action can be performed by a unit of the given ...
bool utype_can_do_action(const struct unit_type *putype, const action_id act_id)
Return TRUE iff units of the given type can do the specified generalized (ruleset defined) action ena...
const struct veteran_level * utype_veteran_level(const struct unit_type *punittype, int level)
Return veteran level properties of given unit in given veterancy level.
#define UCF_LAST_USER_FLAG
static bool uclass_has_flag(const struct unit_class *punitclass, enum unit_class_flag_id flag)
#define utype_fuel(ptype)
#define combat_bonus_list_iterate_end
#define combat_bonus_list_iterate(bonuslist, pbonus)
#define unit_class_iterate(_p)
static bool utype_has_flag(const struct unit_type *punittype, int flag)
#define UTYF_LAST_USER_FLAG
#define unit_type_iterate(_p)
#define uclass_index(_c_)
#define unit_class_iterate_end
#define unit_type_iterate_end
const char * freeciv_name_version()
Return string containing both name of Freeciv21 and version.