Freeciv-3.2
Loading...
Searching...
No Matches
multipliers.h
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 2014 - SÅ‚awomir Lach
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__MULTIPLIERS_H
15#define FC__MULTIPLIERS_H
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21/* utility */
22#include "bitvector.h"
23#include "string_vector.h"
24
25/* common */
26#include "fc_types.h"
27#include "name_translation.h"
28#include "requirements.h"
29
31{
34 bool ruledit_disabled; /* Does not really exist - hole in multipliers array */
35 int start; /* display units */
36 int stop; /* display units */
37 int step; /* display units */
38 int def; /* default value, in display units */
39 int offset;
40 int factor;
44};
45
46void multipliers_init(void);
47void multipliers_free(void);
48
52
54
55const char *multiplier_name_translation(const struct multiplier *pmul);
56const char *multiplier_rule_name(const struct multiplier *pmul);
57struct multiplier *multiplier_by_rule_name(const char *name);
58
59bool multiplier_can_be_changed(struct multiplier *pmul, struct player *pplayer);
60
61#define multipliers_iterate(_mul_) \
62{ \
63 Multiplier_type_id _i; \
64 for (_i = 0; _i < multiplier_count(); _i++) { \
65 struct multiplier *_mul_ = multiplier_by_number(_i);
66
67#define multipliers_iterate_end \
68 } \
69}
70
71#define multipliers_re_active_iterate(_mul_) \
72 multipliers_iterate(_mul_) { \
73 if (!_mul_->ruledit_disabled) {
74
75#define multipliers_re_active_iterate_end \
76 } \
77 } multipliers_iterate_end;
78
79#ifdef __cplusplus
80}
81#endif
82
83#endif /* FC__MULTIPLIERS_H */
char * incite_cost
Definition comments.c:75
int Multiplier_type_id
Definition fc_types.h:386
const char * name
Definition inputfile.c:127
const char * multiplier_rule_name(const struct multiplier *pmul)
void multipliers_free(void)
Definition multipliers.c:43
Multiplier_type_id multiplier_count(void)
Definition multipliers.c:88
const char * multiplier_name_translation(const struct multiplier *pmul)
Definition multipliers.c:97
bool multiplier_can_be_changed(struct multiplier *pmul, struct player *pplayer)
Multiplier_type_id multiplier_number(const struct multiplier *pmul)
Definition multipliers.c:67
struct multiplier * multiplier_by_rule_name(const char *name)
struct multiplier * multiplier_by_number(Multiplier_type_id id)
Definition multipliers.c:57
void multipliers_init(void)
Definition multipliers.c:28
Multiplier_type_id multiplier_index(const struct multiplier *pmul)
Definition multipliers.c:80
struct requirement_vector reqs
Definition multipliers.h:42
struct strvec * helptext
Definition multipliers.h:43
Multiplier_type_id id
Definition multipliers.h:32
int minimum_turns
Definition multipliers.h:41
bool ruledit_disabled
Definition multipliers.h:34
struct name_translation name
Definition multipliers.h:33