Freeciv-3.3: /fast/freeciv/nightly/main/tools/manual/manual_units.c Source File

Freeciv-3.3

Loading...
Searching...
No Matches
manual_units.c
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
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 "fcintl.h"
20
21/* common */
22#include "game.h"
23#include "movement.h"
24
25/* client */
26#include "helpdata.h"
27
28/* tools/manual */
29#include "fc_manual.h"
30
31/**********************************************************************/
37 bool manual_units(struct tag_types *tag_info)
38{
39 FILE *doc;
40
41 doc = manual_start(tag_info, MANUAL_UNITS);
42
43 if (doc == NULL) {
44 return FALSE;
45 }
46
47 /* Freeciv-web uses (parts of) the unit type HTML output in its own
48 * manual pages. */
49 /* FIXME: this doesn't resemble the wiki manual at all. */
50 /* TRANS: markup ... Freeciv version ... ruleset name ... markup */
51 fprintf(doc, _("%sFreeciv %s unit types help (%s)%s\n\n"),
52 tag_info->title_begin, VERSION_STRING, game.control.name,
53 tag_info->title_end);
54 unit_type_iterate(putype) {
55 char buf[64000];
56
57 fprintf(doc, tag_info->item_begin, "utype", putype->item_number);
58 fprintf(doc, "%s%s%s\n\n", tag_info->sect_title_begin,
59 utype_name_translation(putype), tag_info->sect_title_end);
60 fprintf(doc, tag_info->subitem_begin, "cost");
61 fprintf(doc,
62 PL_("Cost: %d shield",
63 "Cost: %d shields",
64 utype_build_shield_cost_base(putype)),
65 utype_build_shield_cost_base(putype));
66 fprintf(doc, "%s", tag_info->subitem_end);
67 fprintf(doc, tag_info->subitem_begin, "upkeep");
68 fprintf(doc, _("Upkeep: %s"),
69 helptext_unit_upkeep_str(putype));
70 fprintf(doc, "%s", tag_info->subitem_end);
71 fprintf(doc, tag_info->subitem_begin, "moves");
72 fprintf(doc, _("Moves: %s"),
73 move_points_text(putype->move_rate, TRUE));
74 fprintf(doc, "%s", tag_info->subitem_end);
75 fprintf(doc, tag_info->subitem_begin, "vision");
76 fprintf(doc, _("Vision: %d"),
77 (int)sqrt((double)putype->vision_radius_sq));
78 fprintf(doc, "%s", tag_info->subitem_end);
79 fprintf(doc, tag_info->subitem_begin, "attack");
80 fprintf(doc, _("Attack: %d"),
81 putype->attack_strength);
82 fprintf(doc, "%s", tag_info->subitem_end);
83 fprintf(doc, tag_info->subitem_begin, "defense");
84 fprintf(doc, _("Defense: %d"),
85 putype->defense_strength);
86 fprintf(doc, "%s", tag_info->subitem_end);
87 fprintf(doc, tag_info->subitem_begin, "firepower");
88 fprintf(doc, _("Firepower: %d"),
89 putype->firepower);
90 fprintf(doc, "%s", tag_info->subitem_end);
91 fprintf(doc, tag_info->subitem_begin, "hitpoints");
92 fprintf(doc, _("Hitpoints: %d"),
93 putype->hp);
94 fprintf(doc, "%s", tag_info->subitem_end);
95 fprintf(doc, tag_info->subitem_begin, "obsolete");
96 fprintf(doc, _("Obsolete by: %s"),
97 U_NOT_OBSOLETED == putype->obsoleted_by ?
98 Q_("?utype:None") :
99 utype_name_translation(putype->obsoleted_by));
100 fprintf(doc, "%s", tag_info->subitem_end);
101 fprintf(doc, tag_info->subitem_begin, "helptext");
102 helptext_unit(buf, sizeof(buf), NULL, "", putype);
103 fprintf(doc, "%s", buf);
104 fprintf(doc, "%s", tag_info->subitem_end);
105 fprintf(doc, "%s", tag_info->item_end);
106 } unit_type_iterate_end;
107
108 manual_finalize(tag_info, doc, MANUAL_UNITS);
109
110 return TRUE;
111}
incite_cost
char * incite_cost
Definition comments.c:74
manual_finalize
void manual_finalize(struct tag_types *tag_info, FILE *doc, enum manuals manual)
Definition fc_manual.c:316
manual_start
FILE * manual_start(struct tag_types *tag_info, int manual_number)
Definition fc_manual.c:287
fc_manual.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
game
struct civ_game game
Definition game.c:61
game.h
helptext_unit_upkeep_str
char * helptext_unit_upkeep_str(const struct unit_type *utype)
Definition helpdata.c:4966
helptext_unit
char * helptext_unit(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, const struct unit_type *utype)
Definition helpdata.c:1865
helpdata.h
manual_units
bool manual_units(struct tag_types *tag_info)
Definition manual_units.c:37
move_points_text
const char * move_points_text(int mp, bool reduce)
Definition movement.c:1016
movement.h
civ_game::control
struct packet_ruleset_control control
Definition game.h:83
packet_ruleset_control::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1463
tag_types
Definition fc_manual.h:28
TRUE
#define TRUE
Definition support.h:46
FALSE
#define FALSE
Definition support.h:47
utype_build_shield_cost_base
int utype_build_shield_cost_base(const struct unit_type *punittype)
Definition unittype.c:1468
utype_name_translation
const char * utype_name_translation(const struct unit_type *punittype)
Definition unittype.c:1560
unit_type_iterate
#define unit_type_iterate(_p)
Definition unittype.h:859
unit_type_iterate_end
#define unit_type_iterate_end
Definition unittype.h:866
U_NOT_OBSOLETED
#define U_NOT_OBSOLETED
Definition unittype.h:535