Freeciv-3.2
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 "counters.h"
27#include "extras.h"
28#include "government.h"
29#include "map.h"
30#include "movement.h"
31#include "nation.h"
32#include "player.h"
33#include "requirements.h"
34#include "server_settings.h"
35#include "specialist.h"
36#include "terrain.h"
37
38#include "reqtext.h"
39
40/*************************************************************/
48bool req_text_insert(char *buf, size_t bufsz, struct player *pplayer,
49 const struct requirement *preq,
50 enum rt_verbosity verb, const char *prefix)
51{
52 if (preq->quiet && verb != VERB_ACTUAL) {
53 return FALSE;
54 }
55
56 switch (preq->source.kind) {
57 case VUT_NONE:
58 return FALSE;
59
60 case VUT_COUNTER:
61 if (preq->present) {
62
63 fc_strlcat(buf, prefix, bufsz);
65 _("Requires counter %s to achieve at minimum %d value."),
66 counter_rule_name(preq->source.value.counter),
67 preq->source.value.counter->checkpoint);
68 } else {
69
70 fc_strlcat(buf, prefix, bufsz);
72 _("Requires counter %s to be less than %d value."),
73 counter_rule_name(preq->source.value.counter),
74 preq->source.value.counter->checkpoint - 1);
75 }
76 break;
77 case VUT_ADVANCE:
78 switch (preq->range) {
80 fc_strlcat(buf, prefix, bufsz);
81 if (preq->present) {
83 _("Requires knowledge of the technology %s."),
84 advance_name_translation(preq->source.value.advance));
85 } else {
87 _("Prevented by knowledge of the technology %s."),
88 advance_name_translation(preq->source.value.advance));
89 }
90 return TRUE;
91 case REQ_RANGE_TEAM:
92 fc_strlcat(buf, prefix, bufsz);
93 if (preq->present) {
95 _("Requires that a player on your team knows the "
96 "technology %s."),
97 advance_name_translation(preq->source.value.advance));
98 } else {
100 _("Prevented if any player on your team knows the "
101 "technology %s."),
102 advance_name_translation(preq->source.value.advance));
103 }
104 return TRUE;
106 fc_strlcat(buf, prefix, bufsz);
107 if (preq->present) {
109 _("Requires that a player allied to you knows the "
110 "technology %s."),
111 advance_name_translation(preq->source.value.advance));
112 } else {
114 _("Prevented if any player allied to you knows the "
115 "technology %s."),
116 advance_name_translation(preq->source.value.advance));
117 }
118 return TRUE;
119 case REQ_RANGE_WORLD:
120 fc_strlcat(buf, prefix, bufsz);
121 if (preq->survives) {
122 if (preq->present) {
124 _("Requires that someone has discovered the "
125 "technology %s."),
126 advance_name_translation(preq->source.value.advance));
127 } else {
129 _("Requires that no-one has yet discovered the "
130 "technology %s."),
131 advance_name_translation(preq->source.value.advance));
132 }
133 } else {
134 if (preq->present) {
136 _("Requires that some player knows the "
137 "technology %s."),
138 advance_name_translation(preq->source.value.advance));
139 } else {
141 _("Requires that no player knows the "
142 "technology %s."),
143 advance_name_translation(preq->source.value.advance));
144 }
145 }
146 return TRUE;
147 case REQ_RANGE_LOCAL:
148 case REQ_RANGE_TILE:
151 case REQ_RANGE_CITY:
154 case REQ_RANGE_COUNT:
155 /* Not supported. */
156 break;
157 }
158 break;
159
160 case VUT_TECHFLAG:
161 switch (preq->range) {
162 case REQ_RANGE_PLAYER:
163 fc_strlcat(buf, prefix, bufsz);
164 if (preq->present) {
166 /* TRANS: %s is a (translatable) tech flag. */
167 _("Requires knowledge of a technology with the "
168 "\"%s\" flag."),
169 tech_flag_id_translated_name(preq->source.value.techflag));
170 } else {
172 /* TRANS: %s is a (translatable) tech flag. */
173 _("Prevented by knowledge of any technology with the "
174 "\"%s\" flag."),
175 tech_flag_id_translated_name(preq->source.value.techflag));
176 }
177 return TRUE;
178 case REQ_RANGE_TEAM:
179 fc_strlcat(buf, prefix, bufsz);
180 if (preq->present) {
182 /* TRANS: %s is a (translatable) tech flag. */
183 _("Requires that a player on your team knows "
184 "a technology with the \"%s\" flag."),
185 tech_flag_id_translated_name(preq->source.value.techflag));
186 } else {
188 /* TRANS: %s is a (translatable) tech flag. */
189 _("Prevented if any player on your team knows "
190 "any technology with the \"%s\" flag."),
191 tech_flag_id_translated_name(preq->source.value.techflag));
192 }
193 return TRUE;
195 fc_strlcat(buf, prefix, bufsz);
196 if (preq->present) {
198 /* TRANS: %s is a (translatable) tech flag. */
199 _("Requires that a player allied to you knows "
200 "a technology with the \"%s\" flag."),
201 tech_flag_id_translated_name(preq->source.value.techflag));
202 } else {
204 /* TRANS: %s is a (translatable) tech flag. */
205 _("Prevented if any player allied to you knows "
206 "any technology with the \"%s\" flag."),
207 tech_flag_id_translated_name(preq->source.value.techflag));
208 }
209 return TRUE;
210 case REQ_RANGE_WORLD:
211 fc_strlcat(buf, prefix, bufsz);
212 if (preq->present) {
214 /* TRANS: %s is a (translatable) tech flag. */
215 _("Requires that some player knows a technology "
216 "with the \"%s\" flag."),
217 tech_flag_id_translated_name(preq->source.value.techflag));
218 } else {
220 /* TRANS: %s is a (translatable) tech flag. */
221 _("Requires that no player knows any technology with "
222 "the \"%s\" flag."),
223 tech_flag_id_translated_name(preq->source.value.techflag));
224 }
225 return TRUE;
226 case REQ_RANGE_LOCAL:
227 case REQ_RANGE_TILE:
230 case REQ_RANGE_CITY:
233 case REQ_RANGE_COUNT:
234 /* Not supported. */
235 break;
236 }
237 break;
238
239 case VUT_GOVERNMENT:
240 if (preq->range != REQ_RANGE_PLAYER) {
241 break;
242 }
243 fc_strlcat(buf, prefix, bufsz);
244 if (preq->present) {
245 cat_snprintf(buf, bufsz, _("Requires the %s government."),
246 government_name_translation(preq->source.value.govern));
247 } else {
248 cat_snprintf(buf, bufsz, _("Not available under the %s government."),
249 government_name_translation(preq->source.value.govern));
250 }
251 return TRUE;
252
253 case VUT_ACHIEVEMENT:
254 switch (preq->range) {
255 case REQ_RANGE_PLAYER:
256 fc_strlcat(buf, prefix, bufsz);
257 if (preq->present) {
258 cat_snprintf(buf, bufsz, _("Requires you to have achieved \"%s\"."),
259 achievement_name_translation(preq->source.value.achievement));
260 } else {
261 cat_snprintf(buf, bufsz, _("Not available once you have achieved "
262 "\"%s\"."),
263 achievement_name_translation(preq->source.value.achievement));
264 }
265 return TRUE;
266 case REQ_RANGE_TEAM:
267 fc_strlcat(buf, prefix, bufsz);
268 if (preq->present) {
269 cat_snprintf(buf, bufsz, _("Requires that at least one of your "
270 "team-mates has achieved \"%s\"."),
271 achievement_name_translation(preq->source.value.achievement));
272 } else {
273 cat_snprintf(buf, bufsz, _("Not available if any of your team-mates "
274 "has achieved \"%s\"."),
275 achievement_name_translation(preq->source.value.achievement));
276 }
277 return TRUE;
279 fc_strlcat(buf, prefix, bufsz);
280 if (preq->present) {
281 cat_snprintf(buf, bufsz, _("Requires that at least one of your allies "
282 "has achieved \"%s\"."),
283 achievement_name_translation(preq->source.value.achievement));
284 } else {
285 cat_snprintf(buf, bufsz, _("Not available if any of your allies has "
286 "achieved \"%s\"."),
287 achievement_name_translation(preq->source.value.achievement));
288 }
289 return TRUE;
290 case REQ_RANGE_WORLD:
291 fc_strlcat(buf, prefix, bufsz);
292 if (preq->present) {
293 cat_snprintf(buf, bufsz, _("Requires that at least one player "
294 "has achieved \"%s\"."),
295 achievement_name_translation(preq->source.value.achievement));
296 } else {
297 cat_snprintf(buf, bufsz, _("Not available if any player has "
298 "achieved \"%s\"."),
299 achievement_name_translation(preq->source.value.achievement));
300 }
301 return TRUE;
302 case REQ_RANGE_LOCAL:
303 case REQ_RANGE_TILE:
306 case REQ_RANGE_CITY:
309 case REQ_RANGE_COUNT:
310 /* Not supported. */
311 break;
312 }
313 break;
314
315 case VUT_ACTION:
316 switch (preq->range) {
317 case REQ_RANGE_LOCAL:
318 fc_strlcat(buf, prefix, bufsz);
319 if (preq->present) {
320 cat_snprintf(buf, bufsz, _("Applies to the \"%s\" action."),
321 action_name_translation(preq->source.value.action));
322 } else {
323 cat_snprintf(buf, bufsz, _("Doesn't apply to the \"%s\""
324 " action."),
325 action_name_translation(preq->source.value.action));
326 }
327 return TRUE;
328 default:
329 /* Not supported. */
330 break;
331 }
332 break;
333
334 case VUT_IMPR_GENUS:
335 switch (preq->range) {
336 case REQ_RANGE_LOCAL:
337 fc_strlcat(buf, prefix, bufsz);
338 if (preq->present) {
339 cat_snprintf(buf, bufsz, _("Applies to \"%s\" buildings."),
341 preq->source.value.impr_genus));
342 } else {
343 cat_snprintf(buf, bufsz, _("Doesn't apply to \"%s\" buildings."),
345 preq->source.value.impr_genus));
346 }
347 return TRUE;
348 default:
349 /* Not supported. */
350 break;
351 }
352 break;
353
354 case VUT_IMPR_FLAG:
355 switch (preq->range) {
356 case REQ_RANGE_LOCAL:
357 fc_strlcat(buf, prefix, bufsz);
358 if (preq->present) {
359 cat_snprintf(buf, bufsz, _("Applies to \"%s\" buildings."),
361 preq->source.value.impr_flag));
362 } else {
363 cat_snprintf(buf, bufsz, _("Doesn't apply to \"%s\" buildings."),
365 preq->source.value.impr_flag));
366 }
367 return TRUE;
368 default:
369 /* Not supported. */
370 break;
371 }
372 break;
373
374 case VUT_PLAYER_FLAG:
375 switch (preq->range) {
376 case REQ_RANGE_PLAYER:
377 fc_strlcat(buf, prefix, bufsz);
378 if (preq->present) {
379 cat_snprintf(buf, bufsz, _("Applies to players with \"%s\" flag."),
381 preq->source.value.plr_flag));
382 } else {
383 cat_snprintf(buf, bufsz, _("Doesn't apply to players with \"%s\" flag."),
385 preq->source.value.plr_flag));
386 }
387 return TRUE;
388 default:
389 /* Not supported. */
390 break;
391 }
392 break;
393
394 case VUT_PLAYER_STATE:
395 switch (preq->range) {
396 case REQ_RANGE_PLAYER:
397 fc_strlcat(buf, prefix, bufsz);
398 if (preq->present) {
399 cat_snprintf(buf, bufsz, _("Applies to \"%s\" players."),
400 plrstate_type_translated_name(preq->source.value.plrstate));
401 } else {
402 cat_snprintf(buf, bufsz, _("Doesn't apply to \"%s\" players."),
403 plrstate_type_translated_name(preq->source.value.plrstate));
404 }
405 return TRUE;
406 default:
407 /* Not supported. */
408 break;
409 }
410 break;
411
412 case VUT_IMPROVEMENT:
413 case VUT_SITE:
414 switch (preq->range) {
415 case REQ_RANGE_WORLD:
416 if (is_great_wonder(preq->source.value.building)) {
417 fc_strlcat(buf, prefix, bufsz);
418 if (preq->survives) {
419 if (preq->present) {
420 if (preq->source.kind == VUT_IMPROVEMENT
421 && can_improvement_go_obsolete(preq->source.value.building)) {
423 /* TRANS: %s is a wonder */
424 _("Requires that %s was built at some point, "
425 "and that it has not yet been rendered "
426 "obsolete."),
428 (preq->source.value.building));
429 } else {
431 /* TRANS: %s is a wonder */
432 _("Requires that %s was built at some point."),
434 (preq->source.value.building));
435 }
436 } else {
437 if (preq->source.kind == VUT_IMPROVEMENT
438 && can_improvement_go_obsolete(preq->source.value.building)) {
440 /* TRANS: %s is a wonder */
441 _("Prevented if %s has ever been built, "
442 "unless it would be obsolete."),
444 (preq->source.value.building));
445 } else {
447 /* TRANS: %s is a wonder */
448 _("Prevented if %s has ever been built."),
450 (preq->source.value.building));
451 }
452 }
453 } else {
454 /* Non-surviving requirement */
455 if (preq->present) {
456 if (preq->source.kind == VUT_IMPROVEMENT
457 && can_improvement_go_obsolete(preq->source.value.building)) {
459 /* TRANS: %s is a wonder */
460 _("Requires %s to be owned by any player "
461 "and not yet obsolete."),
463 (preq->source.value.building));
464 } else {
466 /* TRANS: %s is a wonder */
467 _("Requires %s to be owned by any player."),
469 (preq->source.value.building));
470 }
471 } else {
472 if (preq->source.kind == VUT_IMPROVEMENT
473 && can_improvement_go_obsolete(preq->source.value.building)) {
475 /* TRANS: %s is a wonder */
476 _("Prevented if %s is currently owned by "
477 "any player, unless it is obsolete."),
479 (preq->source.value.building));
480 } else {
482 /* TRANS: %s is a wonder */
483 _("Prevented if %s is currently owned by "
484 "any player."),
486 (preq->source.value.building));
487 }
488 }
489 }
490 return TRUE;
491 }
492 /* Non-great-wonder world-ranged requirements not supported */
493 break;
495 if (is_wonder(preq->source.value.building)) {
496 fc_strlcat(buf, prefix, bufsz);
497 if (preq->survives) {
498 if (preq->present) {
499 if (preq->source.kind == VUT_IMPROVEMENT
500 && can_improvement_go_obsolete(preq->source.value.building)) {
502 /* TRANS: %s is a wonder */
503 _("Requires someone who is currently allied to "
504 "you to have built %s at some point, and for "
505 "it not to have been rendered obsolete."),
507 (preq->source.value.building));
508 } else {
510 /* TRANS: %s is a wonder */
511 _("Requires someone who is currently allied to "
512 "you to have built %s at some point."),
514 (preq->source.value.building));
515 }
516 } else {
517 if (preq->source.kind == VUT_IMPROVEMENT
518 && can_improvement_go_obsolete(preq->source.value.building)) {
520 /* TRANS: %s is a wonder */
521 _("Prevented if someone currently allied to you "
522 "has ever built %s, unless it would be "
523 "obsolete."),
525 (preq->source.value.building));
526 } else {
528 /* TRANS: %s is a wonder */
529 _("Prevented if someone currently allied to you "
530 "has ever built %s."),
532 (preq->source.value.building));
533 }
534 }
535 } else {
536 /* Non-surviving requirement */
537 if (preq->present) {
538 if (preq->source.kind == VUT_IMPROVEMENT
539 && can_improvement_go_obsolete(preq->source.value.building)) {
541 /* TRANS: %s is a wonder */
542 _("Requires someone allied to you to own %s, "
543 "and for it not to have been rendered "
544 "obsolete."),
546 (preq->source.value.building));
547 } else {
549 /* TRANS: %s is a wonder */
550 _("Requires someone allied to you to own %s."),
552 (preq->source.value.building));
553 }
554 } else {
555 if (preq->source.kind == VUT_IMPROVEMENT
556 && can_improvement_go_obsolete(preq->source.value.building)) {
558 /* TRANS: %s is a wonder */
559 _("Prevented if someone allied to you owns %s, "
560 "unless it is obsolete."),
562 (preq->source.value.building));
563 } else {
565 /* TRANS: %s is a wonder */
566 _("Prevented if someone allied to you owns %s."),
568 (preq->source.value.building));
569 }
570 }
571 }
572 return TRUE;
573 }
574 /* Non-wonder alliance-ranged requirements not supported */
575 break;
576 case REQ_RANGE_TEAM:
577 if (is_wonder(preq->source.value.building)) {
578 fc_strlcat(buf, prefix, bufsz);
579 if (preq->survives) {
580 if (preq->present) {
581 if (preq->source.kind == VUT_IMPROVEMENT
582 && can_improvement_go_obsolete(preq->source.value.building)) {
584 /* TRANS: %s is a wonder */
585 _("Requires someone on your team to have "
586 "built %s at some point, and for it not "
587 "to have been rendered obsolete."),
589 (preq->source.value.building));
590 } else {
592 /* TRANS: %s is a wonder */
593 _("Requires someone on your team to have "
594 "built %s at some point."),
596 (preq->source.value.building));
597 }
598 } else {
599 if (preq->source.kind == VUT_IMPROVEMENT
600 && can_improvement_go_obsolete(preq->source.value.building)) {
602 /* TRANS: %s is a wonder */
603 _("Prevented if someone on your team has ever "
604 "built %s, unless it would be obsolete."),
606 (preq->source.value.building));
607 } else {
609 /* TRANS: %s is a wonder */
610 _("Prevented if someone on your team has ever "
611 "built %s."),
613 (preq->source.value.building));
614 }
615 }
616 } else {
617 /* Non-surviving requirement */
618 if (preq->present) {
619 if (preq->source.kind == VUT_IMPROVEMENT
620 && can_improvement_go_obsolete(preq->source.value.building)) {
622 /* TRANS: %s is a wonder */
623 _("Requires someone on your team to own %s, "
624 "and for it not to have been rendered "
625 "obsolete."),
627 (preq->source.value.building));
628 } else {
630 /* TRANS: %s is a wonder */
631 _("Requires someone on your team to own %s."),
633 (preq->source.value.building));
634 }
635 } else {
636 if (preq->source.kind == VUT_IMPROVEMENT
637 && can_improvement_go_obsolete(preq->source.value.building)) {
639 /* TRANS: %s is a wonder */
640 _("Prevented if someone on your team owns %s, "
641 "unless it is obsolete."),
643 (preq->source.value.building));
644 } else {
646 /* TRANS: %s is a wonder */
647 _("Prevented if someone on your team owns %s."),
649 (preq->source.value.building));
650 }
651 }
652 }
653 return TRUE;
654 }
655 /* Non-wonder team-ranged requirements not supported */
656 break;
657 case REQ_RANGE_PLAYER:
658 if (is_wonder(preq->source.value.building)) {
659 fc_strlcat(buf, prefix, bufsz);
660 if (preq->survives) {
661 if (preq->present) {
662 if (preq->source.kind == VUT_IMPROVEMENT
663 && can_improvement_go_obsolete(preq->source.value.building)) {
665 /* TRANS: %s is a wonder */
666 _("Requires you to have built %s at some point, "
667 "and for it not to have been rendered "
668 "obsolete."),
670 (preq->source.value.building));
671 } else {
673 /* TRANS: %s is a wonder */
674 _("Requires you to have built %s at some point."),
676 (preq->source.value.building));
677 }
678 } else {
679 if (preq->source.kind == VUT_IMPROVEMENT
680 && can_improvement_go_obsolete(preq->source.value.building)) {
682 /* TRANS: %s is a wonder */
683 _("Prevented if you have ever built %s, "
684 "unless it would be obsolete."),
686 (preq->source.value.building));
687 } else {
689 /* TRANS: %s is a wonder */
690 _("Prevented if you have ever built %s."),
692 (preq->source.value.building));
693 }
694 }
695 } else {
696 /* Non-surviving requirement */
697 if (preq->present) {
698 if (preq->source.kind == VUT_IMPROVEMENT
699 && can_improvement_go_obsolete(preq->source.value.building)) {
701 /* TRANS: %s is a wonder */
702 _("Requires you to own %s, which must not "
703 "be obsolete."),
705 (preq->source.value.building));
706 } else {
708 /* TRANS: %s is a wonder */
709 _("Requires you to own %s."),
711 (preq->source.value.building));
712 }
713 } else {
714 if (preq->source.kind == VUT_IMPROVEMENT
715 && can_improvement_go_obsolete(preq->source.value.building)) {
717 /* TRANS: %s is a wonder */
718 _("Prevented if you own %s, unless it is "
719 "obsolete."),
721 (preq->source.value.building));
722 } else {
724 /* TRANS: %s is a wonder */
725 _("Prevented if you own %s."),
727 (preq->source.value.building));
728 }
729 }
730 }
731 return TRUE;
732 }
733 /* Non-wonder player-ranged requirements not supported */
734 break;
736 if (is_wonder(preq->source.value.building)) {
737 fc_strlcat(buf, prefix, bufsz);
738 if (preq->present) {
739 if (preq->source.kind == VUT_IMPROVEMENT
740 && can_improvement_go_obsolete(preq->source.value.building)) {
742 /* TRANS: %s is a wonder */
743 _("Requires %s in one of your cities on the same "
744 "continent, and not yet obsolete."),
746 (preq->source.value.building));
747 } else {
749 /* TRANS: %s is a wonder */
750 _("Requires %s in one of your cities on the same "
751 "continent."),
753 (preq->source.value.building));
754 }
755 } else {
756 if (preq->source.kind == VUT_IMPROVEMENT
757 && can_improvement_go_obsolete(preq->source.value.building)) {
759 /* TRANS: %s is a wonder */
760 _("Prevented if %s is in one of your cities on the "
761 "same continent, unless it is obsolete."),
763 (preq->source.value.building));
764 } else {
766 /* TRANS: %s is a wonder */
767 _("Prevented if %s is in one of your cities on the "
768 "same continent."),
770 (preq->source.value.building));
771 }
772 }
773 return TRUE;
774 }
775 /* Surviving or non-wonder continent-ranged requirements not supported */
776 break;
778 fc_strlcat(buf, prefix, bufsz);
779 if (preq->present) {
780 if (preq->source.kind == VUT_IMPROVEMENT
781 && can_improvement_go_obsolete(preq->source.value.building)) {
782 /* Should only apply to wonders */
784 /* TRANS: %s is a building or wonder */
785 _("Requires %s in the city or a trade partner "
786 "(and not yet obsolete)."),
788 (preq->source.value.building));
789 } else {
791 /* TRANS: %s is a building or wonder */
792 _("Requires %s in the city or a trade partner."),
794 (preq->source.value.building));
795 }
796 } else {
797 if (preq->source.kind == VUT_IMPROVEMENT
798 && can_improvement_go_obsolete(preq->source.value.building)) {
799 /* Should only apply to wonders */
801 /* TRANS: %s is a building or wonder */
802 _("Prevented by %s in the city or a trade partner "
803 "(unless it is obsolete)."),
805 (preq->source.value.building));
806 } else {
808 /* TRANS: %s is a building or wonder */
809 _("Prevented by %s in the city or a trade partner."),
811 (preq->source.value.building));
812 }
813 }
814 return TRUE;
815 case REQ_RANGE_CITY:
816 fc_strlcat(buf, prefix, bufsz);
817 if (preq->present) {
818 if (preq->source.kind == VUT_IMPROVEMENT
819 && can_improvement_go_obsolete(preq->source.value.building)) {
820 /* Should only apply to wonders */
822 /* TRANS: %s is a building or wonder */
823 _("Requires %s in the city (and not yet obsolete)."),
825 (preq->source.value.building));
826 } else {
828 /* TRANS: %s is a building or wonder */
829 _("Requires %s in the city."),
831 (preq->source.value.building));
832 }
833 } else {
834 if (preq->source.kind == VUT_IMPROVEMENT
835 && can_improvement_go_obsolete(preq->source.value.building)) {
836 /* Should only apply to wonders */
838 /* TRANS: %s is a building or wonder */
839 _("Prevented by %s in the city (unless it is "
840 "obsolete)."),
842 (preq->source.value.building));
843 } else {
845 /* TRANS: %s is a building or wonder */
846 _("Prevented by %s in the city."),
848 (preq->source.value.building));
849 }
850 }
851 return TRUE;
852 case REQ_RANGE_LOCAL:
853 fc_strlcat(buf, prefix, bufsz);
854 if (preq->present) {
856 _("Only applies to \"%s\" buildings."),
858 (preq->source.value.building));
859 } else {
861 _("Does not apply to \"%s\" buildings."),
863 (preq->source.value.building));
864 }
865 return TRUE;
866 case REQ_RANGE_TILE:
867 fc_strlcat(buf, prefix, bufsz);
868 if (preq->present) {
870 _("Requires \"%s\" building in a city on the tile."),
872 (preq->source.value.building));
873 } else {
875 _("Prevented by \"%s\" building in a city on the tile."),
877 (preq->source.value.building));
878 }
879 return TRUE;
882 case REQ_RANGE_COUNT:
883 /* Not supported. */
884 break;
885 }
886 break;
887
888 case VUT_EXTRA:
889 switch (preq->range) {
890 case REQ_RANGE_LOCAL:
891 fc_strlcat(buf, prefix, bufsz);
892 if (preq->present) {
894 _("Only applies to \"%s\" extras."),
895 extra_name_translation(preq->source.value.extra));
896 } else {
898 _("Does not apply to \"%s\" extras."),
899 extra_name_translation(preq->source.value.extra));
900 }
901 return TRUE;
902 case REQ_RANGE_TILE:
903 fc_strlcat(buf, prefix, bufsz);
904 if (preq->present) {
906 Q_("?extra:Requires %s on the tile."),
907 extra_name_translation(preq->source.value.extra));
908 } else {
910 Q_("?extra:Prevented by %s on the tile."),
911 extra_name_translation(preq->source.value.extra));
912 }
913 return TRUE;
915 fc_strlcat(buf, prefix, bufsz);
916 if (preq->present) {
918 Q_("?extra:Requires %s on the tile or a cardinally "
919 "adjacent tile."),
920 extra_name_translation(preq->source.value.extra));
921 } else {
923 Q_("?extra:Prevented by %s on the tile or any cardinally "
924 "adjacent tile."),
925 extra_name_translation(preq->source.value.extra));
926 }
927 return TRUE;
929 fc_strlcat(buf, prefix, bufsz);
930 if (preq->present) {
932 Q_("?extra:Requires %s on the tile or an adjacent "
933 "tile."),
934 extra_name_translation(preq->source.value.extra));
935 } else {
937 Q_("?extra:Prevented by %s on the tile or any adjacent "
938 "tile."),
939 extra_name_translation(preq->source.value.extra));
940 }
941 return TRUE;
942 case REQ_RANGE_CITY:
943 fc_strlcat(buf, prefix, bufsz);
944 if (preq->present) {
946 Q_("?extra:Requires %s on a tile within the city "
947 "radius."),
948 extra_name_translation(preq->source.value.extra));
949 } else {
951 Q_("?extra:Prevented by %s on any tile within the city "
952 "radius."),
953 extra_name_translation(preq->source.value.extra));
954 }
955 return TRUE;
957 fc_strlcat(buf, prefix, bufsz);
958 if (preq->present) {
960 Q_("?extra:Requires %s on a tile within the city "
961 "radius, or the city radius of a trade partner."),
962 extra_name_translation(preq->source.value.extra));
963 } else {
965 Q_("?extra:Prevented by %s on any tile within the city "
966 "radius or the city radius of a trade partner."),
967 extra_name_translation(preq->source.value.extra));
968 }
969 return TRUE;
971 case REQ_RANGE_PLAYER:
972 case REQ_RANGE_TEAM:
974 case REQ_RANGE_WORLD:
975 case REQ_RANGE_COUNT:
976 /* Not supported. */
977 break;
978 }
979 break;
980
981 case VUT_GOOD:
982 switch (preq->range) {
983 case REQ_RANGE_CITY:
984 fc_strlcat(buf, prefix, bufsz);
985 if (preq->present) {
986 cat_snprintf(buf, bufsz, Q_("?good:Requires import of %s ."),
987 goods_name_translation(preq->source.value.good));
988 } else {
989 cat_snprintf(buf, bufsz, Q_("?goods:Prevented by import of %s."),
990 goods_name_translation(preq->source.value.good));
991 }
992 return TRUE;
993 case REQ_RANGE_LOCAL:
994 case REQ_RANGE_TILE:
999 case REQ_RANGE_PLAYER:
1000 case REQ_RANGE_TEAM:
1001 case REQ_RANGE_ALLIANCE:
1002 case REQ_RANGE_WORLD:
1003 case REQ_RANGE_COUNT:
1004 /* Not supported. */
1005 break;
1006 }
1007 break;
1008
1009 case VUT_TERRAIN:
1010 switch (preq->range) {
1011 case REQ_RANGE_TILE:
1012 fc_strlcat(buf, prefix, bufsz);
1013 if (preq->present) {
1014 cat_snprintf(buf, bufsz, Q_("?terrain:Requires %s on the tile."),
1015 terrain_name_translation(preq->source.value.terrain));
1016 } else {
1017 cat_snprintf(buf, bufsz, Q_("?terrain:Prevented by %s on the tile."),
1018 terrain_name_translation(preq->source.value.terrain));
1019 }
1020 return TRUE;
1022 fc_strlcat(buf, prefix, bufsz);
1023 if (preq->present) {
1025 Q_("?terrain:Requires %s on the tile or a cardinally "
1026 "adjacent tile."),
1027 terrain_name_translation(preq->source.value.terrain));
1028 } else {
1030 Q_("?terrain:Prevented by %s on the tile or any "
1031 "cardinally adjacent tile."),
1032 terrain_name_translation(preq->source.value.terrain));
1033 }
1034 return TRUE;
1035 case REQ_RANGE_ADJACENT:
1036 fc_strlcat(buf, prefix, bufsz);
1037 if (preq->present) {
1039 Q_("?terrain:Requires %s on the tile or an adjacent "
1040 "tile."),
1041 terrain_name_translation(preq->source.value.terrain));
1042 } else {
1044 Q_("?terrain:Prevented by %s on the tile or any "
1045 "adjacent tile."),
1046 terrain_name_translation(preq->source.value.terrain));
1047 }
1048 return TRUE;
1049 case REQ_RANGE_CITY:
1050 fc_strlcat(buf, prefix, bufsz);
1051 if (preq->present) {
1053 Q_("?terrain:Requires %s on a tile within the city "
1054 "radius."),
1055 terrain_name_translation(preq->source.value.terrain));
1056 } else {
1058 Q_("?terrain:Prevented by %s on any tile within the city "
1059 "radius."),
1060 terrain_name_translation(preq->source.value.terrain));
1061 }
1062 return TRUE;
1064 fc_strlcat(buf, prefix, bufsz);
1065 if (preq->present) {
1067 Q_("?terrain:Requires %s on a tile within the city "
1068 "radius, or the city radius of a trade partner."),
1069 terrain_name_translation(preq->source.value.terrain));
1070 } else {
1072 Q_("?terrain:Prevented by %s on any tile within the city "
1073 "radius or the city radius of a trade partner."),
1074 terrain_name_translation(preq->source.value.terrain));
1075 }
1076 return TRUE;
1078 case REQ_RANGE_PLAYER:
1079 case REQ_RANGE_TEAM:
1080 case REQ_RANGE_ALLIANCE:
1081 case REQ_RANGE_WORLD:
1082 case REQ_RANGE_LOCAL:
1083 case REQ_RANGE_COUNT:
1084 /* Not supported. */
1085 break;
1086 }
1087 break;
1088
1089 case VUT_NATION:
1090 switch (preq->range) {
1091 case REQ_RANGE_PLAYER:
1092 fc_strlcat(buf, prefix, bufsz);
1093 if (preq->present) {
1095 /* TRANS: "... playing as the Swedes." */
1096 _("Requires that you are playing as the %s."),
1097 nation_plural_translation(preq->source.value.nation));
1098 } else {
1100 /* TRANS: "... playing as the Turks." */
1101 _("Requires that you are not playing as the %s."),
1102 nation_plural_translation(preq->source.value.nation));
1103 }
1104 return TRUE;
1105 case REQ_RANGE_TEAM:
1106 fc_strlcat(buf, prefix, bufsz);
1107 if (preq->present) {
1109 /* TRANS: "... same team as the Indonesians." */
1110 _("Requires that you are on the same team as "
1111 "the %s."),
1112 nation_plural_translation(preq->source.value.nation));
1113 } else {
1115 /* TRANS: "... same team as the Greeks." */
1116 _("Requires that you are not on the same team as "
1117 "the %s."),
1118 nation_plural_translation(preq->source.value.nation));
1119 }
1120 return TRUE;
1121 case REQ_RANGE_ALLIANCE:
1122 fc_strlcat(buf, prefix, bufsz);
1123 if (preq->present) {
1125 /* TRANS: "... allied with the Koreans." */
1126 _("Requires that you are allied with the %s."),
1127 nation_plural_translation(preq->source.value.nation));
1128 } else {
1130 /* TRANS: "... allied with the Danes." */
1131 _("Requires that you are not allied with the %s."),
1132 nation_plural_translation(preq->source.value.nation));
1133 }
1134 return TRUE;
1135 case REQ_RANGE_WORLD:
1136 fc_strlcat(buf, prefix, bufsz);
1137 if (preq->survives) {
1138 if (preq->present) {
1140 /* TRANS: "Requires the Apaches to have ..." */
1141 _("Requires the %s to have been in the game."),
1142 nation_plural_translation(preq->source.value.nation));
1143 } else {
1145 /* TRANS: "Requires the Celts never to have ..." */
1146 _("Requires the %s never to have been in the "
1147 "game."),
1148 nation_plural_translation(preq->source.value.nation));
1149 }
1150 } else {
1151 if (preq->present) {
1153 /* TRANS: "Requires the Belgians in the game." */
1154 _("Requires the %s in the game."),
1155 nation_plural_translation(preq->source.value.nation));
1156 } else {
1158 /* TRANS: "Requires that the Russians are not ... */
1159 _("Requires that the %s are not in the game."),
1160 nation_plural_translation(preq->source.value.nation));
1161 }
1162 }
1163 return TRUE;
1164 case REQ_RANGE_LOCAL:
1165 case REQ_RANGE_TILE:
1167 case REQ_RANGE_ADJACENT:
1168 case REQ_RANGE_CITY:
1171 case REQ_RANGE_COUNT:
1172 /* Not supported. */
1173 break;
1174 }
1175 break;
1176
1177 case VUT_NATIONGROUP:
1178 switch (preq->range) {
1179 case REQ_RANGE_PLAYER:
1180 fc_strlcat(buf, prefix, bufsz);
1181 if (preq->present) {
1183 /* TRANS: nation group: "... playing African nation." */
1184 _("Requires that you are playing %s nation."),
1185 nation_group_name_translation(preq->source.value.nationgroup));
1186 } else {
1188 /* TRANS: nation group: "... playing Imaginary nation." */
1189 _("Prevented if you are playing %s nation."),
1190 nation_group_name_translation(preq->source.value.nationgroup));
1191 }
1192 return TRUE;
1193 case REQ_RANGE_TEAM:
1194 fc_strlcat(buf, prefix, bufsz);
1195 if (preq->present) {
1197 /* TRANS: nation group: "Requires Medieval nation ..." */
1198 _("Requires %s nation on your team."),
1199 nation_group_name_translation(preq->source.value.nationgroup));
1200 } else {
1202 /* TRANS: nation group: "Prevented by Medieval nation ..." */
1203 _("Prevented by %s nation on your team."),
1204 nation_group_name_translation(preq->source.value.nationgroup));
1205 }
1206 return TRUE;
1207 case REQ_RANGE_ALLIANCE:
1208 fc_strlcat(buf, prefix, bufsz);
1209 if (preq->present) {
1211 /* TRANS: nation group: "Requires Modern nation ..." */
1212 _("Requires %s nation in alliance with you."),
1213 nation_group_name_translation(preq->source.value.nationgroup));
1214 } else {
1216 /* TRANS: nation group: "Prevented by Modern nation ..." */
1217 _("Prevented if %s nation is in alliance with you."),
1218 nation_group_name_translation(preq->source.value.nationgroup));
1219 }
1220 return TRUE;
1221 case REQ_RANGE_WORLD:
1222 fc_strlcat(buf, prefix, bufsz);
1223 if (preq->present) {
1225 /* TRANS: nation group: "Requires Asian nation ..." */
1226 _("Requires %s nation in the game."),
1227 nation_group_name_translation(preq->source.value.nationgroup));
1228 } else {
1230 /* TRANS: nation group: "Prevented by Asian nation ..." */
1231 _("Prevented by %s nation in the game."),
1232 nation_group_name_translation(preq->source.value.nationgroup));
1233 }
1234 return TRUE;
1235 case REQ_RANGE_LOCAL:
1236 case REQ_RANGE_TILE:
1238 case REQ_RANGE_ADJACENT:
1239 case REQ_RANGE_CITY:
1242 case REQ_RANGE_COUNT:
1243 /* Not supported. */
1244 break;
1245 }
1246 break;
1247
1248 case VUT_STYLE:
1249 if (preq->range != REQ_RANGE_PLAYER) {
1250 break;
1251 }
1252 fc_strlcat(buf, prefix, bufsz);
1253 if (preq->present) {
1255 /* TRANS: "Requires that you are playing Asian style
1256 * nation." */
1257 _("Requires that you are playing %s style nation."),
1258 style_name_translation(preq->source.value.style));
1259 } else {
1261 /* TRANS: "Requires that you are not playing Classical
1262 * style nation." */
1263 _("Requires that you are not playing %s style nation."),
1264 style_name_translation(preq->source.value.style));
1265 }
1266 return TRUE;
1267
1268 case VUT_NATIONALITY:
1269 switch (preq->range) {
1271 fc_strlcat(buf, prefix, bufsz);
1272 if (preq->present) {
1274 /* TRANS: "Requires at least one Barbarian citizen ..." */
1275 _("Requires at least one %s citizen in the city or a "
1276 "trade partner."),
1277 nation_adjective_translation(preq->source.value.nationality));
1278 } else {
1280 /* TRANS: "... no Pirate citizens ..." */
1281 _("Requires that there are no %s citizens in "
1282 "the city or any trade partners."),
1283 nation_adjective_translation(preq->source.value.nationality));
1284 }
1285 return TRUE;
1286 case REQ_RANGE_CITY:
1287 fc_strlcat(buf, prefix, bufsz);
1288 if (preq->present) {
1290 /* TRANS: "Requires at least one Barbarian citizen ..." */
1291 _("Requires at least one %s citizen in the city."),
1292 nation_adjective_translation(preq->source.value.nationality));
1293 } else {
1295 /* TRANS: "... no Pirate citizens ..." */
1296 _("Requires that there are no %s citizens in "
1297 "the city."),
1298 nation_adjective_translation(preq->source.value.nationality));
1299 }
1300 return TRUE;
1301 case REQ_RANGE_WORLD:
1302 case REQ_RANGE_ALLIANCE:
1303 case REQ_RANGE_TEAM:
1304 case REQ_RANGE_PLAYER:
1305 case REQ_RANGE_LOCAL:
1306 case REQ_RANGE_TILE:
1308 case REQ_RANGE_ADJACENT:
1310 case REQ_RANGE_COUNT:
1311 /* Not supported. */
1312 break;
1313 }
1314 break;
1315
1316 case VUT_ORIGINAL_OWNER:
1317 switch (preq->range) {
1318 case REQ_RANGE_CITY:
1319 fc_strlcat(buf, prefix, bufsz);
1320 if (preq->present) {
1322 _("Requires city to be founded by %s."),
1323 nation_adjective_translation(preq->source.value.origowner));
1324 } else {
1326 _("Requires that city was not originally owned by %s."),
1327 nation_adjective_translation(preq->source.value.origowner));
1328 }
1329 return TRUE;
1331 case REQ_RANGE_WORLD:
1332 case REQ_RANGE_ALLIANCE:
1333 case REQ_RANGE_TEAM:
1334 case REQ_RANGE_PLAYER:
1335 case REQ_RANGE_LOCAL:
1336 case REQ_RANGE_TILE:
1338 case REQ_RANGE_ADJACENT:
1340 case REQ_RANGE_COUNT:
1341 /* Not supported. */
1342 break;
1343 }
1344 break;
1345
1346 case VUT_DIPLREL:
1347 switch (preq->range) {
1348 case REQ_RANGE_PLAYER:
1349 fc_strlcat(buf, prefix, bufsz);
1350 if (preq->present) {
1352 /* TRANS: in this and following strings, '%s' can be one
1353 * of a wide range of relationships; e.g., 'Peace',
1354 * 'Never met', 'Foreign', 'Hosts embassy',
1355 * 'Provided Casus Belli' */
1356 _("Requires that you have the relationship '%s' with at "
1357 "least one other living player."),
1358 diplrel_name_translation(preq->source.value.diplrel));
1359 } else {
1361 _("Requires that you do not have the relationship '%s' "
1362 "with any living player."),
1363 diplrel_name_translation(preq->source.value.diplrel));
1364 }
1365 return TRUE;
1366 case REQ_RANGE_TEAM:
1367 fc_strlcat(buf, prefix, bufsz);
1368 if (preq->present) {
1370 _("Requires that somebody on your team has the "
1371 "relationship '%s' with at least one other living "
1372 "player."),
1373 diplrel_name_translation(preq->source.value.diplrel));
1374 } else {
1376 _("Requires that nobody on your team has the "
1377 "relationship '%s' with any living player."),
1378 diplrel_name_translation(preq->source.value.diplrel));
1379 }
1380 return TRUE;
1381 case REQ_RANGE_ALLIANCE:
1382 fc_strlcat(buf, prefix, bufsz);
1383 if (preq->present) {
1385 _("Requires that somebody in your alliance has the "
1386 "relationship '%s' with at least one other living "
1387 "player."),
1388 diplrel_name_translation(preq->source.value.diplrel));
1389 } else {
1391 _("Requires that nobody in your alliance has the "
1392 "relationship '%s' with any living player."),
1393 diplrel_name_translation(preq->source.value.diplrel));
1394 }
1395 return TRUE;
1396 case REQ_RANGE_WORLD:
1397 fc_strlcat(buf, prefix, bufsz);
1398 if (preq->present) {
1400 _("Requires the relationship '%s' between two living "
1401 "players."),
1402 diplrel_name_translation(preq->source.value.diplrel));
1403 } else {
1405 _("Requires that no two living players have the "
1406 "relationship '%s'."),
1407 diplrel_name_translation(preq->source.value.diplrel));
1408 }
1409 return TRUE;
1410 case REQ_RANGE_LOCAL:
1411 fc_strlcat(buf, prefix, bufsz);
1412 if (preq->present) {
1414 _("Requires that you have the relationship '%s' with the "
1415 "other player."),
1416 diplrel_name_translation(preq->source.value.diplrel));
1417 } else {
1419 _("Requires that you do not have the relationship '%s' "
1420 "with the other player."),
1421 diplrel_name_translation(preq->source.value.diplrel));
1422 }
1423 return TRUE;
1424 case REQ_RANGE_TILE:
1426 case REQ_RANGE_ADJACENT:
1427 case REQ_RANGE_CITY:
1430 case REQ_RANGE_COUNT:
1431 /* Not supported. */
1432 break;
1433 }
1434 break;
1435
1436 case VUT_DIPLREL_TILE:
1437 switch (preq->range) {
1438 case REQ_RANGE_PLAYER:
1439 fc_strlcat(buf, prefix, bufsz);
1440 if (preq->present) {
1442 /* TRANS: in this and following strings, '%s' can be one
1443 * of a wide range of relationships; e.g., 'Peace',
1444 * 'Never met', 'Foreign', 'Hosts embassy',
1445 * 'Provided Casus Belli' */
1446 _("Requires that the tile owner has the relationship"
1447 " '%s' with at least one other living player."),
1448 diplrel_name_translation(preq->source.value.diplrel));
1449 } else {
1451 _("Requires that the tile owner does not have the"
1452 " relationship '%s' with any living player."),
1453 diplrel_name_translation(preq->source.value.diplrel));
1454 }
1455 return TRUE;
1456 case REQ_RANGE_TEAM:
1457 fc_strlcat(buf, prefix, bufsz);
1458 if (preq->present) {
1460 _("Requires that somebody on the tile owner's team"
1461 " has the relationship '%s' with at least one other"
1462 " living player."),
1463 diplrel_name_translation(preq->source.value.diplrel));
1464 } else {
1466 _("Requires that nobody on the tile owner's team has"
1467 " the relationship '%s' with any living player."),
1468 diplrel_name_translation(preq->source.value.diplrel));
1469 }
1470 return TRUE;
1471 case REQ_RANGE_ALLIANCE:
1472 fc_strlcat(buf, prefix, bufsz);
1473 if (preq->present) {
1475 _("Requires that somebody in the tile owner's alliance"
1476 " has the relationship '%s' with at least one other "
1477 "living player."),
1478 diplrel_name_translation(preq->source.value.diplrel));
1479 } else {
1481 _("Requires that nobody in the tile owner's alliance "
1482 "has the relationship '%s' with any living player."),
1483 diplrel_name_translation(preq->source.value.diplrel));
1484 }
1485 return TRUE;
1486 case REQ_RANGE_LOCAL:
1487 fc_strlcat(buf, prefix, bufsz);
1488 if (preq->present) {
1490 _("Requires that you have the relationship '%s' with"
1491 " the tile owner."),
1492 diplrel_name_translation(preq->source.value.diplrel));
1493 } else {
1495 _("Requires that you do not have the relationship '%s'"
1496 " with the tile owner."),
1497 diplrel_name_translation(preq->source.value.diplrel));
1498 }
1499 return TRUE;
1500 case REQ_RANGE_TILE:
1502 case REQ_RANGE_ADJACENT:
1503 case REQ_RANGE_CITY:
1506 case REQ_RANGE_WORLD:
1507 case REQ_RANGE_COUNT:
1508 /* Not supported. */
1509 break;
1510 }
1511 break;
1512
1513 case VUT_DIPLREL_TILE_O:
1514 switch (preq->range) {
1515 case REQ_RANGE_LOCAL:
1516 fc_strlcat(buf, prefix, bufsz);
1517 if (preq->present) {
1519 _("Requires that the tile owner has the relationship"
1520 " '%s' with the other player."),
1521 diplrel_name_translation(preq->source.value.diplrel));
1522 } else {
1524 _("Requires that the tile owner does not have the"
1525 " relationship '%s' with the other player."),
1526 diplrel_name_translation(preq->source.value.diplrel));
1527 }
1528 return TRUE;
1529 case REQ_RANGE_TILE:
1531 case REQ_RANGE_ADJACENT:
1532 case REQ_RANGE_CITY:
1535 case REQ_RANGE_PLAYER:
1536 case REQ_RANGE_TEAM:
1537 case REQ_RANGE_ALLIANCE:
1538 case REQ_RANGE_WORLD:
1539 case REQ_RANGE_COUNT:
1540 /* Not supported. */
1541 break;
1542 }
1543 break;
1544
1546 switch (preq->range) {
1547 case REQ_RANGE_PLAYER:
1548 fc_strlcat(buf, prefix, bufsz);
1549 if (preq->present) {
1551 /* TRANS: in this and following strings, '%s' can be one
1552 * of a wide range of relationships; e.g., 'Peace',
1553 * 'Never met', 'Foreign', 'Hosts embassy',
1554 * 'Provided Casus Belli' */
1555 _("Requires that the tile has at least one unit whose "
1556 "owner has the relationship "
1557 "'%s' with at least one other living player."),
1558 diplrel_name_translation(preq->source.value.diplrel));
1559 } else {
1561 _("Requires that no unit at the tile is owned by a player "
1562 "who has the relationship '%s' with any living player."),
1563 diplrel_name_translation(preq->source.value.diplrel));
1564 }
1565 return TRUE;
1566 case REQ_RANGE_TEAM:
1567 fc_strlcat(buf, prefix, bufsz);
1568 if (preq->present) {
1570 _("Requires that the tile has at least one unit whose "
1571 "owner is on a team where a member "
1572 "has the relationship '%s' with at least one other "
1573 "living player."),
1574 diplrel_name_translation(preq->source.value.diplrel));
1575 } else {
1577 _("Requires that no unit at the tile is owned by a player "
1578 "who is on a team where a member "
1579 "has the relationship '%s' with at least one other "
1580 "living player."),
1581 diplrel_name_translation(preq->source.value.diplrel));
1582 }
1583 return TRUE;
1584 case REQ_RANGE_ALLIANCE:
1585 fc_strlcat(buf, prefix, bufsz);
1586 if (preq->present) {
1588 _("Requires that the tile has at least one unit whose "
1589 "owner is allied to someone that "
1590 "has the relationship '%s' with at least one other "
1591 "living player."),
1592 diplrel_name_translation(preq->source.value.diplrel));
1593 } else {
1595 _("Requires that no unit at the tile is owned by a player "
1596 "allied to someone that "
1597 "has the relationship '%s' with any living player."),
1598 diplrel_name_translation(preq->source.value.diplrel));
1599 }
1600 return TRUE;
1601 case REQ_RANGE_LOCAL:
1602 fc_strlcat(buf, prefix, bufsz);
1603 if (preq->present) {
1605 _("Requires that you have the relationship '%s' with "
1606 "the owner of at least one unit at the tile."),
1607 diplrel_name_translation(preq->source.value.diplrel));
1608 } else {
1610 _("Requires that you do not have the relationship '%s' "
1611 "with the owner of any unit at the tile."),
1612 diplrel_name_translation(preq->source.value.diplrel));
1613 }
1614 return TRUE;
1615 case REQ_RANGE_TILE:
1617 case REQ_RANGE_ADJACENT:
1618 case REQ_RANGE_CITY:
1621 case REQ_RANGE_WORLD:
1622 case REQ_RANGE_COUNT:
1623 /* Not supported. */
1624 break;
1625 }
1626 break;
1627
1629 switch (preq->range) {
1630 case REQ_RANGE_LOCAL:
1631 fc_strlcat(buf, prefix, bufsz);
1632 if (preq->present) {
1634 _("Requires that the tile has at least one unit whose "
1635 "owner has the relationship '%s' with the other player."),
1636 diplrel_name_translation(preq->source.value.diplrel));
1637 } else {
1639 _("Requires that no unit at the tile is owned by a player "
1640 "who has the relationship '%s' with the other player."),
1641 diplrel_name_translation(preq->source.value.diplrel));
1642 }
1643 return TRUE;
1644 case REQ_RANGE_TILE:
1646 case REQ_RANGE_ADJACENT:
1647 case REQ_RANGE_CITY:
1650 case REQ_RANGE_PLAYER:
1651 case REQ_RANGE_TEAM:
1652 case REQ_RANGE_ALLIANCE:
1653 case REQ_RANGE_WORLD:
1654 case REQ_RANGE_COUNT:
1655 /* Not supported. */
1656 break;
1657 }
1658 break;
1659
1660 case VUT_UTYPE:
1661 switch (preq->range) {
1662 case REQ_RANGE_LOCAL:
1663 fc_strlcat(buf, prefix, bufsz);
1664 if (preq->present) {
1665 /* TRANS: %s is a single kind of unit (e.g., "Settlers"). */
1666 cat_snprintf(buf, bufsz, Q_("?unit:Requires %s."),
1667 utype_name_translation(preq->source.value.utype));
1668 } else {
1669 /* TRANS: %s is a single kind of unit (e.g., "Settlers"). */
1670 cat_snprintf(buf, bufsz, Q_("?unit:Does not apply to %s."),
1671 utype_name_translation(preq->source.value.utype));
1672 }
1673 return TRUE;
1674 case REQ_RANGE_TILE:
1676 case REQ_RANGE_ADJACENT:
1677 case REQ_RANGE_CITY:
1680 case REQ_RANGE_PLAYER:
1681 case REQ_RANGE_TEAM:
1682 case REQ_RANGE_ALLIANCE:
1683 case REQ_RANGE_WORLD:
1684 case REQ_RANGE_COUNT:
1685 /* Not supported. */
1686 break;
1687 }
1688 break;
1689
1690 case VUT_UTFLAG:
1691 switch (preq->range) {
1692 case REQ_RANGE_LOCAL:
1693 {
1694 struct astring astr = ASTRING_INIT;
1695
1696 /* Unit type flags mean nothing to users. Explicitly list the unit
1697 * types with those flags. */
1698 if (role_units_translations(&astr, preq->source.value.unitflag,
1699 TRUE)) {
1700 fc_strlcat(buf, prefix, bufsz);
1701 if (preq->present) {
1702 /* TRANS: %s is a list of unit types separated by "or". */
1703 cat_snprintf(buf, bufsz, Q_("?ulist:Requires %s."),
1704 astr_str(&astr));
1705 } else {
1706 /* TRANS: %s is a list of unit types separated by "or". */
1707 cat_snprintf(buf, bufsz, Q_("?ulist:Does not apply to %s."),
1708 astr_str(&astr));
1709 }
1710 astr_free(&astr);
1711 return TRUE;
1712 }
1713 }
1714 break;
1715 case REQ_RANGE_TILE:
1717 case REQ_RANGE_ADJACENT:
1718 case REQ_RANGE_CITY:
1721 case REQ_RANGE_PLAYER:
1722 case REQ_RANGE_TEAM:
1723 case REQ_RANGE_ALLIANCE:
1724 case REQ_RANGE_WORLD:
1725 case REQ_RANGE_COUNT:
1726 /* Not supported. */
1727 break;
1728 }
1729 break;
1730
1731 case VUT_UCLASS:
1732 switch (preq->range) {
1733 case REQ_RANGE_LOCAL:
1734 fc_strlcat(buf, prefix, bufsz);
1735 if (preq->present) {
1736 /* TRANS: %s is a single unit class (e.g., "Air"). */
1737 cat_snprintf(buf, bufsz, Q_("?uclass:Requires %s units."),
1738 uclass_name_translation(preq->source.value.uclass));
1739 } else {
1740 /* TRANS: %s is a single unit class (e.g., "Air"). */
1741 cat_snprintf(buf, bufsz, Q_("?uclass:Does not apply to %s units."),
1742 uclass_name_translation(preq->source.value.uclass));
1743 }
1744 return TRUE;
1745 case REQ_RANGE_TILE:
1747 case REQ_RANGE_ADJACENT:
1748 case REQ_RANGE_CITY:
1751 case REQ_RANGE_PLAYER:
1752 case REQ_RANGE_TEAM:
1753 case REQ_RANGE_ALLIANCE:
1754 case REQ_RANGE_WORLD:
1755 case REQ_RANGE_COUNT:
1756 /* Not supported. */
1757 break;
1758 }
1759 break;
1760
1761 case VUT_UCFLAG:
1762 {
1763 const char *classes[uclass_count()];
1764 int i = 0;
1765 bool done = FALSE;
1766 struct astring list = ASTRING_INIT;
1767
1768 unit_class_iterate(uclass) {
1769 if (uclass_has_flag(uclass, preq->source.value.unitclassflag)) {
1770 classes[i++] = uclass_name_translation(uclass);
1771 }
1774
1775 switch (preq->range) {
1776 case REQ_RANGE_LOCAL:
1777 fc_strlcat(buf, prefix, bufsz);
1778 if (preq->present) {
1779 /* TRANS: %s is a list of unit classes separated by "or". */
1780 cat_snprintf(buf, bufsz, Q_("?uclasslist:Requires %s units."),
1781 astr_str(&list));
1782 } else {
1783 /* TRANS: %s is a list of unit classes separated by "or". */
1784 cat_snprintf(buf, bufsz, Q_("?uclasslist:Does not apply to "
1785 "%s units."),
1786 astr_str(&list));
1787 }
1788 done = TRUE;
1789 break;
1790 case REQ_RANGE_TILE:
1792 case REQ_RANGE_ADJACENT:
1793 case REQ_RANGE_CITY:
1796 case REQ_RANGE_PLAYER:
1797 case REQ_RANGE_TEAM:
1798 case REQ_RANGE_ALLIANCE:
1799 case REQ_RANGE_WORLD:
1800 case REQ_RANGE_COUNT:
1801 /* Not supported. */
1802 break;
1803 }
1804 astr_free(&list);
1805 if (done) {
1806 return TRUE;
1807 }
1808 }
1809 break;
1810
1811 case VUT_UNITSTATE:
1812 {
1813 switch (preq->range) {
1814 case REQ_RANGE_LOCAL:
1815 switch (preq->source.value.unit_state) {
1816 case USP_TRANSPORTED:
1817 fc_strlcat(buf, prefix, bufsz);
1818 if (preq->present) {
1820 _("Requires that the unit is transported."));
1821 } else {
1823 _("Requires that the unit isn't transported."));
1824 }
1825 return TRUE;
1826 case USP_LIVABLE_TILE:
1827 fc_strlcat(buf, prefix, bufsz);
1828 if (preq->present) {
1830 _("Requires that the unit is on livable tile."));
1831 } else {
1833 _("Requires that the unit isn't on livable tile."));
1834 }
1835 return TRUE;
1836 case USP_TRANSPORTING:
1837 fc_strlcat(buf, prefix, bufsz);
1838 if (preq->present) {
1840 _("Requires that the unit does transport one or "
1841 "more cargo units."));
1842 } else {
1844 _("Requires that the unit doesn't transport "
1845 "any cargo units."));
1846 }
1847 return TRUE;
1848 case USP_HAS_HOME_CITY:
1849 fc_strlcat(buf, prefix, bufsz);
1850 if (preq->present) {
1852 _("Requires that the unit has a home city."));
1853 } else {
1855 _("Requires that the unit is homeless."));
1856 }
1857 return TRUE;
1858 case USP_NATIVE_TILE:
1859 fc_strlcat(buf, prefix, bufsz);
1860 if (preq->present) {
1862 _("Requires that the unit is on native tile."));
1863 } else {
1865 _("Requires that the unit isn't on native tile."));
1866 }
1867 return TRUE;
1868 case USP_NATIVE_EXTRA:
1869 fc_strlcat(buf, prefix, bufsz);
1870 if (preq->present) {
1872 _("Requires that the unit is in a native extra."));
1873 } else {
1875 _("Requires that the unit isn't in a native extra."));
1876 }
1877 return TRUE;
1879 fc_strlcat(buf, prefix, bufsz);
1880 if (preq->present) {
1882 _("Requires that the unit has moved this turn."));
1883 } else {
1885 _("Requires that the unit hasn't moved this turn."));
1886 }
1887 return TRUE;
1888 case USP_COUNT:
1889 fc_assert_msg(preq->source.value.unit_state != USP_COUNT,
1890 "Invalid unit state property.");
1891 }
1892 break;
1893 case REQ_RANGE_TILE:
1895 case REQ_RANGE_ADJACENT:
1896 case REQ_RANGE_CITY:
1899 case REQ_RANGE_PLAYER:
1900 case REQ_RANGE_TEAM:
1901 case REQ_RANGE_ALLIANCE:
1902 case REQ_RANGE_WORLD:
1903 case REQ_RANGE_COUNT:
1904 /* Not supported. */
1905 break;
1906 }
1907 }
1908 break;
1909
1910 case VUT_ACTIVITY:
1911 {
1912 switch (preq->range) {
1913 case REQ_RANGE_LOCAL:
1914 fc_strlcat(buf, prefix, bufsz);
1915 if (preq->present) {
1917 _("Requires that the unit is performing activity %s."),
1918 Q_(unit_activity_name(preq->source.value.activity)));
1919 } else {
1921 _("Requires that the unit is not performing activity %s."),
1922 Q_(unit_activity_name(preq->source.value.activity)));
1923 }
1924 return TRUE;
1925 case REQ_RANGE_TILE:
1927 case REQ_RANGE_ADJACENT:
1928 case REQ_RANGE_CITY:
1931 case REQ_RANGE_PLAYER:
1932 case REQ_RANGE_TEAM:
1933 case REQ_RANGE_ALLIANCE:
1934 case REQ_RANGE_WORLD:
1935 case REQ_RANGE_COUNT:
1936 /* Not supported. */
1937 break;
1938 }
1939 }
1940 break;
1941
1942 case VUT_MINMOVES:
1943 {
1944 switch (preq->range) {
1945 case REQ_RANGE_LOCAL:
1946 fc_strlcat(buf, prefix, bufsz);
1947 if (preq->present) {
1949 /* TRANS: %s is numeric move points; it may have a
1950 * fractional part ("1 1/3 MP"). */
1951 _("Requires that the unit has at least %s MP left."),
1952 move_points_text(preq->source.value.minmoves, TRUE));
1953 } else {
1955 /* TRANS: %s is numeric move points; it may have a
1956 * fractional part ("1 1/3 MP"). */
1957 _("Requires that the unit has less than %s MP left."),
1958 move_points_text(preq->source.value.minmoves, TRUE));
1959 }
1960 return TRUE;
1961 case REQ_RANGE_TILE:
1963 case REQ_RANGE_ADJACENT:
1964 case REQ_RANGE_CITY:
1967 case REQ_RANGE_PLAYER:
1968 case REQ_RANGE_TEAM:
1969 case REQ_RANGE_ALLIANCE:
1970 case REQ_RANGE_WORLD:
1971 case REQ_RANGE_COUNT:
1972 /* Not supported. */
1973 break;
1974 }
1975 }
1976 break;
1977
1978 case VUT_MINVETERAN:
1979 if (preq->range != REQ_RANGE_LOCAL) {
1980 break;
1981 }
1982 /* FIXME: this would be better with veteran level names, but that's
1983 * potentially unit type dependent. */
1984 fc_strlcat(buf, prefix, bufsz);
1985 if (preq->present) {
1987 PL_("Requires a unit with at least %d veteran level.",
1988 "Requires a unit with at least %d veteran levels.",
1989 preq->source.value.minveteran),
1990 preq->source.value.minveteran);
1991 } else {
1993 PL_("Requires a unit with fewer than %d veteran level.",
1994 "Requires a unit with fewer than %d veteran levels.",
1995 preq->source.value.minveteran),
1996 preq->source.value.minveteran);
1997 }
1998 return TRUE;
1999
2000 case VUT_MINHP:
2001 if (preq->range != REQ_RANGE_LOCAL) {
2002 break;
2003 }
2004
2005 fc_strlcat(buf, prefix, bufsz);
2006 if (preq->present) {
2008 PL_("Requires a unit with at least %d hit point left.",
2009 "Requires a unit with at least %d hit points left.",
2010 preq->source.value.min_hit_points),
2011 preq->source.value.min_hit_points);
2012 } else {
2014 PL_("Requires a unit with fewer than %d hit point "
2015 "left.",
2016 "Requires a unit with fewer than %d hit points "
2017 "left.",
2018 preq->source.value.min_hit_points),
2019 preq->source.value.min_hit_points);
2020 }
2021 return TRUE;
2022
2023 case VUT_OTYPE:
2024 if (preq->range != REQ_RANGE_LOCAL) {
2025 break;
2026 }
2027 fc_strlcat(buf, prefix, bufsz);
2028 if (preq->present) {
2029 /* TRANS: "Applies only to Food." */
2030 cat_snprintf(buf, bufsz, Q_("?output:Applies only to %s."),
2031 get_output_name(preq->source.value.outputtype));
2032 } else {
2033 /* TRANS: "Does not apply to Food." */
2034 cat_snprintf(buf, bufsz, Q_("?output:Does not apply to %s."),
2035 get_output_name(preq->source.value.outputtype));
2036 }
2037 return TRUE;
2038
2039 case VUT_SPECIALIST:
2040 if (preq->range != REQ_RANGE_LOCAL) {
2041 break;
2042 }
2043 fc_strlcat(buf, prefix, bufsz);
2044 if (preq->present) {
2045 /* TRANS: "Applies only to Scientists." */
2046 cat_snprintf(buf, bufsz, Q_("?specialist:Applies only to %s."),
2047 specialist_plural_translation(preq->source.value.specialist));
2048 } else {
2049 /* TRANS: "Does not apply to Scientists." */
2050 cat_snprintf(buf, bufsz, Q_("?specialist:Does not apply to %s."),
2051 specialist_plural_translation(preq->source.value.specialist));
2052 }
2053 return TRUE;
2054
2055 case VUT_MINSIZE:
2056 switch (preq->range) {
2058 fc_strlcat(buf, prefix, bufsz);
2059 if (preq->present) {
2061 PL_("Requires a minimum city size of %d for this "
2062 "city or a trade partner.",
2063 "Requires a minimum city size of %d for this "
2064 "city or a trade partner.",
2065 preq->source.value.minsize),
2066 preq->source.value.minsize);
2067 } else {
2069 PL_("Requires the city size to be less than %d "
2070 "for this city and all trade partners.",
2071 "Requires the city size to be less than %d "
2072 "for this city and all trade partners.",
2073 preq->source.value.minsize),
2074 preq->source.value.minsize);
2075 }
2076 return TRUE;
2077 case REQ_RANGE_CITY:
2078 fc_strlcat(buf, prefix, bufsz);
2079 if (preq->present) {
2081 PL_("Requires a minimum city size of %d.",
2082 "Requires a minimum city size of %d.",
2083 preq->source.value.minsize),
2084 preq->source.value.minsize);
2085 } else {
2087 PL_("Requires the city size to be less than %d.",
2088 "Requires the city size to be less than %d.",
2089 preq->source.value.minsize),
2090 preq->source.value.minsize);
2091 }
2092 return TRUE;
2093 case REQ_RANGE_LOCAL:
2094 case REQ_RANGE_TILE:
2096 case REQ_RANGE_ADJACENT:
2098 case REQ_RANGE_PLAYER:
2099 case REQ_RANGE_TEAM:
2100 case REQ_RANGE_ALLIANCE:
2101 case REQ_RANGE_WORLD:
2102 case REQ_RANGE_COUNT:
2103 /* Not supported. */
2104 break;
2105 }
2106 break;
2107
2108 case VUT_MINCULTURE:
2109 switch (preq->range) {
2110 case REQ_RANGE_CITY:
2111 fc_strlcat(buf, prefix, bufsz);
2112 if (preq->present) {
2114 PL_("Requires a minimum culture of %d in the city.",
2115 "Requires a minimum culture of %d in the city.",
2116 preq->source.value.minculture),
2117 preq->source.value.minculture);
2118 } else {
2120 PL_("Requires the culture in the city to be less "
2121 "than %d.",
2122 "Requires the culture in the city to be less "
2123 "than %d.",
2124 preq->source.value.minculture),
2125 preq->source.value.minculture);
2126 }
2127 return TRUE;
2129 fc_strlcat(buf, prefix, bufsz);
2130 if (preq->present) {
2132 PL_("Requires a minimum culture of %d in this city or "
2133 "a trade partner.",
2134 "Requires a minimum culture of %d in this city or "
2135 "a trade partner.",
2136 preq->source.value.minculture),
2137 preq->source.value.minculture);
2138 } else {
2140 PL_("Requires the culture in this city and all trade "
2141 "partners to be less than %d.",
2142 "Requires the culture in this city and all trade "
2143 "partners to be less than %d.",
2144 preq->source.value.minculture),
2145 preq->source.value.minculture);
2146 }
2147 return TRUE;
2148 case REQ_RANGE_PLAYER:
2149 fc_strlcat(buf, prefix, bufsz);
2150 if (preq->present) {
2152 PL_("Requires your nation to have culture "
2153 "of at least %d.",
2154 "Requires your nation to have culture "
2155 "of at least %d.",
2156 preq->source.value.minculture),
2157 preq->source.value.minculture);
2158 } else {
2160 PL_("Prevented if your nation has culture of "
2161 "%d or more.",
2162 "Prevented if your nation has culture of "
2163 "%d or more.",
2164 preq->source.value.minculture),
2165 preq->source.value.minculture);
2166 }
2167 return TRUE;
2168 case REQ_RANGE_TEAM:
2169 fc_strlcat(buf, prefix, bufsz);
2170 if (preq->present) {
2172 PL_("Requires someone on your team to have culture of "
2173 "at least %d.",
2174 "Requires someone on your team to have culture of "
2175 "at least %d.",
2176 preq->source.value.minculture),
2177 preq->source.value.minculture);
2178 } else {
2180 PL_("Prevented if anyone on your team has culture of "
2181 "%d or more.",
2182 "Prevented if anyone on your team has culture of "
2183 "%d or more.",
2184 preq->source.value.minculture),
2185 preq->source.value.minculture);
2186 }
2187 return TRUE;
2188 case REQ_RANGE_ALLIANCE:
2189 fc_strlcat(buf, prefix, bufsz);
2190 if (preq->present) {
2192 PL_("Requires someone in your current alliance to "
2193 "have culture of at least %d.",
2194 "Requires someone in your current alliance to "
2195 "have culture of at least %d.",
2196 preq->source.value.minculture),
2197 preq->source.value.minculture);
2198 } else {
2200 PL_("Prevented if anyone in your current alliance has "
2201 "culture of %d or more.",
2202 "Prevented if anyone in your current alliance has "
2203 "culture of %d or more.",
2204 preq->source.value.minculture),
2205 preq->source.value.minculture);
2206 }
2207 return TRUE;
2208 case REQ_RANGE_WORLD:
2209 fc_strlcat(buf, prefix, bufsz);
2210 if (preq->present) {
2212 PL_("Requires that some player has culture of at "
2213 "least %d.",
2214 "Requires that some player has culture of at "
2215 "least %d.",
2216 preq->source.value.minculture),
2217 preq->source.value.minculture);
2218 } else {
2220 PL_("Requires that no player has culture of %d "
2221 "or more.",
2222 "Requires that no player has culture of %d "
2223 "or more.",
2224 preq->source.value.minculture),
2225 preq->source.value.minculture);
2226 }
2227 return TRUE;
2228 case REQ_RANGE_LOCAL:
2229 case REQ_RANGE_TILE:
2231 case REQ_RANGE_ADJACENT:
2233 case REQ_RANGE_COUNT:
2234 break;
2235 }
2236 break;
2237
2238 case VUT_MINFOREIGNPCT:
2239 switch (preq->range) {
2240 case REQ_RANGE_CITY:
2241 fc_strlcat(buf, prefix, bufsz);
2242 if (preq->present) {
2244 _("At least %d%% of the citizens of the city "
2245 "must be foreign."),
2246 preq->source.value.minforeignpct);
2247 } else {
2249 _("Less than %d%% of the citizens of the city "
2250 "must be foreign."),
2251 preq->source.value.minforeignpct);
2252 }
2253 return TRUE;
2255 fc_strlcat(buf, prefix, bufsz);
2256 if (preq->present) {
2258 _("At least %d%% of the citizens of the city "
2259 "or some trade partner must be foreign."),
2260 preq->source.value.minforeignpct);
2261 } else {
2263 _("Less than %d%% of the citizens of the city "
2264 "and each trade partner must be foreign."),
2265 preq->source.value.minforeignpct);
2266 }
2267 return TRUE;
2268 case REQ_RANGE_PLAYER:
2269 case REQ_RANGE_TEAM:
2270 case REQ_RANGE_ALLIANCE:
2271 case REQ_RANGE_WORLD:
2272 case REQ_RANGE_LOCAL:
2273 case REQ_RANGE_TILE:
2275 case REQ_RANGE_ADJACENT:
2277 case REQ_RANGE_COUNT:
2278 break;
2279 }
2280 break;
2281
2282 case VUT_MAXTILEUNITS:
2283 switch (preq->range) {
2284 case REQ_RANGE_TILE:
2285 fc_strlcat(buf, prefix, bufsz);
2286 if (preq->present) {
2288 PL_("At most %d unit may be present on the tile.",
2289 "At most %d units may be present on the tile.",
2290 preq->source.value.max_tile_units),
2291 preq->source.value.max_tile_units);
2292 } else {
2294 PL_("There must be more than %d unit present on "
2295 "the tile.",
2296 "There must be more than %d units present on "
2297 "the tile.",
2298 preq->source.value.max_tile_units),
2299 preq->source.value.max_tile_units);
2300 }
2301 return TRUE;
2303 fc_strlcat(buf, prefix, bufsz);
2304 if (preq->present) {
2306 PL_("The tile or at least one cardinally adjacent tile "
2307 "must have %d unit or fewer.",
2308 "The tile or at least one cardinally adjacent tile "
2309 "must have %d units or fewer.",
2310 preq->source.value.max_tile_units),
2311 preq->source.value.max_tile_units);
2312 } else {
2314 PL_("The tile and all cardinally adjacent tiles must "
2315 "have more than %d unit each.",
2316 "The tile and all cardinally adjacent tiles must "
2317 "have more than %d units each.",
2318 preq->source.value.max_tile_units),
2319 preq->source.value.max_tile_units);
2320 }
2321 return TRUE;
2322 case REQ_RANGE_ADJACENT:
2323 fc_strlcat(buf, prefix, bufsz);
2324 if (preq->present) {
2326 PL_("The tile or at least one adjacent tile must have "
2327 "%d unit or fewer.",
2328 "The tile or at least one adjacent tile must have "
2329 "%d units or fewer.",
2330 preq->source.value.max_tile_units),
2331 preq->source.value.max_tile_units);
2332 } else {
2334 PL_("The tile and all adjacent tiles must have more "
2335 "than %d unit each.",
2336 "The tile and all adjacent tiles must have more "
2337 "than %d units each.",
2338 preq->source.value.max_tile_units),
2339 preq->source.value.max_tile_units);
2340 }
2341 return TRUE;
2342 case REQ_RANGE_CITY:
2345 case REQ_RANGE_PLAYER:
2346 case REQ_RANGE_TEAM:
2347 case REQ_RANGE_ALLIANCE:
2348 case REQ_RANGE_WORLD:
2349 case REQ_RANGE_LOCAL:
2350 case REQ_RANGE_COUNT:
2351 /* Not supported. */
2352 break;
2353 }
2354 break;
2355
2356 case VUT_AI_LEVEL:
2357 if (preq->range != REQ_RANGE_PLAYER) {
2358 break;
2359 }
2360 fc_strlcat(buf, prefix, bufsz);
2361 if (preq->present) {
2363 /* TRANS: AI level (e.g., "Handicapped") */
2364 _("Applies to %s AI players."),
2365 ai_level_translated_name(preq->source.value.ai_level));
2366 } else {
2368 /* TRANS: AI level (e.g., "Cheating") */
2369 _("Does not apply to %s AI players."),
2370 ai_level_translated_name(preq->source.value.ai_level));
2371 }
2372 return TRUE;
2373
2374 case VUT_TERRAINCLASS:
2375 switch (preq->range) {
2376 case REQ_RANGE_TILE:
2377 fc_strlcat(buf, prefix, bufsz);
2378 if (preq->present) {
2380 /* TRANS: %s is a terrain class */
2381 Q_("?terrainclass:Requires %s terrain on the tile."),
2383 (preq->source.value.terrainclass));
2384 } else {
2386 /* TRANS: %s is a terrain class */
2387 Q_("?terrainclass:Prevented by %s terrain on the tile."),
2389 (preq->source.value.terrainclass));
2390 }
2391 return TRUE;
2393 fc_strlcat(buf, prefix, bufsz);
2394 if (preq->present) {
2396 /* TRANS: %s is a terrain class */
2397 Q_("?terrainclass:Requires %s terrain on the tile or a "
2398 "cardinally adjacent tile."),
2400 (preq->source.value.terrainclass));
2401 } else {
2403 /* TRANS: %s is a terrain class */
2404 Q_("?terrainclass:Prevented by %s terrain on the tile or "
2405 "any cardinally adjacent tile."),
2407 (preq->source.value.terrainclass));
2408 }
2409 return TRUE;
2410 case REQ_RANGE_ADJACENT:
2411 fc_strlcat(buf, prefix, bufsz);
2412 if (preq->present) {
2414 /* TRANS: %s is a terrain class */
2415 Q_("?terrainclass:Requires %s terrain on the tile or an "
2416 "adjacent tile."),
2418 (preq->source.value.terrainclass));
2419 } else {
2421 /* TRANS: %s is a terrain class */
2422 Q_("?terrainclass:Prevented by %s terrain on the tile or "
2423 "any adjacent tile."),
2425 (preq->source.value.terrainclass));
2426 }
2427 return TRUE;
2428 case REQ_RANGE_CITY:
2429 fc_strlcat(buf, prefix, bufsz);
2430 if (preq->present) {
2432 /* TRANS: %s is a terrain class */
2433 Q_("?terrainclass:Requires %s terrain on a tile within "
2434 "the city radius."),
2436 (preq->source.value.terrainclass));
2437 } else {
2439 /* TRANS: %s is a terrain class */
2440 Q_("?terrainclass:Prevented by %s terrain on any tile "
2441 "within the city radius."),
2443 (preq->source.value.terrainclass));
2444 }
2445 return TRUE;
2447 fc_strlcat(buf, prefix, bufsz);
2448 if (preq->present) {
2450 /* TRANS: %s is a terrain class */
2451 Q_("?terrainclass:Requires %s terrain on a tile within "
2452 "the city radius or the city radius of a trade "
2453 "partner."),
2455 (preq->source.value.terrainclass));
2456 } else {
2458 /* TRANS: %s is a terrain class */
2459 Q_("?terrainclass:Prevented by %s terrain on any tile "
2460 "within the city radius or the city radius of a trade "
2461 "partner."),
2463 (preq->source.value.terrainclass));
2464 }
2465 return TRUE;
2467 case REQ_RANGE_PLAYER:
2468 case REQ_RANGE_TEAM:
2469 case REQ_RANGE_ALLIANCE:
2470 case REQ_RANGE_WORLD:
2471 case REQ_RANGE_LOCAL:
2472 case REQ_RANGE_COUNT:
2473 /* Not supported. */
2474 break;
2475 }
2476 break;
2477
2478 case VUT_TERRFLAG:
2479 switch (preq->range) {
2480 case REQ_RANGE_TILE:
2481 fc_strlcat(buf, prefix, bufsz);
2482 if (preq->present) {
2484 /* TRANS: %s is a (translatable) terrain flag. */
2485 _("Requires terrain with the \"%s\" flag on the tile."),
2486 terrain_flag_id_translated_name(preq->source.value.terrainflag));
2487 } else {
2489 /* TRANS: %s is a (translatable) terrain flag. */
2490 _("Prevented by terrain with the \"%s\" flag on the "
2491 "tile."),
2492 terrain_flag_id_translated_name(preq->source.value.terrainflag));
2493 }
2494 return TRUE;
2496 fc_strlcat(buf, prefix, bufsz);
2497 if (preq->present) {
2499 /* TRANS: %s is a (translatable) terrain flag. */
2500 _("Requires terrain with the \"%s\" flag on the "
2501 "tile or a cardinally adjacent tile."),
2502 terrain_flag_id_translated_name(preq->source.value.terrainflag));
2503 } else {
2505 /* TRANS: %s is a (translatable) terrain flag. */
2506 _("Prevented by terrain with the \"%s\" flag on "
2507 "the tile or any cardinally adjacent tile."),
2508 terrain_flag_id_translated_name(preq->source.value.terrainflag));
2509 }
2510 return TRUE;
2511 case REQ_RANGE_ADJACENT:
2512 fc_strlcat(buf, prefix, bufsz);
2513 if (preq->present) {
2515 /* TRANS: %s is a (translatable) terrain flag. */
2516 _("Requires terrain with the \"%s\" flag on the "
2517 "tile or an adjacent tile."),
2518 terrain_flag_id_translated_name(preq->source.value.terrainflag));
2519 } else {
2521 /* TRANS: %s is a (translatable) terrain flag. */
2522 _("Prevented by terrain with the \"%s\" flag on "
2523 "the tile or any adjacent tile."),
2524 terrain_flag_id_translated_name(preq->source.value.terrainflag));
2525 }
2526 return TRUE;
2527 case REQ_RANGE_CITY:
2528 fc_strlcat(buf, prefix, bufsz);
2529 if (preq->present) {
2531 /* TRANS: %s is a (translatable) terrain flag. */
2532 _("Requires terrain with the \"%s\" flag on a tile "
2533 "within the city radius."),
2534 terrain_flag_id_translated_name(preq->source.value.terrainflag));
2535 } else {
2537 /* TRANS: %s is a (translatable) terrain flag. */
2538 _("Prevented by terrain with the \"%s\" flag on any tile "
2539 "within the city radius."),
2540 terrain_flag_id_translated_name(preq->source.value.terrainflag));
2541 }
2542 return TRUE;
2544 fc_strlcat(buf, prefix, bufsz);
2545 if (preq->present) {
2547 /* TRANS: %s is a (translatable) terrain flag. */
2548 _("Requires terrain with the \"%s\" flag on a tile "
2549 "within the city radius or the city radius of "
2550 "a trade partner."),
2551 terrain_flag_id_translated_name(preq->source.value.terrainflag));
2552 } else {
2554 /* TRANS: %s is a (translatable) terrain flag. */
2555 _("Prevented by terrain with the \"%s\" flag on any tile "
2556 "within the city radius or the city radius of "
2557 "a trade partner."),
2558 terrain_flag_id_translated_name(preq->source.value.terrainflag));
2559 }
2560 return TRUE;
2562 case REQ_RANGE_PLAYER:
2563 case REQ_RANGE_TEAM:
2564 case REQ_RANGE_ALLIANCE:
2565 case REQ_RANGE_WORLD:
2566 case REQ_RANGE_LOCAL:
2567 case REQ_RANGE_COUNT:
2568 /* Not supported. */
2569 break;
2570 }
2571 break;
2572
2573 case VUT_ROADFLAG:
2574 switch (preq->range) {
2575 case REQ_RANGE_LOCAL:
2576 fc_strlcat(buf, prefix, bufsz);
2577 if (preq->present) {
2579 /* TRANS: %s is a (translatable) road flag. */
2580 _("Only applies to roads with the \"%s\" flag."),
2582 (preq->source.value.roadflag));
2583 } else {
2585 /* TRANS: %s is a (translatable) road flag. */
2586 _("Does not apply to roads with the \"%s\" flag."),
2588 (preq->source.value.roadflag));
2589 }
2590 return TRUE;
2591 case REQ_RANGE_TILE:
2592 fc_strlcat(buf, prefix, bufsz);
2593 if (preq->present) {
2595 /* TRANS: %s is a (translatable) road flag. */
2596 _("Requires a road with the \"%s\" flag on the tile."),
2597 road_flag_id_translated_name(preq->source.value.roadflag));
2598 } else {
2600 /* TRANS: %s is a (translatable) road flag. */
2601 _("Prevented by a road with the \"%s\" flag on the "
2602 "tile."),
2603 road_flag_id_translated_name(preq->source.value.roadflag));
2604 }
2605 return TRUE;
2607 fc_strlcat(buf, prefix, bufsz);
2608 if (preq->present) {
2610 /* TRANS: %s is a (translatable) road flag. */
2611 _("Requires a road with the \"%s\" flag on the "
2612 "tile or a cardinally adjacent tile."),
2613 road_flag_id_translated_name(preq->source.value.roadflag));
2614 } else {
2616 /* TRANS: %s is a (translatable) road flag. */
2617 _("Prevented by a road with the \"%s\" flag on "
2618 "the tile or any cardinally adjacent tile."),
2619 road_flag_id_translated_name(preq->source.value.roadflag));
2620 }
2621 return TRUE;
2622 case REQ_RANGE_ADJACENT:
2623 fc_strlcat(buf, prefix, bufsz);
2624 if (preq->present) {
2626 /* TRANS: %s is a (translatable) road flag. */
2627 _("Requires a road with the \"%s\" flag on the "
2628 "tile or an adjacent tile."),
2629 road_flag_id_translated_name(preq->source.value.roadflag));
2630 } else {
2632 /* TRANS: %s is a (translatable) road flag. */
2633 _("Prevented by a road with the \"%s\" flag on "
2634 "the tile or any adjacent tile."),
2635 road_flag_id_translated_name(preq->source.value.roadflag));
2636 }
2637 return TRUE;
2638 case REQ_RANGE_CITY:
2639 fc_strlcat(buf, prefix, bufsz);
2640 if (preq->present) {
2642 /* TRANS: %s is a (translatable) road flag. */
2643 _("Requires a road with the \"%s\" flag on a tile "
2644 "within the city radius."),
2645 road_flag_id_translated_name(preq->source.value.roadflag));
2646 } else {
2648 /* TRANS: %s is a (translatable) road flag. */
2649 _("Prevented by a road with the \"%s\" flag on any tile "
2650 "within the city radius."),
2651 road_flag_id_translated_name(preq->source.value.roadflag));
2652 }
2653 return TRUE;
2655 fc_strlcat(buf, prefix, bufsz);
2656 if (preq->present) {
2658 /* TRANS: %s is a (translatable) road flag. */
2659 _("Requires a road with the \"%s\" flag on a tile "
2660 "within the city radius or the city radius of a "
2661 "trade partner."),
2662 road_flag_id_translated_name(preq->source.value.roadflag));
2663 } else {
2665 /* TRANS: %s is a (translatable) road flag. */
2666 _("Prevented by a road with the \"%s\" flag on any tile "
2667 "within the city radius or the city radius of a "
2668 "trade partner."),
2669 road_flag_id_translated_name(preq->source.value.roadflag));
2670 }
2671 return TRUE;
2673 case REQ_RANGE_PLAYER:
2674 case REQ_RANGE_TEAM:
2675 case REQ_RANGE_ALLIANCE:
2676 case REQ_RANGE_WORLD:
2677 case REQ_RANGE_COUNT:
2678 /* Not supported. */
2679 break;
2680 }
2681 break;
2682
2683 case VUT_EXTRAFLAG:
2684 switch (preq->range) {
2685 case REQ_RANGE_LOCAL:
2686 fc_strlcat(buf, prefix, bufsz);
2687 if (preq->present) {
2689 /* TRANS: %s is a (translatable) extra flag. */
2690 _("Only applies to extras with the \"%s\" flag."),
2692 (preq->source.value.extraflag));
2693 } else {
2695 /* TRANS: %s is a (translatable) extra flag. */
2696 _("Does not apply to extras with the \"%s\" flag."),
2698 (preq->source.value.extraflag));
2699 }
2700 return TRUE;
2701 case REQ_RANGE_TILE:
2702 fc_strlcat(buf, prefix, bufsz);
2703 if (preq->present) {
2705 /* TRANS: %s is a (translatable) extra flag. */
2706 _("Requires an extra with the \"%s\" flag on the tile."),
2707 extra_flag_id_translated_name(preq->source.value.extraflag));
2708 } else {
2710 /* TRANS: %s is a (translatable) extra flag. */
2711 _("Prevented by an extra with the \"%s\" flag on the "
2712 "tile."),
2713 extra_flag_id_translated_name(preq->source.value.extraflag));
2714 }
2715 return TRUE;
2717 fc_strlcat(buf, prefix, bufsz);
2718 if (preq->present) {
2720 /* TRANS: %s is a (translatable) extra flag. */
2721 _("Requires an extra with the \"%s\" flag on the "
2722 "tile or a cardinally adjacent tile."),
2723 extra_flag_id_translated_name(preq->source.value.extraflag));
2724 } else {
2726 /* TRANS: %s is a (translatable) extra flag. */
2727 _("Prevented by an extra with the \"%s\" flag on "
2728 "the tile or any cardinally adjacent tile."),
2729 extra_flag_id_translated_name(preq->source.value.extraflag));
2730 }
2731 return TRUE;
2732 case REQ_RANGE_ADJACENT:
2733 fc_strlcat(buf, prefix, bufsz);
2734 if (preq->present) {
2736 /* TRANS: %s is a (translatable) extra flag. */
2737 _("Requires an extra with the \"%s\" flag on the "
2738 "tile or an adjacent tile."),
2739 extra_flag_id_translated_name(preq->source.value.extraflag));
2740 } else {
2742 /* TRANS: %s is a (translatable) extra flag. */
2743 _("Prevented by an extra with the \"%s\" flag on "
2744 "the tile or any adjacent tile."),
2745 extra_flag_id_translated_name(preq->source.value.extraflag));
2746 }
2747 return TRUE;
2748 case REQ_RANGE_CITY:
2749 fc_strlcat(buf, prefix, bufsz);
2750 if (preq->present) {
2752 /* TRANS: %s is a (translatable) extra flag. */
2753 _("Requires an extra with the \"%s\" flag on a tile "
2754 "within the city radius."),
2755 extra_flag_id_translated_name(preq->source.value.extraflag));
2756 } else {
2758 /* TRANS: %s is a (translatable) extra flag. */
2759 _("Prevented by an extra with the \"%s\" flag on any tile "
2760 "within the city radius."),
2761 extra_flag_id_translated_name(preq->source.value.extraflag));
2762 }
2763 return TRUE;
2765 fc_strlcat(buf, prefix, bufsz);
2766 if (preq->present) {
2768 /* TRANS: %s is a (translatable) extra flag. */
2769 _("Requires an extra with the \"%s\" flag on a tile "
2770 "within the city radius or the city radius of a "
2771 "trade partner."),
2772 extra_flag_id_translated_name(preq->source.value.extraflag));
2773 } else {
2775 /* TRANS: %s is a (translatable) extra flag. */
2776 _("Prevented by an extra with the \"%s\" flag on any tile "
2777 "within the city radius or the city radius of a "
2778 "trade partner."),
2779 extra_flag_id_translated_name(preq->source.value.extraflag));
2780 }
2781 return TRUE;
2783 case REQ_RANGE_PLAYER:
2784 case REQ_RANGE_TEAM:
2785 case REQ_RANGE_ALLIANCE:
2786 case REQ_RANGE_WORLD:
2787 case REQ_RANGE_COUNT:
2788 /* Not supported. */
2789 break;
2790 }
2791 break;
2792
2793 case VUT_MINYEAR:
2794 if (preq->range != REQ_RANGE_WORLD) {
2795 break;
2796 }
2797 fc_strlcat(buf, prefix, bufsz);
2798 if (preq->present) {
2800 _("Requires the game to have reached the year %s."),
2801 textyear(preq->source.value.minyear));
2802 } else {
2804 _("Requires that the game has not yet reached the "
2805 "year %s."),
2806 textyear(preq->source.value.minyear));
2807 }
2808 return TRUE;
2809
2810 case VUT_MINCALFRAG:
2811 if (preq->range != REQ_RANGE_WORLD) {
2812 break;
2813 }
2814 fc_strlcat(buf, prefix, bufsz);
2815 if (preq->present) {
2817 /* TRANS: %s is a representation of a calendar fragment,
2818 * from the ruleset. May be a bare number. */
2819 _("Requires the game to have reached %s."),
2820 textcalfrag(preq->source.value.mincalfrag));
2821 } else {
2823 /* TRANS: %s is a representation of a calendar fragment,
2824 * from the ruleset. May be a bare number. */
2825 _("Requires that the game has not yet reached %s."),
2826 textcalfrag(preq->source.value.mincalfrag));
2827 }
2828 return TRUE;
2829
2830 case VUT_TOPO:
2831 if (preq->range != REQ_RANGE_WORLD) {
2832 break;
2833 }
2834 fc_strlcat(buf, prefix, bufsz);
2835 if (preq->present) {
2837 /* TRANS: topology flag name ("Hex", "ISO") */
2838 _("Requires %s map."),
2839 _(topo_flag_name(preq->source.value.topo_property)));
2840 } else {
2842 /* TRANS: topology flag name ("Hex", "ISO") */
2843 _("Prevented on %s map."),
2844 _(topo_flag_name(preq->source.value.topo_property)));
2845 }
2846 return TRUE;
2847
2848 case VUT_WRAP:
2849 if (preq->range != REQ_RANGE_WORLD) {
2850 break;
2851 }
2852 fc_strlcat(buf, prefix, bufsz);
2853 if (preq->present) {
2855 /* TRANS: wrap flag name ("WrapX", "WrapY") */
2856 _("Requires %s map."),
2857 _(wrap_flag_name(preq->source.value.wrap_property)));
2858 } else {
2860 /* TRANS: wrap flag name ("WrapX", "WrapY") */
2861 _("Prevented on %s map."),
2862 _(wrap_flag_name(preq->source.value.wrap_property)));
2863 }
2864 return TRUE;
2865
2866 case VUT_SERVERSETTING:
2867 if (preq->range != REQ_RANGE_WORLD) {
2868 break;
2869 }
2870 fc_strlcat(buf, prefix, bufsz);
2872 /* TRANS: %s is a server setting, its value and if it is
2873 * required to be present or absent. The string's format
2874 * is specified in ssetv_human_readable().
2875 * Example: "killstack is enabled". */
2876 _("Requires that the server setting %s."),
2877 ssetv_human_readable(preq->source.value.ssetval,
2878 preq->present));
2879 return TRUE;
2880
2881 case VUT_AGE:
2882 fc_strlcat(buf, prefix, bufsz);
2883 if (preq->present) {
2885 _("Requires age of %d turns."),
2886 preq->source.value.age);
2887 } else {
2889 _("Prevented if age is over %d turns."),
2890 preq->source.value.age);
2891 }
2892 return TRUE;
2893
2894 case VUT_FORM_AGE:
2895 fc_strlcat(buf, prefix, bufsz);
2896 if (preq->present) {
2898 _("Requires form age of %d turns."),
2899 preq->source.value.form_age);
2900 } else {
2902 _("Prevented if form age is over %d turns."),
2903 preq->source.value.form_age);
2904 }
2905 return TRUE;
2906
2907 case VUT_MINTECHS:
2908 switch (preq->range) {
2909 case REQ_RANGE_WORLD:
2910 fc_strlcat(buf, prefix, bufsz);
2911 if (preq->present) {
2913 _("Requires %d techs to be known in the world."),
2914 preq->source.value.min_techs);
2915 } else {
2917 _("Prevented when %d techs are known in the world."),
2918 preq->source.value.min_techs);
2919 }
2920 return TRUE;
2921 case REQ_RANGE_PLAYER:
2922 fc_strlcat(buf, prefix, bufsz);
2923 if (preq->present) {
2925 _("Requires player to know %d techs."),
2926 preq->source.value.min_techs);
2927 } else {
2929 _("Prevented when player knows %d techs."),
2930 preq->source.value.min_techs);
2931 }
2932 return TRUE;
2933 case REQ_RANGE_LOCAL:
2934 case REQ_RANGE_TILE:
2936 case REQ_RANGE_ADJACENT:
2937 case REQ_RANGE_CITY:
2940 case REQ_RANGE_TEAM:
2941 case REQ_RANGE_ALLIANCE:
2942 case REQ_RANGE_COUNT:
2943 /* Not supported. */
2944 break;
2945 }
2946 break;
2947
2948 case VUT_TERRAINALTER:
2949 switch (preq->range) {
2950 case REQ_RANGE_TILE:
2951 fc_strlcat(buf, prefix, bufsz);
2952 if (preq->present) {
2954 _("Requires terrain on which alteration %s is "
2955 "possible."),
2956 Q_(terrain_alteration_name(preq->source.value.terrainalter)));
2957 } else {
2959 _("Prevented by terrain on which alteration %s "
2960 "can be made."),
2961 Q_(terrain_alteration_name(preq->source.value.terrainalter)));
2962 }
2963 return TRUE;
2965 case REQ_RANGE_ADJACENT:
2966 case REQ_RANGE_CITY:
2969 case REQ_RANGE_PLAYER:
2970 case REQ_RANGE_TEAM:
2971 case REQ_RANGE_ALLIANCE:
2972 case REQ_RANGE_WORLD:
2973 case REQ_RANGE_LOCAL:
2974 case REQ_RANGE_COUNT:
2975 /* Not supported. */
2976 break;
2977 }
2978 break;
2979
2980 case VUT_CITYTILE:
2981 if (preq->source.value.citytile == CITYT_LAST) {
2982 break;
2983 } else {
2984 static char *tile_property = NULL;
2985
2986 switch (preq->source.value.citytile) {
2987 case CITYT_CENTER:
2988 tile_property = _("city centers");
2989 break;
2990 case CITYT_CLAIMED:
2991 tile_property = _("claimed tiles");
2992 break;
2993 case CITYT_EXTRAS_OWNED:
2994 tile_property = _("owned extras");
2995 break;
2996 case CITYT_WORKED:
2997 tile_property = _("worked tiles");
2998 break;
3000 /* TRANS: a specific city for each use case */
3001 tile_property = _("tiles on the same continent as the city");
3002 break;
3004 {
3005 bool oceanic_cities = FALSE; /* FIXME: maybe cache globally? */
3006
3011 /* TRANS: a specific city for each use case */
3012 tile_property = _("tiles of a mass of a different "
3013 "terrain class next to the city");
3014 break;
3015 }
3017 if (oceanic_cities) {
3018 break;
3019 }
3020 /* TRANS: a specific city for each use case */
3021 tile_property = _("tiles of a body of water next to the city");
3022 }
3023 break;
3024 case CITYT_LAST:
3025 fc_assert(preq->source.value.citytile != CITYT_LAST);
3026 break;
3027 }
3028
3029 switch (preq->range) {
3030 case REQ_RANGE_TILE:
3031 fc_strlcat(buf, prefix, bufsz);
3032 if (preq->present) {
3034 /* TRANS: tile property ("city centers", etc) */
3035 Q_("?tileprop:Applies only to %s."), tile_property);
3036 } else {
3038 /* TRANS: tile property ("city centers", etc) */
3039 Q_("?tileprop:Does not apply to %s."), tile_property);
3040 }
3041 return TRUE;
3043 fc_strlcat(buf, prefix, bufsz);
3044 if (preq->present) {
3045 /* TRANS: tile property ("city centers", etc) */
3046 cat_snprintf(buf, bufsz, Q_("?tileprop:Applies only to %s and "
3047 "cardinally adjacent tiles."),
3049 } else {
3050 /* TRANS: tile property ("city centers", etc) */
3051 cat_snprintf(buf, bufsz, Q_("?tileprop:Does not apply to %s or "
3052 "cardinally adjacent tiles."),
3054 }
3055 return TRUE;
3056 case REQ_RANGE_ADJACENT:
3057 fc_strlcat(buf, prefix, bufsz);
3058 if (preq->present) {
3059 /* TRANS: tile property ("city centers", etc) */
3060 cat_snprintf(buf, bufsz, Q_("?tileprop:Applies only to %s and "
3061 "adjacent tiles."), tile_property);
3062 } else {
3063 /* TRANS: tile property ("city centers", etc) */
3064 cat_snprintf(buf, bufsz, Q_("?tileprop:Does not apply to %s or "
3065 "adjacent tiles."), tile_property);
3066 }
3067 return TRUE;
3068 case REQ_RANGE_CITY:
3071 case REQ_RANGE_PLAYER:
3072 case REQ_RANGE_TEAM:
3073 case REQ_RANGE_ALLIANCE:
3074 case REQ_RANGE_WORLD:
3075 case REQ_RANGE_LOCAL:
3076 case REQ_RANGE_COUNT:
3077 /* Not supported. */
3078 break;
3079 }
3080
3081 break;
3082 }
3083
3084 case VUT_CITYSTATUS:
3085 if (preq->source.value.citystatus != CITYS_LAST) {
3086 static char *city_property = NULL;
3087
3088 switch (preq->source.value.citystatus) {
3090 city_property = _("owned by original");
3091 break;
3092 case CITYS_STARVED:
3093 city_property = _("starved");
3094 break;
3095 case CITYS_DISORDER:
3096 city_property = _("disorder");
3097 break;
3098 case CITYS_CELEBRATION:
3099 city_property = _("celebration");
3100 break;
3101 case CITYS_TRANSFERRED:
3102 city_property = _("transferred");
3103 break;
3104 case CITYS_LAST:
3105 fc_assert(preq->source.value.citystatus != CITYS_LAST);
3106 break;
3107 }
3108
3109 switch (preq->range) {
3110 case REQ_RANGE_CITY:
3111 fc_strlcat(buf, prefix, bufsz);
3112 if (preq->present) {
3113 /* TRANS: city property ("owned by original", etc) */
3114 cat_snprintf(buf, bufsz, Q_("?cityprop:Applies only to %s cities"),
3116 } else {
3117 /* TRANS: city property ("owned by original", etc) */
3118 cat_snprintf(buf, bufsz, Q_("?cityprop:Does not apply to %s cities"),
3120 }
3121 return TRUE;
3123 fc_strlcat(buf, prefix, bufsz);
3124 if (preq->present) {
3125 /* TRANS: city property ("owned by original", etc) */
3126 cat_snprintf(buf, bufsz, Q_("?cityprop:Applies only to %s cities or "
3127 "their trade partners."), city_property);
3128 } else {
3129 /* TRANS: city property ("owned by original", etc) */
3130 cat_snprintf(buf, bufsz, Q_("?cityprop:Does not apply to %s cities or "
3131 "their trade partners."), city_property);
3132 }
3133 return TRUE;
3134 case REQ_RANGE_LOCAL:
3135 case REQ_RANGE_TILE:
3136 case REQ_RANGE_ADJACENT:
3139 case REQ_RANGE_PLAYER:
3140 case REQ_RANGE_TEAM:
3141 case REQ_RANGE_ALLIANCE:
3142 case REQ_RANGE_WORLD:
3143 case REQ_RANGE_COUNT:
3144 /* Not supported. */
3145 break;
3146 }
3147 }
3148 break;
3149
3150 case VUT_MINLATITUDE:
3151 switch (preq->range) {
3152 case REQ_RANGE_WORLD:
3153 fc_strlcat(buf, prefix, bufsz);
3154 if (preq->present) {
3156 _("Some part of the world must be at latitude %d or "
3157 "further north."),
3158 preq->source.value.latitude);
3159 } else {
3161 _("The entire world must be at latitude %d or "
3162 "further south."),
3163 preq->source.value.latitude - 1);
3164 }
3165 return TRUE;
3166 case REQ_RANGE_TILE:
3167 fc_strlcat(buf, prefix, bufsz);
3168 if (preq->present) {
3170 _("Tile must be at latitude %d or further north."),
3171 preq->source.value.latitude);
3172 } else {
3174 _("Tile must be at latitude %d or further south."),
3175 preq->source.value.latitude - 1);
3176 }
3177 return TRUE;
3179 fc_strlcat(buf, prefix, bufsz);
3180 if (preq->present) {
3182 _("A cardinally adjacent tile must be at latitude "
3183 "%d or further north."),
3184 preq->source.value.latitude);
3185 } else {
3187 _("All cardinally adjacent tiles must be at latitude "
3188 "%d or further south."),
3189 preq->source.value.latitude - 1);
3190 }
3191 return TRUE;
3192 case REQ_RANGE_ADJACENT:
3193 fc_strlcat(buf, prefix, bufsz);
3194 if (preq->present) {
3196 _("An adjacent tile must be at latitude %d or "
3197 "further north."),
3198 preq->source.value.latitude);
3199 } else {
3201 _("All adjacent tiles must be at latitude %d or "
3202 "further south."),
3203 preq->source.value.latitude - 1);
3204 }
3205 return TRUE;
3206 case REQ_RANGE_CITY:
3209 case REQ_RANGE_PLAYER:
3210 case REQ_RANGE_TEAM:
3211 case REQ_RANGE_ALLIANCE:
3212 case REQ_RANGE_LOCAL:
3213 case REQ_RANGE_COUNT:
3214 /* Not supported. */
3215 break;
3216 }
3217 break;
3218
3219 case VUT_MAXLATITUDE:
3220 switch (preq->range) {
3221 case REQ_RANGE_WORLD:
3222 fc_strlcat(buf, prefix, bufsz);
3223 if (preq->present) {
3225 _("Some part of the world must be at latitude %d or "
3226 "further south."),
3227 preq->source.value.latitude);
3228 } else {
3230 _("The entire world must be at latitude %d or "
3231 "further north."),
3232 preq->source.value.latitude + 1);
3233 }
3234 return TRUE;
3235 case REQ_RANGE_TILE:
3236 fc_strlcat(buf, prefix, bufsz);
3237 if (preq->present) {
3239 _("Tile must be at latitude %d or further south."),
3240 preq->source.value.latitude);
3241 } else {
3243 _("Tile must be at latitude %d or further north."),
3244 preq->source.value.latitude + 1);
3245 }
3246 return TRUE;
3248 fc_strlcat(buf, prefix, bufsz);
3249 if (preq->present) {
3251 _("A cardinally adjacent tile must be at latitude "
3252 "%d or further south."),
3253 preq->source.value.latitude);
3254 } else {
3256 _("All cardinally adjacent tiles must be at latitude "
3257 "%d or further north."),
3258 preq->source.value.latitude + 1);
3259 }
3260 return TRUE;
3261 case REQ_RANGE_ADJACENT:
3262 fc_strlcat(buf, prefix, bufsz);
3263 if (preq->present) {
3265 _("An adjacent tile must be at latitude %d or "
3266 "further south."),
3267 preq->source.value.latitude);
3268 } else {
3270 _("All adjacent tiles must be at latitude %d or "
3271 "further north."),
3272 preq->source.value.latitude + 1);
3273 }
3274 return TRUE;
3275 case REQ_RANGE_CITY:
3278 case REQ_RANGE_PLAYER:
3279 case REQ_RANGE_TEAM:
3280 case REQ_RANGE_ALLIANCE:
3281 case REQ_RANGE_LOCAL:
3282 case REQ_RANGE_COUNT:
3283 /* Not supported. */
3284 break;
3285 }
3286 break;
3287
3288 case VUT_COUNT:
3289 break;
3290 }
3291
3292 if (verb == VERB_DEFAULT) {
3293 char text[256];
3294
3295 log_error("%s requirement %s in range %d is not supported in reqtext.c.",
3296 preq->present ? "Present" : "Absent",
3297 universal_name_translation(&preq->source, text, sizeof(text)),
3298 preq->range);
3299 }
3300
3301 return FALSE;
3302}
3303
3304/*************************************************************/
3307bool req_text_insert_nl(char *buf, size_t bufsz, struct player *pplayer,
3308 const struct requirement *preq,
3309 enum rt_verbosity verb, const char *prefix)
3310{
3311 if (req_text_insert(buf, bufsz, pplayer, preq, verb, prefix)) {
3312 fc_strlcat(buf, "\n", bufsz);
3313
3314 return TRUE;
3315 }
3316
3317 return FALSE;
3318}
const char * achievement_name_translation(struct achievement *pach)
const char * action_name_translation(const struct action *action)
Definition actions.c:1991
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:629
static struct fc_sockaddr_list * list
Definition clinet.c:102
char * incite_cost
Definition comments.c:75
const char * counter_rule_name(struct counter *pcount)
Definition counters.c:165
const char * extra_name_translation(const struct extra_type *pextra)
Definition extras.c:194
#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:143
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:1015
const char * nation_adjective_translation(const struct nation_type *pnation)
Definition nation.c:149
const char * nation_group_name_translation(const struct nation_group *pgroup)
Definition nation.c:1090
const char * nation_plural_translation(const struct nation_type *pnation)
Definition nation.c:159
const char * diplrel_name_translation(int value)
Definition player.c:1627
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:3307
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:48
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
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:836
int cat_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:1000
#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:661
const char * terrain_name_translation(const struct terrain *pterrain)
Definition terrain.c:238
enum terrain_class terrain_type_terrain_class(const struct terrain *pterrain)
Definition terrain.c:582
#define terrain_type_iterate(_p)
Definition terrain.h:373
#define terrain_type_iterate_end
Definition terrain.h:379
#define terrain_has_flag(terr, flag)
Definition terrain.h:283
const char * goods_name_translation(struct goods_type *pgood)
const char * uclass_name_translation(const struct unit_class *pclass)
Definition unittype.c:1632
Unit_Class_id uclass_count(void)
Definition unittype.c:2446
const char * utype_name_translation(const struct unit_type *punittype)
Definition unittype.c:1560
bool role_units_translations(struct astring *astr, int flag, bool alts)
Definition unittype.c:1668
static bool uclass_has_flag(const struct unit_class *punitclass, enum unit_class_flag_id flag)
Definition unittype.h:766
#define unit_class_iterate(_p)
Definition unittype.h:908
#define unit_class_iterate_end
Definition unittype.h:915