Freeciv-3.4
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#include "tiledef.h"
38
39#include "reqtext.h"
40
41/*************************************************************/
49bool req_text_insert(char *buf, size_t bufsz, struct player *pplayer,
50 const struct requirement *preq,
51 enum rt_verbosity verb, const char *prefix)
52{
53 if (preq->quiet && verb != VERB_ACTUAL) {
54 return FALSE;
55 }
56
57 switch (preq->source.kind) {
58 case VUT_NONE:
59 return FALSE;
60
61 case VUT_COUNTER:
62 if (preq->present) {
63
64 fc_strlcat(buf, prefix, bufsz);
66 _("Requires counter %s to achieve at minimum %d value."),
67 counter_rule_name(preq->source.value.counter),
68 preq->source.value.counter->checkpoint);
69 } else {
70
71 fc_strlcat(buf, prefix, bufsz);
73 _("Requires counter %s to be less than %d value."),
74 counter_rule_name(preq->source.value.counter),
75 preq->source.value.counter->checkpoint - 1);
76 }
77 break;
78 case VUT_ADVANCE:
79 switch (preq->range) {
81 fc_strlcat(buf, prefix, bufsz);
82 if (preq->present) {
84 _("Requires knowledge of the technology %s."),
85 advance_name_translation(preq->source.value.advance));
86 } else {
88 _("Prevented by knowledge of the technology %s."),
89 advance_name_translation(preq->source.value.advance));
90 }
91 return TRUE;
92 case REQ_RANGE_TEAM:
93 fc_strlcat(buf, prefix, bufsz);
94 if (preq->present) {
96 _("Requires that a player on your team knows the "
97 "technology %s."),
98 advance_name_translation(preq->source.value.advance));
99 } else {
101 _("Prevented if any player on your team knows the "
102 "technology %s."),
103 advance_name_translation(preq->source.value.advance));
104 }
105 return TRUE;
107 fc_strlcat(buf, prefix, bufsz);
108 if (preq->present) {
110 _("Requires that a player allied to you knows the "
111 "technology %s."),
112 advance_name_translation(preq->source.value.advance));
113 } else {
115 _("Prevented if any player allied to you knows the "
116 "technology %s."),
117 advance_name_translation(preq->source.value.advance));
118 }
119 return TRUE;
120 case REQ_RANGE_WORLD:
121 fc_strlcat(buf, prefix, bufsz);
122 if (preq->survives) {
123 if (preq->present) {
125 _("Requires that someone has discovered the "
126 "technology %s."),
127 advance_name_translation(preq->source.value.advance));
128 } else {
130 _("Requires that no-one has yet discovered the "
131 "technology %s."),
132 advance_name_translation(preq->source.value.advance));
133 }
134 } else {
135 if (preq->present) {
137 _("Requires that some player knows the "
138 "technology %s."),
139 advance_name_translation(preq->source.value.advance));
140 } else {
142 _("Requires that no player knows the "
143 "technology %s."),
144 advance_name_translation(preq->source.value.advance));
145 }
146 }
147 return TRUE;
148 case REQ_RANGE_LOCAL:
149 case REQ_RANGE_TILE:
152 case REQ_RANGE_CITY:
155 case REQ_RANGE_COUNT:
156 /* Not supported. */
157 break;
158 }
159 break;
160
161 case VUT_TECHFLAG:
162 switch (preq->range) {
163 case REQ_RANGE_PLAYER:
164 fc_strlcat(buf, prefix, bufsz);
165 if (preq->present) {
167 /* TRANS: %s is a (translatable) tech flag. */
168 _("Requires knowledge of a technology with the "
169 "\"%s\" flag."),
170 tech_flag_id_translated_name(preq->source.value.techflag));
171 } else {
173 /* TRANS: %s is a (translatable) tech flag. */
174 _("Prevented by knowledge of any technology with the "
175 "\"%s\" flag."),
176 tech_flag_id_translated_name(preq->source.value.techflag));
177 }
178 return TRUE;
179 case REQ_RANGE_TEAM:
180 fc_strlcat(buf, prefix, bufsz);
181 if (preq->present) {
183 /* TRANS: %s is a (translatable) tech flag. */
184 _("Requires that a player on your team knows "
185 "a technology with the \"%s\" flag."),
186 tech_flag_id_translated_name(preq->source.value.techflag));
187 } else {
189 /* TRANS: %s is a (translatable) tech flag. */
190 _("Prevented if any player on your team knows "
191 "any technology with the \"%s\" flag."),
192 tech_flag_id_translated_name(preq->source.value.techflag));
193 }
194 return TRUE;
196 fc_strlcat(buf, prefix, bufsz);
197 if (preq->present) {
199 /* TRANS: %s is a (translatable) tech flag. */
200 _("Requires that a player allied to you knows "
201 "a technology with the \"%s\" flag."),
202 tech_flag_id_translated_name(preq->source.value.techflag));
203 } else {
205 /* TRANS: %s is a (translatable) tech flag. */
206 _("Prevented if any player allied to you knows "
207 "any technology with the \"%s\" flag."),
208 tech_flag_id_translated_name(preq->source.value.techflag));
209 }
210 return TRUE;
211 case REQ_RANGE_WORLD:
212 fc_strlcat(buf, prefix, bufsz);
213 if (preq->present) {
215 /* TRANS: %s is a (translatable) tech flag. */
216 _("Requires that some player knows a technology "
217 "with the \"%s\" flag."),
218 tech_flag_id_translated_name(preq->source.value.techflag));
219 } else {
221 /* TRANS: %s is a (translatable) tech flag. */
222 _("Requires that no player knows any technology with "
223 "the \"%s\" flag."),
224 tech_flag_id_translated_name(preq->source.value.techflag));
225 }
226 return TRUE;
227 case REQ_RANGE_LOCAL:
228 case REQ_RANGE_TILE:
231 case REQ_RANGE_CITY:
234 case REQ_RANGE_COUNT:
235 /* Not supported. */
236 break;
237 }
238 break;
239
240 case VUT_GOVERNMENT:
241 if (preq->range != REQ_RANGE_PLAYER) {
242 break;
243 }
244 fc_strlcat(buf, prefix, bufsz);
245 if (preq->present) {
246 cat_snprintf(buf, bufsz, _("Requires the %s government."),
247 government_name_translation(preq->source.value.govern));
248 } else {
249 cat_snprintf(buf, bufsz, _("Not available under the %s government."),
250 government_name_translation(preq->source.value.govern));
251 }
252 return TRUE;
253
254 case VUT_GOVFLAG:
255 if (preq->range != REQ_RANGE_PLAYER) {
256 break;
257 }
258 fc_strlcat(buf, prefix, bufsz);
259 if (preq->present) {
260 cat_snprintf(buf, bufsz, _("Requires a %s government."),
261 gov_flag_id_translated_name(preq->source.value.govflag));
262 } else {
263 cat_snprintf(buf, bufsz, _("Not available under a %s government."),
264 gov_flag_id_translated_name(preq->source.value.govflag));
265 }
266 return TRUE;
267
268 case VUT_ACHIEVEMENT:
269 switch (preq->range) {
270 case REQ_RANGE_PLAYER:
271 fc_strlcat(buf, prefix, bufsz);
272 if (preq->present) {
273 cat_snprintf(buf, bufsz, _("Requires you to have achieved \"%s\"."),
274 achievement_name_translation(preq->source.value.achievement));
275 } else {
276 cat_snprintf(buf, bufsz, _("Not available once you have achieved "
277 "\"%s\"."),
278 achievement_name_translation(preq->source.value.achievement));
279 }
280 return TRUE;
281 case REQ_RANGE_TEAM:
282 fc_strlcat(buf, prefix, bufsz);
283 if (preq->present) {
284 cat_snprintf(buf, bufsz, _("Requires that at least one of your "
285 "team-mates has achieved \"%s\"."),
286 achievement_name_translation(preq->source.value.achievement));
287 } else {
288 cat_snprintf(buf, bufsz, _("Not available if any of your team-mates "
289 "has achieved \"%s\"."),
290 achievement_name_translation(preq->source.value.achievement));
291 }
292 return TRUE;
294 fc_strlcat(buf, prefix, bufsz);
295 if (preq->present) {
296 cat_snprintf(buf, bufsz, _("Requires that at least one of your allies "
297 "has achieved \"%s\"."),
298 achievement_name_translation(preq->source.value.achievement));
299 } else {
300 cat_snprintf(buf, bufsz, _("Not available if any of your allies has "
301 "achieved \"%s\"."),
302 achievement_name_translation(preq->source.value.achievement));
303 }
304 return TRUE;
305 case REQ_RANGE_WORLD:
306 fc_strlcat(buf, prefix, bufsz);
307 if (preq->present) {
308 cat_snprintf(buf, bufsz, _("Requires that at least one player "
309 "has achieved \"%s\"."),
310 achievement_name_translation(preq->source.value.achievement));
311 } else {
312 cat_snprintf(buf, bufsz, _("Not available if any player has "
313 "achieved \"%s\"."),
314 achievement_name_translation(preq->source.value.achievement));
315 }
316 return TRUE;
317 case REQ_RANGE_LOCAL:
318 case REQ_RANGE_TILE:
321 case REQ_RANGE_CITY:
324 case REQ_RANGE_COUNT:
325 /* Not supported. */
326 break;
327 }
328 break;
329
330 case VUT_ACTION:
331 switch (preq->range) {
332 case REQ_RANGE_LOCAL:
333 fc_strlcat(buf, prefix, bufsz);
334 if (preq->present) {
335 cat_snprintf(buf, bufsz, _("Applies to the \"%s\" action."),
336 action_name_translation(preq->source.value.action));
337 } else {
338 cat_snprintf(buf, bufsz, _("Doesn't apply to the \"%s\""
339 " action."),
340 action_name_translation(preq->source.value.action));
341 }
342 return TRUE;
343 default:
344 /* Not supported. */
345 break;
346 }
347 break;
348
349 case VUT_IMPR_GENUS:
350 switch (preq->range) {
351 case REQ_RANGE_LOCAL:
352 fc_strlcat(buf, prefix, bufsz);
353 if (preq->present) {
354 cat_snprintf(buf, bufsz, _("Applies to \"%s\" buildings."),
356 preq->source.value.impr_genus));
357 } else {
358 cat_snprintf(buf, bufsz, _("Doesn't apply to \"%s\" buildings."),
360 preq->source.value.impr_genus));
361 }
362 return TRUE;
363 default:
364 /* Not supported. */
365 break;
366 }
367 break;
368
369 case VUT_IMPR_FLAG:
370 switch (preq->range) {
371 case REQ_RANGE_LOCAL:
372 fc_strlcat(buf, prefix, bufsz);
373 if (preq->present) {
374 cat_snprintf(buf, bufsz, _("Applies to \"%s\" buildings."),
376 preq->source.value.impr_flag));
377 } else {
378 cat_snprintf(buf, bufsz, _("Doesn't apply to \"%s\" buildings."),
380 preq->source.value.impr_flag));
381 }
382 return TRUE;
383 default:
384 /* Not supported. */
385 break;
386 }
387 break;
388
389 case VUT_PLAYER_FLAG:
390 switch (preq->range) {
391 case REQ_RANGE_PLAYER:
392 fc_strlcat(buf, prefix, bufsz);
393 if (preq->present) {
394 cat_snprintf(buf, bufsz, _("Applies to players with \"%s\" flag."),
396 preq->source.value.plr_flag));
397 } else {
398 cat_snprintf(buf, bufsz, _("Doesn't apply to players with \"%s\" flag."),
400 preq->source.value.plr_flag));
401 }
402 return TRUE;
403 default:
404 /* Not supported. */
405 break;
406 }
407 break;
408
409 case VUT_PLAYER_STATE:
410 switch (preq->range) {
411 case REQ_RANGE_PLAYER:
412 fc_strlcat(buf, prefix, bufsz);
413 if (preq->present) {
414 cat_snprintf(buf, bufsz, _("Applies to \"%s\" players."),
415 plrstate_type_translated_name(preq->source.value.plrstate));
416 } else {
417 cat_snprintf(buf, bufsz, _("Doesn't apply to \"%s\" players."),
418 plrstate_type_translated_name(preq->source.value.plrstate));
419 }
420 return TRUE;
421 default:
422 /* Not supported. */
423 break;
424 }
425 break;
426
427 case VUT_IMPROVEMENT:
428 case VUT_SITE:
429 switch (preq->range) {
430 case REQ_RANGE_WORLD:
431 if (is_great_wonder(preq->source.value.building)) {
432 fc_strlcat(buf, prefix, bufsz);
433 if (preq->survives) {
434 if (preq->present) {
435 if (preq->source.kind == VUT_IMPROVEMENT
436 && can_improvement_go_obsolete(preq->source.value.building)) {
438 /* TRANS: %s is a wonder */
439 _("Requires that %s was built at some point, "
440 "and that it has not yet been rendered "
441 "obsolete."),
443 (preq->source.value.building));
444 } else {
446 /* TRANS: %s is a wonder */
447 _("Requires that %s was built at some point."),
449 (preq->source.value.building));
450 }
451 } else {
452 if (preq->source.kind == VUT_IMPROVEMENT
453 && can_improvement_go_obsolete(preq->source.value.building)) {
455 /* TRANS: %s is a wonder */
456 _("Prevented if %s has ever been built, "
457 "unless it would be obsolete."),
459 (preq->source.value.building));
460 } else {
462 /* TRANS: %s is a wonder */
463 _("Prevented if %s has ever been built."),
465 (preq->source.value.building));
466 }
467 }
468 } else {
469 /* Non-surviving requirement */
470 if (preq->present) {
471 if (preq->source.kind == VUT_IMPROVEMENT
472 && can_improvement_go_obsolete(preq->source.value.building)) {
474 /* TRANS: %s is a wonder */
475 _("Requires %s to be owned by any player "
476 "and not yet obsolete."),
478 (preq->source.value.building));
479 } else {
481 /* TRANS: %s is a wonder */
482 _("Requires %s to be owned by any player."),
484 (preq->source.value.building));
485 }
486 } else {
487 if (preq->source.kind == VUT_IMPROVEMENT
488 && can_improvement_go_obsolete(preq->source.value.building)) {
490 /* TRANS: %s is a wonder */
491 _("Prevented if %s is currently owned by "
492 "any player, unless it is obsolete."),
494 (preq->source.value.building));
495 } else {
497 /* TRANS: %s is a wonder */
498 _("Prevented if %s is currently owned by "
499 "any player."),
501 (preq->source.value.building));
502 }
503 }
504 }
505 return TRUE;
506 }
507 /* Non-great-wonder world-ranged requirements not supported */
508 break;
510 if (is_wonder(preq->source.value.building)) {
511 fc_strlcat(buf, prefix, bufsz);
512 if (preq->survives) {
513 if (preq->present) {
514 if (preq->source.kind == VUT_IMPROVEMENT
515 && can_improvement_go_obsolete(preq->source.value.building)) {
517 /* TRANS: %s is a wonder */
518 _("Requires someone who is currently allied to "
519 "you to have built %s at some point, and for "
520 "it not to have been rendered obsolete."),
522 (preq->source.value.building));
523 } else {
525 /* TRANS: %s is a wonder */
526 _("Requires someone who is currently allied to "
527 "you to have built %s at some point."),
529 (preq->source.value.building));
530 }
531 } else {
532 if (preq->source.kind == VUT_IMPROVEMENT
533 && can_improvement_go_obsolete(preq->source.value.building)) {
535 /* TRANS: %s is a wonder */
536 _("Prevented if someone currently allied to you "
537 "has ever built %s, unless it would be "
538 "obsolete."),
540 (preq->source.value.building));
541 } else {
543 /* TRANS: %s is a wonder */
544 _("Prevented if someone currently allied to you "
545 "has ever built %s."),
547 (preq->source.value.building));
548 }
549 }
550 } else {
551 /* Non-surviving requirement */
552 if (preq->present) {
553 if (preq->source.kind == VUT_IMPROVEMENT
554 && can_improvement_go_obsolete(preq->source.value.building)) {
556 /* TRANS: %s is a wonder */
557 _("Requires someone allied to you to own %s, "
558 "and for it not to have been rendered "
559 "obsolete."),
561 (preq->source.value.building));
562 } else {
564 /* TRANS: %s is a wonder */
565 _("Requires someone allied to you to own %s."),
567 (preq->source.value.building));
568 }
569 } else {
570 if (preq->source.kind == VUT_IMPROVEMENT
571 && can_improvement_go_obsolete(preq->source.value.building)) {
573 /* TRANS: %s is a wonder */
574 _("Prevented if someone allied to you owns %s, "
575 "unless it is obsolete."),
577 (preq->source.value.building));
578 } else {
580 /* TRANS: %s is a wonder */
581 _("Prevented if someone allied to you owns %s."),
583 (preq->source.value.building));
584 }
585 }
586 }
587 return TRUE;
588 }
589 /* Non-wonder alliance-ranged requirements not supported */
590 break;
591 case REQ_RANGE_TEAM:
592 if (is_wonder(preq->source.value.building)) {
593 fc_strlcat(buf, prefix, bufsz);
594 if (preq->survives) {
595 if (preq->present) {
596 if (preq->source.kind == VUT_IMPROVEMENT
597 && can_improvement_go_obsolete(preq->source.value.building)) {
599 /* TRANS: %s is a wonder */
600 _("Requires someone on your team to have "
601 "built %s at some point, and for it not "
602 "to have been rendered obsolete."),
604 (preq->source.value.building));
605 } else {
607 /* TRANS: %s is a wonder */
608 _("Requires someone on your team to have "
609 "built %s at some point."),
611 (preq->source.value.building));
612 }
613 } else {
614 if (preq->source.kind == VUT_IMPROVEMENT
615 && can_improvement_go_obsolete(preq->source.value.building)) {
617 /* TRANS: %s is a wonder */
618 _("Prevented if someone on your team has ever "
619 "built %s, unless it would be obsolete."),
621 (preq->source.value.building));
622 } else {
624 /* TRANS: %s is a wonder */
625 _("Prevented if someone on your team has ever "
626 "built %s."),
628 (preq->source.value.building));
629 }
630 }
631 } else {
632 /* Non-surviving requirement */
633 if (preq->present) {
634 if (preq->source.kind == VUT_IMPROVEMENT
635 && can_improvement_go_obsolete(preq->source.value.building)) {
637 /* TRANS: %s is a wonder */
638 _("Requires someone on your team to own %s, "
639 "and for it not to have been rendered "
640 "obsolete."),
642 (preq->source.value.building));
643 } else {
645 /* TRANS: %s is a wonder */
646 _("Requires someone on your team to own %s."),
648 (preq->source.value.building));
649 }
650 } else {
651 if (preq->source.kind == VUT_IMPROVEMENT
652 && can_improvement_go_obsolete(preq->source.value.building)) {
654 /* TRANS: %s is a wonder */
655 _("Prevented if someone on your team owns %s, "
656 "unless it is obsolete."),
658 (preq->source.value.building));
659 } else {
661 /* TRANS: %s is a wonder */
662 _("Prevented if someone on your team owns %s."),
664 (preq->source.value.building));
665 }
666 }
667 }
668 return TRUE;
669 }
670 /* Non-wonder team-ranged requirements not supported */
671 break;
672 case REQ_RANGE_PLAYER:
673 if (is_wonder(preq->source.value.building)) {
674 fc_strlcat(buf, prefix, bufsz);
675 if (preq->survives) {
676 if (preq->present) {
677 if (preq->source.kind == VUT_IMPROVEMENT
678 && can_improvement_go_obsolete(preq->source.value.building)) {
680 /* TRANS: %s is a wonder */
681 _("Requires you to have built %s at some point, "
682 "and for it not to have been rendered "
683 "obsolete."),
685 (preq->source.value.building));
686 } else {
688 /* TRANS: %s is a wonder */
689 _("Requires you to have built %s at some point."),
691 (preq->source.value.building));
692 }
693 } else {
694 if (preq->source.kind == VUT_IMPROVEMENT
695 && can_improvement_go_obsolete(preq->source.value.building)) {
697 /* TRANS: %s is a wonder */
698 _("Prevented if you have ever built %s, "
699 "unless it would be obsolete."),
701 (preq->source.value.building));
702 } else {
704 /* TRANS: %s is a wonder */
705 _("Prevented if you have ever built %s."),
707 (preq->source.value.building));
708 }
709 }
710 } else {
711 /* Non-surviving requirement */
712 if (preq->present) {
713 if (preq->source.kind == VUT_IMPROVEMENT
714 && can_improvement_go_obsolete(preq->source.value.building)) {
716 /* TRANS: %s is a wonder */
717 _("Requires you to own %s, which must not "
718 "be obsolete."),
720 (preq->source.value.building));
721 } else {
723 /* TRANS: %s is a wonder */
724 _("Requires you to own %s."),
726 (preq->source.value.building));
727 }
728 } else {
729 if (preq->source.kind == VUT_IMPROVEMENT
730 && can_improvement_go_obsolete(preq->source.value.building)) {
732 /* TRANS: %s is a wonder */
733 _("Prevented if you own %s, unless it is "
734 "obsolete."),
736 (preq->source.value.building));
737 } else {
739 /* TRANS: %s is a wonder */
740 _("Prevented if you own %s."),
742 (preq->source.value.building));
743 }
744 }
745 }
746 return TRUE;
747 }
748 /* Non-wonder player-ranged requirements not supported */
749 break;
751 if (is_wonder(preq->source.value.building)) {
752 fc_strlcat(buf, prefix, bufsz);
753 if (preq->present) {
754 if (preq->source.kind == VUT_IMPROVEMENT
755 && can_improvement_go_obsolete(preq->source.value.building)) {
757 /* TRANS: %s is a wonder */
758 _("Requires %s in one of your cities on the same "
759 "continent, and not yet obsolete."),
761 (preq->source.value.building));
762 } else {
764 /* TRANS: %s is a wonder */
765 _("Requires %s in one of your cities on the same "
766 "continent."),
768 (preq->source.value.building));
769 }
770 } else {
771 if (preq->source.kind == VUT_IMPROVEMENT
772 && can_improvement_go_obsolete(preq->source.value.building)) {
774 /* TRANS: %s is a wonder */
775 _("Prevented if %s is in one of your cities on the "
776 "same continent, unless it is obsolete."),
778 (preq->source.value.building));
779 } else {
781 /* TRANS: %s is a wonder */
782 _("Prevented if %s is in one of your cities on the "
783 "same continent."),
785 (preq->source.value.building));
786 }
787 }
788 return TRUE;
789 }
790 /* Surviving or non-wonder continent-ranged requirements not supported */
791 break;
793 fc_strlcat(buf, prefix, bufsz);
794 if (preq->present) {
795 if (preq->source.kind == VUT_IMPROVEMENT
796 && can_improvement_go_obsolete(preq->source.value.building)) {
797 /* Should only apply to wonders */
799 /* TRANS: %s is a building or wonder */
800 _("Requires %s in the city or a trade partner "
801 "(and not yet obsolete)."),
803 (preq->source.value.building));
804 } else {
806 /* TRANS: %s is a building or wonder */
807 _("Requires %s in the city or a trade partner."),
809 (preq->source.value.building));
810 }
811 } else {
812 if (preq->source.kind == VUT_IMPROVEMENT
813 && can_improvement_go_obsolete(preq->source.value.building)) {
814 /* Should only apply to wonders */
816 /* TRANS: %s is a building or wonder */
817 _("Prevented by %s in the city or a trade partner "
818 "(unless it is obsolete)."),
820 (preq->source.value.building));
821 } else {
823 /* TRANS: %s is a building or wonder */
824 _("Prevented by %s in the city or a trade partner."),
826 (preq->source.value.building));
827 }
828 }
829 return TRUE;
830 case REQ_RANGE_CITY:
831 fc_strlcat(buf, prefix, bufsz);
832 if (preq->present) {
833 if (preq->source.kind == VUT_IMPROVEMENT
834 && can_improvement_go_obsolete(preq->source.value.building)) {
835 /* Should only apply to wonders */
837 /* TRANS: %s is a building or wonder */
838 _("Requires %s in the city (and not yet obsolete)."),
840 (preq->source.value.building));
841 } else {
843 /* TRANS: %s is a building or wonder */
844 _("Requires %s in the city."),
846 (preq->source.value.building));
847 }
848 } else {
849 if (preq->source.kind == VUT_IMPROVEMENT
850 && can_improvement_go_obsolete(preq->source.value.building)) {
851 /* Should only apply to wonders */
853 /* TRANS: %s is a building or wonder */
854 _("Prevented by %s in the city (unless it is "
855 "obsolete)."),
857 (preq->source.value.building));
858 } else {
860 /* TRANS: %s is a building or wonder */
861 _("Prevented by %s in the city."),
863 (preq->source.value.building));
864 }
865 }
866 return TRUE;
867 case REQ_RANGE_LOCAL:
868 fc_strlcat(buf, prefix, bufsz);
869 if (preq->present) {
871 _("Only applies to \"%s\" buildings."),
873 (preq->source.value.building));
874 } else {
876 _("Does not apply to \"%s\" buildings."),
878 (preq->source.value.building));
879 }
880 return TRUE;
881 case REQ_RANGE_TILE:
882 fc_strlcat(buf, prefix, bufsz);
883 if (preq->present) {
885 _("Requires \"%s\" building in a city on the tile."),
887 (preq->source.value.building));
888 } else {
890 _("Prevented by \"%s\" building in a city on the tile."),
892 (preq->source.value.building));
893 }
894 return TRUE;
897 case REQ_RANGE_COUNT:
898 /* Not supported. */
899 break;
900 }
901 break;
902
903 case VUT_EXTRA:
904 switch (preq->range) {
905 case REQ_RANGE_LOCAL:
906 fc_strlcat(buf, prefix, bufsz);
907 if (preq->present) {
909 _("Only applies to \"%s\" extras."),
910 extra_name_translation(preq->source.value.extra));
911 } else {
913 _("Does not apply to \"%s\" extras."),
914 extra_name_translation(preq->source.value.extra));
915 }
916 return TRUE;
917 case REQ_RANGE_TILE:
918 fc_strlcat(buf, prefix, bufsz);
919 if (preq->present) {
921 Q_("?extra:Requires %s on the tile."),
922 extra_name_translation(preq->source.value.extra));
923 } else {
925 Q_("?extra:Prevented by %s on the tile."),
926 extra_name_translation(preq->source.value.extra));
927 }
928 return TRUE;
930 fc_strlcat(buf, prefix, bufsz);
931 if (preq->present) {
933 Q_("?extra:Requires %s on the tile or a cardinally "
934 "adjacent tile."),
935 extra_name_translation(preq->source.value.extra));
936 } else {
938 Q_("?extra:Prevented by %s on the tile or any cardinally "
939 "adjacent tile."),
940 extra_name_translation(preq->source.value.extra));
941 }
942 return TRUE;
944 fc_strlcat(buf, prefix, bufsz);
945 if (preq->present) {
947 Q_("?extra:Requires %s on the tile or an adjacent "
948 "tile."),
949 extra_name_translation(preq->source.value.extra));
950 } else {
952 Q_("?extra:Prevented by %s on the tile or any adjacent "
953 "tile."),
954 extra_name_translation(preq->source.value.extra));
955 }
956 return TRUE;
957 case REQ_RANGE_CITY:
958 fc_strlcat(buf, prefix, bufsz);
959 if (preq->present) {
961 Q_("?extra:Requires %s on a tile within the city "
962 "radius."),
963 extra_name_translation(preq->source.value.extra));
964 } else {
966 Q_("?extra:Prevented by %s on any tile within the city "
967 "radius."),
968 extra_name_translation(preq->source.value.extra));
969 }
970 return TRUE;
972 fc_strlcat(buf, prefix, bufsz);
973 if (preq->present) {
975 Q_("?extra:Requires %s on a tile within the city "
976 "radius, or the city radius of a trade partner."),
977 extra_name_translation(preq->source.value.extra));
978 } else {
980 Q_("?extra:Prevented by %s on any tile within the city "
981 "radius or the city radius of a trade partner."),
982 extra_name_translation(preq->source.value.extra));
983 }
984 return TRUE;
986 case REQ_RANGE_PLAYER:
987 case REQ_RANGE_TEAM:
989 case REQ_RANGE_WORLD:
990 case REQ_RANGE_COUNT:
991 /* Not supported. */
992 break;
993 }
994 break;
995
996 case VUT_TILEDEF:
997 switch (preq->range) {
998 case REQ_RANGE_LOCAL:
999 fc_strlcat(buf, prefix, bufsz);
1000 if (preq->present) {
1002 _("Only applies to \"%s\" tiledef."),
1003 tiledef_name_translation(preq->source.value.tiledef));
1004 } else {
1006 _("Does not apply to \"%s\" tiledef."),
1007 tiledef_name_translation(preq->source.value.tiledef));
1008 }
1009 return TRUE;
1010 case REQ_RANGE_TILE:
1011 fc_strlcat(buf, prefix, bufsz);
1012 if (preq->present) {
1014 Q_("?tiledef:Requires %s on the tile."),
1015 tiledef_name_translation(preq->source.value.tiledef));
1016 } else {
1018 Q_("?tiledef:Prevented by %s on the tile."),
1019 tiledef_name_translation(preq->source.value.tiledef));
1020 }
1021 return TRUE;
1023 fc_strlcat(buf, prefix, bufsz);
1024 if (preq->present) {
1026 Q_("?tiledef:Requires %s on the tile or a cardinally "
1027 "adjacent tile."),
1028 tiledef_name_translation(preq->source.value.tiledef));
1029 } else {
1031 Q_("?tiledef:Prevented by %s on the tile or any cardinally "
1032 "adjacent tile."),
1033 tiledef_name_translation(preq->source.value.tiledef));
1034 }
1035 return TRUE;
1036 case REQ_RANGE_ADJACENT:
1037 fc_strlcat(buf, prefix, bufsz);
1038 if (preq->present) {
1040 Q_("?tiledef:Requires %s on the tile or an adjacent "
1041 "tile."),
1042 tiledef_name_translation(preq->source.value.tiledef));
1043 } else {
1045 Q_("?tiledef:Prevented by %s on the tile or any adjacent "
1046 "tile."),
1047 tiledef_name_translation(preq->source.value.tiledef));
1048 }
1049 return TRUE;
1050 case REQ_RANGE_CITY:
1051 fc_strlcat(buf, prefix, bufsz);
1052 if (preq->present) {
1054 Q_("?tiledef:Requires %s on a tile within the city "
1055 "radius."),
1056 tiledef_name_translation(preq->source.value.tiledef));
1057 } else {
1059 Q_("?tiledef:Prevented by %s on any tile within the city "
1060 "radius."),
1061 tiledef_name_translation(preq->source.value.tiledef));
1062 }
1063 return TRUE;
1065 fc_strlcat(buf, prefix, bufsz);
1066 if (preq->present) {
1068 Q_("?tiledef:Requires %s on a tile within the city "
1069 "radius, or the city radius of a trade partner."),
1070 tiledef_name_translation(preq->source.value.tiledef));
1071 } else {
1073 Q_("?tiledef:Prevented by %s on any tile within the city "
1074 "radius or the city radius of a trade partner."),
1075 tiledef_name_translation(preq->source.value.tiledef));
1076 }
1077 return TRUE;
1079 case REQ_RANGE_PLAYER:
1080 case REQ_RANGE_TEAM:
1081 case REQ_RANGE_ALLIANCE:
1082 case REQ_RANGE_WORLD:
1083 case REQ_RANGE_COUNT:
1084 /* Not supported. */
1085 break;
1086 }
1087 break;
1088
1089 case VUT_GOOD:
1090 switch (preq->range) {
1091 case REQ_RANGE_CITY:
1092 fc_strlcat(buf, prefix, bufsz);
1093 if (preq->present) {
1094 cat_snprintf(buf, bufsz, Q_("?good:Requires import of %s ."),
1095 goods_name_translation(preq->source.value.good));
1096 } else {
1097 cat_snprintf(buf, bufsz, Q_("?goods:Prevented by import of %s."),
1098 goods_name_translation(preq->source.value.good));
1099 }
1100 return TRUE;
1101 case REQ_RANGE_LOCAL:
1102 case REQ_RANGE_TILE:
1104 case REQ_RANGE_ADJACENT:
1107 case REQ_RANGE_PLAYER:
1108 case REQ_RANGE_TEAM:
1109 case REQ_RANGE_ALLIANCE:
1110 case REQ_RANGE_WORLD:
1111 case REQ_RANGE_COUNT:
1112 /* Not supported. */
1113 break;
1114 }
1115 break;
1116
1117 case VUT_TERRAIN:
1118 switch (preq->range) {
1119 case REQ_RANGE_TILE:
1120 fc_strlcat(buf, prefix, bufsz);
1121 if (preq->present) {
1122 cat_snprintf(buf, bufsz, Q_("?terrain:Requires %s on the tile."),
1123 terrain_name_translation(preq->source.value.terrain));
1124 } else {
1125 cat_snprintf(buf, bufsz, Q_("?terrain:Prevented by %s on the tile."),
1126 terrain_name_translation(preq->source.value.terrain));
1127 }
1128 return TRUE;
1130 fc_strlcat(buf, prefix, bufsz);
1131 if (preq->present) {
1133 Q_("?terrain:Requires %s on the tile or a cardinally "
1134 "adjacent tile."),
1135 terrain_name_translation(preq->source.value.terrain));
1136 } else {
1138 Q_("?terrain:Prevented by %s on the tile or any "
1139 "cardinally adjacent tile."),
1140 terrain_name_translation(preq->source.value.terrain));
1141 }
1142 return TRUE;
1143 case REQ_RANGE_ADJACENT:
1144 fc_strlcat(buf, prefix, bufsz);
1145 if (preq->present) {
1147 Q_("?terrain:Requires %s on the tile or an adjacent "
1148 "tile."),
1149 terrain_name_translation(preq->source.value.terrain));
1150 } else {
1152 Q_("?terrain:Prevented by %s on the tile or any "
1153 "adjacent tile."),
1154 terrain_name_translation(preq->source.value.terrain));
1155 }
1156 return TRUE;
1157 case REQ_RANGE_CITY:
1158 fc_strlcat(buf, prefix, bufsz);
1159 if (preq->present) {
1161 Q_("?terrain:Requires %s on a tile within the city "
1162 "radius."),
1163 terrain_name_translation(preq->source.value.terrain));
1164 } else {
1166 Q_("?terrain:Prevented by %s on any tile within the city "
1167 "radius."),
1168 terrain_name_translation(preq->source.value.terrain));
1169 }
1170 return TRUE;
1172 fc_strlcat(buf, prefix, bufsz);
1173 if (preq->present) {
1175 Q_("?terrain:Requires %s on a tile within the city "
1176 "radius, or the city radius of a trade partner."),
1177 terrain_name_translation(preq->source.value.terrain));
1178 } else {
1180 Q_("?terrain:Prevented by %s on any tile within the city "
1181 "radius or the city radius of a trade partner."),
1182 terrain_name_translation(preq->source.value.terrain));
1183 }
1184 return TRUE;
1186 case REQ_RANGE_PLAYER:
1187 case REQ_RANGE_TEAM:
1188 case REQ_RANGE_ALLIANCE:
1189 case REQ_RANGE_WORLD:
1190 case REQ_RANGE_LOCAL:
1191 case REQ_RANGE_COUNT:
1192 /* Not supported. */
1193 break;
1194 }
1195 break;
1196
1197 case VUT_NATION:
1198 switch (preq->range) {
1199 case REQ_RANGE_PLAYER:
1200 fc_strlcat(buf, prefix, bufsz);
1201 if (preq->present) {
1203 /* TRANS: "... playing as the Swedes." */
1204 _("Requires that you are playing as the %s."),
1205 nation_plural_translation(preq->source.value.nation));
1206 } else {
1208 /* TRANS: "... playing as the Turks." */
1209 _("Requires that you are not playing as the %s."),
1210 nation_plural_translation(preq->source.value.nation));
1211 }
1212 return TRUE;
1213 case REQ_RANGE_TEAM:
1214 fc_strlcat(buf, prefix, bufsz);
1215 if (preq->present) {
1217 /* TRANS: "... same team as the Indonesians." */
1218 _("Requires that you are on the same team as "
1219 "the %s."),
1220 nation_plural_translation(preq->source.value.nation));
1221 } else {
1223 /* TRANS: "... same team as the Greeks." */
1224 _("Requires that you are not on the same team as "
1225 "the %s."),
1226 nation_plural_translation(preq->source.value.nation));
1227 }
1228 return TRUE;
1229 case REQ_RANGE_ALLIANCE:
1230 fc_strlcat(buf, prefix, bufsz);
1231 if (preq->present) {
1233 /* TRANS: "... allied with the Koreans." */
1234 _("Requires that you are allied with the %s."),
1235 nation_plural_translation(preq->source.value.nation));
1236 } else {
1238 /* TRANS: "... allied with the Danes." */
1239 _("Requires that you are not allied with the %s."),
1240 nation_plural_translation(preq->source.value.nation));
1241 }
1242 return TRUE;
1243 case REQ_RANGE_WORLD:
1244 fc_strlcat(buf, prefix, bufsz);
1245 if (preq->survives) {
1246 if (preq->present) {
1248 /* TRANS: "Requires the Apaches to have ..." */
1249 _("Requires the %s to have been in the game."),
1250 nation_plural_translation(preq->source.value.nation));
1251 } else {
1253 /* TRANS: "Requires the Celts never to have ..." */
1254 _("Requires the %s never to have been in the "
1255 "game."),
1256 nation_plural_translation(preq->source.value.nation));
1257 }
1258 } else {
1259 if (preq->present) {
1261 /* TRANS: "Requires the Belgians in the game." */
1262 _("Requires the %s in the game."),
1263 nation_plural_translation(preq->source.value.nation));
1264 } else {
1266 /* TRANS: "Requires that the Russians are not ... */
1267 _("Requires that the %s are not in the game."),
1268 nation_plural_translation(preq->source.value.nation));
1269 }
1270 }
1271 return TRUE;
1272 case REQ_RANGE_LOCAL:
1273 case REQ_RANGE_TILE:
1275 case REQ_RANGE_ADJACENT:
1276 case REQ_RANGE_CITY:
1279 case REQ_RANGE_COUNT:
1280 /* Not supported. */
1281 break;
1282 }
1283 break;
1284
1285 case VUT_NATIONGROUP:
1286 switch (preq->range) {
1287 case REQ_RANGE_PLAYER:
1288 fc_strlcat(buf, prefix, bufsz);
1289 if (preq->present) {
1291 /* TRANS: nation group: "... playing African nation." */
1292 _("Requires that you are playing %s nation."),
1293 nation_group_name_translation(preq->source.value.nationgroup));
1294 } else {
1296 /* TRANS: nation group: "... playing Imaginary nation." */
1297 _("Prevented if you are playing %s nation."),
1298 nation_group_name_translation(preq->source.value.nationgroup));
1299 }
1300 return TRUE;
1301 case REQ_RANGE_TEAM:
1302 fc_strlcat(buf, prefix, bufsz);
1303 if (preq->present) {
1305 /* TRANS: nation group: "Requires Medieval nation ..." */
1306 _("Requires %s nation on your team."),
1307 nation_group_name_translation(preq->source.value.nationgroup));
1308 } else {
1310 /* TRANS: nation group: "Prevented by Medieval nation ..." */
1311 _("Prevented by %s nation on your team."),
1312 nation_group_name_translation(preq->source.value.nationgroup));
1313 }
1314 return TRUE;
1315 case REQ_RANGE_ALLIANCE:
1316 fc_strlcat(buf, prefix, bufsz);
1317 if (preq->present) {
1319 /* TRANS: nation group: "Requires Modern nation ..." */
1320 _("Requires %s nation in alliance with you."),
1321 nation_group_name_translation(preq->source.value.nationgroup));
1322 } else {
1324 /* TRANS: nation group: "Prevented by Modern nation ..." */
1325 _("Prevented if %s nation is in alliance with you."),
1326 nation_group_name_translation(preq->source.value.nationgroup));
1327 }
1328 return TRUE;
1329 case REQ_RANGE_WORLD:
1330 fc_strlcat(buf, prefix, bufsz);
1331 if (preq->present) {
1333 /* TRANS: nation group: "Requires Asian nation ..." */
1334 _("Requires %s nation in the game."),
1335 nation_group_name_translation(preq->source.value.nationgroup));
1336 } else {
1338 /* TRANS: nation group: "Prevented by Asian nation ..." */
1339 _("Prevented by %s nation in the game."),
1340 nation_group_name_translation(preq->source.value.nationgroup));
1341 }
1342 return TRUE;
1343 case REQ_RANGE_LOCAL:
1344 case REQ_RANGE_TILE:
1346 case REQ_RANGE_ADJACENT:
1347 case REQ_RANGE_CITY:
1350 case REQ_RANGE_COUNT:
1351 /* Not supported. */
1352 break;
1353 }
1354 break;
1355
1356 case VUT_STYLE:
1357 if (preq->range != REQ_RANGE_PLAYER) {
1358 break;
1359 }
1360 fc_strlcat(buf, prefix, bufsz);
1361 if (preq->present) {
1363 /* TRANS: "Requires that you are playing Asian style
1364 * nation." */
1365 _("Requires that you are playing %s style nation."),
1366 style_name_translation(preq->source.value.style));
1367 } else {
1369 /* TRANS: "Requires that you are not playing Classical
1370 * style nation." */
1371 _("Requires that you are not playing %s style nation."),
1372 style_name_translation(preq->source.value.style));
1373 }
1374 return TRUE;
1375
1376 case VUT_NATIONALITY:
1377 switch (preq->range) {
1379 fc_strlcat(buf, prefix, bufsz);
1380 if (preq->present) {
1382 /* TRANS: "Requires at least one Barbarian citizen ..." */
1383 _("Requires at least one %s citizen in the city or a "
1384 "trade partner."),
1385 nation_adjective_translation(preq->source.value.nationality));
1386 } else {
1388 /* TRANS: "... no Pirate citizens ..." */
1389 _("Requires that there are no %s citizens in "
1390 "the city or any trade partners."),
1391 nation_adjective_translation(preq->source.value.nationality));
1392 }
1393 return TRUE;
1394 case REQ_RANGE_CITY:
1395 fc_strlcat(buf, prefix, bufsz);
1396 if (preq->present) {
1398 /* TRANS: "Requires at least one Barbarian citizen ..." */
1399 _("Requires at least one %s citizen in the city."),
1400 nation_adjective_translation(preq->source.value.nationality));
1401 } else {
1403 /* TRANS: "... no Pirate citizens ..." */
1404 _("Requires that there are no %s citizens in "
1405 "the city."),
1406 nation_adjective_translation(preq->source.value.nationality));
1407 }
1408 return TRUE;
1409 case REQ_RANGE_WORLD:
1410 case REQ_RANGE_ALLIANCE:
1411 case REQ_RANGE_TEAM:
1412 case REQ_RANGE_PLAYER:
1413 case REQ_RANGE_LOCAL:
1414 case REQ_RANGE_TILE:
1416 case REQ_RANGE_ADJACENT:
1418 case REQ_RANGE_COUNT:
1419 /* Not supported. */
1420 break;
1421 }
1422 break;
1423
1424 case VUT_ORIGINAL_OWNER:
1425 switch (preq->range) {
1426 case REQ_RANGE_CITY:
1427 fc_strlcat(buf, prefix, bufsz);
1428 if (preq->present) {
1430 _("Requires city to be founded by %s."),
1431 nation_adjective_translation(preq->source.value.origowner));
1432 } else {
1434 _("Requires that city was not originally owned by %s."),
1435 nation_adjective_translation(preq->source.value.origowner));
1436 }
1437 return TRUE;
1439 case REQ_RANGE_WORLD:
1440 case REQ_RANGE_ALLIANCE:
1441 case REQ_RANGE_TEAM:
1442 case REQ_RANGE_PLAYER:
1443 case REQ_RANGE_LOCAL:
1444 case REQ_RANGE_TILE:
1446 case REQ_RANGE_ADJACENT:
1448 case REQ_RANGE_COUNT:
1449 /* Not supported. */
1450 break;
1451 }
1452 break;
1453
1454 case VUT_DIPLREL:
1455 switch (preq->range) {
1456 case REQ_RANGE_PLAYER:
1457 fc_strlcat(buf, prefix, bufsz);
1458 if (preq->present) {
1460 /* TRANS: in this and following strings, '%s' can be one
1461 * of a wide range of relationships; e.g., 'Peace',
1462 * 'Never met', 'Foreign', 'Hosts embassy',
1463 * 'Provided Casus Belli' */
1464 _("Requires that you have the relationship '%s' with at "
1465 "least one other living player."),
1466 diplrel_name_translation(preq->source.value.diplrel));
1467 } else {
1469 _("Requires that you do not have the relationship '%s' "
1470 "with any living player."),
1471 diplrel_name_translation(preq->source.value.diplrel));
1472 }
1473 return TRUE;
1474 case REQ_RANGE_TEAM:
1475 fc_strlcat(buf, prefix, bufsz);
1476 if (preq->present) {
1478 _("Requires that somebody on your team has the "
1479 "relationship '%s' with at least one other living "
1480 "player."),
1481 diplrel_name_translation(preq->source.value.diplrel));
1482 } else {
1484 _("Requires that nobody on your team has the "
1485 "relationship '%s' with any living player."),
1486 diplrel_name_translation(preq->source.value.diplrel));
1487 }
1488 return TRUE;
1489 case REQ_RANGE_ALLIANCE:
1490 fc_strlcat(buf, prefix, bufsz);
1491 if (preq->present) {
1493 _("Requires that somebody in your alliance has the "
1494 "relationship '%s' with at least one other living "
1495 "player."),
1496 diplrel_name_translation(preq->source.value.diplrel));
1497 } else {
1499 _("Requires that nobody in your alliance has the "
1500 "relationship '%s' with any living player."),
1501 diplrel_name_translation(preq->source.value.diplrel));
1502 }
1503 return TRUE;
1504 case REQ_RANGE_WORLD:
1505 fc_strlcat(buf, prefix, bufsz);
1506 if (preq->present) {
1508 _("Requires the relationship '%s' between two living "
1509 "players."),
1510 diplrel_name_translation(preq->source.value.diplrel));
1511 } else {
1513 _("Requires that no two living players have the "
1514 "relationship '%s'."),
1515 diplrel_name_translation(preq->source.value.diplrel));
1516 }
1517 return TRUE;
1518 case REQ_RANGE_LOCAL:
1519 fc_strlcat(buf, prefix, bufsz);
1520 if (preq->present) {
1522 _("Requires that you have the relationship '%s' with the "
1523 "other player."),
1524 diplrel_name_translation(preq->source.value.diplrel));
1525 } else {
1527 _("Requires that you do not have the relationship '%s' "
1528 "with the other player."),
1529 diplrel_name_translation(preq->source.value.diplrel));
1530 }
1531 return TRUE;
1532 case REQ_RANGE_TILE:
1534 case REQ_RANGE_ADJACENT:
1535 case REQ_RANGE_CITY:
1538 case REQ_RANGE_COUNT:
1539 /* Not supported. */
1540 break;
1541 }
1542 break;
1543
1544 case VUT_DIPLREL_TILE:
1545 switch (preq->range) {
1546 case REQ_RANGE_PLAYER:
1547 fc_strlcat(buf, prefix, bufsz);
1548 if (preq->present) {
1550 /* TRANS: in this and following strings, '%s' can be one
1551 * of a wide range of relationships; e.g., 'Peace',
1552 * 'Never met', 'Foreign', 'Hosts embassy',
1553 * 'Provided Casus Belli' */
1554 _("Requires that the tile owner has the relationship"
1555 " '%s' with at least one other living player."),
1556 diplrel_name_translation(preq->source.value.diplrel));
1557 } else {
1559 _("Requires that the tile owner does not have the"
1560 " relationship '%s' with any living player."),
1561 diplrel_name_translation(preq->source.value.diplrel));
1562 }
1563 return TRUE;
1564 case REQ_RANGE_TEAM:
1565 fc_strlcat(buf, prefix, bufsz);
1566 if (preq->present) {
1568 _("Requires that somebody on the tile owner's team"
1569 " has the relationship '%s' with at least one other"
1570 " living player."),
1571 diplrel_name_translation(preq->source.value.diplrel));
1572 } else {
1574 _("Requires that nobody on the tile owner's team has"
1575 " the relationship '%s' with any living player."),
1576 diplrel_name_translation(preq->source.value.diplrel));
1577 }
1578 return TRUE;
1579 case REQ_RANGE_ALLIANCE:
1580 fc_strlcat(buf, prefix, bufsz);
1581 if (preq->present) {
1583 _("Requires that somebody in the tile owner's alliance"
1584 " has the relationship '%s' with at least one other "
1585 "living player."),
1586 diplrel_name_translation(preq->source.value.diplrel));
1587 } else {
1589 _("Requires that nobody in the tile owner's alliance "
1590 "has the relationship '%s' with any living player."),
1591 diplrel_name_translation(preq->source.value.diplrel));
1592 }
1593 return TRUE;
1594 case REQ_RANGE_LOCAL:
1595 fc_strlcat(buf, prefix, bufsz);
1596 if (preq->present) {
1598 _("Requires that you have the relationship '%s' with"
1599 " the tile owner."),
1600 diplrel_name_translation(preq->source.value.diplrel));
1601 } else {
1603 _("Requires that you do not have the relationship '%s'"
1604 " with the tile owner."),
1605 diplrel_name_translation(preq->source.value.diplrel));
1606 }
1607 return TRUE;
1608 case REQ_RANGE_TILE:
1610 case REQ_RANGE_ADJACENT:
1611 case REQ_RANGE_CITY:
1614 case REQ_RANGE_WORLD:
1615 case REQ_RANGE_COUNT:
1616 /* Not supported. */
1617 break;
1618 }
1619 break;
1620
1621 case VUT_DIPLREL_TILE_O:
1622 switch (preq->range) {
1623 case REQ_RANGE_LOCAL:
1624 fc_strlcat(buf, prefix, bufsz);
1625 if (preq->present) {
1627 _("Requires that the tile owner has the relationship"
1628 " '%s' with the other player."),
1629 diplrel_name_translation(preq->source.value.diplrel));
1630 } else {
1632 _("Requires that the tile owner does not have the"
1633 " relationship '%s' with the other player."),
1634 diplrel_name_translation(preq->source.value.diplrel));
1635 }
1636 return TRUE;
1637 case REQ_RANGE_TILE:
1639 case REQ_RANGE_ADJACENT:
1640 case REQ_RANGE_CITY:
1643 case REQ_RANGE_PLAYER:
1644 case REQ_RANGE_TEAM:
1645 case REQ_RANGE_ALLIANCE:
1646 case REQ_RANGE_WORLD:
1647 case REQ_RANGE_COUNT:
1648 /* Not supported. */
1649 break;
1650 }
1651 break;
1652
1654 switch (preq->range) {
1655 case REQ_RANGE_PLAYER:
1656 fc_strlcat(buf, prefix, bufsz);
1657 if (preq->present) {
1659 /* TRANS: in this and following strings, '%s' can be one
1660 * of a wide range of relationships; e.g., 'Peace',
1661 * 'Never met', 'Foreign', 'Hosts embassy',
1662 * 'Provided Casus Belli' */
1663 _("Requires that the tile has at least one unit whose "
1664 "owner has the relationship "
1665 "'%s' with at least one other living player."),
1666 diplrel_name_translation(preq->source.value.diplrel));
1667 } else {
1669 _("Requires that no unit at the tile is owned by a player "
1670 "who has the relationship '%s' with any living player."),
1671 diplrel_name_translation(preq->source.value.diplrel));
1672 }
1673 return TRUE;
1674 case REQ_RANGE_TEAM:
1675 fc_strlcat(buf, prefix, bufsz);
1676 if (preq->present) {
1678 _("Requires that the tile has at least one unit whose "
1679 "owner is on a team where a member "
1680 "has the relationship '%s' with at least one other "
1681 "living player."),
1682 diplrel_name_translation(preq->source.value.diplrel));
1683 } else {
1685 _("Requires that no unit at the tile is owned by a player "
1686 "who is on a team where a member "
1687 "has the relationship '%s' with at least one other "
1688 "living player."),
1689 diplrel_name_translation(preq->source.value.diplrel));
1690 }
1691 return TRUE;
1692 case REQ_RANGE_ALLIANCE:
1693 fc_strlcat(buf, prefix, bufsz);
1694 if (preq->present) {
1696 _("Requires that the tile has at least one unit whose "
1697 "owner is allied to someone that "
1698 "has the relationship '%s' with at least one other "
1699 "living player."),
1700 diplrel_name_translation(preq->source.value.diplrel));
1701 } else {
1703 _("Requires that no unit at the tile is owned by a player "
1704 "allied to someone that "
1705 "has the relationship '%s' with any living player."),
1706 diplrel_name_translation(preq->source.value.diplrel));
1707 }
1708 return TRUE;
1709 case REQ_RANGE_LOCAL:
1710 fc_strlcat(buf, prefix, bufsz);
1711 if (preq->present) {
1713 _("Requires that you have the relationship '%s' with "
1714 "the owner of at least one unit at the tile."),
1715 diplrel_name_translation(preq->source.value.diplrel));
1716 } else {
1718 _("Requires that you do not have the relationship '%s' "
1719 "with the owner of any unit at the tile."),
1720 diplrel_name_translation(preq->source.value.diplrel));
1721 }
1722 return TRUE;
1723 case REQ_RANGE_TILE:
1725 case REQ_RANGE_ADJACENT:
1726 case REQ_RANGE_CITY:
1729 case REQ_RANGE_WORLD:
1730 case REQ_RANGE_COUNT:
1731 /* Not supported. */
1732 break;
1733 }
1734 break;
1735
1737 switch (preq->range) {
1738 case REQ_RANGE_LOCAL:
1739 fc_strlcat(buf, prefix, bufsz);
1740 if (preq->present) {
1742 _("Requires that the tile has at least one unit whose "
1743 "owner has the relationship '%s' with the other player."),
1744 diplrel_name_translation(preq->source.value.diplrel));
1745 } else {
1747 _("Requires that no unit at the tile is owned by a player "
1748 "who has the relationship '%s' with the other player."),
1749 diplrel_name_translation(preq->source.value.diplrel));
1750 }
1751 return TRUE;
1752 case REQ_RANGE_TILE:
1754 case REQ_RANGE_ADJACENT:
1755 case REQ_RANGE_CITY:
1758 case REQ_RANGE_PLAYER:
1759 case REQ_RANGE_TEAM:
1760 case REQ_RANGE_ALLIANCE:
1761 case REQ_RANGE_WORLD:
1762 case REQ_RANGE_COUNT:
1763 /* Not supported. */
1764 break;
1765 }
1766 break;
1767
1768 case VUT_UTYPE:
1769 switch (preq->range) {
1770 case REQ_RANGE_LOCAL:
1771 fc_strlcat(buf, prefix, bufsz);
1772 if (preq->present) {
1773 /* TRANS: %s is a single kind of unit (e.g., "Settlers"). */
1774 cat_snprintf(buf, bufsz, Q_("?unit:Requires %s."),
1775 utype_name_translation(preq->source.value.utype));
1776 } else {
1777 /* TRANS: %s is a single kind of unit (e.g., "Settlers"). */
1778 cat_snprintf(buf, bufsz, Q_("?unit:Does not apply to %s."),
1779 utype_name_translation(preq->source.value.utype));
1780 }
1781 return TRUE;
1782 case REQ_RANGE_TILE:
1784 case REQ_RANGE_ADJACENT:
1785 case REQ_RANGE_CITY:
1788 case REQ_RANGE_PLAYER:
1789 case REQ_RANGE_TEAM:
1790 case REQ_RANGE_ALLIANCE:
1791 case REQ_RANGE_WORLD:
1792 case REQ_RANGE_COUNT:
1793 /* Not supported. */
1794 break;
1795 }
1796 break;
1797
1798 case VUT_UTFLAG:
1799 switch (preq->range) {
1800 case REQ_RANGE_LOCAL:
1801 {
1802 struct astring astr = ASTRING_INIT;
1803
1804 /* Unit type flags mean nothing to users. Explicitly list the unit
1805 * types with those flags. */
1806 if (role_units_translations(&astr, preq->source.value.unitflag,
1807 TRUE)) {
1808 fc_strlcat(buf, prefix, bufsz);
1809 if (preq->present) {
1810 /* TRANS: %s is a list of unit types separated by "or". */
1811 cat_snprintf(buf, bufsz, Q_("?ulist:Requires %s."),
1812 astr_str(&astr));
1813 } else {
1814 /* TRANS: %s is a list of unit types separated by "or". */
1815 cat_snprintf(buf, bufsz, Q_("?ulist:Does not apply to %s."),
1816 astr_str(&astr));
1817 }
1818 astr_free(&astr);
1819 return TRUE;
1820 }
1821 }
1822 break;
1823 case REQ_RANGE_TILE:
1825 case REQ_RANGE_ADJACENT:
1826 case REQ_RANGE_CITY:
1829 case REQ_RANGE_PLAYER:
1830 case REQ_RANGE_TEAM:
1831 case REQ_RANGE_ALLIANCE:
1832 case REQ_RANGE_WORLD:
1833 case REQ_RANGE_COUNT:
1834 /* Not supported. */
1835 break;
1836 }
1837 break;
1838
1839 case VUT_UCLASS:
1840 switch (preq->range) {
1841 case REQ_RANGE_LOCAL:
1842 fc_strlcat(buf, prefix, bufsz);
1843 if (preq->present) {
1844 /* TRANS: %s is a single unit class (e.g., "Air"). */
1845 cat_snprintf(buf, bufsz, Q_("?uclass:Requires %s units."),
1846 uclass_name_translation(preq->source.value.uclass));
1847 } else {
1848 /* TRANS: %s is a single unit class (e.g., "Air"). */
1849 cat_snprintf(buf, bufsz, Q_("?uclass:Does not apply to %s units."),
1850 uclass_name_translation(preq->source.value.uclass));
1851 }
1852 return TRUE;
1853 case REQ_RANGE_TILE:
1855 case REQ_RANGE_ADJACENT:
1856 case REQ_RANGE_CITY:
1859 case REQ_RANGE_PLAYER:
1860 case REQ_RANGE_TEAM:
1861 case REQ_RANGE_ALLIANCE:
1862 case REQ_RANGE_WORLD:
1863 case REQ_RANGE_COUNT:
1864 /* Not supported. */
1865 break;
1866 }
1867 break;
1868
1869 case VUT_UCFLAG:
1870 {
1871 const char *classes[uclass_count()];
1872 int i = 0;
1873 bool done = FALSE;
1874 struct astring list = ASTRING_INIT;
1875
1876 unit_class_iterate(uclass) {
1877 if (uclass_has_flag(uclass, preq->source.value.unitclassflag)) {
1878 classes[i++] = uclass_name_translation(uclass);
1879 }
1882
1883 switch (preq->range) {
1884 case REQ_RANGE_LOCAL:
1885 fc_strlcat(buf, prefix, bufsz);
1886 if (preq->present) {
1887 /* TRANS: %s is a list of unit classes separated by "or". */
1888 cat_snprintf(buf, bufsz, Q_("?uclasslist:Requires %s units."),
1889 astr_str(&list));
1890 } else {
1891 /* TRANS: %s is a list of unit classes separated by "or". */
1892 cat_snprintf(buf, bufsz, Q_("?uclasslist:Does not apply to "
1893 "%s units."),
1894 astr_str(&list));
1895 }
1896 done = TRUE;
1897 break;
1898 case REQ_RANGE_TILE:
1900 case REQ_RANGE_ADJACENT:
1901 case REQ_RANGE_CITY:
1904 case REQ_RANGE_PLAYER:
1905 case REQ_RANGE_TEAM:
1906 case REQ_RANGE_ALLIANCE:
1907 case REQ_RANGE_WORLD:
1908 case REQ_RANGE_COUNT:
1909 /* Not supported. */
1910 break;
1911 }
1912 astr_free(&list);
1913 if (done) {
1914 return TRUE;
1915 }
1916 }
1917 break;
1918
1919 case VUT_UNITSTATE:
1920 {
1921 switch (preq->range) {
1922 case REQ_RANGE_LOCAL:
1923 switch (preq->source.value.unit_state) {
1924 case USP_TRANSPORTED:
1925 fc_strlcat(buf, prefix, bufsz);
1926 if (preq->present) {
1928 _("Requires that the unit is transported."));
1929 } else {
1931 _("Requires that the unit isn't transported."));
1932 }
1933 return TRUE;
1934 case USP_LIVABLE_TILE:
1935 fc_strlcat(buf, prefix, bufsz);
1936 if (preq->present) {
1938 _("Requires that the unit is on livable tile."));
1939 } else {
1941 _("Requires that the unit isn't on livable tile."));
1942 }
1943 return TRUE;
1944 case USP_TRANSPORTING:
1945 fc_strlcat(buf, prefix, bufsz);
1946 if (preq->present) {
1948 _("Requires that the unit does transport one or "
1949 "more cargo units."));
1950 } else {
1952 _("Requires that the unit doesn't transport "
1953 "any cargo units."));
1954 }
1955 return TRUE;
1956 case USP_HAS_HOME_CITY:
1957 fc_strlcat(buf, prefix, bufsz);
1958 if (preq->present) {
1960 _("Requires that the unit has a home city."));
1961 } else {
1963 _("Requires that the unit is homeless."));
1964 }
1965 return TRUE;
1966 case USP_NATIVE_TILE:
1967 fc_strlcat(buf, prefix, bufsz);
1968 if (preq->present) {
1970 _("Requires that the unit is on native tile."));
1971 } else {
1973 _("Requires that the unit isn't on native tile."));
1974 }
1975 return TRUE;
1976 case USP_NATIVE_EXTRA:
1977 fc_strlcat(buf, prefix, bufsz);
1978 if (preq->present) {
1980 _("Requires that the unit is in a native extra."));
1981 } else {
1983 _("Requires that the unit isn't in a native extra."));
1984 }
1985 return TRUE;
1987 fc_strlcat(buf, prefix, bufsz);
1988 if (preq->present) {
1990 _("Requires that the unit has moved this turn."));
1991 } else {
1993 _("Requires that the unit hasn't moved this turn."));
1994 }
1995 return TRUE;
1996 case USP_COUNT:
1997 fc_assert_msg(preq->source.value.unit_state != USP_COUNT,
1998 "Invalid unit state property.");
1999 }
2000 break;
2001 case REQ_RANGE_TILE:
2003 case REQ_RANGE_ADJACENT:
2004 case REQ_RANGE_CITY:
2007 case REQ_RANGE_PLAYER:
2008 case REQ_RANGE_TEAM:
2009 case REQ_RANGE_ALLIANCE:
2010 case REQ_RANGE_WORLD:
2011 case REQ_RANGE_COUNT:
2012 /* Not supported. */
2013 break;
2014 }
2015 }
2016 break;
2017
2018 case VUT_ACTIVITY:
2019 {
2020 switch (preq->range) {
2021 case REQ_RANGE_LOCAL:
2022 fc_strlcat(buf, prefix, bufsz);
2023 if (preq->present) {
2025 _("Requires that the unit is performing activity %s."),
2026 Q_(unit_activity_name(preq->source.value.activity)));
2027 } else {
2029 _("Requires that the unit is not performing activity %s."),
2030 Q_(unit_activity_name(preq->source.value.activity)));
2031 }
2032 return TRUE;
2033 case REQ_RANGE_TILE:
2035 case REQ_RANGE_ADJACENT:
2036 case REQ_RANGE_CITY:
2039 case REQ_RANGE_PLAYER:
2040 case REQ_RANGE_TEAM:
2041 case REQ_RANGE_ALLIANCE:
2042 case REQ_RANGE_WORLD:
2043 case REQ_RANGE_COUNT:
2044 /* Not supported. */
2045 break;
2046 }
2047 }
2048 break;
2049
2050 case VUT_MINMOVES:
2051 {
2052 switch (preq->range) {
2053 case REQ_RANGE_LOCAL:
2054 fc_strlcat(buf, prefix, bufsz);
2055 if (preq->present) {
2057 /* TRANS: %s is numeric move points; it may have a
2058 * fractional part ("1 1/3 MP"). */
2059 _("Requires that the unit has at least %s MP left."),
2060 move_points_text(preq->source.value.minmoves, TRUE));
2061 } else {
2063 /* TRANS: %s is numeric move points; it may have a
2064 * fractional part ("1 1/3 MP"). */
2065 _("Requires that the unit has less than %s MP left."),
2066 move_points_text(preq->source.value.minmoves, TRUE));
2067 }
2068 return TRUE;
2069 case REQ_RANGE_TILE:
2071 case REQ_RANGE_ADJACENT:
2072 case REQ_RANGE_CITY:
2075 case REQ_RANGE_PLAYER:
2076 case REQ_RANGE_TEAM:
2077 case REQ_RANGE_ALLIANCE:
2078 case REQ_RANGE_WORLD:
2079 case REQ_RANGE_COUNT:
2080 /* Not supported. */
2081 break;
2082 }
2083 }
2084 break;
2085
2086 case VUT_MINVETERAN:
2087 if (preq->range != REQ_RANGE_LOCAL) {
2088 break;
2089 }
2090 /* FIXME: this would be better with veteran level names, but that's
2091 * potentially unit type dependent. */
2092 fc_strlcat(buf, prefix, bufsz);
2093 if (preq->present) {
2095 PL_("Requires a unit with at least %d veteran level.",
2096 "Requires a unit with at least %d veteran levels.",
2097 preq->source.value.minveteran),
2098 preq->source.value.minveteran);
2099 } else {
2101 PL_("Requires a unit with fewer than %d veteran level.",
2102 "Requires a unit with fewer than %d veteran levels.",
2103 preq->source.value.minveteran),
2104 preq->source.value.minveteran);
2105 }
2106 return TRUE;
2107
2108 case VUT_MINHP:
2109 if (preq->range != REQ_RANGE_LOCAL) {
2110 break;
2111 }
2112
2113 fc_strlcat(buf, prefix, bufsz);
2114 if (preq->present) {
2116 PL_("Requires a unit with at least %d hit point left.",
2117 "Requires a unit with at least %d hit points left.",
2118 preq->source.value.min_hit_points),
2119 preq->source.value.min_hit_points);
2120 } else {
2122 PL_("Requires a unit with fewer than %d hit point "
2123 "left.",
2124 "Requires a unit with fewer than %d hit points "
2125 "left.",
2126 preq->source.value.min_hit_points),
2127 preq->source.value.min_hit_points);
2128 }
2129 return TRUE;
2130
2131 case VUT_OTYPE:
2132 if (preq->range != REQ_RANGE_LOCAL) {
2133 break;
2134 }
2135 fc_strlcat(buf, prefix, bufsz);
2136 if (preq->present) {
2137 /* TRANS: "Applies only to Food." */
2138 cat_snprintf(buf, bufsz, Q_("?output:Applies only to %s."),
2139 get_output_name(preq->source.value.outputtype));
2140 } else {
2141 /* TRANS: "Does not apply to Food." */
2142 cat_snprintf(buf, bufsz, Q_("?output:Does not apply to %s."),
2143 get_output_name(preq->source.value.outputtype));
2144 }
2145 return TRUE;
2146
2147 case VUT_SPECIALIST:
2148 if (preq->range != REQ_RANGE_LOCAL) {
2149 break;
2150 }
2151 fc_strlcat(buf, prefix, bufsz);
2152 if (preq->present) {
2153 /* TRANS: "Applies only to Scientists." */
2154 cat_snprintf(buf, bufsz, Q_("?specialist:Applies only to %s."),
2155 specialist_plural_translation(preq->source.value.specialist));
2156 } else {
2157 /* TRANS: "Does not apply to Scientists." */
2158 cat_snprintf(buf, bufsz, Q_("?specialist:Does not apply to %s."),
2159 specialist_plural_translation(preq->source.value.specialist));
2160 }
2161 return TRUE;
2162
2163 case VUT_MINSIZE:
2164 switch (preq->range) {
2166 fc_strlcat(buf, prefix, bufsz);
2167 if (preq->present) {
2169 PL_("Requires a minimum city size of %d for this "
2170 "city or a trade partner.",
2171 "Requires a minimum city size of %d for this "
2172 "city or a trade partner.",
2173 preq->source.value.minsize),
2174 preq->source.value.minsize);
2175 } else {
2177 PL_("Requires the city size to be less than %d "
2178 "for this city and all trade partners.",
2179 "Requires the city size to be less than %d "
2180 "for this city and all trade partners.",
2181 preq->source.value.minsize),
2182 preq->source.value.minsize);
2183 }
2184 return TRUE;
2185 case REQ_RANGE_CITY:
2186 fc_strlcat(buf, prefix, bufsz);
2187 if (preq->present) {
2189 PL_("Requires a minimum city size of %d.",
2190 "Requires a minimum city size of %d.",
2191 preq->source.value.minsize),
2192 preq->source.value.minsize);
2193 } else {
2195 PL_("Requires the city size to be less than %d.",
2196 "Requires the city size to be less than %d.",
2197 preq->source.value.minsize),
2198 preq->source.value.minsize);
2199 }
2200 return TRUE;
2201 case REQ_RANGE_LOCAL:
2202 case REQ_RANGE_TILE:
2204 case REQ_RANGE_ADJACENT:
2206 case REQ_RANGE_PLAYER:
2207 case REQ_RANGE_TEAM:
2208 case REQ_RANGE_ALLIANCE:
2209 case REQ_RANGE_WORLD:
2210 case REQ_RANGE_COUNT:
2211 /* Not supported. */
2212 break;
2213 }
2214 break;
2215
2216 case VUT_MINCULTURE:
2217 switch (preq->range) {
2218 case REQ_RANGE_CITY:
2219 fc_strlcat(buf, prefix, bufsz);
2220 if (preq->present) {
2222 PL_("Requires a minimum culture of %d in the city.",
2223 "Requires a minimum culture of %d in the city.",
2224 preq->source.value.minculture),
2225 preq->source.value.minculture);
2226 } else {
2228 PL_("Requires the culture in the city to be less "
2229 "than %d.",
2230 "Requires the culture in the city to be less "
2231 "than %d.",
2232 preq->source.value.minculture),
2233 preq->source.value.minculture);
2234 }
2235 return TRUE;
2237 fc_strlcat(buf, prefix, bufsz);
2238 if (preq->present) {
2240 PL_("Requires a minimum culture of %d in this city or "
2241 "a trade partner.",
2242 "Requires a minimum culture of %d in this city or "
2243 "a trade partner.",
2244 preq->source.value.minculture),
2245 preq->source.value.minculture);
2246 } else {
2248 PL_("Requires the culture in this city and all trade "
2249 "partners to be less than %d.",
2250 "Requires the culture in this city and all trade "
2251 "partners to be less than %d.",
2252 preq->source.value.minculture),
2253 preq->source.value.minculture);
2254 }
2255 return TRUE;
2256 case REQ_RANGE_PLAYER:
2257 fc_strlcat(buf, prefix, bufsz);
2258 if (preq->present) {
2260 PL_("Requires your nation to have culture "
2261 "of at least %d.",
2262 "Requires your nation to have culture "
2263 "of at least %d.",
2264 preq->source.value.minculture),
2265 preq->source.value.minculture);
2266 } else {
2268 PL_("Prevented if your nation has culture of "
2269 "%d or more.",
2270 "Prevented if your nation has culture of "
2271 "%d or more.",
2272 preq->source.value.minculture),
2273 preq->source.value.minculture);
2274 }
2275 return TRUE;
2276 case REQ_RANGE_TEAM:
2277 fc_strlcat(buf, prefix, bufsz);
2278 if (preq->present) {
2280 PL_("Requires someone on your team to have culture of "
2281 "at least %d.",
2282 "Requires someone on your team to have culture of "
2283 "at least %d.",
2284 preq->source.value.minculture),
2285 preq->source.value.minculture);
2286 } else {
2288 PL_("Prevented if anyone on your team has culture of "
2289 "%d or more.",
2290 "Prevented if anyone on your team has culture of "
2291 "%d or more.",
2292 preq->source.value.minculture),
2293 preq->source.value.minculture);
2294 }
2295 return TRUE;
2296 case REQ_RANGE_ALLIANCE:
2297 fc_strlcat(buf, prefix, bufsz);
2298 if (preq->present) {
2300 PL_("Requires someone in your current alliance to "
2301 "have culture of at least %d.",
2302 "Requires someone in your current alliance to "
2303 "have culture of at least %d.",
2304 preq->source.value.minculture),
2305 preq->source.value.minculture);
2306 } else {
2308 PL_("Prevented if anyone in your current alliance has "
2309 "culture of %d or more.",
2310 "Prevented if anyone in your current alliance has "
2311 "culture of %d or more.",
2312 preq->source.value.minculture),
2313 preq->source.value.minculture);
2314 }
2315 return TRUE;
2316 case REQ_RANGE_WORLD:
2317 fc_strlcat(buf, prefix, bufsz);
2318 if (preq->present) {
2320 PL_("Requires that some player has culture of at "
2321 "least %d.",
2322 "Requires that some player has culture of at "
2323 "least %d.",
2324 preq->source.value.minculture),
2325 preq->source.value.minculture);
2326 } else {
2328 PL_("Requires that no player has culture of %d "
2329 "or more.",
2330 "Requires that no player has culture of %d "
2331 "or more.",
2332 preq->source.value.minculture),
2333 preq->source.value.minculture);
2334 }
2335 return TRUE;
2336 case REQ_RANGE_LOCAL:
2337 case REQ_RANGE_TILE:
2339 case REQ_RANGE_ADJACENT:
2341 case REQ_RANGE_COUNT:
2342 break;
2343 }
2344 break;
2345
2346 case VUT_MINFOREIGNPCT:
2347 switch (preq->range) {
2348 case REQ_RANGE_CITY:
2349 fc_strlcat(buf, prefix, bufsz);
2350 if (preq->present) {
2352 _("At least %d%% of the citizens of the city "
2353 "must be foreign."),
2354 preq->source.value.minforeignpct);
2355 } else {
2357 _("Less than %d%% of the citizens of the city "
2358 "must be foreign."),
2359 preq->source.value.minforeignpct);
2360 }
2361 return TRUE;
2363 fc_strlcat(buf, prefix, bufsz);
2364 if (preq->present) {
2366 _("At least %d%% of the citizens of the city "
2367 "or some trade partner must be foreign."),
2368 preq->source.value.minforeignpct);
2369 } else {
2371 _("Less than %d%% of the citizens of the city "
2372 "and each trade partner must be foreign."),
2373 preq->source.value.minforeignpct);
2374 }
2375 return TRUE;
2376 case REQ_RANGE_PLAYER:
2377 case REQ_RANGE_TEAM:
2378 case REQ_RANGE_ALLIANCE:
2379 case REQ_RANGE_WORLD:
2380 case REQ_RANGE_LOCAL:
2381 case REQ_RANGE_TILE:
2383 case REQ_RANGE_ADJACENT:
2385 case REQ_RANGE_COUNT:
2386 break;
2387 }
2388 break;
2389
2391 switch (preq->range) {
2392 case REQ_RANGE_TILE:
2393 fc_strlcat(buf, prefix, bufsz);
2394 if (preq->present) {
2396 PL_("At most %d total unit may be present on the tile.",
2397 "At most %d total units may be present on the tile.",
2398 preq->source.value.max_tile_total_units),
2399 preq->source.value.max_tile_total_units);
2400 } else {
2402 PL_("There must be more than %d total unit present on "
2403 "the tile.",
2404 "There must be more than %d total units present on "
2405 "the tile.",
2406 preq->source.value.max_tile_total_units),
2407 preq->source.value.max_tile_total_units);
2408 }
2409 return TRUE;
2411 fc_strlcat(buf, prefix, bufsz);
2412 if (preq->present) {
2414 PL_("The tile or at least one cardinally adjacent tile "
2415 "must have %d total unit or fewer.",
2416 "The tile or at least one cardinally adjacent tile "
2417 "must have %d total units or fewer.",
2418 preq->source.value.max_tile_total_units),
2419 preq->source.value.max_tile_total_units);
2420 } else {
2422 PL_("The tile and all cardinally adjacent tiles must "
2423 "have more than %d total unit each.",
2424 "The tile and all cardinally adjacent tiles must "
2425 "have more than %d total units each.",
2426 preq->source.value.max_tile_total_units),
2427 preq->source.value.max_tile_total_units);
2428 }
2429 return TRUE;
2430 case REQ_RANGE_ADJACENT:
2431 fc_strlcat(buf, prefix, bufsz);
2432 if (preq->present) {
2434 PL_("The tile or at least one adjacent tile must have "
2435 "%d total unit or fewer.",
2436 "The tile or at least one adjacent tile must have "
2437 "%d total units or fewer.",
2438 preq->source.value.max_tile_total_units),
2439 preq->source.value.max_tile_total_units);
2440 } else {
2442 PL_("The tile and all adjacent tiles must have more "
2443 "than %d total unit each.",
2444 "The tile and all adjacent tiles must have more "
2445 "than %d total units each.",
2446 preq->source.value.max_tile_total_units),
2447 preq->source.value.max_tile_total_units);
2448 }
2449 return TRUE;
2450 case REQ_RANGE_CITY:
2453 case REQ_RANGE_PLAYER:
2454 case REQ_RANGE_TEAM:
2455 case REQ_RANGE_ALLIANCE:
2456 case REQ_RANGE_WORLD:
2457 case REQ_RANGE_LOCAL:
2458 case REQ_RANGE_COUNT:
2459 /* Not supported. */
2460 break;
2461 }
2462 break;
2463
2465 switch (preq->range) {
2466 case REQ_RANGE_TILE:
2467 fc_strlcat(buf, prefix, bufsz);
2468 if (preq->present) {
2470 PL_("At most %d untransported unit may be present on the tile.",
2471 "At most %d untransported units may be present on the tile.",
2472 preq->source.value.max_tile_top_units),
2473 preq->source.value.max_tile_top_units);
2474 } else {
2476 PL_("There must be more than %d untransported unit present on "
2477 "the tile.",
2478 "There must be more than %d untransported units present on "
2479 "the tile.",
2480 preq->source.value.max_tile_top_units),
2481 preq->source.value.max_tile_top_units);
2482 }
2483 return TRUE;
2485 fc_strlcat(buf, prefix, bufsz);
2486 if (preq->present) {
2488 PL_("The tile or at least one cardinally adjacent tile "
2489 "must have %d untransporte unit or fewer.",
2490 "The tile or at least one cardinally adjacent tile "
2491 "must have %d untransporte units or fewer.",
2492 preq->source.value.max_tile_top_units),
2493 preq->source.value.max_tile_top_units);
2494 } else {
2496 PL_("The tile and all cardinally adjacent tiles must "
2497 "have more than %d untransported unit each.",
2498 "The tile and all cardinally adjacent tiles must "
2499 "have more than %d untransported units each.",
2500 preq->source.value.max_tile_top_units),
2501 preq->source.value.max_tile_top_units);
2502 }
2503 return TRUE;
2504 case REQ_RANGE_ADJACENT:
2505 fc_strlcat(buf, prefix, bufsz);
2506 if (preq->present) {
2508 PL_("The tile or at least one adjacent tile must have "
2509 "%d untransported unit or fewer.",
2510 "The tile or at least one adjacent tile must have "
2511 "%d untransported units or fewer.",
2512 preq->source.value.max_tile_top_units),
2513 preq->source.value.max_tile_top_units);
2514 } else {
2516 PL_("The tile and all adjacent tiles must have "
2517 "more than %d untransported unit each.",
2518 "The tile and all adjacent tiles must have "
2519 "more than %d untransported units each.",
2520 preq->source.value.max_tile_top_units),
2521 preq->source.value.max_tile_top_units);
2522 }
2523 return TRUE;
2524 case REQ_RANGE_CITY:
2527 case REQ_RANGE_PLAYER:
2528 case REQ_RANGE_TEAM:
2529 case REQ_RANGE_ALLIANCE:
2530 case REQ_RANGE_WORLD:
2531 case REQ_RANGE_LOCAL:
2532 case REQ_RANGE_COUNT:
2533 /* Not supported. */
2534 break;
2535 }
2536 break;
2537
2538 case VUT_AI_LEVEL:
2539 if (preq->range != REQ_RANGE_PLAYER) {
2540 break;
2541 }
2542 fc_strlcat(buf, prefix, bufsz);
2543 if (preq->present) {
2545 /* TRANS: AI level (e.g., "Handicapped") */
2546 _("Applies to %s AI players."),
2547 ai_level_translated_name(preq->source.value.ai_level));
2548 } else {
2550 /* TRANS: AI level (e.g., "Cheating") */
2551 _("Does not apply to %s AI players."),
2552 ai_level_translated_name(preq->source.value.ai_level));
2553 }
2554 return TRUE;
2555
2556 case VUT_TERRAINCLASS:
2557 switch (preq->range) {
2558 case REQ_RANGE_TILE:
2559 fc_strlcat(buf, prefix, bufsz);
2560 if (preq->present) {
2562 /* TRANS: %s is a terrain class */
2563 Q_("?terrainclass:Requires %s terrain on the tile."),
2565 (preq->source.value.terrainclass));
2566 } else {
2568 /* TRANS: %s is a terrain class */
2569 Q_("?terrainclass:Prevented by %s terrain on the tile."),
2571 (preq->source.value.terrainclass));
2572 }
2573 return TRUE;
2575 fc_strlcat(buf, prefix, bufsz);
2576 if (preq->present) {
2578 /* TRANS: %s is a terrain class */
2579 Q_("?terrainclass:Requires %s terrain on the tile or a "
2580 "cardinally adjacent tile."),
2582 (preq->source.value.terrainclass));
2583 } else {
2585 /* TRANS: %s is a terrain class */
2586 Q_("?terrainclass:Prevented by %s terrain on the tile or "
2587 "any cardinally adjacent tile."),
2589 (preq->source.value.terrainclass));
2590 }
2591 return TRUE;
2592 case REQ_RANGE_ADJACENT:
2593 fc_strlcat(buf, prefix, bufsz);
2594 if (preq->present) {
2596 /* TRANS: %s is a terrain class */
2597 Q_("?terrainclass:Requires %s terrain on the tile or an "
2598 "adjacent tile."),
2600 (preq->source.value.terrainclass));
2601 } else {
2603 /* TRANS: %s is a terrain class */
2604 Q_("?terrainclass:Prevented by %s terrain on the tile or "
2605 "any adjacent tile."),
2607 (preq->source.value.terrainclass));
2608 }
2609 return TRUE;
2610 case REQ_RANGE_CITY:
2611 fc_strlcat(buf, prefix, bufsz);
2612 if (preq->present) {
2614 /* TRANS: %s is a terrain class */
2615 Q_("?terrainclass:Requires %s terrain on a tile within "
2616 "the city radius."),
2618 (preq->source.value.terrainclass));
2619 } else {
2621 /* TRANS: %s is a terrain class */
2622 Q_("?terrainclass:Prevented by %s terrain on any tile "
2623 "within the city radius."),
2625 (preq->source.value.terrainclass));
2626 }
2627 return TRUE;
2629 fc_strlcat(buf, prefix, bufsz);
2630 if (preq->present) {
2632 /* TRANS: %s is a terrain class */
2633 Q_("?terrainclass:Requires %s terrain on a tile within "
2634 "the city radius or the city radius of a trade "
2635 "partner."),
2637 (preq->source.value.terrainclass));
2638 } else {
2640 /* TRANS: %s is a terrain class */
2641 Q_("?terrainclass:Prevented by %s terrain on any tile "
2642 "within the city radius or the city radius of a trade "
2643 "partner."),
2645 (preq->source.value.terrainclass));
2646 }
2647 return TRUE;
2649 case REQ_RANGE_PLAYER:
2650 case REQ_RANGE_TEAM:
2651 case REQ_RANGE_ALLIANCE:
2652 case REQ_RANGE_WORLD:
2653 case REQ_RANGE_LOCAL:
2654 case REQ_RANGE_COUNT:
2655 /* Not supported. */
2656 break;
2657 }
2658 break;
2659
2660 case VUT_TERRFLAG:
2661 switch (preq->range) {
2662 case REQ_RANGE_TILE:
2663 fc_strlcat(buf, prefix, bufsz);
2664 if (preq->present) {
2666 /* TRANS: %s is a (translatable) terrain flag. */
2667 _("Requires terrain with the \"%s\" flag on the tile."),
2668 terrain_flag_id_translated_name(preq->source.value.terrainflag));
2669 } else {
2671 /* TRANS: %s is a (translatable) terrain flag. */
2672 _("Prevented by terrain with the \"%s\" flag on the "
2673 "tile."),
2674 terrain_flag_id_translated_name(preq->source.value.terrainflag));
2675 }
2676 return TRUE;
2678 fc_strlcat(buf, prefix, bufsz);
2679 if (preq->present) {
2681 /* TRANS: %s is a (translatable) terrain flag. */
2682 _("Requires terrain with the \"%s\" flag on the "
2683 "tile or a cardinally adjacent tile."),
2684 terrain_flag_id_translated_name(preq->source.value.terrainflag));
2685 } else {
2687 /* TRANS: %s is a (translatable) terrain flag. */
2688 _("Prevented by terrain with the \"%s\" flag on "
2689 "the tile or any cardinally adjacent tile."),
2690 terrain_flag_id_translated_name(preq->source.value.terrainflag));
2691 }
2692 return TRUE;
2693 case REQ_RANGE_ADJACENT:
2694 fc_strlcat(buf, prefix, bufsz);
2695 if (preq->present) {
2697 /* TRANS: %s is a (translatable) terrain flag. */
2698 _("Requires terrain with the \"%s\" flag on the "
2699 "tile or an adjacent tile."),
2700 terrain_flag_id_translated_name(preq->source.value.terrainflag));
2701 } else {
2703 /* TRANS: %s is a (translatable) terrain flag. */
2704 _("Prevented by terrain with the \"%s\" flag on "
2705 "the tile or any adjacent tile."),
2706 terrain_flag_id_translated_name(preq->source.value.terrainflag));
2707 }
2708 return TRUE;
2709 case REQ_RANGE_CITY:
2710 fc_strlcat(buf, prefix, bufsz);
2711 if (preq->present) {
2713 /* TRANS: %s is a (translatable) terrain flag. */
2714 _("Requires terrain with the \"%s\" flag on a tile "
2715 "within the city radius."),
2716 terrain_flag_id_translated_name(preq->source.value.terrainflag));
2717 } else {
2719 /* TRANS: %s is a (translatable) terrain flag. */
2720 _("Prevented by terrain with the \"%s\" flag on any tile "
2721 "within the city radius."),
2722 terrain_flag_id_translated_name(preq->source.value.terrainflag));
2723 }
2724 return TRUE;
2726 fc_strlcat(buf, prefix, bufsz);
2727 if (preq->present) {
2729 /* TRANS: %s is a (translatable) terrain flag. */
2730 _("Requires terrain with the \"%s\" flag on a tile "
2731 "within the city radius or the city radius of "
2732 "a trade partner."),
2733 terrain_flag_id_translated_name(preq->source.value.terrainflag));
2734 } else {
2736 /* TRANS: %s is a (translatable) terrain flag. */
2737 _("Prevented by terrain with the \"%s\" flag on any tile "
2738 "within the city radius or the city radius of "
2739 "a trade partner."),
2740 terrain_flag_id_translated_name(preq->source.value.terrainflag));
2741 }
2742 return TRUE;
2744 case REQ_RANGE_PLAYER:
2745 case REQ_RANGE_TEAM:
2746 case REQ_RANGE_ALLIANCE:
2747 case REQ_RANGE_WORLD:
2748 case REQ_RANGE_LOCAL:
2749 case REQ_RANGE_COUNT:
2750 /* Not supported. */
2751 break;
2752 }
2753 break;
2754
2755 case VUT_ROADFLAG:
2756 switch (preq->range) {
2757 case REQ_RANGE_LOCAL:
2758 fc_strlcat(buf, prefix, bufsz);
2759 if (preq->present) {
2761 /* TRANS: %s is a (translatable) road flag. */
2762 _("Only applies to roads with the \"%s\" flag."),
2764 (preq->source.value.roadflag));
2765 } else {
2767 /* TRANS: %s is a (translatable) road flag. */
2768 _("Does not apply to roads with the \"%s\" flag."),
2770 (preq->source.value.roadflag));
2771 }
2772 return TRUE;
2773 case REQ_RANGE_TILE:
2774 fc_strlcat(buf, prefix, bufsz);
2775 if (preq->present) {
2777 /* TRANS: %s is a (translatable) road flag. */
2778 _("Requires a road with the \"%s\" flag on the tile."),
2779 road_flag_id_translated_name(preq->source.value.roadflag));
2780 } else {
2782 /* TRANS: %s is a (translatable) road flag. */
2783 _("Prevented by a road with the \"%s\" flag on the "
2784 "tile."),
2785 road_flag_id_translated_name(preq->source.value.roadflag));
2786 }
2787 return TRUE;
2789 fc_strlcat(buf, prefix, bufsz);
2790 if (preq->present) {
2792 /* TRANS: %s is a (translatable) road flag. */
2793 _("Requires a road with the \"%s\" flag on the "
2794 "tile or a cardinally adjacent tile."),
2795 road_flag_id_translated_name(preq->source.value.roadflag));
2796 } else {
2798 /* TRANS: %s is a (translatable) road flag. */
2799 _("Prevented by a road with the \"%s\" flag on "
2800 "the tile or any cardinally adjacent tile."),
2801 road_flag_id_translated_name(preq->source.value.roadflag));
2802 }
2803 return TRUE;
2804 case REQ_RANGE_ADJACENT:
2805 fc_strlcat(buf, prefix, bufsz);
2806 if (preq->present) {
2808 /* TRANS: %s is a (translatable) road flag. */
2809 _("Requires a road with the \"%s\" flag on the "
2810 "tile or an adjacent tile."),
2811 road_flag_id_translated_name(preq->source.value.roadflag));
2812 } else {
2814 /* TRANS: %s is a (translatable) road flag. */
2815 _("Prevented by a road with the \"%s\" flag on "
2816 "the tile or any adjacent tile."),
2817 road_flag_id_translated_name(preq->source.value.roadflag));
2818 }
2819 return TRUE;
2820 case REQ_RANGE_CITY:
2821 fc_strlcat(buf, prefix, bufsz);
2822 if (preq->present) {
2824 /* TRANS: %s is a (translatable) road flag. */
2825 _("Requires a road with the \"%s\" flag on a tile "
2826 "within the city radius."),
2827 road_flag_id_translated_name(preq->source.value.roadflag));
2828 } else {
2830 /* TRANS: %s is a (translatable) road flag. */
2831 _("Prevented by a road with the \"%s\" flag on any tile "
2832 "within the city radius."),
2833 road_flag_id_translated_name(preq->source.value.roadflag));
2834 }
2835 return TRUE;
2837 fc_strlcat(buf, prefix, bufsz);
2838 if (preq->present) {
2840 /* TRANS: %s is a (translatable) road flag. */
2841 _("Requires a road with the \"%s\" flag on a tile "
2842 "within the city radius or the city radius of a "
2843 "trade partner."),
2844 road_flag_id_translated_name(preq->source.value.roadflag));
2845 } else {
2847 /* TRANS: %s is a (translatable) road flag. */
2848 _("Prevented by a road with the \"%s\" flag on any tile "
2849 "within the city radius or the city radius of a "
2850 "trade partner."),
2851 road_flag_id_translated_name(preq->source.value.roadflag));
2852 }
2853 return TRUE;
2855 case REQ_RANGE_PLAYER:
2856 case REQ_RANGE_TEAM:
2857 case REQ_RANGE_ALLIANCE:
2858 case REQ_RANGE_WORLD:
2859 case REQ_RANGE_COUNT:
2860 /* Not supported. */
2861 break;
2862 }
2863 break;
2864
2865 case VUT_EXTRAFLAG:
2866 switch (preq->range) {
2867 case REQ_RANGE_LOCAL:
2868 fc_strlcat(buf, prefix, bufsz);
2869 if (preq->present) {
2871 /* TRANS: %s is a (translatable) extra flag. */
2872 _("Only applies to extras with the \"%s\" flag."),
2874 (preq->source.value.extraflag));
2875 } else {
2877 /* TRANS: %s is a (translatable) extra flag. */
2878 _("Does not apply to extras with the \"%s\" flag."),
2880 (preq->source.value.extraflag));
2881 }
2882 return TRUE;
2883 case REQ_RANGE_TILE:
2884 fc_strlcat(buf, prefix, bufsz);
2885 if (preq->present) {
2887 /* TRANS: %s is a (translatable) extra flag. */
2888 _("Requires an extra with the \"%s\" flag on the tile."),
2889 extra_flag_id_translated_name(preq->source.value.extraflag));
2890 } else {
2892 /* TRANS: %s is a (translatable) extra flag. */
2893 _("Prevented by an extra with the \"%s\" flag on the "
2894 "tile."),
2895 extra_flag_id_translated_name(preq->source.value.extraflag));
2896 }
2897 return TRUE;
2899 fc_strlcat(buf, prefix, bufsz);
2900 if (preq->present) {
2902 /* TRANS: %s is a (translatable) extra flag. */
2903 _("Requires an extra with the \"%s\" flag on the "
2904 "tile or a cardinally adjacent tile."),
2905 extra_flag_id_translated_name(preq->source.value.extraflag));
2906 } else {
2908 /* TRANS: %s is a (translatable) extra flag. */
2909 _("Prevented by an extra with the \"%s\" flag on "
2910 "the tile or any cardinally adjacent tile."),
2911 extra_flag_id_translated_name(preq->source.value.extraflag));
2912 }
2913 return TRUE;
2914 case REQ_RANGE_ADJACENT:
2915 fc_strlcat(buf, prefix, bufsz);
2916 if (preq->present) {
2918 /* TRANS: %s is a (translatable) extra flag. */
2919 _("Requires an extra with the \"%s\" flag on the "
2920 "tile or an adjacent tile."),
2921 extra_flag_id_translated_name(preq->source.value.extraflag));
2922 } else {
2924 /* TRANS: %s is a (translatable) extra flag. */
2925 _("Prevented by an extra with the \"%s\" flag on "
2926 "the tile or any adjacent tile."),
2927 extra_flag_id_translated_name(preq->source.value.extraflag));
2928 }
2929 return TRUE;
2930 case REQ_RANGE_CITY:
2931 fc_strlcat(buf, prefix, bufsz);
2932 if (preq->present) {
2934 /* TRANS: %s is a (translatable) extra flag. */
2935 _("Requires an extra with the \"%s\" flag on a tile "
2936 "within the city radius."),
2937 extra_flag_id_translated_name(preq->source.value.extraflag));
2938 } else {
2940 /* TRANS: %s is a (translatable) extra flag. */
2941 _("Prevented by an extra with the \"%s\" flag on any tile "
2942 "within the city radius."),
2943 extra_flag_id_translated_name(preq->source.value.extraflag));
2944 }
2945 return TRUE;
2947 fc_strlcat(buf, prefix, bufsz);
2948 if (preq->present) {
2950 /* TRANS: %s is a (translatable) extra flag. */
2951 _("Requires an extra with the \"%s\" flag on a tile "
2952 "within the city radius or the city radius of a "
2953 "trade partner."),
2954 extra_flag_id_translated_name(preq->source.value.extraflag));
2955 } else {
2957 /* TRANS: %s is a (translatable) extra flag. */
2958 _("Prevented by an extra with the \"%s\" flag on any tile "
2959 "within the city radius or the city radius of a "
2960 "trade partner."),
2961 extra_flag_id_translated_name(preq->source.value.extraflag));
2962 }
2963 return TRUE;
2965 case REQ_RANGE_PLAYER:
2966 case REQ_RANGE_TEAM:
2967 case REQ_RANGE_ALLIANCE:
2968 case REQ_RANGE_WORLD:
2969 case REQ_RANGE_COUNT:
2970 /* Not supported. */
2971 break;
2972 }
2973 break;
2974
2975 case VUT_MINYEAR:
2976 if (preq->range != REQ_RANGE_WORLD) {
2977 break;
2978 }
2979 fc_strlcat(buf, prefix, bufsz);
2980 if (preq->present) {
2982 _("Requires the game to have reached the year %s."),
2983 textyear(preq->source.value.minyear));
2984 } else {
2986 _("Requires that the game has not yet reached the "
2987 "year %s."),
2988 textyear(preq->source.value.minyear));
2989 }
2990 return TRUE;
2991
2992 case VUT_MINCALFRAG:
2993 if (preq->range != REQ_RANGE_WORLD) {
2994 break;
2995 }
2996 fc_strlcat(buf, prefix, bufsz);
2997 if (preq->present) {
2999 /* TRANS: %s is a representation of a calendar fragment,
3000 * from the ruleset. May be a bare number. */
3001 _("Requires the game to have reached %s."),
3002 textcalfrag(preq->source.value.mincalfrag));
3003 } else {
3005 /* TRANS: %s is a representation of a calendar fragment,
3006 * from the ruleset. May be a bare number. */
3007 _("Requires that the game has not yet reached %s."),
3008 textcalfrag(preq->source.value.mincalfrag));
3009 }
3010 return TRUE;
3011
3012 case VUT_TOPO:
3013 if (preq->range != REQ_RANGE_WORLD) {
3014 break;
3015 }
3016 fc_strlcat(buf, prefix, bufsz);
3017 if (preq->present) {
3019 /* TRANS: topology flag name ("Hex", "ISO") */
3020 _("Requires %s map."),
3021 _(topo_flag_name(preq->source.value.topo_property)));
3022 } else {
3024 /* TRANS: topology flag name ("Hex", "ISO") */
3025 _("Prevented on %s map."),
3026 _(topo_flag_name(preq->source.value.topo_property)));
3027 }
3028 return TRUE;
3029
3030 case VUT_WRAP:
3031 if (preq->range != REQ_RANGE_WORLD) {
3032 break;
3033 }
3034 fc_strlcat(buf, prefix, bufsz);
3035 if (preq->present) {
3037 /* TRANS: wrap flag name ("WrapX", "WrapY") */
3038 _("Requires %s map."),
3039 _(wrap_flag_name(preq->source.value.wrap_property)));
3040 } else {
3042 /* TRANS: wrap flag name ("WrapX", "WrapY") */
3043 _("Prevented on %s map."),
3044 _(wrap_flag_name(preq->source.value.wrap_property)));
3045 }
3046 return TRUE;
3047
3048 case VUT_SERVERSETTING:
3049 if (preq->range != REQ_RANGE_WORLD) {
3050 break;
3051 }
3052 fc_strlcat(buf, prefix, bufsz);
3054 /* TRANS: %s is a server setting, its value and if it is
3055 * required to be present or absent. The string's format
3056 * is specified in ssetv_human_readable().
3057 * Example: "killstack is enabled". */
3058 _("Requires that the server setting %s."),
3059 ssetv_human_readable(preq->source.value.ssetval,
3060 preq->present));
3061 return TRUE;
3062
3063 case VUT_AGE:
3064 fc_strlcat(buf, prefix, bufsz);
3065 if (preq->present) {
3067 _("Requires age of %d turns."),
3068 preq->source.value.age);
3069 } else {
3071 _("Prevented if age is over %d turns."),
3072 preq->source.value.age);
3073 }
3074 return TRUE;
3075
3076 case VUT_FORM_AGE:
3077 fc_strlcat(buf, prefix, bufsz);
3078 if (preq->present) {
3080 _("Requires form age of %d turns."),
3081 preq->source.value.form_age);
3082 } else {
3084 _("Prevented if form age is over %d turns."),
3085 preq->source.value.form_age);
3086 }
3087 return TRUE;
3088
3089 case VUT_MINTECHS:
3090 switch (preq->range) {
3091 case REQ_RANGE_WORLD:
3092 fc_strlcat(buf, prefix, bufsz);
3093 if (preq->present) {
3095 _("Requires %d techs to be known in the world."),
3096 preq->source.value.min_techs);
3097 } else {
3099 _("Prevented when %d techs are known in the world."),
3100 preq->source.value.min_techs);
3101 }
3102 return TRUE;
3103 case REQ_RANGE_PLAYER:
3104 fc_strlcat(buf, prefix, bufsz);
3105 if (preq->present) {
3107 _("Requires player to know %d techs."),
3108 preq->source.value.min_techs);
3109 } else {
3111 _("Prevented when player knows %d techs."),
3112 preq->source.value.min_techs);
3113 }
3114 return TRUE;
3115 case REQ_RANGE_LOCAL:
3116 case REQ_RANGE_TILE:
3118 case REQ_RANGE_ADJACENT:
3119 case REQ_RANGE_CITY:
3122 case REQ_RANGE_TEAM:
3123 case REQ_RANGE_ALLIANCE:
3124 case REQ_RANGE_COUNT:
3125 /* Not supported. */
3126 break;
3127 }
3128 break;
3129
3130 case VUT_FUTURETECHS:
3131 switch (preq->range) {
3132 case REQ_RANGE_WORLD:
3133 fc_strlcat(buf, prefix, bufsz);
3134 if (preq->present) {
3136 _("Requires %d future techs to be known in the world."),
3137 preq->source.value.future_techs);
3138 } else {
3140 _("Prevented when %d future techs are known in the world."),
3141 preq->source.value.future_techs);
3142 }
3143 return TRUE;
3144 case REQ_RANGE_PLAYER:
3145 fc_strlcat(buf, prefix, bufsz);
3146 if (preq->present) {
3148 _("Requires player to know %d future techs."),
3149 preq->source.value.future_techs);
3150 } else {
3152 _("Prevented when player knows %d future techs."),
3153 preq->source.value.future_techs);
3154 }
3155 return TRUE;
3156 case REQ_RANGE_LOCAL:
3157 case REQ_RANGE_TILE:
3159 case REQ_RANGE_ADJACENT:
3160 case REQ_RANGE_CITY:
3163 case REQ_RANGE_TEAM:
3164 case REQ_RANGE_ALLIANCE:
3165 case REQ_RANGE_COUNT:
3166 /* Not supported. */
3167 break;
3168 }
3169 break;
3170
3171 case VUT_MINCITIES:
3172 switch (preq->range) {
3173 case REQ_RANGE_PLAYER:
3174 fc_strlcat(buf, prefix, bufsz);
3175 if (preq->present) {
3177 _("Requires player to have at least %d cities."),
3178 preq->source.value.min_cities);
3179 } else {
3181 _("Prevented when player has at least %d cities."),
3182 preq->source.value.min_cities);
3183 }
3184 return TRUE;
3185 case REQ_RANGE_WORLD:
3186 case REQ_RANGE_LOCAL:
3187 case REQ_RANGE_TILE:
3189 case REQ_RANGE_ADJACENT:
3190 case REQ_RANGE_CITY:
3193 case REQ_RANGE_TEAM:
3194 case REQ_RANGE_ALLIANCE:
3195 case REQ_RANGE_COUNT:
3196 /* Not supported. */
3197 break;
3198 }
3199 break;
3200
3201 case VUT_TERRAINALTER:
3202 switch (preq->range) {
3203 case REQ_RANGE_TILE:
3204 fc_strlcat(buf, prefix, bufsz);
3205 if (preq->present) {
3207 _("Requires terrain on which alteration %s is "
3208 "possible."),
3209 Q_(terrain_alteration_name(preq->source.value.terrainalter)));
3210 } else {
3212 _("Prevented by terrain on which alteration %s "
3213 "can be made."),
3214 Q_(terrain_alteration_name(preq->source.value.terrainalter)));
3215 }
3216 return TRUE;
3218 case REQ_RANGE_ADJACENT:
3219 case REQ_RANGE_CITY:
3222 case REQ_RANGE_PLAYER:
3223 case REQ_RANGE_TEAM:
3224 case REQ_RANGE_ALLIANCE:
3225 case REQ_RANGE_WORLD:
3226 case REQ_RANGE_LOCAL:
3227 case REQ_RANGE_COUNT:
3228 /* Not supported. */
3229 break;
3230 }
3231 break;
3232
3233 case VUT_CITYTILE:
3234 if (preq->source.value.citytile == CITYT_LAST) {
3235 break;
3236 } else {
3237 static char *tile_property = nullptr;
3238
3239 switch (preq->source.value.citytile) {
3240 case CITYT_CENTER:
3241 tile_property = _("city centers");
3242 break;
3243 case CITYT_CLAIMED:
3244 tile_property = _("claimed tiles");
3245 break;
3246 case CITYT_EXTRAS_OWNED:
3247 tile_property = _("owned extras");
3248 break;
3249 case CITYT_WORKED:
3250 tile_property = _("worked tiles");
3251 break;
3253 /* TRANS: a specific city for each use case */
3254 tile_property = _("tiles on the same continent as the city");
3255 break;
3257 {
3258 bool oceanic_cities = FALSE; /* FIXME: maybe cache globally? */
3259
3264 /* TRANS: a specific city for each use case */
3265 tile_property = _("tiles of a mass of a different "
3266 "terrain class next to the city");
3267 break;
3268 }
3270 if (oceanic_cities) {
3271 break;
3272 }
3273 /* TRANS: a specific city for each use case */
3274 tile_property = _("tiles of a body of water next to the city");
3275 }
3276 break;
3277 case CITYT_LAST:
3278 fc_assert(preq->source.value.citytile != CITYT_LAST);
3279 break;
3280 }
3281
3282 switch (preq->range) {
3283 case REQ_RANGE_TILE:
3284 fc_strlcat(buf, prefix, bufsz);
3285 if (preq->present) {
3287 /* TRANS: tile property ("city centers", etc) */
3288 Q_("?tileprop:Applies only to %s."), tile_property);
3289 } else {
3291 /* TRANS: tile property ("city centers", etc) */
3292 Q_("?tileprop:Does not apply to %s."), tile_property);
3293 }
3294 return TRUE;
3296 fc_strlcat(buf, prefix, bufsz);
3297 if (preq->present) {
3298 /* TRANS: tile property ("city centers", etc) */
3299 cat_snprintf(buf, bufsz, Q_("?tileprop:Applies only to %s and "
3300 "cardinally adjacent tiles."),
3302 } else {
3303 /* TRANS: tile property ("city centers", etc) */
3304 cat_snprintf(buf, bufsz, Q_("?tileprop:Does not apply to %s or "
3305 "cardinally adjacent tiles."),
3307 }
3308 return TRUE;
3309 case REQ_RANGE_ADJACENT:
3310 fc_strlcat(buf, prefix, bufsz);
3311 if (preq->present) {
3312 /* TRANS: tile property ("city centers", etc) */
3313 cat_snprintf(buf, bufsz, Q_("?tileprop:Applies only to %s and "
3314 "adjacent tiles."), tile_property);
3315 } else {
3316 /* TRANS: tile property ("city centers", etc) */
3317 cat_snprintf(buf, bufsz, Q_("?tileprop:Does not apply to %s or "
3318 "adjacent tiles."), tile_property);
3319 }
3320 return TRUE;
3321 case REQ_RANGE_CITY:
3324 case REQ_RANGE_PLAYER:
3325 case REQ_RANGE_TEAM:
3326 case REQ_RANGE_ALLIANCE:
3327 case REQ_RANGE_WORLD:
3328 case REQ_RANGE_LOCAL:
3329 case REQ_RANGE_COUNT:
3330 /* Not supported. */
3331 break;
3332 }
3333
3334 break;
3335 }
3336
3337 case VUT_CITYSTATUS:
3338 if (preq->source.value.citystatus != CITYS_LAST) {
3339 static char *city_property = nullptr;
3340
3341 switch (preq->source.value.citystatus) {
3343 city_property = _("owned by original");
3344 break;
3345 case CITYS_STARVED:
3346 city_property = _("starved");
3347 break;
3348 case CITYS_DISORDER:
3349 city_property = _("disorder");
3350 break;
3351 case CITYS_CELEBRATION:
3352 city_property = _("celebration");
3353 break;
3354 case CITYS_TRANSFERRED:
3355 city_property = _("transferred");
3356 break;
3358 city_property = _("capitalconnected");
3359 break;
3360 case CITYS_LAST:
3361 fc_assert(preq->source.value.citystatus != CITYS_LAST);
3362 break;
3363 }
3364
3365 switch (preq->range) {
3366 case REQ_RANGE_CITY:
3367 fc_strlcat(buf, prefix, bufsz);
3368 if (preq->present) {
3369 /* TRANS: city property ("owned by original", etc) */
3370 cat_snprintf(buf, bufsz, Q_("?cityprop:Applies only to %s cities"),
3372 } else {
3373 /* TRANS: city property ("owned by original", etc) */
3374 cat_snprintf(buf, bufsz, Q_("?cityprop:Does not apply to %s cities"),
3376 }
3377 return TRUE;
3379 fc_strlcat(buf, prefix, bufsz);
3380 if (preq->present) {
3381 /* TRANS: city property ("owned by original", etc) */
3382 cat_snprintf(buf, bufsz, Q_("?cityprop:Applies only to %s cities or "
3383 "their trade partners."), city_property);
3384 } else {
3385 /* TRANS: city property ("owned by original", etc) */
3386 cat_snprintf(buf, bufsz, Q_("?cityprop:Does not apply to %s cities or "
3387 "their trade partners."), city_property);
3388 }
3389 return TRUE;
3390 case REQ_RANGE_LOCAL:
3391 case REQ_RANGE_TILE:
3392 case REQ_RANGE_ADJACENT:
3395 case REQ_RANGE_PLAYER:
3396 case REQ_RANGE_TEAM:
3397 case REQ_RANGE_ALLIANCE:
3398 case REQ_RANGE_WORLD:
3399 case REQ_RANGE_COUNT:
3400 /* Not supported. */
3401 break;
3402 }
3403 }
3404 break;
3405
3406 case VUT_MINLATITUDE:
3407 switch (preq->range) {
3408 case REQ_RANGE_WORLD:
3409 fc_strlcat(buf, prefix, bufsz);
3410 if (preq->present) {
3412 _("Some part of the world must be at latitude %d or "
3413 "further north."),
3414 preq->source.value.latitude);
3415 } else {
3417 _("The entire world must be at latitude %d or "
3418 "further south."),
3419 preq->source.value.latitude - 1);
3420 }
3421 return TRUE;
3422 case REQ_RANGE_TILE:
3423 fc_strlcat(buf, prefix, bufsz);
3424 if (preq->present) {
3426 _("Tile must be at latitude %d or further north."),
3427 preq->source.value.latitude);
3428 } else {
3430 _("Tile must be at latitude %d or further south."),
3431 preq->source.value.latitude - 1);
3432 }
3433 return TRUE;
3435 fc_strlcat(buf, prefix, bufsz);
3436 if (preq->present) {
3438 _("A cardinally adjacent tile must be at latitude "
3439 "%d or further north."),
3440 preq->source.value.latitude);
3441 } else {
3443 _("All cardinally adjacent tiles must be at latitude "
3444 "%d or further south."),
3445 preq->source.value.latitude - 1);
3446 }
3447 return TRUE;
3448 case REQ_RANGE_ADJACENT:
3449 fc_strlcat(buf, prefix, bufsz);
3450 if (preq->present) {
3452 _("An adjacent tile must be at latitude %d or "
3453 "further north."),
3454 preq->source.value.latitude);
3455 } else {
3457 _("All adjacent tiles must be at latitude %d or "
3458 "further south."),
3459 preq->source.value.latitude - 1);
3460 }
3461 return TRUE;
3462 case REQ_RANGE_CITY:
3465 case REQ_RANGE_PLAYER:
3466 case REQ_RANGE_TEAM:
3467 case REQ_RANGE_ALLIANCE:
3468 case REQ_RANGE_LOCAL:
3469 case REQ_RANGE_COUNT:
3470 /* Not supported. */
3471 break;
3472 }
3473 break;
3474
3475 case VUT_MAXLATITUDE:
3476 switch (preq->range) {
3477 case REQ_RANGE_WORLD:
3478 fc_strlcat(buf, prefix, bufsz);
3479 if (preq->present) {
3481 _("Some part of the world must be at latitude %d or "
3482 "further south."),
3483 preq->source.value.latitude);
3484 } else {
3486 _("The entire world must be at latitude %d or "
3487 "further north."),
3488 preq->source.value.latitude + 1);
3489 }
3490 return TRUE;
3491 case REQ_RANGE_TILE:
3492 fc_strlcat(buf, prefix, bufsz);
3493 if (preq->present) {
3495 _("Tile must be at latitude %d or further south."),
3496 preq->source.value.latitude);
3497 } else {
3499 _("Tile must be at latitude %d or further north."),
3500 preq->source.value.latitude + 1);
3501 }
3502 return TRUE;
3504 fc_strlcat(buf, prefix, bufsz);
3505 if (preq->present) {
3507 _("A cardinally adjacent tile must be at latitude "
3508 "%d or further south."),
3509 preq->source.value.latitude);
3510 } else {
3512 _("All cardinally adjacent tiles must be at latitude "
3513 "%d or further north."),
3514 preq->source.value.latitude + 1);
3515 }
3516 return TRUE;
3517 case REQ_RANGE_ADJACENT:
3518 fc_strlcat(buf, prefix, bufsz);
3519 if (preq->present) {
3521 _("An adjacent tile must be at latitude %d or "
3522 "further south."),
3523 preq->source.value.latitude);
3524 } else {
3526 _("All adjacent tiles must be at latitude %d or "
3527 "further north."),
3528 preq->source.value.latitude + 1);
3529 }
3530 return TRUE;
3531 case REQ_RANGE_CITY:
3534 case REQ_RANGE_PLAYER:
3535 case REQ_RANGE_TEAM:
3536 case REQ_RANGE_ALLIANCE:
3537 case REQ_RANGE_LOCAL:
3538 case REQ_RANGE_COUNT:
3539 /* Not supported. */
3540 break;
3541 }
3542 break;
3543
3545 switch (preq->range) {
3546 case REQ_RANGE_TILE:
3547 fc_strlcat(buf, prefix, bufsz);
3548 /* Test some special cases */
3549 switch (preq->source.value.distance_sq)
3550 {
3551 case 0:
3552 if (preq->present) {
3553 fc_strlcat(buf, _("Must be the same tile."), bufsz);
3554 } else {
3555 fc_strlcat(buf, _("Must not be the same tile."), bufsz);
3556 }
3557 break;
3558 case 1:
3559 if (preq->present) {
3560 fc_strlcat(buf, _("Must be cardinally adjacent."), bufsz);
3561 } else {
3562 fc_strlcat(buf, _("Must not be cardinally adjacent."), bufsz);
3563 }
3564 break;
3565 case 2:
3566 case 3:
3567 if (preq->present) {
3568 fc_strlcat(buf, _("Must be adjacent."), bufsz);
3569 } else {
3570 fc_strlcat(buf, _("Must not be adjacent."), bufsz);
3571 }
3572 break;
3573
3574 default:
3575 if (preq->present) {
3577 _("The squared distance between the tiles "
3578 "must be at most %d."),
3579 preq->source.value.distance_sq);
3580 } else {
3582 _("The squared distance between the tiles "
3583 "must be at least %d."),
3584 preq->source.value.distance_sq + 1);
3585 }
3586 break;
3587 }
3588 return TRUE;
3590 case REQ_RANGE_ADJACENT:
3591 case REQ_RANGE_CITY:
3594 case REQ_RANGE_PLAYER:
3595 case REQ_RANGE_TEAM:
3596 case REQ_RANGE_ALLIANCE:
3597 case REQ_RANGE_WORLD:
3598 case REQ_RANGE_LOCAL:
3599 case REQ_RANGE_COUNT:
3600 /* Not supported. */
3601 break;
3602 }
3603 break;
3604
3606 switch (preq->range) {
3608 fc_strlcat(buf, prefix, bufsz);
3609 /* Off-by-one: The requirement counts the tile itself, we're phrasing
3610 * the helptext in terms of *other* tiles only. */
3611 if (preq->present) {
3612 if (preq->source.value.region_tiles == 1) {
3613 /* Special case for zero */
3615 _("No other cardinally adjacent tile may be part of "
3616 "the same continent or ocean."),
3617 bufsz);
3618 } else {
3620 PL_("No more than %d other cardinally adjacent tile "
3621 "may be part of the same continent or ocean.",
3622 "No more than %d other cardinally adjacent tiles "
3623 "may be part of the same continent or ocean.",
3624 preq->source.value.region_tiles - 1),
3625 preq->source.value.region_tiles - 1);
3626 }
3627 } else {
3629 PL_("Requires at least %d other cardinally adjacent "
3630 "tile of the same continent or ocean.",
3631 "Requires at least %d other cardinally adjacent "
3632 "tiles of the same continent or ocean.",
3633 preq->source.value.region_tiles),
3634 preq->source.value.region_tiles);
3635 }
3636
3637 return TRUE;
3638 case REQ_RANGE_ADJACENT:
3639 fc_strlcat(buf, prefix, bufsz);
3640 /* Off-by-one: The requirement counts the tile itself, we're phrasing
3641 * the helptext in terms of *other* tiles only. */
3642 if (preq->present) {
3643 if (preq->source.value.region_tiles == 1) {
3644 /* Special case for zero */
3646 _("No other adjacent tile may be part of the same "
3647 "continent or ocean."),
3648 bufsz);
3649 } else {
3651 PL_("No more than %d other adjacent tile may be "
3652 "part of the same continent or ocean.",
3653 "No more than %d other adjacent tiles may be "
3654 "part of the same continent or ocean.",
3655 preq->source.value.region_tiles - 1),
3656 preq->source.value.region_tiles - 1);
3657 }
3658 } else {
3660 PL_("Requires at least %d other adjacent tile of the "
3661 "same continent or ocean.",
3662 "Requires at least %d other adjacent tiles of the "
3663 "same continent or ocean.",
3664 preq->source.value.region_tiles),
3665 preq->source.value.region_tiles);
3666 }
3667
3668 return TRUE;
3670 fc_strlcat(buf, prefix, bufsz);
3671 if (preq->present) {
3673 _("Requires a continent or ocean size of at most %d."),
3674 preq->source.value.region_tiles);
3675 } else {
3677 _("Requires a continent or ocean size of at least %d."),
3678 preq->source.value.region_tiles + 1);
3679 }
3680
3681 return TRUE;
3682 case REQ_RANGE_PLAYER:
3683 case REQ_RANGE_TEAM:
3684 case REQ_RANGE_ALLIANCE:
3685 case REQ_RANGE_WORLD:
3686 case REQ_RANGE_LOCAL:
3687 case REQ_RANGE_TILE:
3688 case REQ_RANGE_CITY:
3690 case REQ_RANGE_COUNT:
3691 /* Not supported. */
3692 break;
3693 }
3694 break;
3695
3696 case VUT_TILE_REL:
3697 switch (preq->source.value.tilerel) {
3698 case TREL_SAME_TCLASS:
3699 switch (preq->range) {
3700 case REQ_RANGE_TILE:
3701 fc_strlcat(buf, prefix, bufsz);
3702 if (preq->present) {
3703 fc_strlcat(buf, _("Must be on the same terrain class."),
3704 bufsz);
3705 } else {
3706 fc_strlcat(buf, _("Must be on a different terrain class."),
3707 bufsz);
3708 }
3709 return TRUE;
3711 fc_strlcat(buf, prefix, bufsz);
3712 if (preq->present) {
3713 fc_strlcat(buf, _("Must be cardinally adjacent to the same "
3714 "terrain class."),
3715 bufsz);
3716 } else {
3717 fc_strlcat(buf, _("Must not be cardinally adjacent to the same "
3718 "terrain class."),
3719 bufsz);
3720 }
3721 return TRUE;
3722 case REQ_RANGE_ADJACENT:
3723 fc_strlcat(buf, prefix, bufsz);
3724 if (preq->present) {
3725 fc_strlcat(buf, _("Must be adjacent to the same terrain class."),
3726 bufsz);
3727 } else {
3728 fc_strlcat(buf, _("Must not be adjacent to the same terrain "
3729 "class."),
3730 bufsz);
3731 }
3732 return TRUE;
3733 case REQ_RANGE_CITY:
3736 case REQ_RANGE_PLAYER:
3737 case REQ_RANGE_TEAM:
3738 case REQ_RANGE_ALLIANCE:
3739 case REQ_RANGE_WORLD:
3740 case REQ_RANGE_LOCAL:
3741 case REQ_RANGE_COUNT:
3742 /* Not supported. */
3743 break;
3744 }
3745 break;
3746 case TREL_SAME_REGION:
3747 switch (preq->range) {
3748 case REQ_RANGE_TILE:
3749 fc_strlcat(buf, prefix, bufsz);
3750 if (preq->present) {
3751 fc_strlcat(buf, _("Must be on the same continent or ocean."),
3752 bufsz);
3753 } else {
3754 fc_strlcat(buf, _("Must be on a different continent or ocean."),
3755 bufsz);
3756 }
3757 return TRUE;
3759 fc_strlcat(buf, prefix, bufsz);
3760 if (preq->present) {
3761 fc_strlcat(buf, _("Must be cardinally adjacent to the same "
3762 "continent or ocean."),
3763 bufsz);
3764 } else {
3765 fc_strlcat(buf, _("Must not be cardinally adjacent to the same "
3766 "continent or ocean."),
3767 bufsz);
3768 }
3769 return TRUE;
3770 case REQ_RANGE_ADJACENT:
3771 fc_strlcat(buf, prefix, bufsz);
3772 if (preq->present) {
3773 fc_strlcat(buf, _("Must be adjacent to the same continent or "
3774 "ocean."),
3775 bufsz);
3776 } else {
3777 fc_strlcat(buf, _("Must not be adjacent to the same continent "
3778 "or ocean."),
3779 bufsz);
3780 }
3781 return TRUE;
3782 case REQ_RANGE_CITY:
3785 case REQ_RANGE_PLAYER:
3786 case REQ_RANGE_TEAM:
3787 case REQ_RANGE_ALLIANCE:
3788 case REQ_RANGE_WORLD:
3789 case REQ_RANGE_LOCAL:
3790 case REQ_RANGE_COUNT:
3791 /* Not supported. */
3792 break;
3793 }
3794 break;
3796 switch (preq->range) {
3798 fc_strlcat(buf, prefix, bufsz);
3799 if (preq->present) {
3800 fc_strlcat(buf, _("May only be cardinally adjacent to this "
3801 "other continent or ocean."),
3802 bufsz);
3803 } else {
3804 fc_strlcat(buf, _("Must be cardinally adjacent to more than "
3805 "just this other continent or ocean."),
3806 bufsz);
3807 }
3808 return TRUE;
3809 case REQ_RANGE_ADJACENT:
3810 fc_strlcat(buf, prefix, bufsz);
3811 if (preq->present) {
3812 fc_strlcat(buf, _("May only be adjacent to this other continent "
3813 "or ocean."),
3814 bufsz);
3815 } else {
3816 fc_strlcat(buf, _("Must be adjacent to more than just this "
3817 "other continent or ocean."),
3818 bufsz);
3819 }
3820 return TRUE;
3821 case REQ_RANGE_CITY:
3824 case REQ_RANGE_PLAYER:
3825 case REQ_RANGE_TEAM:
3826 case REQ_RANGE_ALLIANCE:
3827 case REQ_RANGE_WORLD:
3828 case REQ_RANGE_LOCAL:
3829 case REQ_RANGE_TILE:
3830 case REQ_RANGE_COUNT:
3831 /* Not supported. */
3832 break;
3833 }
3834 break;
3836 switch (preq->range) {
3837 case REQ_RANGE_TILE:
3838 fc_strlcat(buf, prefix, bufsz);
3839 if (preq->present) {
3840 fc_strlcat(buf, _("Must be on a lake or island surrounded by "
3841 "this continent or ocean."),
3842 bufsz);
3843 } else {
3844 fc_strlcat(buf, _("Must not be on a lake or island surrounded "
3845 "by this continent or ocean."),
3846 bufsz);
3847 }
3848 return TRUE;
3850 fc_strlcat(buf, prefix, bufsz);
3851 if (preq->present) {
3852 fc_strlcat(buf, _("Must be on or cardinally adjacent to a lake "
3853 "or island surrounded by this continent or "
3854 "ocean."),
3855 bufsz);
3856 } else {
3857 fc_strlcat(buf, _("Must not be on nor cardinally adjacent to a "
3858 "lake or island surrounded by this continent "
3859 "or ocean."),
3860 bufsz);
3861 }
3862 return TRUE;
3863 case REQ_RANGE_ADJACENT:
3864 fc_strlcat(buf, prefix, bufsz);
3865 if (preq->present) {
3866 fc_strlcat(buf, _("Must be on or adjacent to a lake or island "
3867 "surrounded by this continent or ocean."),
3868 bufsz);
3869 } else {
3870 fc_strlcat(buf, _("Must not be on nor adjacent to a lake or "
3871 "island surrounded by this continent or "
3872 "ocean."),
3873 bufsz);
3874 }
3875 return TRUE;
3876 case REQ_RANGE_CITY:
3879 case REQ_RANGE_PLAYER:
3880 case REQ_RANGE_TEAM:
3881 case REQ_RANGE_ALLIANCE:
3882 case REQ_RANGE_WORLD:
3883 case REQ_RANGE_LOCAL:
3884 case REQ_RANGE_COUNT:
3885 /* Not supported. */
3886 break;
3887 }
3888 break;
3889
3890 case TREL_COUNT:
3891 /* Invalid. */
3892 break;
3893 }
3894 break;
3895
3896 case VUT_COUNT:
3897 break;
3898 }
3899
3900 if (verb == VERB_DEFAULT) {
3901 char text[256];
3902
3903 log_error("%s requirement %s in range %d is not supported in reqtext.c.",
3904 preq->present ? "Present" : "Absent",
3905 universal_name_translation(&preq->source, text, sizeof(text)),
3906 preq->range);
3907 }
3908
3909 return FALSE;
3910}
3911
3912/*************************************************************/
3915bool req_text_insert_nl(char *buf, size_t bufsz, struct player *pplayer,
3916 const struct requirement *preq,
3917 enum rt_verbosity verb, const char *prefix)
3918{
3919 if (req_text_insert(buf, bufsz, pplayer, preq, verb, prefix)) {
3920 fc_strlcat(buf, "\n", bufsz);
3921
3922 return TRUE;
3923 }
3924
3925 return FALSE;
3926}
const char * achievement_name_translation(struct achievement *pach)
const char * action_name_translation(const struct action *paction)
Definition actions.c:1251
void astr_free(struct astring *astr)
Definition astring.c:148
const char * astr_build_or_list(struct astring *astr, const char *const *items, size_t number)
Definition astring.c:313
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:121
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:77
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:145
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:182
#define fc_assert(condition)
Definition log.h:177
#define log_error(message,...)
Definition log.h:104
const char * move_points_text(int mp, bool reduce)
Definition movement.c:1066
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:1080
const char * nation_plural_translation(const struct nation_type *pnation)
Definition nation.c:159
const char * diplrel_name_translation(int value)
Definition player.c:1614
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:3915
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:49
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:166
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:822
int cat_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:986
#define TRUE
Definition support.h:46
#define FALSE
Definition support.h:47
const char * advance_name_translation(const struct advance *padvance)
Definition tech.c:300
const char * terrain_class_name_translation(enum terrain_class tclass)
Definition terrain.c:664
const char * terrain_name_translation(const struct terrain *pterrain)
Definition terrain.c:240
enum terrain_class terrain_type_terrain_class(const struct terrain *pterrain)
Definition terrain.c:585
#define terrain_type_iterate(_p)
Definition terrain.h:267
#define terrain_type_iterate_end
Definition terrain.h:273
#define terrain_has_flag(terr, flag)
Definition terrain.h:177
const char * tiledef_name_translation(const struct tiledef *td)
Definition tiledef.c:95
const char * goods_name_translation(struct goods_type *pgood)
const char * uclass_name_translation(const struct unit_class *pclass)
Definition unittype.c:1658
Unit_Class_id uclass_count(void)
Definition unittype.c:2475
const char * utype_name_translation(const struct unit_type *punittype)
Definition unittype.c:1586
bool role_units_translations(struct astring *astr, int flag, bool alts)
Definition unittype.c:1694
static bool uclass_has_flag(const struct unit_class *punitclass, enum unit_class_flag_id flag)
Definition unittype.h:773
#define unit_class_iterate(_p)
Definition unittype.h:916
#define unit_class_iterate_end
Definition unittype.h:923