Freeciv21
Develop your civilization from humble roots to a global empire
reqtext.cpp
Go to the documentation of this file.
1 /*
2 Copyright (c) 1996-2021 Freeciv21 and Freeciv contributors. This file is
3  /\/\ part of Freeciv21. Freeciv21 is free software: you can
4  \_\ _..._ redistribute it and/or modify it under the terms of the
5  (" )(_..._) GNU General Public License as published by the Free
6  ^^ // \\ Software Foundation, either version 3 of the License,
7  or (at your option) any later version. You should have
8 received a copy of the GNU General Public License along with Freeciv21.
9  If not, see https://www.gnu.org/licenses/.
10  */
11 
12 // utility
13 #include "astring.h"
14 #include "fcintl.h"
15 
16 // common
17 #include "achievements.h"
18 #include "actions.h"
19 #include "calendar.h"
20 #include "extras.h"
21 #include "government.h"
22 #include "map.h"
23 #include "movement.h"
24 #include "nation.h"
25 #include "player.h"
26 #include "requirements.h"
27 #include "server_settings.h"
28 #include "specialist.h"
29 #include "style.h"
30 
31 #include "reqtext.h"
32 
41 bool req_text_insert(char *buf, size_t bufsz, struct player *pplayer,
42  const struct requirement *preq, enum rt_verbosity verb,
43  const char *prefix)
44 {
45  if (preq->quiet && verb != VERB_ACTUAL) {
46  return false;
47  }
48 
49  switch (preq->source.kind) {
50  case VUT_NONE:
51  return false;
52 
53  case VUT_ADVANCE:
54  switch (preq->range) {
55  case REQ_RANGE_PLAYER:
56  fc_strlcat(buf, prefix, bufsz);
57  if (preq->present) {
58  cat_snprintf(buf, bufsz,
59  _("Requires knowledge of the technology %s."),
61  } else {
62  cat_snprintf(buf, bufsz,
63  _("Prevented by knowledge of the technology %s."),
65  }
66  return true;
67  case REQ_RANGE_TEAM:
68  fc_strlcat(buf, prefix, bufsz);
69  if (preq->present) {
70  cat_snprintf(buf, bufsz,
71  _("Requires that a player on your team knows the "
72  "technology %s."),
74  } else {
75  cat_snprintf(buf, bufsz,
76  _("Prevented if any player on your team knows the "
77  "technology %s."),
79  }
80  return true;
81  case REQ_RANGE_ALLIANCE:
82  fc_strlcat(buf, prefix, bufsz);
83  if (preq->present) {
84  cat_snprintf(buf, bufsz,
85  _("Requires that a player allied to you knows the "
86  "technology %s."),
88  } else {
89  cat_snprintf(buf, bufsz,
90  _("Prevented if any player allied to you knows the "
91  "technology %s."),
93  }
94  return true;
95  case REQ_RANGE_WORLD:
96  fc_strlcat(buf, prefix, bufsz);
97  if (preq->survives) {
98  if (preq->present) {
99  cat_snprintf(buf, bufsz,
100  _("Requires that someone has discovered the "
101  "technology %s."),
103  } else {
104  cat_snprintf(buf, bufsz,
105  _("Requires that no-one has yet discovered the "
106  "technology %s."),
108  }
109  } else {
110  if (preq->present) {
111  cat_snprintf(buf, bufsz,
112  _("Requires that some player knows the "
113  "technology %s."),
115  } else {
116  cat_snprintf(buf, bufsz,
117  _("Requires that no player knows the "
118  "technology %s."),
120  }
121  }
122  return true;
123  case REQ_RANGE_LOCAL:
124  case REQ_RANGE_CADJACENT:
125  case REQ_RANGE_ADJACENT:
126  case REQ_RANGE_CITY:
127  case REQ_RANGE_TRADEROUTE:
128  case REQ_RANGE_CONTINENT:
129  case REQ_RANGE_COUNT:
130  // Not supported.
131  break;
132  }
133  break;
134 
135  case VUT_TECHFLAG:
136  switch (preq->range) {
137  case REQ_RANGE_PLAYER:
138  fc_strlcat(buf, prefix, bufsz);
139  if (preq->present) {
140  cat_snprintf(buf, bufsz,
141  // TRANS: %s is a (translatable) tech flag.
142  _("Requires knowledge of a technology with the "
143  "\"%s\" flag."),
144  tech_flag_id_translated_name(
145  tech_flag_id(preq->source.value.techflag)));
146  } else {
147  cat_snprintf(buf, bufsz,
148  // TRANS: %s is a (translatable) tech flag.
149  _("Prevented by knowledge of any technology with the "
150  "\"%s\" flag."),
151  tech_flag_id_translated_name(
152  tech_flag_id(preq->source.value.techflag)));
153  }
154  return true;
155  case REQ_RANGE_TEAM:
156  fc_strlcat(buf, prefix, bufsz);
157  if (preq->present) {
158  cat_snprintf(buf, bufsz,
159  // TRANS: %s is a (translatable) tech flag.
160  _("Requires that a player on your team knows "
161  "a technology with the \"%s\" flag."),
162  tech_flag_id_translated_name(
163  tech_flag_id(preq->source.value.techflag)));
164  } else {
165  cat_snprintf(buf, bufsz,
166  // TRANS: %s is a (translatable) tech flag.
167  _("Prevented if any player on your team knows "
168  "any technology with the \"%s\" flag."),
169  tech_flag_id_translated_name(
170  tech_flag_id(preq->source.value.techflag)));
171  }
172  return true;
173  case REQ_RANGE_ALLIANCE:
174  fc_strlcat(buf, prefix, bufsz);
175  if (preq->present) {
176  cat_snprintf(buf, bufsz,
177  // TRANS: %s is a (translatable) tech flag.
178  _("Requires that a player allied to you knows "
179  "a technology with the \"%s\" flag."),
180  tech_flag_id_translated_name(
181  tech_flag_id(preq->source.value.techflag)));
182  } else {
183  cat_snprintf(buf, bufsz,
184  // TRANS: %s is a (translatable) tech flag.
185  _("Prevented if any player allied to you knows "
186  "any technology with the \"%s\" flag."),
187  tech_flag_id_translated_name(
188  tech_flag_id(preq->source.value.techflag)));
189  }
190  return true;
191  case REQ_RANGE_WORLD:
192  fc_strlcat(buf, prefix, bufsz);
193  if (preq->present) {
194  cat_snprintf(buf, bufsz,
195  // TRANS: %s is a (translatable) tech flag.
196  _("Requires that some player knows a technology "
197  "with the \"%s\" flag."),
198  tech_flag_id_translated_name(
199  tech_flag_id(preq->source.value.techflag)));
200  } else {
201  cat_snprintf(buf, bufsz,
202  // TRANS: %s is a (translatable) tech flag.
203  _("Requires that no player knows any technology with "
204  "the \"%s\" flag."),
205  tech_flag_id_translated_name(
206  tech_flag_id(preq->source.value.techflag)));
207  }
208  return true;
209  case REQ_RANGE_LOCAL:
210  case REQ_RANGE_CADJACENT:
211  case REQ_RANGE_ADJACENT:
212  case REQ_RANGE_CITY:
213  case REQ_RANGE_TRADEROUTE:
214  case REQ_RANGE_CONTINENT:
215  case REQ_RANGE_COUNT:
216  // Not supported.
217  break;
218  }
219  break;
220 
221  case VUT_GOVERNMENT:
222  if (preq->range != REQ_RANGE_PLAYER) {
223  break;
224  }
225  fc_strlcat(buf, prefix, bufsz);
226  if (preq->present) {
227  cat_snprintf(buf, bufsz, _("Requires the %s government."),
229  } else {
230  cat_snprintf(buf, bufsz, _("Not available under the %s government."),
232  }
233  return true;
234 
235  case VUT_ACHIEVEMENT:
236  switch (preq->range) {
237  case REQ_RANGE_PLAYER:
238  fc_strlcat(buf, prefix, bufsz);
239  if (preq->present) {
240  cat_snprintf(
241  buf, bufsz, _("Requires you to have achieved \"%s\"."),
243  } else {
244  cat_snprintf(
245  buf, bufsz,
246  _("Not available once you have achieved "
247  "\"%s\"."),
249  }
250  return true;
251  case REQ_RANGE_TEAM:
252  fc_strlcat(buf, prefix, bufsz);
253  if (preq->present) {
254  cat_snprintf(
255  buf, bufsz,
256  _("Requires that at least one of your "
257  "team-mates has achieved \"%s\"."),
259  } else {
260  cat_snprintf(
261  buf, bufsz,
262  _("Not available if any of your team-mates "
263  "has achieved \"%s\"."),
265  }
266  return true;
267  case REQ_RANGE_ALLIANCE:
268  fc_strlcat(buf, prefix, bufsz);
269  if (preq->present) {
270  cat_snprintf(
271  buf, bufsz,
272  _("Requires that at least one of your allies "
273  "has achieved \"%s\"."),
275  } else {
276  cat_snprintf(
277  buf, bufsz,
278  _("Not available if any of your allies has "
279  "achieved \"%s\"."),
281  }
282  return true;
283  case REQ_RANGE_WORLD:
284  fc_strlcat(buf, prefix, bufsz);
285  if (preq->present) {
286  cat_snprintf(
287  buf, bufsz,
288  _("Requires that at least one player "
289  "has achieved \"%s\"."),
291  } else {
292  cat_snprintf(
293  buf, bufsz,
294  _("Not available if any player has "
295  "achieved \"%s\"."),
297  }
298  return true;
299  case REQ_RANGE_LOCAL:
300  case REQ_RANGE_CADJACENT:
301  case REQ_RANGE_ADJACENT:
302  case REQ_RANGE_CITY:
303  case REQ_RANGE_TRADEROUTE:
304  case REQ_RANGE_CONTINENT:
305  case REQ_RANGE_COUNT:
306  // Not supported.
307  break;
308  }
309  break;
310 
311  case VUT_ACTION:
312  switch (preq->range) {
313  case REQ_RANGE_LOCAL:
314  fc_strlcat(buf, prefix, bufsz);
315  if (preq->present) {
316  cat_snprintf(buf, bufsz, _("Applies to the \"%s\" action."),
317  qUtf8Printable(action_name_translation(
318  preq->source.value.action)));
319  } else {
320  cat_snprintf(buf, bufsz,
321  _("Doesn't apply to the \"%s\""
322  " action."),
323  qUtf8Printable(action_name_translation(
324  preq->source.value.action)));
325  }
326  return true;
327  default:
328  // Not supported.
329  break;
330  }
331  break;
332 
333  case VUT_IMPR_GENUS:
334  switch (preq->range) {
335  case REQ_RANGE_LOCAL:
336  fc_strlcat(buf, prefix, bufsz);
337  if (preq->present) {
338  cat_snprintf(
339  buf, bufsz, _("Applies to \"%s\" buildings."),
340  impr_genus_id_translated_name(preq->source.value.impr_genus));
341  } else {
342  cat_snprintf(
343  buf, bufsz, _("Doesn't apply to \"%s\" buildings."),
344  impr_genus_id_translated_name(preq->source.value.impr_genus));
345  }
346  return true;
347  default:
348  // Not supported.
349  break;
350  }
351  break;
352 
353  case VUT_IMPROVEMENT:
354  switch (preq->range) {
355  case REQ_RANGE_WORLD:
356  if (is_great_wonder(preq->source.value.building)) {
357  fc_strlcat(buf, prefix, bufsz);
358  if (preq->survives) {
359  if (preq->present) {
361  cat_snprintf(
362  buf, bufsz,
363  // TRANS: %s is a wonder
364  _("Requires that %s was built at some point, "
365  "and that it has not yet been rendered "
366  "obsolete."),
368  } else {
369  cat_snprintf(
370  buf, bufsz,
371  // TRANS: %s is a wonder
372  _("Requires that %s was built at some point."),
374  }
375  } else {
377  cat_snprintf(
378  buf, bufsz,
379  // TRANS: %s is a wonder
380  _("Prevented if %s has ever been built, "
381  "unless it would be obsolete."),
383  } else {
384  cat_snprintf(
385  buf, bufsz,
386  // TRANS: %s is a wonder
387  _("Prevented if %s has ever been built."),
389  }
390  }
391  } else {
392  // Non-surviving requirement
393  if (preq->present) {
395  cat_snprintf(
396  buf, bufsz,
397  // TRANS: %s is a wonder
398  _("Requires %s to be owned by any player "
399  "and not yet obsolete."),
401  } else {
402  cat_snprintf(
403  buf, bufsz,
404  // TRANS: %s is a wonder
405  _("Requires %s to be owned by any player."),
407  }
408  } else {
410  cat_snprintf(
411  buf, bufsz,
412  // TRANS: %s is a wonder
413  _("Prevented if %s is currently owned by "
414  "any player, unless it is obsolete."),
416  } else {
417  cat_snprintf(
418  buf, bufsz,
419  // TRANS: %s is a wonder
420  _("Prevented if %s is currently owned by "
421  "any player."),
423  }
424  }
425  }
426  return true;
427  }
428  // non-great-wonder world-ranged requirements not supported
429  break;
430  case REQ_RANGE_ALLIANCE:
431  if (is_wonder(preq->source.value.building)) {
432  fc_strlcat(buf, prefix, bufsz);
433  if (preq->survives) {
434  if (preq->present) {
436  cat_snprintf(
437  buf, bufsz,
438  // TRANS: %s is a wonder
439  _("Requires someone who is currently allied to "
440  "you to have built %s at some point, and for "
441  "it not to have been rendered obsolete."),
443  } else {
444  cat_snprintf(
445  buf, bufsz,
446  // TRANS: %s is a wonder
447  _("Requires someone who is currently allied to "
448  "you to have built %s at some point."),
450  }
451  } else {
453  cat_snprintf(
454  buf, bufsz,
455  // TRANS: %s is a wonder
456  _("Prevented if someone currently allied to you "
457  "has ever built %s, unless it would be "
458  "obsolete."),
460  } else {
461  cat_snprintf(
462  buf, bufsz,
463  // TRANS: %s is a wonder
464  _("Prevented if someone currently allied to you "
465  "has ever built %s."),
467  }
468  }
469  } else {
470  // Non-surviving requirement
471  if (preq->present) {
473  cat_snprintf(
474  buf, bufsz,
475  // TRANS: %s is a wonder
476  _("Requires someone allied to you to own %s, "
477  "and for it not to have been rendered "
478  "obsolete."),
480  } else {
481  cat_snprintf(
482  buf, bufsz,
483  // TRANS: %s is a wonder
484  _("Requires someone allied to you to own %s."),
486  }
487  } else {
489  cat_snprintf(
490  buf, bufsz,
491  // TRANS: %s is a wonder
492  _("Prevented if someone allied to you owns %s, "
493  "unless it is obsolete."),
495  } else {
496  cat_snprintf(
497  buf, bufsz,
498  // TRANS: %s is a wonder
499  _("Prevented if someone allied to you owns %s."),
501  }
502  }
503  }
504  return true;
505  }
506  // non-wonder alliance-ranged requirements not supported
507  break;
508  case REQ_RANGE_TEAM:
509  if (is_wonder(preq->source.value.building)) {
510  fc_strlcat(buf, prefix, bufsz);
511  if (preq->survives) {
512  if (preq->present) {
514  cat_snprintf(
515  buf, bufsz,
516  // TRANS: %s is a wonder
517  _("Requires someone on your team to have "
518  "built %s at some point, and for it not "
519  "to have been rendered obsolete."),
521  } else {
522  cat_snprintf(
523  buf, bufsz,
524  // TRANS: %s is a wonder
525  _("Requires someone on your team to have "
526  "built %s at some point."),
528  }
529  } else {
531  cat_snprintf(
532  buf, bufsz,
533  // TRANS: %s is a wonder
534  _("Prevented if someone on your team has ever "
535  "built %s, unless it would be obsolete."),
537  } else {
538  cat_snprintf(
539  buf, bufsz,
540  // TRANS: %s is a wonder
541  _("Prevented if someone on your team has ever "
542  "built %s."),
544  }
545  }
546  } else {
547  // Non-surviving requirement
548  if (preq->present) {
550  cat_snprintf(
551  buf, bufsz,
552  // TRANS: %s is a wonder
553  _("Requires someone on your team to own %s, "
554  "and for it not to have been rendered "
555  "obsolete."),
557  } else {
558  cat_snprintf(
559  buf, bufsz,
560  // TRANS: %s is a wonder
561  _("Requires someone on your team to own %s."),
563  }
564  } else {
566  cat_snprintf(
567  buf, bufsz,
568  // TRANS: %s is a wonder
569  _("Prevented if someone on your team owns %s, "
570  "unless it is obsolete."),
572  } else {
573  cat_snprintf(
574  buf, bufsz,
575  // TRANS: %s is a wonder
576  _("Prevented if someone on your team owns %s."),
578  }
579  }
580  }
581  return true;
582  }
583  // non-wonder team-ranged requirements not supported
584  break;
585  case REQ_RANGE_PLAYER:
586  if (is_wonder(preq->source.value.building)) {
587  fc_strlcat(buf, prefix, bufsz);
588  if (preq->survives) {
589  if (preq->present) {
591  cat_snprintf(
592  buf, bufsz,
593  // TRANS: %s is a wonder
594  _("Requires you to have built %s at some point, "
595  "and for it not to have been rendered "
596  "obsolete."),
598  } else {
599  cat_snprintf(
600  buf, bufsz,
601  // TRANS: %s is a wonder
602  _("Requires you to have built %s at some point."),
604  }
605  } else {
607  cat_snprintf(
608  buf, bufsz,
609  // TRANS: %s is a wonder
610  _("Prevented if you have ever built %s, "
611  "unless it would be obsolete."),
613  } else {
614  cat_snprintf(
615  buf, bufsz,
616  // TRANS: %s is a wonder
617  _("Prevented if you have ever built %s."),
619  }
620  }
621  } else {
622  // Non-surviving requirement
623  if (preq->present) {
625  cat_snprintf(
626  buf, bufsz,
627  // TRANS: %s is a wonder
628  _("Requires you to own %s, which must not "
629  "be obsolete."),
631  } else {
632  cat_snprintf(
633  buf, bufsz,
634  // TRANS: %s is a wonder
635  _("Requires you to own %s."),
637  }
638  } else {
640  cat_snprintf(
641  buf, bufsz,
642  // TRANS: %s is a wonder
643  _("Prevented if you own %s, unless it is "
644  "obsolete."),
646  } else {
647  cat_snprintf(
648  buf, bufsz,
649  // TRANS: %s is a wonder
650  _("Prevented if you own %s."),
652  }
653  }
654  }
655  return true;
656  }
657  // non-wonder player-ranged requirements not supported
658  break;
659  case REQ_RANGE_CONTINENT:
660  if (is_wonder(preq->source.value.building)) {
661  fc_strlcat(buf, prefix, bufsz);
662  if (preq->present) {
664  cat_snprintf(
665  buf, bufsz,
666  // TRANS: %s is a wonder
667  _("Requires %s in one of your cities on the same "
668  "continent, and not yet obsolete."),
670  } else {
671  cat_snprintf(
672  buf, bufsz,
673  // TRANS: %s is a wonder
674  _("Requires %s in one of your cities on the same "
675  "continent."),
677  }
678  } else {
680  cat_snprintf(
681  buf, bufsz,
682  // TRANS: %s is a wonder
683  _("Prevented if %s is in one of your cities on the "
684  "same continent, unless it is obsolete."),
686  } else {
687  cat_snprintf(
688  buf, bufsz,
689  // TRANS: %s is a wonder
690  _("Prevented if %s is in one of your cities on the "
691  "same continent."),
693  }
694  }
695  return true;
696  }
697  /* surviving or non-wonder continent-ranged requirements not supported
698  */
699  break;
700  case REQ_RANGE_TRADEROUTE:
701  fc_strlcat(buf, prefix, bufsz);
702  if (preq->present) {
704  // Should only apply to wonders
705  cat_snprintf(
706  buf, bufsz,
707  // TRANS: %s is a building or wonder
708  _("Requires %s in the city or a trade partner "
709  "(and not yet obsolete)."),
711  } else {
712  cat_snprintf(
713  buf, bufsz,
714  // TRANS: %s is a building or wonder
715  _("Requires %s in the city or a trade partner."),
717  }
718  } else {
720  // Should only apply to wonders
721  cat_snprintf(
722  buf, bufsz,
723  // TRANS: %s is a building or wonder
724  _("Prevented by %s in the city or a trade partner "
725  "(unless it is obsolete)."),
727  } else {
728  cat_snprintf(
729  buf, bufsz,
730  // TRANS: %s is a building or wonder
731  _("Prevented by %s in the city or a trade partner."),
733  }
734  }
735  return true;
736  case REQ_RANGE_CITY:
737  fc_strlcat(buf, prefix, bufsz);
738  if (preq->present) {
740  // Should only apply to wonders
741  cat_snprintf(
742  buf, bufsz,
743  // TRANS: %s is a building or wonder
744  _("Requires %s in the city (and not yet obsolete)."),
746  } else {
747  cat_snprintf(
748  buf, bufsz,
749  // TRANS: %s is a building or wonder
750  _("Requires %s in the city."),
752  }
753  } else {
755  // Should only apply to wonders
756  cat_snprintf(
757  buf, bufsz,
758  // TRANS: %s is a building or wonder
759  _("Prevented by %s in the city (unless it is "
760  "obsolete)."),
762  } else {
763  cat_snprintf(
764  buf, bufsz,
765  // TRANS: %s is a building or wonder
766  _("Prevented by %s in the city."),
768  }
769  }
770  return true;
771  case REQ_RANGE_LOCAL:
772  fc_strlcat(buf, prefix, bufsz);
773  if (preq->present) {
774  cat_snprintf(
775  buf, bufsz, _("Only applies to \"%s\" buildings."),
777  } else {
778  cat_snprintf(
779  buf, bufsz, _("Does not apply to \"%s\" buildings."),
781  }
782  return true;
783  case REQ_RANGE_CADJACENT:
784  case REQ_RANGE_ADJACENT:
785  case REQ_RANGE_COUNT:
786  // Not supported.
787  break;
788  }
789  break;
790 
791  case VUT_EXTRA:
792  switch (preq->range) {
793  case REQ_RANGE_LOCAL:
794  fc_strlcat(buf, prefix, bufsz);
795  if (preq->present) {
796  cat_snprintf(buf, bufsz, Q_("?extra:Requires %s on the tile."),
798  } else {
799  cat_snprintf(buf, bufsz, Q_("?extra:Prevented by %s on the tile."),
801  }
802  return true;
803  case REQ_RANGE_CADJACENT:
804  fc_strlcat(buf, prefix, bufsz);
805  if (preq->present) {
806  cat_snprintf(buf, bufsz,
807  Q_("?extra:Requires %s on the tile or a cardinally "
808  "adjacent tile."),
810  } else {
811  cat_snprintf(
812  buf, bufsz,
813  Q_("?extra:Prevented by %s on the tile or any cardinally "
814  "adjacent tile."),
816  }
817  return true;
818  case REQ_RANGE_ADJACENT:
819  fc_strlcat(buf, prefix, bufsz);
820  if (preq->present) {
821  cat_snprintf(buf, bufsz,
822  Q_("?extra:Requires %s on the tile or an adjacent "
823  "tile."),
825  } else {
826  cat_snprintf(buf, bufsz,
827  Q_("?extra:Prevented by %s on the tile or any adjacent "
828  "tile."),
830  }
831  return true;
832  case REQ_RANGE_CITY:
833  fc_strlcat(buf, prefix, bufsz);
834  if (preq->present) {
835  cat_snprintf(buf, bufsz,
836  Q_("?extra:Requires %s on a tile within the city "
837  "radius."),
839  } else {
840  cat_snprintf(buf, bufsz,
841  Q_("?extra:Prevented by %s on any tile within the city "
842  "radius."),
844  }
845  return true;
846  case REQ_RANGE_TRADEROUTE:
847  fc_strlcat(buf, prefix, bufsz);
848  if (preq->present) {
849  cat_snprintf(buf, bufsz,
850  Q_("?extra:Requires %s on a tile within the city "
851  "radius, or the city radius of a trade partner."),
853  } else {
854  cat_snprintf(buf, bufsz,
855  Q_("?extra:Prevented by %s on any tile within the city "
856  "radius or the city radius of a trade partner."),
858  }
859  return true;
860  case REQ_RANGE_CONTINENT:
861  case REQ_RANGE_PLAYER:
862  case REQ_RANGE_TEAM:
863  case REQ_RANGE_ALLIANCE:
864  case REQ_RANGE_WORLD:
865  case REQ_RANGE_COUNT:
866  // Not supported.
867  break;
868  }
869  break;
870 
871  case VUT_GOOD:
872  switch (preq->range) {
873  case REQ_RANGE_CITY:
874  fc_strlcat(buf, prefix, bufsz);
875  if (preq->present) {
876  cat_snprintf(buf, bufsz, Q_("?good:Requires import of %s ."),
878  } else {
879  cat_snprintf(buf, bufsz, Q_("?goods:Prevented by import of %s."),
881  }
882  return true;
883  case REQ_RANGE_LOCAL:
884  case REQ_RANGE_CADJACENT:
885  case REQ_RANGE_ADJACENT:
886  case REQ_RANGE_TRADEROUTE:
887  case REQ_RANGE_CONTINENT:
888  case REQ_RANGE_PLAYER:
889  case REQ_RANGE_TEAM:
890  case REQ_RANGE_ALLIANCE:
891  case REQ_RANGE_WORLD:
892  case REQ_RANGE_COUNT:
893  // Not supported.
894  break;
895  }
896  break;
897 
898  case VUT_TERRAIN:
899  switch (preq->range) {
900  case REQ_RANGE_LOCAL:
901  fc_strlcat(buf, prefix, bufsz);
902  if (preq->present) {
903  cat_snprintf(buf, bufsz, Q_("?terrain:Requires %s on the tile."),
905  } else {
906  cat_snprintf(buf, bufsz, Q_("?terrain:Prevented by %s on the tile."),
908  }
909  return true;
910  case REQ_RANGE_CADJACENT:
911  fc_strlcat(buf, prefix, bufsz);
912  if (preq->present) {
913  cat_snprintf(buf, bufsz,
914  Q_("?terrain:Requires %s on the tile or a cardinally "
915  "adjacent tile."),
917  } else {
918  cat_snprintf(buf, bufsz,
919  Q_("?terrain:Prevented by %s on the tile or any "
920  "cardinally adjacent tile."),
922  }
923  return true;
924  case REQ_RANGE_ADJACENT:
925  fc_strlcat(buf, prefix, bufsz);
926  if (preq->present) {
927  cat_snprintf(buf, bufsz,
928  Q_("?terrain:Requires %s on the tile or an adjacent "
929  "tile."),
931  } else {
932  cat_snprintf(buf, bufsz,
933  Q_("?terrain:Prevented by %s on the tile or any "
934  "adjacent tile."),
936  }
937  return true;
938  case REQ_RANGE_CITY:
939  fc_strlcat(buf, prefix, bufsz);
940  if (preq->present) {
941  cat_snprintf(buf, bufsz,
942  Q_("?terrain:Requires %s on a tile within the city "
943  "radius."),
945  } else {
946  cat_snprintf(
947  buf, bufsz,
948  Q_("?terrain:Prevented by %s on any tile within the city "
949  "radius."),
951  }
952  return true;
953  case REQ_RANGE_TRADEROUTE:
954  fc_strlcat(buf, prefix, bufsz);
955  if (preq->present) {
956  cat_snprintf(buf, bufsz,
957  Q_("?terrain:Requires %s on a tile within the city "
958  "radius, or the city radius of a trade partner."),
960  } else {
961  cat_snprintf(
962  buf, bufsz,
963  Q_("?terrain:Prevented by %s on any tile within the city "
964  "radius or the city radius of a trade partner."),
966  }
967  return true;
968  case REQ_RANGE_CONTINENT:
969  case REQ_RANGE_PLAYER:
970  case REQ_RANGE_TEAM:
971  case REQ_RANGE_ALLIANCE:
972  case REQ_RANGE_WORLD:
973  case REQ_RANGE_COUNT:
974  // Not supported.
975  break;
976  }
977  break;
978 
979  case VUT_NATION:
980  switch (preq->range) {
981  case REQ_RANGE_PLAYER:
982  fc_strlcat(buf, prefix, bufsz);
983  if (preq->present) {
984  cat_snprintf(buf, bufsz,
985  // TRANS: "... playing as the Swedes."
986  _("Requires that you are playing as the %s."),
988  } else {
989  cat_snprintf(buf, bufsz,
990  // TRANS: "... playing as the Turks."
991  _("Requires that you are not playing as the %s."),
993  }
994  return true;
995  case REQ_RANGE_TEAM:
996  fc_strlcat(buf, prefix, bufsz);
997  if (preq->present) {
998  cat_snprintf(buf, bufsz,
999  // TRANS: "... same team as the Indonesians."
1000  _("Requires that you are on the same team as "
1001  "the %s."),
1003  } else {
1004  cat_snprintf(buf, bufsz,
1005  // TRANS: "... same team as the Greeks."
1006  _("Requires that you are not on the same team as "
1007  "the %s."),
1009  }
1010  return true;
1011  case REQ_RANGE_ALLIANCE:
1012  fc_strlcat(buf, prefix, bufsz);
1013  if (preq->present) {
1014  cat_snprintf(buf, bufsz,
1015  // TRANS: "... allied with the Koreans."
1016  _("Requires that you are allied with the %s."),
1018  } else {
1019  cat_snprintf(buf, bufsz,
1020  // TRANS: "... allied with the Danes."
1021  _("Requires that you are not allied with the %s."),
1023  }
1024  return true;
1025  case REQ_RANGE_WORLD:
1026  fc_strlcat(buf, prefix, bufsz);
1027  if (preq->survives) {
1028  if (preq->present) {
1029  cat_snprintf(buf, bufsz,
1030  // TRANS: "Requires the Apaches to have ..."
1031  _("Requires the %s to have been in the game."),
1033  } else {
1034  cat_snprintf(buf, bufsz,
1035  // TRANS: "Requires the Celts never to have ..."
1036  _("Requires the %s never to have been in the "
1037  "game."),
1039  }
1040  } else {
1041  if (preq->present) {
1042  cat_snprintf(buf, bufsz,
1043  // TRANS: "Requires the Belgians in the game."
1044  _("Requires the %s in the game."),
1046  } else {
1047  cat_snprintf(buf, bufsz,
1048  // TRANS: "Requires that the Russians are not ...
1049  _("Requires that the %s are not in the game."),
1051  }
1052  }
1053  return true;
1054  case REQ_RANGE_LOCAL:
1055  case REQ_RANGE_CADJACENT:
1056  case REQ_RANGE_ADJACENT:
1057  case REQ_RANGE_CITY:
1058  case REQ_RANGE_TRADEROUTE:
1059  case REQ_RANGE_CONTINENT:
1060  case REQ_RANGE_COUNT:
1061  // Not supported.
1062  break;
1063  }
1064  break;
1065 
1066  case VUT_NATIONGROUP:
1067  switch (preq->range) {
1068  case REQ_RANGE_PLAYER:
1069  fc_strlcat(buf, prefix, bufsz);
1070  if (preq->present) {
1071  cat_snprintf(
1072  buf, bufsz,
1073  // TRANS: nation group: "... playing African nation."
1074  _("Requires that you are playing %s nation."),
1076  } else {
1077  cat_snprintf(
1078  buf, bufsz,
1079  // TRANS: nation group: "... playing Imaginary nation."
1080  _("Prevented if you are playing %s nation."),
1082  }
1083  return true;
1084  case REQ_RANGE_TEAM:
1085  fc_strlcat(buf, prefix, bufsz);
1086  if (preq->present) {
1087  cat_snprintf(
1088  buf, bufsz,
1089  // TRANS: nation group: "Requires Medieval nation ..."
1090  _("Requires %s nation on your team."),
1092  } else {
1093  cat_snprintf(
1094  buf, bufsz,
1095  // TRANS: nation group: "Prevented by Medieval nation ..."
1096  _("Prevented by %s nation on your team."),
1098  }
1099  return true;
1100  case REQ_RANGE_ALLIANCE:
1101  fc_strlcat(buf, prefix, bufsz);
1102  if (preq->present) {
1103  cat_snprintf(
1104  buf, bufsz,
1105  // TRANS: nation group: "Requires Modern nation ..."
1106  _("Requires %s nation in alliance with you."),
1108  } else {
1109  cat_snprintf(
1110  buf, bufsz,
1111  // TRANS: nation group: "Prevented by Modern nation ..."
1112  _("Prevented if %s nation is in alliance with you."),
1114  }
1115  return true;
1116  case REQ_RANGE_WORLD:
1117  fc_strlcat(buf, prefix, bufsz);
1118  if (preq->present) {
1119  cat_snprintf(
1120  buf, bufsz,
1121  // TRANS: nation group: "Requires Asian nation ..."
1122  _("Requires %s nation in the game."),
1124  } else {
1125  cat_snprintf(
1126  buf, bufsz,
1127  // TRANS: nation group: "Prevented by Asian nation ..."
1128  _("Prevented by %s nation in the game."),
1130  }
1131  return true;
1132  case REQ_RANGE_LOCAL:
1133  case REQ_RANGE_CADJACENT:
1134  case REQ_RANGE_ADJACENT:
1135  case REQ_RANGE_CITY:
1136  case REQ_RANGE_TRADEROUTE:
1137  case REQ_RANGE_CONTINENT:
1138  case REQ_RANGE_COUNT:
1139  // Not supported.
1140  break;
1141  }
1142  break;
1143 
1144  case VUT_STYLE:
1145  if (preq->range != REQ_RANGE_PLAYER) {
1146  break;
1147  }
1148  fc_strlcat(buf, prefix, bufsz);
1149  if (preq->present) {
1150  cat_snprintf(buf, bufsz,
1151  /* TRANS: "Requires that you are playing Asian style
1152  * nation." */
1153  _("Requires that you are playing %s style nation."),
1155  } else {
1156  cat_snprintf(buf, bufsz,
1157  /* TRANS: "Requires that you are not playing Classical
1158  * style nation." */
1159  _("Requires that you are not playing %s style nation."),
1161  }
1162  return true;
1163 
1164  case VUT_NATIONALITY:
1165  switch (preq->range) {
1166  case REQ_RANGE_TRADEROUTE:
1167  fc_strlcat(buf, prefix, bufsz);
1168  if (preq->present) {
1169  cat_snprintf(
1170  buf, bufsz,
1171  // TRANS: "Requires at least one Barbarian citizen ..."
1172  _("Requires at least one %s citizen in the city or a "
1173  "trade partner."),
1175  } else {
1176  cat_snprintf(
1177  buf, bufsz,
1178  // TRANS: "... no Pirate citizens ..."
1179  _("Requires that there are no %s citizens in "
1180  "the city or any trade partners."),
1182  }
1183  return true;
1184  case REQ_RANGE_CITY:
1185  fc_strlcat(buf, prefix, bufsz);
1186  if (preq->present) {
1187  cat_snprintf(
1188  buf, bufsz,
1189  // TRANS: "Requires at least one Barbarian citizen ..."
1190  _("Requires at least one %s citizen in the city."),
1192  } else {
1193  cat_snprintf(
1194  buf, bufsz,
1195  // TRANS: "... no Pirate citizens ..."
1196  _("Requires that there are no %s citizens in "
1197  "the city."),
1199  }
1200  return true;
1201  case REQ_RANGE_WORLD:
1202  case REQ_RANGE_ALLIANCE:
1203  case REQ_RANGE_TEAM:
1204  case REQ_RANGE_PLAYER:
1205  case REQ_RANGE_LOCAL:
1206  case REQ_RANGE_CADJACENT:
1207  case REQ_RANGE_ADJACENT:
1208  case REQ_RANGE_CONTINENT:
1209  case REQ_RANGE_COUNT:
1210  // Not supported.
1211  break;
1212  }
1213  break;
1214 
1215  case VUT_DIPLREL:
1216  switch (preq->range) {
1217  case REQ_RANGE_PLAYER:
1218  fc_strlcat(buf, prefix, bufsz);
1219  if (preq->present) {
1220  cat_snprintf(
1221  buf, bufsz,
1222  /* TRANS: in this and following strings, '%s' can be one
1223  * of a wide range of relationships; e.g., 'Peace',
1224  * 'Never met', 'Is foreign', 'Hosts embassy',
1225  * 'Provided Casus Belli' */
1226  _("Requires that you have the relationship '%s' with at "
1227  "least one other living player."),
1229  } else {
1230  cat_snprintf(buf, bufsz,
1231  _("Requires that you do not have the relationship '%s' "
1232  "with any living player."),
1234  }
1235  return true;
1236  case REQ_RANGE_TEAM:
1237  fc_strlcat(buf, prefix, bufsz);
1238  if (preq->present) {
1239  cat_snprintf(buf, bufsz,
1240  _("Requires that somebody on your team has the "
1241  "relationship '%s' with at least one other living "
1242  "player."),
1244  } else {
1245  cat_snprintf(buf, bufsz,
1246  _("Requires that nobody on your team has the "
1247  "relationship '%s' with any living player."),
1249  }
1250  return true;
1251  case REQ_RANGE_ALLIANCE:
1252  fc_strlcat(buf, prefix, bufsz);
1253  if (preq->present) {
1254  cat_snprintf(buf, bufsz,
1255  _("Requires that somebody in your alliance has the "
1256  "relationship '%s' with at least one other living "
1257  "player."),
1259  } else {
1260  cat_snprintf(buf, bufsz,
1261  _("Requires that nobody in your alliance has the "
1262  "relationship '%s' with any living player."),
1264  }
1265  return true;
1266  case REQ_RANGE_WORLD:
1267  fc_strlcat(buf, prefix, bufsz);
1268  if (preq->present) {
1269  cat_snprintf(buf, bufsz,
1270  _("Requires the relationship '%s' between two living "
1271  "players."),
1273  } else {
1274  cat_snprintf(buf, bufsz,
1275  _("Requires that no two living players have the "
1276  "relationship '%s'."),
1278  }
1279  return true;
1280  case REQ_RANGE_LOCAL:
1281  fc_strlcat(buf, prefix, bufsz);
1282  if (preq->present) {
1283  cat_snprintf(
1284  buf, bufsz,
1285  _("Requires that you have the relationship '%s' with the "
1286  "other player."),
1288  } else {
1289  cat_snprintf(buf, bufsz,
1290  _("Requires that you do not have the relationship '%s' "
1291  "with the other player."),
1293  }
1294  return true;
1295  case REQ_RANGE_CADJACENT:
1296  case REQ_RANGE_ADJACENT:
1297  case REQ_RANGE_CITY:
1298  case REQ_RANGE_TRADEROUTE:
1299  case REQ_RANGE_CONTINENT:
1300  case REQ_RANGE_COUNT:
1301  // Not supported.
1302  break;
1303  }
1304  break;
1305 
1306  case VUT_UTYPE:
1307  switch (preq->range) {
1308  case REQ_RANGE_LOCAL:
1309  fc_strlcat(buf, prefix, bufsz);
1310  if (preq->present) {
1311  // TRANS: %s is a single kind of unit (e.g., "Settlers").
1312  cat_snprintf(buf, bufsz, Q_("?unit:Requires %s."),
1314  } else {
1315  // TRANS: %s is a single kind of unit (e.g., "Settlers").
1316  cat_snprintf(buf, bufsz, Q_("?unit:Does not apply to %s."),
1318  }
1319  return true;
1320  case REQ_RANGE_CADJACENT:
1321  case REQ_RANGE_ADJACENT:
1322  case REQ_RANGE_CITY:
1323  case REQ_RANGE_TRADEROUTE:
1324  case REQ_RANGE_CONTINENT:
1325  case REQ_RANGE_PLAYER:
1326  case REQ_RANGE_TEAM:
1327  case REQ_RANGE_ALLIANCE:
1328  case REQ_RANGE_WORLD:
1329  case REQ_RANGE_COUNT:
1330  // Not supported.
1331  break;
1332  }
1333  break;
1334 
1335  case VUT_UTFLAG:
1336  switch (preq->range) {
1337  case REQ_RANGE_LOCAL: {
1338  QString roles;
1339 
1340  /* Unit type flags mean nothing to users. Explicitly list the unit
1341  * types with those flags. */
1342  if (role_units_translations(roles, preq->source.value.unitflag,
1343  true)) {
1344  fc_strlcat(buf, prefix, bufsz);
1345  if (preq->present) {
1346  // TRANS: %s is a list of unit types separated by "or".
1347  cat_snprintf(buf, bufsz, Q_("?ulist:Requires %s."),
1348  qUtf8Printable(roles));
1349  } else {
1350  // TRANS: %s is a list of unit types separated by "or".
1351  cat_snprintf(buf, bufsz, Q_("?ulist:Does not apply to %s."),
1352  qUtf8Printable(roles));
1353  }
1354  return true;
1355  }
1356  } break;
1357  case REQ_RANGE_CADJACENT:
1358  case REQ_RANGE_ADJACENT:
1359  case REQ_RANGE_CITY:
1360  case REQ_RANGE_TRADEROUTE:
1361  case REQ_RANGE_CONTINENT:
1362  case REQ_RANGE_PLAYER:
1363  case REQ_RANGE_TEAM:
1364  case REQ_RANGE_ALLIANCE:
1365  case REQ_RANGE_WORLD:
1366  case REQ_RANGE_COUNT:
1367  // Not supported.
1368  break;
1369  }
1370  break;
1371 
1372  case VUT_UCLASS:
1373  switch (preq->range) {
1374  case REQ_RANGE_LOCAL:
1375  fc_strlcat(buf, prefix, bufsz);
1376  if (preq->present) {
1377  // TRANS: %s is a single unit class (e.g., "Air").
1378  cat_snprintf(buf, bufsz, Q_("?uclass:Requires %s units."),
1380  } else {
1381  // TRANS: %s is a single unit class (e.g., "Air").
1382  cat_snprintf(buf, bufsz, Q_("?uclass:Does not apply to %s units."),
1384  }
1385  return true;
1386  case REQ_RANGE_CADJACENT:
1387  case REQ_RANGE_ADJACENT:
1388  case REQ_RANGE_CITY:
1389  case REQ_RANGE_TRADEROUTE:
1390  case REQ_RANGE_CONTINENT:
1391  case REQ_RANGE_PLAYER:
1392  case REQ_RANGE_TEAM:
1393  case REQ_RANGE_ALLIANCE:
1394  case REQ_RANGE_WORLD:
1395  case REQ_RANGE_COUNT:
1396  // Not supported.
1397  break;
1398  }
1399  break;
1400 
1401  case VUT_UCFLAG: {
1402  QVector<QString> classes;
1403  classes.reserve(uclass_count());
1404  bool done = false;
1405  QString list;
1406 
1407  unit_class_iterate(uclass)
1408  {
1409  if (uclass_has_flag(uclass, unit_class_flag_id(
1410  preq->source.value.unitclassflag))) {
1411  classes.append(uclass_name_translation(uclass));
1412  }
1413  }
1415  list = strvec_to_or_list(classes);
1416 
1417  switch (preq->range) {
1418  case REQ_RANGE_LOCAL:
1419  fc_strlcat(buf, prefix, bufsz);
1420  if (preq->present) {
1421  // TRANS: %s is a list of unit classes separated by "or".
1422  cat_snprintf(buf, bufsz, Q_("?uclasslist:Requires %s units."),
1423  qUtf8Printable(list));
1424  } else {
1425  // TRANS: %s is a list of unit classes separated by "or".
1426  cat_snprintf(buf, bufsz,
1427  Q_("?uclasslist:Does not apply to "
1428  "%s units."),
1429  qUtf8Printable(list));
1430  }
1431  done = true;
1432  break;
1433  case REQ_RANGE_CADJACENT:
1434  case REQ_RANGE_ADJACENT:
1435  case REQ_RANGE_CITY:
1436  case REQ_RANGE_TRADEROUTE:
1437  case REQ_RANGE_CONTINENT:
1438  case REQ_RANGE_PLAYER:
1439  case REQ_RANGE_TEAM:
1440  case REQ_RANGE_ALLIANCE:
1441  case REQ_RANGE_WORLD:
1442  case REQ_RANGE_COUNT:
1443  // Not supported.
1444  break;
1445  }
1446  if (done) {
1447  return true;
1448  }
1449  } break;
1450 
1451  case VUT_UNITSTATE: {
1452  switch (preq->range) {
1453  case REQ_RANGE_LOCAL:
1454  switch (preq->source.value.unit_state) {
1455  case USP_TRANSPORTED:
1456  fc_strlcat(buf, prefix, bufsz);
1457  if (preq->present) {
1458  cat_snprintf(buf, bufsz,
1459  _("Requires that the unit is transported."));
1460  } else {
1461  cat_snprintf(buf, bufsz,
1462  _("Requires that the unit isn't transported."));
1463  }
1464  return true;
1465  case USP_LIVABLE_TILE:
1466  fc_strlcat(buf, prefix, bufsz);
1467  if (preq->present) {
1468  cat_snprintf(buf, bufsz,
1469  _("Requires that the unit is on livable tile."));
1470  } else {
1471  cat_snprintf(buf, bufsz,
1472  _("Requires that the unit isn't on livable tile."));
1473  }
1474  return true;
1475  case USP_DOMESTIC_TILE:
1476  fc_strlcat(buf, prefix, bufsz);
1477  if (preq->present) {
1478  cat_snprintf(buf, bufsz,
1479  _("Requires that the unit is on a domestic "
1480  "tile."));
1481  } else {
1482  cat_snprintf(buf, bufsz,
1483  _("Requires that the unit isn't on a domestic "
1484  "tile."));
1485  }
1486  return true;
1487  case USP_TRANSPORTING:
1488  fc_strlcat(buf, prefix, bufsz);
1489  if (preq->present) {
1490  cat_snprintf(buf, bufsz,
1491  _("Requires that the unit does transport one or "
1492  "more cargo units."));
1493  } else {
1494  cat_snprintf(buf, bufsz,
1495  _("Requires that the unit doesn't transport "
1496  "any cargo units."));
1497  }
1498  return true;
1499  case USP_HAS_HOME_CITY:
1500  fc_strlcat(buf, prefix, bufsz);
1501  if (preq->present) {
1502  cat_snprintf(buf, bufsz,
1503  _("Requires that the unit has a home city."));
1504  } else {
1505  cat_snprintf(buf, bufsz, _("Requires that the unit is homeless."));
1506  }
1507  return true;
1508  case USP_NATIVE_TILE:
1509  fc_strlcat(buf, prefix, bufsz);
1510  if (preq->present) {
1511  cat_snprintf(buf, bufsz,
1512  _("Requires that the unit is on native tile."));
1513  } else {
1514  cat_snprintf(buf, bufsz,
1515  _("Requires that the unit isn't on native tile."));
1516  }
1517  return true;
1518  case USP_NATIVE_EXTRA:
1519  fc_strlcat(buf, prefix, bufsz);
1520  if (preq->present) {
1521  cat_snprintf(buf, bufsz,
1522  _("Requires that the unit is in a native extra."));
1523  } else {
1524  cat_snprintf(buf, bufsz,
1525  _("Requires that the unit isn't in a native extra."));
1526  }
1527  return true;
1528  case USP_MOVED_THIS_TURN:
1529  fc_strlcat(buf, prefix, bufsz);
1530  if (preq->present) {
1531  cat_snprintf(buf, bufsz,
1532  _("Requires that the unit has moved this turn."));
1533  } else {
1534  cat_snprintf(buf, bufsz,
1535  _("Requires that the unit hasn't moved this turn."));
1536  }
1537  return true;
1538  case USP_COUNT:
1539  fc_assert_msg(preq->source.value.unit_state != USP_COUNT,
1540  "Invalid unit state property.");
1541  }
1542  break;
1543  case REQ_RANGE_CADJACENT:
1544  case REQ_RANGE_ADJACENT:
1545  case REQ_RANGE_CITY:
1546  case REQ_RANGE_TRADEROUTE:
1547  case REQ_RANGE_CONTINENT:
1548  case REQ_RANGE_PLAYER:
1549  case REQ_RANGE_TEAM:
1550  case REQ_RANGE_ALLIANCE:
1551  case REQ_RANGE_WORLD:
1552  case REQ_RANGE_COUNT:
1553  // Not supported.
1554  break;
1555  }
1556  } break;
1557 
1558  case VUT_ACTIVITY: {
1559  switch (preq->range) {
1560  case REQ_RANGE_LOCAL:
1561  fc_strlcat(buf, prefix, bufsz);
1562  if (preq->present) {
1563  cat_snprintf(buf, bufsz,
1564  _("Requires that the unit is performing activity %s."),
1565  _(unit_activity_name(preq->source.value.activity)));
1566  } else {
1567  cat_snprintf(
1568  buf, bufsz,
1569  _("Requires that the unit is not performing activity %s."),
1570  _(unit_activity_name(preq->source.value.activity)));
1571  }
1572  return true;
1573  case REQ_RANGE_CADJACENT:
1574  case REQ_RANGE_ADJACENT:
1575  case REQ_RANGE_CITY:
1576  case REQ_RANGE_TRADEROUTE:
1577  case REQ_RANGE_CONTINENT:
1578  case REQ_RANGE_PLAYER:
1579  case REQ_RANGE_TEAM:
1580  case REQ_RANGE_ALLIANCE:
1581  case REQ_RANGE_WORLD:
1582  case REQ_RANGE_COUNT:
1583  // Not supported.
1584  break;
1585  }
1586  } break;
1587 
1588  case VUT_MINMOVES: {
1589  switch (preq->range) {
1590  case REQ_RANGE_LOCAL:
1591  fc_strlcat(buf, prefix, bufsz);
1592  if (preq->present) {
1593  cat_snprintf(buf, bufsz,
1594  /* %s is numeric move points; it may have a
1595  * fractional part ("1 1/3 MP"). */
1596  _("Requires that the unit has at least %s MP left."),
1597  move_points_text(preq->source.value.minmoves, true));
1598  } else {
1599  cat_snprintf(buf, bufsz,
1600  /* %s is numeric move points; it may have a
1601  * fractional part ("1 1/3 MP"). */
1602  _("Requires that the unit has less than %s MP left."),
1603  move_points_text(preq->source.value.minmoves, true));
1604  }
1605  return true;
1606  case REQ_RANGE_CADJACENT:
1607  case REQ_RANGE_ADJACENT:
1608  case REQ_RANGE_CITY:
1609  case REQ_RANGE_TRADEROUTE:
1610  case REQ_RANGE_CONTINENT:
1611  case REQ_RANGE_PLAYER:
1612  case REQ_RANGE_TEAM:
1613  case REQ_RANGE_ALLIANCE:
1614  case REQ_RANGE_WORLD:
1615  case REQ_RANGE_COUNT:
1616  // Not supported.
1617  break;
1618  }
1619  } break;
1620 
1621  case VUT_MINVETERAN:
1622  if (preq->range != REQ_RANGE_LOCAL) {
1623  break;
1624  }
1625  /* FIXME: this would be better with veteran level names, but that's
1626  * potentially unit type dependent. */
1627  fc_strlcat(buf, prefix, bufsz);
1628  if (preq->present) {
1629  cat_snprintf(buf, bufsz,
1630  PL_("Requires a unit with at least %d veteran level.",
1631  "Requires a unit with at least %d veteran levels.",
1632  preq->source.value.minveteran),
1633  preq->source.value.minveteran);
1634  } else {
1635  cat_snprintf(buf, bufsz,
1636  PL_("Requires a unit with fewer than %d veteran level.",
1637  "Requires a unit with fewer than %d veteran levels.",
1638  preq->source.value.minveteran),
1639  preq->source.value.minveteran);
1640  }
1641  return true;
1642 
1643  case VUT_MINHP:
1644  if (preq->range != REQ_RANGE_LOCAL) {
1645  break;
1646  }
1647 
1648  fc_strlcat(buf, prefix, bufsz);
1649  if (preq->present) {
1650  cat_snprintf(buf, bufsz,
1651  PL_("Requires a unit with at least %d hit point left.",
1652  "Requires a unit with at least %d hit points left.",
1653  preq->source.value.min_hit_points),
1654  preq->source.value.min_hit_points);
1655  } else {
1656  cat_snprintf(buf, bufsz,
1657  PL_("Requires a unit with fewer than %d hit point "
1658  "left.",
1659  "Requires a unit with fewer than %d hit points "
1660  "left.",
1661  preq->source.value.min_hit_points),
1662  preq->source.value.min_hit_points);
1663  }
1664  return true;
1665 
1666  case VUT_OTYPE:
1667  if (preq->range != REQ_RANGE_LOCAL) {
1668  break;
1669  }
1670  fc_strlcat(buf, prefix, bufsz);
1671  if (preq->present) {
1672  // TRANS: "Applies only to Food."
1673  cat_snprintf(buf, bufsz, Q_("?output:Applies only to %s."),
1675  } else {
1676  // TRANS: "Does not apply to Food."
1677  cat_snprintf(buf, bufsz, Q_("?output:Does not apply to %s."),
1679  }
1680  return true;
1681 
1682  case VUT_SPECIALIST:
1683  if (preq->range != REQ_RANGE_LOCAL) {
1684  break;
1685  }
1686  fc_strlcat(buf, prefix, bufsz);
1687  if (preq->present) {
1688  // TRANS: "Applies only to Scientists."
1689  cat_snprintf(
1690  buf, bufsz, Q_("?specialist:Applies only to %s."),
1692  } else {
1693  // TRANS: "Does not apply to Scientists."
1694  cat_snprintf(
1695  buf, bufsz, Q_("?specialist:Does not apply to %s."),
1697  }
1698  return true;
1699 
1700  case VUT_MINSIZE:
1701  switch (preq->range) {
1702  case REQ_RANGE_TRADEROUTE:
1703  fc_strlcat(buf, prefix, bufsz);
1704  if (preq->present) {
1705  cat_snprintf(buf, bufsz,
1706  PL_("Requires a minimum city size of %d for this "
1707  "city or a trade partner.",
1708  "Requires a minimum city size of %d for this "
1709  "city or a trade partner.",
1710  preq->source.value.minsize),
1711  preq->source.value.minsize);
1712  } else {
1713  cat_snprintf(buf, bufsz,
1714  PL_("Requires the city size to be less than %d "
1715  "for this city and all trade partners.",
1716  "Requires the city size to be less than %d "
1717  "for this city and all trade partners.",
1718  preq->source.value.minsize),
1719  preq->source.value.minsize);
1720  }
1721  return true;
1722  case REQ_RANGE_CITY:
1723  fc_strlcat(buf, prefix, bufsz);
1724  if (preq->present) {
1725  cat_snprintf(buf, bufsz,
1726  PL_("Requires a minimum city size of %d.",
1727  "Requires a minimum city size of %d.",
1728  preq->source.value.minsize),
1729  preq->source.value.minsize);
1730  } else {
1731  cat_snprintf(buf, bufsz,
1732  PL_("Requires the city size to be less than %d.",
1733  "Requires the city size to be less than %d.",
1734  preq->source.value.minsize),
1735  preq->source.value.minsize);
1736  }
1737  return true;
1738  case REQ_RANGE_LOCAL:
1739  case REQ_RANGE_CADJACENT:
1740  case REQ_RANGE_ADJACENT:
1741  case REQ_RANGE_CONTINENT:
1742  case REQ_RANGE_PLAYER:
1743  case REQ_RANGE_TEAM:
1744  case REQ_RANGE_ALLIANCE:
1745  case REQ_RANGE_WORLD:
1746  case REQ_RANGE_COUNT:
1747  // Not supported.
1748  break;
1749  }
1750  break;
1751 
1752  case VUT_MINCULTURE:
1753  switch (preq->range) {
1754  case REQ_RANGE_CITY:
1755  fc_strlcat(buf, prefix, bufsz);
1756  if (preq->present) {
1757  cat_snprintf(buf, bufsz,
1758  PL_("Requires a minimum culture of %d in the city.",
1759  "Requires a minimum culture of %d in the city.",
1760  preq->source.value.minculture),
1761  preq->source.value.minculture);
1762  } else {
1763  cat_snprintf(buf, bufsz,
1764  PL_("Requires the culture in the city to be less "
1765  "than %d.",
1766  "Requires the culture in the city to be less "
1767  "than %d.",
1768  preq->source.value.minculture),
1769  preq->source.value.minculture);
1770  }
1771  return true;
1772  case REQ_RANGE_TRADEROUTE:
1773  fc_strlcat(buf, prefix, bufsz);
1774  if (preq->present) {
1775  cat_snprintf(buf, bufsz,
1776  PL_("Requires a minimum culture of %d in this city or "
1777  "a trade partner.",
1778  "Requires a minimum culture of %d in this city or "
1779  "a trade partner.",
1780  preq->source.value.minculture),
1781  preq->source.value.minculture);
1782  } else {
1783  cat_snprintf(buf, bufsz,
1784  PL_("Requires the culture in this city and all trade "
1785  "partners to be less than %d.",
1786  "Requires the culture in this city and all trade "
1787  "partners to be less than %d.",
1788  preq->source.value.minculture),
1789  preq->source.value.minculture);
1790  }
1791  return true;
1792  case REQ_RANGE_PLAYER:
1793  fc_strlcat(buf, prefix, bufsz);
1794  if (preq->present) {
1795  cat_snprintf(buf, bufsz,
1796  PL_("Requires your nation to have culture "
1797  "of at least %d.",
1798  "Requires your nation to have culture "
1799  "of at least %d.",
1800  preq->source.value.minculture),
1801  preq->source.value.minculture);
1802  } else {
1803  cat_snprintf(buf, bufsz,
1804  PL_("Prevented if your nation has culture of "
1805  "%d or more.",
1806  "Prevented if your nation has culture of "
1807  "%d or more.",
1808  preq->source.value.minculture),
1809  preq->source.value.minculture);
1810  }
1811  return true;
1812  case REQ_RANGE_TEAM:
1813  fc_strlcat(buf, prefix, bufsz);
1814  if (preq->present) {
1815  cat_snprintf(buf, bufsz,
1816  PL_("Requires someone on your team to have culture of "
1817  "at least %d.",
1818  "Requires someone on your team to have culture of "
1819  "at least %d.",
1820  preq->source.value.minculture),
1821  preq->source.value.minculture);
1822  } else {
1823  cat_snprintf(buf, bufsz,
1824  PL_("Prevented if anyone on your team has culture of "
1825  "%d or more.",
1826  "Prevented if anyone on your team has culture of "
1827  "%d or more.",
1828  preq->source.value.minculture),
1829  preq->source.value.minculture);
1830  }
1831  return true;
1832  case REQ_RANGE_ALLIANCE:
1833  fc_strlcat(buf, prefix, bufsz);
1834  if (preq->present) {
1835  cat_snprintf(buf, bufsz,
1836  PL_("Requires someone in your current alliance to "
1837  "have culture of at least %d.",
1838  "Requires someone in your current alliance to "
1839  "have culture of at least %d.",
1840  preq->source.value.minculture),
1841  preq->source.value.minculture);
1842  } else {
1843  cat_snprintf(buf, bufsz,
1844  PL_("Prevented if anyone in your current alliance has "
1845  "culture of %d or more.",
1846  "Prevented if anyone in your current alliance has "
1847  "culture of %d or more.",
1848  preq->source.value.minculture),
1849  preq->source.value.minculture);
1850  }
1851  return true;
1852  case REQ_RANGE_WORLD:
1853  fc_strlcat(buf, prefix, bufsz);
1854  if (preq->present) {
1855  cat_snprintf(buf, bufsz,
1856  PL_("Requires that some player has culture of at "
1857  "least %d.",
1858  "Requires that some player has culture of at "
1859  "least %d.",
1860  preq->source.value.minculture),
1861  preq->source.value.minculture);
1862  } else {
1863  cat_snprintf(buf, bufsz,
1864  PL_("Requires that no player has culture of %d "
1865  "or more.",
1866  "Requires that no player has culture of %d "
1867  "or more.",
1868  preq->source.value.minculture),
1869  preq->source.value.minculture);
1870  }
1871  return true;
1872  case REQ_RANGE_LOCAL:
1873  case REQ_RANGE_CADJACENT:
1874  case REQ_RANGE_ADJACENT:
1875  case REQ_RANGE_CONTINENT:
1876  case REQ_RANGE_COUNT:
1877  break;
1878  }
1879  break;
1880 
1881  case VUT_MINFOREIGNPCT:
1882  switch (preq->range) {
1883  case REQ_RANGE_CITY:
1884  fc_strlcat(buf, prefix, bufsz);
1885  if (preq->present) {
1886  cat_snprintf(buf, bufsz,
1887  _("At least %d%% of the citizens of the city "
1888  "must be foreign."),
1889  preq->source.value.minforeignpct);
1890  } else {
1891  cat_snprintf(buf, bufsz,
1892  _("Less than %d%% of the citizens of the city "
1893  "must be foreign."),
1894  preq->source.value.minforeignpct);
1895  }
1896  return true;
1897  case REQ_RANGE_TRADEROUTE:
1898  fc_strlcat(buf, prefix, bufsz);
1899  if (preq->present) {
1900  cat_snprintf(buf, bufsz,
1901  _("At least %d%% of the citizens of the city "
1902  "or some trade partner must be foreign."),
1903  preq->source.value.minforeignpct);
1904  } else {
1905  cat_snprintf(buf, bufsz,
1906  _("Less than %d%% of the citizens of the city "
1907  "and each trade partner must be foreign."),
1908  preq->source.value.minforeignpct);
1909  }
1910  return true;
1911  case REQ_RANGE_PLAYER:
1912  case REQ_RANGE_TEAM:
1913  case REQ_RANGE_ALLIANCE:
1914  case REQ_RANGE_WORLD:
1915  case REQ_RANGE_LOCAL:
1916  case REQ_RANGE_CADJACENT:
1917  case REQ_RANGE_ADJACENT:
1918  case REQ_RANGE_CONTINENT:
1919  case REQ_RANGE_COUNT:
1920  break;
1921  }
1922  break;
1923 
1924  case VUT_MAXTILEUNITS:
1925  switch (preq->range) {
1926  case REQ_RANGE_LOCAL:
1927  fc_strlcat(buf, prefix, bufsz);
1928  if (preq->present) {
1929  cat_snprintf(buf, bufsz,
1930  PL_("At most %d unit may be present on the tile.",
1931  "At most %d units may be present on the tile.",
1932  preq->source.value.max_tile_units),
1933  preq->source.value.max_tile_units);
1934  } else {
1935  cat_snprintf(buf, bufsz,
1936  PL_("There must be more than %d unit present on "
1937  "the tile.",
1938  "There must be more than %d units present on "
1939  "the tile.",
1940  preq->source.value.max_tile_units),
1941  preq->source.value.max_tile_units);
1942  }
1943  return true;
1944  case REQ_RANGE_CADJACENT:
1945  fc_strlcat(buf, prefix, bufsz);
1946  if (preq->present) {
1947  cat_snprintf(buf, bufsz,
1948  PL_("The tile or at least one cardinally adjacent tile "
1949  "must have %d unit or fewer.",
1950  "The tile or at least one cardinally adjacent tile "
1951  "must have %d units or fewer.",
1952  preq->source.value.max_tile_units),
1953  preq->source.value.max_tile_units);
1954  } else {
1955  cat_snprintf(buf, bufsz,
1956  PL_("The tile and all cardinally adjacent tiles must "
1957  "have more than %d unit each.",
1958  "The tile and all cardinally adjacent tiles must "
1959  "have more than %d units each.",
1960  preq->source.value.max_tile_units),
1961  preq->source.value.max_tile_units);
1962  }
1963  return true;
1964  case REQ_RANGE_ADJACENT:
1965  fc_strlcat(buf, prefix, bufsz);
1966  if (preq->present) {
1967  cat_snprintf(buf, bufsz,
1968  PL_("The tile or at least one adjacent tile must have "
1969  "%d unit or fewer.",
1970  "The tile or at least one adjacent tile must have "
1971  "%d units or fewer.",
1972  preq->source.value.max_tile_units),
1973  preq->source.value.max_tile_units);
1974  } else {
1975  cat_snprintf(buf, bufsz,
1976  PL_("The tile and all adjacent tiles must have more "
1977  "than %d unit each.",
1978  "The tile and all adjacent tiles must have more "
1979  "than %d units each.",
1980  preq->source.value.max_tile_units),
1981  preq->source.value.max_tile_units);
1982  }
1983  return true;
1984  case REQ_RANGE_CITY:
1985  case REQ_RANGE_TRADEROUTE:
1986  case REQ_RANGE_CONTINENT:
1987  case REQ_RANGE_PLAYER:
1988  case REQ_RANGE_TEAM:
1989  case REQ_RANGE_ALLIANCE:
1990  case REQ_RANGE_WORLD:
1991  case REQ_RANGE_COUNT:
1992  // Not supported.
1993  break;
1994  }
1995  break;
1996 
1997  case VUT_AI_LEVEL:
1998  if (preq->range != REQ_RANGE_PLAYER) {
1999  break;
2000  }
2001  fc_strlcat(buf, prefix, bufsz);
2002  if (preq->present) {
2003  cat_snprintf(buf, bufsz,
2004  // TRANS: AI level (e.g., "Handicapped")
2005  _("Applies to %s AI players."),
2006  ai_level_translated_name(preq->source.value.ai_level));
2007  } else {
2008  cat_snprintf(buf, bufsz,
2009  // TRANS: AI level (e.g., "Cheating")
2010  _("Does not apply to %s AI players."),
2011  ai_level_translated_name(preq->source.value.ai_level));
2012  }
2013  return true;
2014 
2015  case VUT_TERRAINCLASS:
2016  switch (preq->range) {
2017  case REQ_RANGE_LOCAL:
2018  fc_strlcat(buf, prefix, bufsz);
2019  if (preq->present) {
2020  cat_snprintf(buf, bufsz,
2021  // TRANS: %s is a terrain class
2022  Q_("?terrainclass:Requires %s terrain on the tile."),
2024  terrain_class(preq->source.value.terrainclass)));
2025  } else {
2026  cat_snprintf(
2027  buf, bufsz,
2028  // TRANS: %s is a terrain class
2029  Q_("?terrainclass:Prevented by %s terrain on the tile."),
2031  terrain_class(preq->source.value.terrainclass)));
2032  }
2033  return true;
2034  case REQ_RANGE_CADJACENT:
2035  fc_strlcat(buf, prefix, bufsz);
2036  if (preq->present) {
2037  cat_snprintf(buf, bufsz,
2038  // TRANS: %s is a terrain class
2039  Q_("?terrainclass:Requires %s terrain on the tile or a "
2040  "cardinally adjacent tile."),
2042  terrain_class(preq->source.value.terrainclass)));
2043  } else {
2044  cat_snprintf(
2045  buf, bufsz,
2046  // TRANS: %s is a terrain class
2047  Q_("?terrainclass:Prevented by %s terrain on the tile or "
2048  "any cardinally adjacent tile."),
2050  terrain_class(preq->source.value.terrainclass)));
2051  }
2052  return true;
2053  case REQ_RANGE_ADJACENT:
2054  fc_strlcat(buf, prefix, bufsz);
2055  if (preq->present) {
2056  cat_snprintf(
2057  buf, bufsz,
2058  // TRANS: %s is a terrain class
2059  Q_("?terrainclass:Requires %s terrain on the tile or an "
2060  "adjacent tile."),
2062  terrain_class(preq->source.value.terrainclass)));
2063  } else {
2064  cat_snprintf(
2065  buf, bufsz,
2066  // TRANS: %s is a terrain class
2067  Q_("?terrainclass:Prevented by %s terrain on the tile or "
2068  "any adjacent tile."),
2070  terrain_class(preq->source.value.terrainclass)));
2071  }
2072  return true;
2073  case REQ_RANGE_CITY:
2074  fc_strlcat(buf, prefix, bufsz);
2075  if (preq->present) {
2076  cat_snprintf(buf, bufsz,
2077  // TRANS: %s is a terrain class
2078  Q_("?terrainclass:Requires %s terrain on a tile within "
2079  "the city radius."),
2081  terrain_class(preq->source.value.terrainclass)));
2082  } else {
2083  cat_snprintf(buf, bufsz,
2084  // TRANS: %s is a terrain class
2085  Q_("?terrainclass:Prevented by %s terrain on any tile "
2086  "within the city radius."),
2088  terrain_class(preq->source.value.terrainclass)));
2089  }
2090  return true;
2091  case REQ_RANGE_TRADEROUTE:
2092  fc_strlcat(buf, prefix, bufsz);
2093  if (preq->present) {
2094  cat_snprintf(buf, bufsz,
2095  // TRANS: %s is a terrain class
2096  Q_("?terrainclass:Requires %s terrain on a tile within "
2097  "the city radius or the city radius of a trade "
2098  "partner."),
2100  terrain_class(preq->source.value.terrainclass)));
2101  } else {
2102  cat_snprintf(
2103  buf, bufsz,
2104  // TRANS: %s is a terrain class
2105  Q_("?terrainclass:Prevented by %s terrain on any tile "
2106  "within the city radius or the city radius of a trade "
2107  "partner."),
2109  terrain_class(preq->source.value.terrainclass)));
2110  }
2111  return true;
2112  case REQ_RANGE_CONTINENT:
2113  case REQ_RANGE_PLAYER:
2114  case REQ_RANGE_TEAM:
2115  case REQ_RANGE_ALLIANCE:
2116  case REQ_RANGE_WORLD:
2117  case REQ_RANGE_COUNT:
2118  // Not supported.
2119  break;
2120  }
2121  break;
2122 
2123  case VUT_TERRFLAG:
2124  switch (preq->range) {
2125  case REQ_RANGE_LOCAL:
2126  fc_strlcat(buf, prefix, bufsz);
2127  if (preq->present) {
2128  cat_snprintf(buf, bufsz,
2129  // TRANS: %s is a (translatable) terrain flag.
2130  _("Requires terrain with the \"%s\" flag on the tile."),
2131  terrain_flag_id_translated_name(
2132  terrain_flag_id(preq->source.value.terrainflag)));
2133  } else {
2134  cat_snprintf(buf, bufsz,
2135  // TRANS: %s is a (translatable) terrain flag.
2136  _("Prevented by terrain with the \"%s\" flag on the "
2137  "tile."),
2138  terrain_flag_id_translated_name(
2139  terrain_flag_id(preq->source.value.terrainflag)));
2140  }
2141  return true;
2142  case REQ_RANGE_CADJACENT:
2143  fc_strlcat(buf, prefix, bufsz);
2144  if (preq->present) {
2145  cat_snprintf(buf, bufsz,
2146  // TRANS: %s is a (translatable) terrain flag.
2147  _("Requires terrain with the \"%s\" flag on the "
2148  "tile or a cardinally adjacent tile."),
2149  terrain_flag_id_translated_name(
2150  terrain_flag_id(preq->source.value.terrainflag)));
2151  } else {
2152  cat_snprintf(buf, bufsz,
2153  // TRANS: %s is a (translatable) terrain flag.
2154  _("Prevented by terrain with the \"%s\" flag on "
2155  "the tile or any cardinally adjacent tile."),
2156  terrain_flag_id_translated_name(
2157  terrain_flag_id(preq->source.value.terrainflag)));
2158  }
2159  return true;
2160  case REQ_RANGE_ADJACENT:
2161  fc_strlcat(buf, prefix, bufsz);
2162  if (preq->present) {
2163  cat_snprintf(buf, bufsz,
2164  // TRANS: %s is a (translatable) terrain flag.
2165  _("Requires terrain with the \"%s\" flag on the "
2166  "tile or an adjacent tile."),
2167  terrain_flag_id_translated_name(
2168  terrain_flag_id(preq->source.value.terrainflag)));
2169  } else {
2170  cat_snprintf(buf, bufsz,
2171  // TRANS: %s is a (translatable) terrain flag.
2172  _("Prevented by terrain with the \"%s\" flag on "
2173  "the tile or any adjacent tile."),
2174  terrain_flag_id_translated_name(
2175  terrain_flag_id(preq->source.value.terrainflag)));
2176  }
2177  return true;
2178  case REQ_RANGE_CITY:
2179  fc_strlcat(buf, prefix, bufsz);
2180  if (preq->present) {
2181  cat_snprintf(buf, bufsz,
2182  // TRANS: %s is a (translatable) terrain flag.
2183  _("Requires terrain with the \"%s\" flag on a tile "
2184  "within the city radius."),
2185  terrain_flag_id_translated_name(
2186  terrain_flag_id(preq->source.value.terrainflag)));
2187  } else {
2188  cat_snprintf(
2189  buf, bufsz,
2190  // TRANS: %s is a (translatable) terrain flag.
2191  _("Prevented by terrain with the \"%s\" flag on any tile "
2192  "within the city radius."),
2193  terrain_flag_id_translated_name(
2194  terrain_flag_id(preq->source.value.terrainflag)));
2195  }
2196  return true;
2197  case REQ_RANGE_TRADEROUTE:
2198  fc_strlcat(buf, prefix, bufsz);
2199  if (preq->present) {
2200  cat_snprintf(buf, bufsz,
2201  // TRANS: %s is a (translatable) terrain flag.
2202  _("Requires terrain with the \"%s\" flag on a tile "
2203  "within the city radius or the city radius of "
2204  "a trade partner."),
2205  terrain_flag_id_translated_name(
2206  terrain_flag_id(preq->source.value.terrainflag)));
2207  } else {
2208  cat_snprintf(
2209  buf, bufsz,
2210  // TRANS: %s is a (translatable) terrain flag.
2211  _("Prevented by terrain with the \"%s\" flag on any tile "
2212  "within the city radius or the city radius of "
2213  "a trade partner."),
2214  terrain_flag_id_translated_name(
2215  terrain_flag_id(preq->source.value.terrainflag)));
2216  }
2217  return true;
2218  case REQ_RANGE_CONTINENT:
2219  case REQ_RANGE_PLAYER:
2220  case REQ_RANGE_TEAM:
2221  case REQ_RANGE_ALLIANCE:
2222  case REQ_RANGE_WORLD:
2223  case REQ_RANGE_COUNT:
2224  // Not supported.
2225  break;
2226  }
2227  break;
2228 
2229  case VUT_BASEFLAG:
2230  switch (preq->range) {
2231  case REQ_RANGE_LOCAL:
2232  fc_strlcat(buf, prefix, bufsz);
2233  if (preq->present) {
2234  cat_snprintf(buf, bufsz,
2235  // TRANS: %s is a (translatable) base flag.
2236  _("Requires a base with the \"%s\" flag on the tile."),
2237  base_flag_id_translated_name(
2238  base_flag_id(preq->source.value.baseflag)));
2239  } else {
2240  cat_snprintf(buf, bufsz,
2241  // TRANS: %s is a (translatable) base flag.
2242  _("Prevented by a base with the \"%s\" flag on the "
2243  "tile."),
2244  base_flag_id_translated_name(
2245  base_flag_id(preq->source.value.baseflag)));
2246  }
2247  return true;
2248  case REQ_RANGE_CADJACENT:
2249  fc_strlcat(buf, prefix, bufsz);
2250  if (preq->present) {
2251  cat_snprintf(buf, bufsz,
2252  // TRANS: %s is a (translatable) base flag.
2253  _("Requires a base with the \"%s\" flag on the "
2254  "tile or a cardinally adjacent tile."),
2255  base_flag_id_translated_name(
2256  base_flag_id(preq->source.value.baseflag)));
2257  } else {
2258  cat_snprintf(buf, bufsz,
2259  // TRANS: %s is a (translatable) base flag.
2260  _("Prevented by a base with the \"%s\" flag on "
2261  "the tile or any cardinally adjacent tile."),
2262  base_flag_id_translated_name(
2263  base_flag_id(preq->source.value.baseflag)));
2264  }
2265  return true;
2266  case REQ_RANGE_ADJACENT:
2267  fc_strlcat(buf, prefix, bufsz);
2268  if (preq->present) {
2269  cat_snprintf(buf, bufsz,
2270  // TRANS: %s is a (translatable) base flag.
2271  _("Requires a base with the \"%s\" flag on the "
2272  "tile or an adjacent tile."),
2273  base_flag_id_translated_name(
2274  base_flag_id(preq->source.value.baseflag)));
2275  } else {
2276  cat_snprintf(buf, bufsz,
2277  // TRANS: %s is a (translatable) base flag.
2278  _("Prevented by a base with the \"%s\" flag on "
2279  "the tile or any adjacent tile."),
2280  base_flag_id_translated_name(
2281  base_flag_id(preq->source.value.baseflag)));
2282  }
2283  return true;
2284  case REQ_RANGE_CITY:
2285  fc_strlcat(buf, prefix, bufsz);
2286  if (preq->present) {
2287  cat_snprintf(buf, bufsz,
2288  // TRANS: %s is a (translatable) base flag.
2289  _("Requires a base with the \"%s\" flag on a tile "
2290  "within the city radius."),
2291  base_flag_id_translated_name(
2292  base_flag_id(preq->source.value.baseflag)));
2293  } else {
2294  cat_snprintf(
2295  buf, bufsz,
2296  // TRANS: %s is a (translatable) base flag.
2297  _("Prevented by a base with the \"%s\" flag on any tile "
2298  "within the city radius."),
2299  base_flag_id_translated_name(
2300  base_flag_id(preq->source.value.baseflag)));
2301  }
2302  return true;
2303  case REQ_RANGE_TRADEROUTE:
2304  fc_strlcat(buf, prefix, bufsz);
2305  if (preq->present) {
2306  cat_snprintf(buf, bufsz,
2307  // TRANS: %s is a (translatable) base flag.
2308  _("Requires a base with the \"%s\" flag on a tile "
2309  "within the city radius or the city radius of a "
2310  "trade partner."),
2311  base_flag_id_translated_name(
2312  base_flag_id(preq->source.value.baseflag)));
2313  } else {
2314  cat_snprintf(
2315  buf, bufsz,
2316  // TRANS: %s is a (translatable) base flag.
2317  _("Prevented by a base with the \"%s\" flag on any tile "
2318  "within the city radius or the city radius of a "
2319  "trade partner."),
2320  base_flag_id_translated_name(
2321  base_flag_id(preq->source.value.baseflag)));
2322  }
2323  return true;
2324  case REQ_RANGE_CONTINENT:
2325  case REQ_RANGE_PLAYER:
2326  case REQ_RANGE_TEAM:
2327  case REQ_RANGE_ALLIANCE:
2328  case REQ_RANGE_WORLD:
2329  case REQ_RANGE_COUNT:
2330  // Not supported.
2331  break;
2332  }
2333  break;
2334 
2335  case VUT_ROADFLAG:
2336  switch (preq->range) {
2337  case REQ_RANGE_LOCAL:
2338  fc_strlcat(buf, prefix, bufsz);
2339  if (preq->present) {
2340  cat_snprintf(buf, bufsz,
2341  // TRANS: %s is a (translatable) road flag.
2342  _("Requires a road with the \"%s\" flag on the tile."),
2343  road_flag_id_translated_name(
2344  road_flag_id(preq->source.value.roadflag)));
2345  } else {
2346  cat_snprintf(buf, bufsz,
2347  // TRANS: %s is a (translatable) road flag.
2348  _("Prevented by a road with the \"%s\" flag on the "
2349  "tile."),
2350  road_flag_id_translated_name(
2351  road_flag_id(preq->source.value.roadflag)));
2352  }
2353  return true;
2354  case REQ_RANGE_CADJACENT:
2355  fc_strlcat(buf, prefix, bufsz);
2356  if (preq->present) {
2357  cat_snprintf(buf, bufsz,
2358  // TRANS: %s is a (translatable) road flag.
2359  _("Requires a road with the \"%s\" flag on the "
2360  "tile or a cardinally adjacent tile."),
2361  road_flag_id_translated_name(
2362  road_flag_id(preq->source.value.roadflag)));
2363  } else {
2364  cat_snprintf(buf, bufsz,
2365  // TRANS: %s is a (translatable) road flag.
2366  _("Prevented by a road with the \"%s\" flag on "
2367  "the tile or any cardinally adjacent tile."),
2368  road_flag_id_translated_name(
2369  road_flag_id(preq->source.value.roadflag)));
2370  }
2371  return true;
2372  case REQ_RANGE_ADJACENT:
2373  fc_strlcat(buf, prefix, bufsz);
2374  if (preq->present) {
2375  cat_snprintf(buf, bufsz,
2376  // TRANS: %s is a (translatable) road flag.
2377  _("Requires a road with the \"%s\" flag on the "
2378  "tile or an adjacent tile."),
2379  road_flag_id_translated_name(
2380  road_flag_id(preq->source.value.roadflag)));
2381  } else {
2382  cat_snprintf(buf, bufsz,
2383  // TRANS: %s is a (translatable) road flag.
2384  _("Prevented by a road with the \"%s\" flag on "
2385  "the tile or any adjacent tile."),
2386  road_flag_id_translated_name(
2387  road_flag_id(preq->source.value.roadflag)));
2388  }
2389  return true;
2390  case REQ_RANGE_CITY:
2391  fc_strlcat(buf, prefix, bufsz);
2392  if (preq->present) {
2393  cat_snprintf(buf, bufsz,
2394  // TRANS: %s is a (translatable) road flag.
2395  _("Requires a road with the \"%s\" flag on a tile "
2396  "within the city radius."),
2397  road_flag_id_translated_name(
2398  road_flag_id(preq->source.value.roadflag)));
2399  } else {
2400  cat_snprintf(
2401  buf, bufsz,
2402  // TRANS: %s is a (translatable) road flag.
2403  _("Prevented by a road with the \"%s\" flag on any tile "
2404  "within the city radius."),
2405  road_flag_id_translated_name(
2406  road_flag_id(preq->source.value.roadflag)));
2407  }
2408  return true;
2409  case REQ_RANGE_TRADEROUTE:
2410  fc_strlcat(buf, prefix, bufsz);
2411  if (preq->present) {
2412  cat_snprintf(buf, bufsz,
2413  // TRANS: %s is a (translatable) road flag.
2414  _("Requires a road with the \"%s\" flag on a tile "
2415  "within the city radius or the city radius of a "
2416  "trade partner."),
2417  road_flag_id_translated_name(
2418  road_flag_id(preq->source.value.roadflag)));
2419  } else {
2420  cat_snprintf(
2421  buf, bufsz,
2422  // TRANS: %s is a (translatable) road flag.
2423  _("Prevented by a road with the \"%s\" flag on any tile "
2424  "within the city radius or the city radius of a "
2425  "trade partner."),
2426  road_flag_id_translated_name(
2427  road_flag_id(preq->source.value.roadflag)));
2428  }
2429  return true;
2430  case REQ_RANGE_CONTINENT:
2431  case REQ_RANGE_PLAYER:
2432  case REQ_RANGE_TEAM:
2433  case REQ_RANGE_ALLIANCE:
2434  case REQ_RANGE_WORLD:
2435  case REQ_RANGE_COUNT:
2436  // Not supported.
2437  break;
2438  }
2439  break;
2440 
2441  case VUT_EXTRAFLAG:
2442  switch (preq->range) {
2443  case REQ_RANGE_LOCAL:
2444  fc_strlcat(buf, prefix, bufsz);
2445  if (preq->present) {
2446  cat_snprintf(
2447  buf, bufsz,
2448  // TRANS: %s is a (translatable) extra flag.
2449  _("Requires an extra with the \"%s\" flag on the tile."),
2450  extra_flag_id_translated_name(
2451  extra_flag_id(preq->source.value.extraflag)));
2452  } else {
2453  cat_snprintf(buf, bufsz,
2454  // TRANS: %s is a (translatable) extra flag.
2455  _("Prevented by an extra with the \"%s\" flag on the "
2456  "tile."),
2457  extra_flag_id_translated_name(
2458  extra_flag_id(preq->source.value.extraflag)));
2459  }
2460  return true;
2461  case REQ_RANGE_CADJACENT:
2462  fc_strlcat(buf, prefix, bufsz);
2463  if (preq->present) {
2464  cat_snprintf(buf, bufsz,
2465  // TRANS: %s is a (translatable) extra flag.
2466  _("Requires an extra with the \"%s\" flag on the "
2467  "tile or a cardinally adjacent tile."),
2468  extra_flag_id_translated_name(
2469  extra_flag_id(preq->source.value.extraflag)));
2470  } else {
2471  cat_snprintf(buf, bufsz,
2472  // TRANS: %s is a (translatable) extra flag.
2473  _("Prevented by an extra with the \"%s\" flag on "
2474  "the tile or any cardinally adjacent tile."),
2475  extra_flag_id_translated_name(
2476  extra_flag_id(preq->source.value.extraflag)));
2477  }
2478  return true;
2479  case REQ_RANGE_ADJACENT:
2480  fc_strlcat(buf, prefix, bufsz);
2481  if (preq->present) {
2482  cat_snprintf(buf, bufsz,
2483  // TRANS: %s is a (translatable) extra flag.
2484  _("Requires an extra with the \"%s\" flag on the "
2485  "tile or an adjacent tile."),
2486  extra_flag_id_translated_name(
2487  extra_flag_id(preq->source.value.extraflag)));
2488  } else {
2489  cat_snprintf(buf, bufsz,
2490  // TRANS: %s is a (translatable) extra flag.
2491  _("Prevented by an extra with the \"%s\" flag on "
2492  "the tile or any adjacent tile."),
2493  extra_flag_id_translated_name(
2494  extra_flag_id(preq->source.value.extraflag)));
2495  }
2496  return true;
2497  case REQ_RANGE_CITY:
2498  fc_strlcat(buf, prefix, bufsz);
2499  if (preq->present) {
2500  cat_snprintf(buf, bufsz,
2501  // TRANS: %s is a (translatable) extra flag.
2502  _("Requires an extra with the \"%s\" flag on a tile "
2503  "within the city radius."),
2504  extra_flag_id_translated_name(
2505  extra_flag_id(preq->source.value.extraflag)));
2506  } else {
2507  cat_snprintf(
2508  buf, bufsz,
2509  // TRANS: %s is a (translatable) extra flag.
2510  _("Prevented by an extra with the \"%s\" flag on any tile "
2511  "within the city radius."),
2512  extra_flag_id_translated_name(
2513  extra_flag_id(preq->source.value.extraflag)));
2514  }
2515  return true;
2516  case REQ_RANGE_TRADEROUTE:
2517  fc_strlcat(buf, prefix, bufsz);
2518  if (preq->present) {
2519  cat_snprintf(buf, bufsz,
2520  // TRANS: %s is a (translatable) extra flag.
2521  _("Requires an extra with the \"%s\" flag on a tile "
2522  "within the city radius or the city radius of a "
2523  "trade partner."),
2524  extra_flag_id_translated_name(
2525  extra_flag_id(preq->source.value.extraflag)));
2526  } else {
2527  cat_snprintf(
2528  buf, bufsz,
2529  // TRANS: %s is a (translatable) extra flag.
2530  _("Prevented by an extra with the \"%s\" flag on any tile "
2531  "within the city radius or the city radius of a "
2532  "trade partner."),
2533  extra_flag_id_translated_name(
2534  extra_flag_id(preq->source.value.extraflag)));
2535  }
2536  return true;
2537  case REQ_RANGE_CONTINENT:
2538  case REQ_RANGE_PLAYER:
2539  case REQ_RANGE_TEAM:
2540  case REQ_RANGE_ALLIANCE:
2541  case REQ_RANGE_WORLD:
2542  case REQ_RANGE_COUNT:
2543  // Not supported.
2544  break;
2545  }
2546  break;
2547 
2548  case VUT_MINYEAR:
2549  if (preq->range != REQ_RANGE_WORLD) {
2550  break;
2551  }
2552  fc_strlcat(buf, prefix, bufsz);
2553  if (preq->present) {
2554  cat_snprintf(buf, bufsz,
2555  _("Requires the game to have reached the year %s."),
2556  textyear(preq->source.value.minyear));
2557  } else {
2558  cat_snprintf(buf, bufsz,
2559  _("Requires that the game has not yet reached the "
2560  "year %s."),
2561  textyear(preq->source.value.minyear));
2562  }
2563  return true;
2564 
2565  case VUT_MINCALFRAG:
2566  if (preq->range != REQ_RANGE_WORLD) {
2567  break;
2568  }
2569  fc_strlcat(buf, prefix, bufsz);
2570  if (preq->present) {
2571  cat_snprintf(buf, bufsz,
2572  /* TRANS: %s is a representation of a calendar fragment,
2573  * from the ruleset. May be a bare number. */
2574  _("Requires the game to have reached %s."),
2576  } else {
2577  cat_snprintf(buf, bufsz,
2578  /* TRANS: %s is a representation of a calendar fragment,
2579  * from the ruleset. May be a bare number. */
2580  _("Requires that the game has not yet reached %s."),
2582  }
2583  return true;
2584 
2585  case VUT_TOPO:
2586  if (preq->range != REQ_RANGE_WORLD) {
2587  break;
2588  }
2589  fc_strlcat(buf, prefix, bufsz);
2590  if (preq->present) {
2591  cat_snprintf(buf, bufsz,
2592  // TRANS: topology flag name ("WrapX", "ISO", etc)
2593  _("Requires %s map."),
2594  _(topo_flag_name(preq->source.value.topo_property)));
2595  } else {
2596  cat_snprintf(buf, bufsz,
2597  // TRANS: topology flag name ("WrapX", "ISO", etc)
2598  _("Prevented on %s map."),
2599  _(topo_flag_name(preq->source.value.topo_property)));
2600  }
2601  return true;
2602 
2603  case VUT_SERVERSETTING:
2604  if (preq->range != REQ_RANGE_WORLD) {
2605  break;
2606  }
2607  fc_strlcat(buf, prefix, bufsz);
2608  cat_snprintf(buf, bufsz,
2609  /* TRANS: %s is a server setting, its value and if it is
2610  * required to be present or absent. The string's format
2611  * is specified in ssetv_human_readable().
2612  * Example: "killstack is enabled". */
2613  _("Requires that the server setting %s."),
2614  qUtf8Printable(ssetv_human_readable(
2615  preq->source.value.ssetval, preq->present)));
2616  return true;
2617 
2618  case VUT_AGE:
2619  fc_strlcat(buf, prefix, bufsz);
2620  if (preq->present) {
2621  cat_snprintf(buf, bufsz, _("Requires age of %d turns."),
2622  preq->source.value.age);
2623  } else {
2624  cat_snprintf(buf, bufsz, _("Prevented if age is over %d turns."),
2625  preq->source.value.age);
2626  }
2627  return true;
2628 
2629  case VUT_MINTECHS:
2630  switch (preq->range) {
2631  case REQ_RANGE_WORLD:
2632  fc_strlcat(buf, prefix, bufsz);
2633  if (preq->present) {
2634  cat_snprintf(buf, bufsz,
2635  _("Requires %d techs to be known in the world."),
2636  preq->source.value.min_techs);
2637  } else {
2638  cat_snprintf(buf, bufsz,
2639  _("Prevented when %d techs are known in the world."),
2640  preq->source.value.min_techs);
2641  }
2642  return true;
2643  case REQ_RANGE_PLAYER:
2644  fc_strlcat(buf, prefix, bufsz);
2645  if (preq->present) {
2646  cat_snprintf(buf, bufsz, _("Requires player to know %d techs."),
2647  preq->source.value.min_techs);
2648  } else {
2649  cat_snprintf(buf, bufsz, _("Prevented when player knows %d techs."),
2650  preq->source.value.min_techs);
2651  }
2652  return true;
2653  case REQ_RANGE_LOCAL:
2654  case REQ_RANGE_CADJACENT:
2655  case REQ_RANGE_ADJACENT:
2656  case REQ_RANGE_CITY:
2657  case REQ_RANGE_TRADEROUTE:
2658  case REQ_RANGE_CONTINENT:
2659  case REQ_RANGE_TEAM:
2660  case REQ_RANGE_ALLIANCE:
2661  case REQ_RANGE_COUNT:
2662  // Not supported.
2663  break;
2664  }
2665  break;
2666 
2667  case VUT_TERRAINALTER:
2668  switch (preq->range) {
2669  case REQ_RANGE_LOCAL:
2670  fc_strlcat(buf, prefix, bufsz);
2671  if (preq->present) {
2672  cat_snprintf(buf, bufsz,
2673  _("Requires terrain on which alteration %s is "
2674  "possible."),
2675  Q_(terrain_alteration_name(terrain_alteration(
2676  preq->source.value.terrainalter))));
2677  } else {
2678  cat_snprintf(buf, bufsz,
2679  _("Prevented by terrain on which alteration %s "
2680  "can be made."),
2681  Q_(terrain_alteration_name(terrain_alteration(
2682  preq->source.value.terrainalter))));
2683  }
2684  return true;
2685  case REQ_RANGE_CADJACENT:
2686  case REQ_RANGE_ADJACENT:
2687  case REQ_RANGE_CITY:
2688  case REQ_RANGE_TRADEROUTE:
2689  case REQ_RANGE_CONTINENT:
2690  case REQ_RANGE_PLAYER:
2691  case REQ_RANGE_TEAM:
2692  case REQ_RANGE_ALLIANCE:
2693  case REQ_RANGE_WORLD:
2694  case REQ_RANGE_COUNT:
2695  // Not supported.
2696  break;
2697  }
2698  break;
2699 
2700  case VUT_CITYTILE:
2701  if (preq->source.value.citytile == CITYT_LAST) {
2702  break;
2703  } else {
2704  static const char *tile_property = nullptr;
2705 
2706  switch (preq->source.value.citytile) {
2707  case CITYT_CENTER:
2708  tile_property = "city centers";
2709  break;
2710  case CITYT_CLAIMED:
2711  tile_property = "claimed tiles";
2712  break;
2713  case CITYT_LAST:
2714  fc_assert(preq->source.value.citytile != CITYT_LAST);
2715  break;
2716  }
2717 
2718  switch (preq->range) {
2719  case REQ_RANGE_LOCAL:
2720  fc_strlcat(buf, prefix, bufsz);
2721  if (preq->present) {
2722  cat_snprintf(buf, bufsz,
2723  // TRANS: tile property ("city centers", etc)
2724  Q_("?tileprop:Applies only to %s."), tile_property);
2725  } else {
2726  cat_snprintf(buf, bufsz,
2727  // TRANS: tile property ("city centers", etc)
2728  Q_("?tileprop:Does not apply to %s."), tile_property);
2729  }
2730  return true;
2731  case REQ_RANGE_CADJACENT:
2732  fc_strlcat(buf, prefix, bufsz);
2733  if (preq->present) {
2734  // TRANS: tile property ("city centers", etc)
2735  cat_snprintf(buf, bufsz,
2736  Q_("?tileprop:Applies only to %s and "
2737  "cardinally adjacent tiles."),
2738  tile_property);
2739  } else {
2740  // TRANS: tile property ("city centers", etc)
2741  cat_snprintf(buf, bufsz,
2742  Q_("?tileprop:Does not apply to %s or "
2743  "cardinally adjacent tiles."),
2744  tile_property);
2745  }
2746  return true;
2747  case REQ_RANGE_ADJACENT:
2748  fc_strlcat(buf, prefix, bufsz);
2749  if (preq->present) {
2750  // TRANS: tile property ("city centers", etc)
2751  cat_snprintf(buf, bufsz,
2752  Q_("?tileprop:Applies only to %s and "
2753  "adjacent tiles."),
2754  tile_property);
2755  } else {
2756  // TRANS: tile property ("city centers", etc)
2757  cat_snprintf(buf, bufsz,
2758  Q_("?tileprop:Does not apply to %s or "
2759  "adjacent tiles."),
2760  tile_property);
2761  }
2762  return true;
2763  case REQ_RANGE_CITY:
2764  case REQ_RANGE_TRADEROUTE:
2765  case REQ_RANGE_CONTINENT:
2766  case REQ_RANGE_PLAYER:
2767  case REQ_RANGE_TEAM:
2768  case REQ_RANGE_ALLIANCE:
2769  case REQ_RANGE_WORLD:
2770  case REQ_RANGE_COUNT:
2771  // Not supported.
2772  break;
2773  }
2774  }
2775 
2776  case VUT_CITYSTATUS:
2777  if (preq->source.value.citystatus == CITYS_LAST) {
2778  break;
2779  } else {
2780  static const char *city_property = nullptr;
2781 
2782  switch (preq->source.value.citystatus) {
2783  case CITYS_OWNED_BY_ORIGINAL:
2784  city_property = "owned by original";
2785  break;
2786  case CITYS_LAST:
2787  fc_assert(preq->source.value.citystatus != CITYS_LAST);
2788  break;
2789  }
2790 
2791  switch (preq->range) {
2792  case REQ_RANGE_CITY:
2793  fc_strlcat(buf, prefix, bufsz);
2794  if (preq->present) {
2795  // TRANS: city property ("owned by original", etc)
2796  cat_snprintf(buf, bufsz, Q_("?cityprop:Applies only to %s cities"),
2797  city_property);
2798  } else {
2799  // TRANS: city property ("owned by original", etc)
2800  cat_snprintf(buf, bufsz,
2801  Q_("?cityprop:Does not apply to %s cities"),
2802  city_property);
2803  }
2804  return true;
2805  case REQ_RANGE_TRADEROUTE:
2806  fc_strlcat(buf, prefix, bufsz);
2807  if (preq->present) {
2808  // TRANS: city property ("owned by original", etc)
2809  cat_snprintf(buf, bufsz,
2810  Q_("?cityprop:Applies only to %s cities or "
2811  "their trade partners."),
2812  city_property);
2813  } else {
2814  // TRANS: city property ("owned by original", etc)
2815  cat_snprintf(buf, bufsz,
2816  Q_("?cityprop:Does not apply to %s cities or "
2817  "their trade partners."),
2818  city_property);
2819  }
2820  return true;
2821  case REQ_RANGE_LOCAL:
2822  case REQ_RANGE_ADJACENT:
2823  case REQ_RANGE_CADJACENT:
2824  case REQ_RANGE_CONTINENT:
2825  case REQ_RANGE_PLAYER:
2826  case REQ_RANGE_TEAM:
2827  case REQ_RANGE_ALLIANCE:
2828  case REQ_RANGE_WORLD:
2829  case REQ_RANGE_COUNT:
2830  // Not supported.
2831  break;
2832  }
2833  }
2834 
2835  case VUT_VISIONLAYER:
2836  switch (preq->range) {
2837  case REQ_RANGE_LOCAL:
2838  fc_strlcat(buf, prefix, bufsz);
2839  if (preq->present) {
2840  cat_snprintf(buf, bufsz, _("Applies to the \"%s\" vision layer."),
2841  qUtf8Printable(vision_layer_translated_name(
2842  preq->source.value.vlayer)));
2843  } else {
2844  cat_snprintf(buf, bufsz,
2845  _("Doesn't apply to the \"%s\""
2846  " vision layer."),
2847  qUtf8Printable(vision_layer_translated_name(
2848  preq->source.value.vlayer)));
2849  }
2850  return true;
2851  default:
2852  // Not supported.
2853  break;
2854  }
2855  break;
2856 
2857  case VUT_NINTEL:
2858  fc_strlcat(buf, prefix, bufsz);
2859  if (preq->present) {
2860  // TRANS: "For Wonders intelligence." Very rare.
2861  cat_snprintf(buf, bufsz, _("For %s intelligence."),
2862  qUtf8Printable(national_intelligence_translated_name(
2863  preq->source.value.nintel)));
2864  } else {
2865  // TRANS: "For intelligence other than Wonders." Very rare.
2866  cat_snprintf(buf, bufsz, _("For intelligence other than %s."),
2867  qUtf8Printable(national_intelligence_translated_name(
2868  preq->source.value.nintel)));
2869  }
2870  return true;
2871  break;
2872 
2873  case VUT_COUNT:
2874  break;
2875  }
2876 
2877  if (verb == VERB_DEFAULT) {
2878  char text[256];
2879 
2880  qCritical("%s requirement %s in range %d is not supported in reqtext.c.",
2881  preq->present ? "Present" : "Absent",
2882  universal_name_translation(&preq->source, text, sizeof(text)),
2883  preq->range);
2884  }
2885 
2886  return false;
2887 }
2888 
2892 bool req_text_insert_nl(char *buf, size_t bufsz, struct player *pplayer,
2893  const struct requirement *preq,
2894  enum rt_verbosity verb, const char *prefix)
2895 {
2896  if (req_text_insert(buf, bufsz, pplayer, preq, verb, prefix)) {
2897  fc_strlcat(buf, "\n", bufsz);
2898 
2899  return true;
2900  }
2901 
2902  return false;
2903 }
const char * achievement_name_translation(struct achievement *pach)
Return translated name of this achievement type.
const QString action_name_translation(const struct action *action)
Get the action name used when displaying the action in the UI.
Definition: actions.cpp:1353
QString strvec_to_or_list(const QVector< QString > &psv)
Definition: astring.cpp:20
const char * textcalfrag(int frag)
Produce a statically allocated textual representation of the given calendar fragment.
Definition: calendar.cpp:97
const char * textyear(int year)
Produce a statically allocated textual representation of the given year.
Definition: calendar.cpp:116
const char * get_output_name(Output_type_id output)
Return a translated name for the output type.
Definition: city.cpp:602
const char * extra_name_translation(const struct extra_type *pextra)
Return the (translated) name of the extra type.
Definition: extras.cpp:165
#define Q_(String)
Definition: fcintl.h:53
#define PL_(String1, String2, n)
Definition: fcintl.h:54
#define _(String)
Definition: fcintl.h:50
const char * government_name_translation(const struct government *pgovern)
Return the (translated) name of the given government.
Definition: government.cpp:136
bool can_improvement_go_obsolete(const struct impr_type *pimprove)
Return TRUE if the improvement can ever go obsolete.
bool is_wonder(const struct impr_type *pimprove)
Returns whether improvement is some kind of wonder.
bool is_great_wonder(const struct impr_type *pimprove)
Is this building a great wonder?
const char * improvement_name_translation(const struct impr_type *pimprove)
Return the (translated) name of the given improvement.
#define fc_assert_msg(condition, message,...)
Definition: log.h:96
#define fc_assert(condition)
Definition: log.h:89
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...
Definition: movement.cpp:856
const char * nation_group_name_translation(const struct nation_group *pgroup)
Return the translated name of a nation group.
Definition: nation.cpp:953
const char * nation_adjective_translation(const struct nation_type *pnation)
Return the (translated) adjective for the given nation.
Definition: nation.cpp:126
const char * nation_plural_translation(const struct nation_type *pnation)
Return the (translated) plural noun of the given nation.
Definition: nation.cpp:136
const char * diplrel_name_translation(int value)
Return the translated name of the given diplomatic relation.
Definition: player.cpp:1538
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.
Definition: reqtext.cpp:2892
bool req_text_insert(char *buf, size_t bufsz, struct player *pplayer, const struct requirement *preq, enum rt_verbosity verb, const char *prefix)
Append text for the requirement.
Definition: reqtext.cpp:41
rt_verbosity
Definition: reqtext.h:15
@ VERB_ACTUAL
Definition: reqtext.h:15
@ VERB_DEFAULT
Definition: reqtext.h:15
const char * universal_name_translation(const struct universal *psource, char *buf, size_t bufsz)
Make user-friendly text for the source.
QString ssetv_human_readable(ssetv val, bool present)
Returns the server setting - value pair formated in a user readable way.
const char * specialist_plural_translation(const struct specialist *sp)
Return the (translated, plural) name of the specialist type.
Definition: specialist.cpp:151
Definition: player.h:231
enum req_range range
Definition: requirements.h:69
struct universal source
Definition: requirements.h:68
enum universals_n kind
Definition: fc_types.h:740
universals_u value
Definition: fc_types.h:739
const char * style_name_translation(const struct nation_style *pstyle)
Return the (translated) name of the style.
Definition: style.cpp:85
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-...
Definition: support.cpp:448
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...
Definition: support.cpp:564
const char * advance_name_translation(const struct advance *padvance)
Return the (translated) name of the given advance/technology.
Definition: tech.cpp:274
const char * terrain_class_name_translation(enum terrain_class tclass)
Return the (translated) name of the given terrain class.
Definition: terrain.cpp:546
const char * terrain_name_translation(const struct terrain *pterrain)
Return the (translated) name of the terrain.
Definition: terrain.cpp:175
const char * goods_name_translation(struct goods_type *pgood)
Return translated name of this goods type.
const struct unit_type * utype
Definition: fc_types.h:585
int unitflag
Definition: fc_types.h:607
int min_techs
Definition: fc_types.h:623
int mincalfrag
Definition: fc_types.h:602
struct nation_style * style
Definition: fc_types.h:589
enum vision_layer vlayer
Definition: fc_types.h:596
enum ai_level ai_level
Definition: fc_types.h:593
struct specialist * specialist
Definition: fc_types.h:582
enum impr_genus_id impr_genus
Definition: fc_types.h:617
enum citytile_type citytile
Definition: fc_types.h:594
struct nation_group * nationgroup
Definition: fc_types.h:588
struct extra_type * extra
Definition: fc_types.h:586
struct nation_type * nation
Definition: fc_types.h:580
int minmoves
Definition: fc_types.h:618
int terrainclass
Definition: fc_types.h:604
int unitclassflag
Definition: fc_types.h:606
struct government * govern
Definition: fc_types.h:578
int max_tile_units
Definition: fc_types.h:619
int terrainalter
Definition: fc_types.h:605
int minculture
Definition: fc_types.h:599
enum citystatus_type citystatus
Definition: fc_types.h:595
int minforeignpct
Definition: fc_types.h:600
const struct impr_type * building
Definition: fc_types.h:579
struct achievement * achievement
Definition: fc_types.h:587
ssetv ssetval
Definition: fc_types.h:626
int techflag
Definition: fc_types.h:609
struct advance * advance
Definition: fc_types.h:577
enum unit_activity activity
Definition: fc_types.h:616
struct goods_type * good
Definition: fc_types.h:591
struct terrain * terrain
Definition: fc_types.h:583
int terrainflag
Definition: fc_types.h:608
enum national_intelligence nintel
Definition: fc_types.h:597
enum ustate_prop unit_state
Definition: fc_types.h:615
int minveteran
Definition: fc_types.h:620
int extraflag
Definition: fc_types.h:612
Output_type_id outputtype
Definition: fc_types.h:603
int roadflag
Definition: fc_types.h:611
enum topo_flag topo_property
Definition: fc_types.h:625
int min_hit_points
Definition: fc_types.h:621
struct unit_class * uclass
Definition: fc_types.h:584
struct nation_type * nationality
Definition: fc_types.h:581
struct action * action
Definition: fc_types.h:590
int baseflag
Definition: fc_types.h:610
const char * uclass_name_translation(const struct unit_class *pclass)
Return the (translated) name of the unit class.
Definition: unittype.cpp:1324
Unit_Class_id uclass_count()
Return the unit_class count.
Definition: unittype.cpp:2101
bool role_units_translations(QString &astr, int flag, bool alts)
Return a string with all the names of units with this flag.
Definition: unittype.cpp:1343
const char * utype_name_translation(const struct unit_type *punittype)
Return the (translated) name of the unit type.
Definition: unittype.cpp:1256
static bool uclass_has_flag(const struct unit_class *punitclass, enum unit_class_flag_id flag)
Definition: unittype.h:704
#define unit_class_iterate(_p)
Definition: unittype.h:823
#define unit_class_iterate_end
Definition: unittype.h:829