Stop sharing requirement_unit_state_ereq().
[freeciv.git] / common / specialist.h
blob755cf6afc9ba77e0e561e531f0fd2b3fe19ad2ba
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.
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 ***********************************************************************/
14 #ifndef FC__SPECIALIST_H
15 #define FC__SPECIALIST_H
17 #ifdef __cplusplus
18 extern "C" {
19 #endif /* __cplusplus */
21 /* utility */
22 #include "shared.h"
24 /* common */
25 #include "fc_types.h"
26 #include "name_translation.h"
27 #include "requirements.h"
29 struct specialist {
30 int item_number;
31 struct name_translation name;
32 struct name_translation abbreviation;
33 bool disabled;
35 char graphic_alt[MAX_LEN_NAME];
37 struct requirement_vector reqs;
39 struct strvec *helptext;
42 #define DEFAULT_SPECIALIST default_specialist
44 extern struct specialist specialists[SP_MAX];
45 extern int default_specialist;
47 /* General specialist accessor functions. */
48 Specialist_type_id specialist_count(void);
49 Specialist_type_id specialist_index(const struct specialist *sp);
50 Specialist_type_id specialist_number(const struct specialist *sp);
52 struct specialist *specialist_by_number(const Specialist_type_id id);
53 struct specialist *specialist_by_rule_name(const char *name);
54 struct specialist *specialist_by_translated_name(const char *name);
56 const char *specialist_rule_name(const struct specialist *sp);
57 const char *specialist_plural_translation(const struct specialist *sp);
58 const char *specialist_abbreviation_translation(const struct specialist *sp);
60 /* Ancillary routines */
61 const char *specialists_abbreviation_string(void);
62 const char *specialists_string(const citizens *specialist_list);
64 int get_specialist_output(const struct city *pcity,
65 Specialist_type_id sp, Output_type_id otype);
67 /* Initialization and iteration */
68 void specialists_init(void);
69 void specialists_free(void);
71 /* usually an index to arrays */
72 #define specialist_type_iterate(sp) \
73 { \
74 Specialist_type_id sp; \
76 for (sp = 0; sp < specialist_count(); sp++) {
78 #define specialist_type_iterate_end \
79 } \
82 #define specialist_active_type_iterate(_p) \
83 specialist_type_iterate(_p##_) { \
84 struct specialist *_p = specialist_by_number(_p##_); \
85 if (!_p->disabled) {
87 #define specialist_active_type_iterate_end \
88 } \
89 } specialist_type_iterate_end;
91 #ifdef __cplusplus
93 #endif /* __cplusplus */
95 #endif /* FC__SPECIALIST_H */