Freeciv21
Develop your civilization from humble roots to a global empire
style.h
Go to the documentation of this file.
1 /**************************************************************************
2  Copyright (c) 1996-2020 Freeciv21 and Freeciv contributors. This file
3  is part of Freeciv21. Freeciv21 is free software:
4 |\_/|,,_____,~~` you can redistribute it and/or modify it under the
5 (.".)~~ )`~}} terms of the GNU General Public License as published
6  \o/\ /---~\\ ~}} by the Free Software Foundation, either version 3 of
7  _// _// ~} the License, or (at your option) any later version.
8  You should have received a copy of the GNU General
9  Public License along with Freeciv21. If not, see
10  https://www.gnu.org/licenses/.
11 **************************************************************************/
12 
13 #pragma once
14 
15 #include "name_translation.h"
16 #include "requirements.h"
17 
18 struct nation_style {
19  int id;
20  struct name_translation name;
22 };
23 
24 struct music_style {
25  int id;
26  QString music_peaceful;
27  QString music_combat;
28  struct requirement_vector reqs;
29 };
30 
31 void styles_alloc(int count);
32 void styles_free();
33 int style_number(const struct nation_style *pstyle);
34 int style_index(const struct nation_style *pstyle);
35 struct nation_style *style_by_number(int id);
36 const char *style_name_translation(const struct nation_style *pstyle);
37 const char *style_rule_name(const struct nation_style *pstyle);
38 struct nation_style *style_by_rule_name(const char *name);
39 
40 #define styles_iterate(_p) \
41  { \
42  int _i_; \
43  for (_i_ = 0; _i_ < game.control.num_styles; _i_++) { \
44  struct nation_style *_p = style_by_number(_i_);
45 
46 #define styles_iterate_end \
47  } \
48  }
49 
50 #define styles_re_active_iterate(_p) \
51  styles_iterate(_p) \
52  { \
53  if (!_p->ruledit_disabled) {
54 
55 #define styles_re_active_iterate_end \
56  } \
57  } \
58  styles_iterate_end;
59 
60 void music_styles_alloc(int count);
61 void music_styles_free();
62 
63 int music_style_number(const struct music_style *pms);
64 struct music_style *music_style_by_number(int id);
65 
66 struct music_style *player_music_style(struct player *plr);
67 
68 #define music_styles_iterate(_p) \
69  { \
70  int _i_; \
71  for (_i_ = 0; _i_ < game.control.num_music_styles; _i_++) { \
72  struct music_style *_p = music_style_by_number(_i_); \
73  if (_p != nullptr) {
74 
75 #define music_styles_iterate_end \
76  } \
77  } \
78  }
79 
80 int style_of_city(const struct city *pcity);
81 
82 int basic_city_style_for_style(struct nation_style *pstyle);
83 
84 int city_style(struct city *pcity);
const char * name
Definition: inputfile.cpp:118
Definition: city.h:291
struct requirement_vector reqs
Definition: style.h:28
QString music_peaceful
Definition: style.h:26
QString music_combat
Definition: style.h:27
int id
Definition: style.h:25
struct name_translation name
Definition: style.h:20
int id
Definition: style.h:19
bool ruledit_disabled
Definition: style.h:21
Definition: player.h:231
struct music_style * player_music_style(struct player *plr)
Return music style for player.
Definition: style.cpp:172
int city_style(struct city *pcity)
Return citystyle of the city.
Definition: style.cpp:234
struct nation_style * style_by_rule_name(const char *name)
Returns style matching rule name or nullptr if there is no style with such name.
Definition: style.cpp:103
const char * style_rule_name(const struct nation_style *pstyle)
Return the (untranslated) rule name of the style.
Definition: style.cpp:94
void music_styles_free()
Free the memory associated with music styles.
Definition: style.cpp:136
struct music_style * music_style_by_number(int id)
Return music style of given id.
Definition: style.cpp:158
void styles_alloc(int count)
Initialise styles structures.
Definition: style.cpp:30
int music_style_number(const struct music_style *pms)
Return the music style id.
Definition: style.cpp:148
void styles_free()
Free the memory associated with styles.
Definition: style.cpp:45
struct nation_style * style_by_number(int id)
Return style of given id.
Definition: style.cpp:74
int style_of_city(const struct city *pcity)
Evaluate which style should be used to draw a city.
Definition: style.cpp:192
int style_number(const struct nation_style *pstyle)
Return the style id.
Definition: style.cpp:54
void music_styles_alloc(int count)
Initialise music styles structures.
Definition: style.cpp:121
int style_index(const struct nation_style *pstyle)
Return the style index.
Definition: style.cpp:64
int basic_city_style_for_style(struct nation_style *pstyle)
Return basic city style representing nation style.
Definition: style.cpp:197
const char * style_name_translation(const struct nation_style *pstyle)
Return the (translated) name of the style.
Definition: style.cpp:85