Freeciv-3.2: /fast/freeciv/nightly/S3_2/common/reqtext.c Source File

Freeciv-3.2

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