Freeciv-3.4
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
42
43#define DEFAULT_SPECIALIST default_specialist
44
45extern struct specialist specialists[SP_MAX];
46extern int default_specialist;
47
48/* General specialist accessor functions. */
53
55struct specialist *specialist_by_rule_name(const char *name);
57
58const char *specialist_rule_name(const struct specialist *sp);
59const char *specialist_plural_translation(const struct specialist *sp);
60const char *specialist_abbreviation_translation(const struct specialist *sp);
61
64bool is_super_specialist(const struct specialist *sp);
65bool is_normal_specialist(const struct specialist *sp);
66
67/* Ancillary routines */
68const char *specialists_abbreviation_string(void);
70
71int get_specialist_output(const struct city *pcity,
73
74/* Initialization and iteration */
75void specialists_init(void);
76void specialists_free(void);
77
78/* usually an index to arrays */
79#define specialist_type_iterate(sp) \
80{ \
81 Specialist_type_id sp; \
82 \
83 for (sp = 0; sp < specialist_count(); sp++) {
84
85#define specialist_type_iterate_end \
86 } \
87}
88
89#define normal_specialist_type_iterate(sp) \
90{ \
91 Specialist_type_id sp; \
92 \
93 for (sp = 0; sp < normal_specialist_count(); sp++) {
94
95#define normal_specialist_type_iterate_end \
96 } \
97}
98
99#define super_specialist_type_iterate(sp) \
100{ \
101 Specialist_type_id sp; \
102 \
103 for (sp = normal_specialist_count(); sp < specialist_count(); sp++) {
104
105#define super_specialist_type_iterate_end \
106 } \
107}
108
109#define specialist_type_re_active_iterate(_p) \
110 specialist_type_iterate(_p##_) { \
111 struct specialist *_p = specialist_by_number(_p##_); \
112 if (!_p->ruledit_disabled) {
113
114#define specialist_type_re_active_iterate_end \
115 } \
116 } specialist_type_iterate_end;
117
118#ifdef __cplusplus
119}
120#endif /* __cplusplus */
121
122#endif /* FC__SPECIALIST_H */
char * incite_cost
Definition comments.c:76
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit int const struct action *paction struct unit struct city * pcity
Definition dialogs_g.h:78
unsigned char citizens
Definition fc_types.h:248
#define SP_MAX
Definition fc_types.h:268
int Specialist_type_id
Definition fc_types.h:235
#define MAX_LEN_NAME
Definition fc_types.h:67
enum output_type_id Output_type_id
Definition fc_types.h:238
const char * name
Definition inputfile.c:127
struct specialist specialists[SP_MAX]
Definition specialist.c:30
const char * specialists_abbreviation_string(void)
Definition specialist.c:227
struct specialist * specialist_by_rule_name(const char *name)
Definition specialist.c:123
struct specialist * specialist_by_number(const Specialist_type_id id)
Definition specialist.c:110
bool is_super_specialist_id(Specialist_type_id sp)
Definition specialist.c:184
bool is_normal_specialist(const struct specialist *sp)
Definition specialist.c:217
Specialist_type_id specialist_index(const struct specialist *sp)
Definition specialist.c:90
Specialist_type_id specialist_number(const struct specialist *sp)
Definition specialist.c:100
Specialist_type_id normal_specialist_count(void)
Definition specialist.c:79
const char * specialist_rule_name(const struct specialist *sp)
Definition specialist.c:157
int default_specialist
Definition specialist.c:31
const char * specialist_plural_translation(const struct specialist *sp)
Definition specialist.c:166
void specialists_free(void)
Definition specialist.c:53
Specialist_type_id specialist_count(void)
Definition specialist.c:71
const char * specialist_abbreviation_translation(const struct specialist *sp)
Definition specialist.c:175
void specialists_init(void)
Definition specialist.c:36
const char * specialists_string(const citizens *specialist_list)
Definition specialist.c:252
bool is_normal_specialist_id(Specialist_type_id sp)
Definition specialist.c:196
struct specialist * specialist_by_translated_name(const char *name)
Definition specialist.c:141
bool is_super_specialist(const struct specialist *sp)
Definition specialist.c:208
int get_specialist_output(const struct city *pcity, Specialist_type_id sp, Output_type_id otype)
Definition specialist.c:270
Definition city.h:318
int item_number
Definition specialist.h:30
struct requirement_vector reqs
Definition specialist.h:38
char graphic_alt[MAX_LEN_NAME]
Definition specialist.h:36
bool ruledit_disabled
Definition specialist.h:33
struct strvec * helptext
Definition specialist.h:40
char graphic_str[MAX_LEN_NAME]
Definition specialist.h:35
struct name_translation name
Definition specialist.h:31
struct name_translation abbreviation
Definition specialist.h:32