Support changing players' science box in the editor.
[freeciv.git] / common / specialist.h
blob65fdf811feabc9e6c08231184db7e4696132c83f
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;
34 char graphic_alt[MAX_LEN_NAME];
36 struct requirement_vector reqs;
38 struct strvec *helptext;
41 #define DEFAULT_SPECIALIST default_specialist
43 extern struct specialist specialists[SP_MAX];
44 extern int default_specialist;
46 /* General specialist accessor functions. */
47 Specialist_type_id specialist_count(void);
48 Specialist_type_id specialist_index(const struct specialist *sp);
49 Specialist_type_id specialist_number(const struct specialist *sp);
51 struct specialist *specialist_by_number(const Specialist_type_id id);
52 struct specialist *specialist_by_rule_name(const char *name);
53 struct specialist *specialist_by_translated_name(const char *name);
55 const char *specialist_rule_name(const struct specialist *sp);
56 const char *specialist_plural_translation(const struct specialist *sp);
57 const char *specialist_abbreviation_translation(const struct specialist *sp);
59 /* Ancillary routines */
60 const char *specialists_abbreviation_string(void);
61 const char *specialists_string(const citizens *specialists);
63 int get_specialist_output(const struct city *pcity,
64 Specialist_type_id sp, Output_type_id otype);
66 /* Initialization and iteration */
67 void specialists_init(void);
68 void specialists_free(void);
70 /* usually an index to arrays */
71 #define specialist_type_iterate(sp) \
72 { \
73 Specialist_type_id sp; \
75 for (sp = 0; sp < specialist_count(); sp++) {
77 #define specialist_type_iterate_end \
78 } \
81 #ifdef __cplusplus
83 #endif /* __cplusplus */
85 #endif /* FC__SPECIALIST_H */