File: multipliers.h

package info (click to toggle)
freeciv 2.6.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 212,508 kB
  • sloc: ansic: 443,831; cpp: 29,541; sh: 7,982; makefile: 7,886; python: 1,933; xml: 945
file content (69 lines) | stat: -rw-r--r-- 1,995 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/********************************************************************** 
 Freeciv - Copyright (C) 2014 - SÅ‚awomir Lach
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2, or (at your option)
   any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
***********************************************************************/

#ifndef FC__MULTIPLIERS_H
#define FC__MULTIPLIERS_H

#ifdef __cplusplus
extern "C" {
#endif

/* utility */
#include "bitvector.h"
#include "string_vector.h"

/* common */
#include "fc_types.h"
#include "name_translation.h"
  
struct multiplier
{
  Multiplier_type_id id;
  struct name_translation name;
  int start; /* display units */
  int stop;  /* display units */
  int step;  /* display units */
  int def;   /* default value, in display units */
  int offset;
  int factor;
  struct strvec *helptext;
};

void multipliers_init(void);
void multipliers_free(void);

Multiplier_type_id multiplier_count(void);
Multiplier_type_id multiplier_index(const struct multiplier *pmul);
Multiplier_type_id multiplier_number(const struct multiplier *pmul);

struct multiplier *multiplier_by_number(Multiplier_type_id id);

const char *multiplier_name_translation(const struct multiplier *pmul);
const char *multiplier_rule_name(const struct multiplier *pmul);
struct multiplier *multiplier_by_rule_name(const char *name);

#define multipliers_iterate(_mul_) \
{      \
    Multiplier_type_id _i; \
       for (_i = 0; _i < multiplier_count(); _i++) { \
        struct multiplier *_mul_ = multiplier_by_number(_i);

#define multipliers_iterate_end \
      }  \
}

#ifdef __cplusplus
}
#endif

#endif /* FC__MULTIPLIERS_H */