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