Freeciv-3.2: /fast/freeciv/nightly/S3_2/common/specialist.h Source File

Freeciv-3.2

Loading...
Searching...
No Matches
specialist.h
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 2005 - The Freeciv Project
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#ifndef FC__SPECIALIST_H
15#define FC__SPECIALIST_H
16
17#ifdef __cplusplus
18extern "C" {
19#endif /* __cplusplus */
20
21/* utility */
22#include "shared.h"
23
24/* common */
25#include "fc_types.h"
26#include "name_translation.h"
27#include "requirements.h"
28
29 struct specialist {
30 int item_number;
31 struct name_translation name;
32 struct name_translation abbreviation;
33 bool ruledit_disabled;
34
35 char graphic_str[MAX_LEN_NAME];
36 char graphic_alt[MAX_LEN_NAME];
37
38 struct requirement_vector reqs;
39
40 struct strvec *helptext;
41};
42
43#define DEFAULT_SPECIALIST default_specialist
44
45extern struct specialist specialists[SP_MAX];
46extern int default_specialist;
47
48/* General specialist accessor functions. */
49 Specialist_type_id specialist_count(void);
50 Specialist_type_id specialist_index(const struct specialist *sp);
51 Specialist_type_id specialist_number(const struct specialist *sp);
52
53struct specialist *specialist_by_number(const Specialist_type_id id);
54struct specialist *specialist_by_rule_name(const char *name);
55struct specialist *specialist_by_translated_name(const char *name);
56
57const char *specialist_rule_name(const struct specialist *sp);
58const char *specialist_plural_translation(const struct specialist *sp);
59const char *specialist_abbreviation_translation(const struct specialist *sp);
60
61/* Ancillary routines */
62const char *specialists_abbreviation_string(void);
63const char *specialists_string(const citizens *specialist_list);
64
65int get_specialist_output(const struct city *pcity,
66 Specialist_type_id sp, Output_type_id otype);
67
68/* Initialization and iteration */
69void specialists_init(void);
70void specialists_free(void);
71
72/* usually an index to arrays */
73#define specialist_type_iterate(sp) \
74{ \
75 Specialist_type_id sp; \
76 \
77 for (sp = 0; sp < specialist_count(); sp++) {
78
79#define specialist_type_iterate_end \
80 } \
81}
82
83#define specialist_type_re_active_iterate(_p) \
84 specialist_type_iterate(_p##_) { \
85 struct specialist *_p = specialist_by_number(_p##_); \
86 if (!_p->ruledit_disabled) {
87
88#define specialist_type_re_active_iterate_end \
89 } \
90 } specialist_type_iterate_end;
91
92#ifdef __cplusplus
93}
94#endif /* __cplusplus */
95
96#endif /* FC__SPECIALIST_H */
incite_cost
char * incite_cost
Definition comments.c:74
fc_types.h
citizens
unsigned char citizens
Definition fc_types.h:391
SP_MAX
#define SP_MAX
Definition fc_types.h:412
Specialist_type_id
int Specialist_type_id
Definition fc_types.h:378
MAX_LEN_NAME
#define MAX_LEN_NAME
Definition fc_types.h:66
Output_type_id
enum output_type_id Output_type_id
Definition fc_types.h:381
name
const char * name
Definition inputfile.c:127
name_translation.h
requirements.h
shared.h
specialists
struct specialist specialists[SP_MAX]
Definition specialist.c:30
specialists_abbreviation_string
const char * specialists_abbreviation_string(void)
Definition specialist.c:174
specialist_by_rule_name
struct specialist * specialist_by_rule_name(const char *name)
Definition specialist.c:112
specialist_by_number
struct specialist * specialist_by_number(const Specialist_type_id id)
Definition specialist.c:100
specialist_index
Specialist_type_id specialist_index(const struct specialist *sp)
Definition specialist.c:82
specialist_number
Specialist_type_id specialist_number(const struct specialist *sp)
Definition specialist.c:91
specialist_rule_name
const char * specialist_rule_name(const struct specialist *sp)
Definition specialist.c:146
default_specialist
int default_specialist
Definition specialist.c:31
specialist_plural_translation
const char * specialist_plural_translation(const struct specialist *sp)
Definition specialist.c:155
specialists_free
void specialists_free(void)
Definition specialist.c:53
specialist_count
Specialist_type_id specialist_count(void)
Definition specialist.c:71
specialist_abbreviation_translation
const char * specialist_abbreviation_translation(const struct specialist *sp)
Definition specialist.c:164
specialists_init
void specialists_init(void)
Definition specialist.c:36
specialists_string
const char * specialists_string(const citizens *specialist_list)
Definition specialist.c:199
specialist_by_translated_name
struct specialist * specialist_by_translated_name(const char *name)
Definition specialist.c:130
get_specialist_output
int get_specialist_output(const struct city *pcity, Specialist_type_id sp, Output_type_id otype)
Definition specialist.c:217
city
Definition city.h:320
name_translation
Definition name_translation.h:35
specialist
Definition specialist.h:29
specialist::item_number
int item_number
Definition specialist.h:30
specialist::reqs
struct requirement_vector reqs
Definition specialist.h:38
specialist::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition specialist.h:36
specialist::ruledit_disabled
bool ruledit_disabled
Definition specialist.h:33
specialist::helptext
struct strvec * helptext
Definition specialist.h:40
specialist::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition specialist.h:35
specialist::name
struct name_translation name
Definition specialist.h:31
specialist::abbreviation
struct name_translation abbreviation
Definition specialist.h:32
strvec
Definition string_vector.c:29