Freeciv-3.4
Loading...
Searching...
No Matches
tiledef.h
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
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#ifndef FC__TILEDEF_H
14#define FC__TILEDEF_H
15
16#ifdef __cplusplus
17extern "C" {
18#endif /* __cplusplus */
19
20/* common */
21#include "extras.h"
22
23struct tiledef
24{
25 int id;
27
29};
30
31void tiledefs_init(void);
32void tiledefs_free(void);
33
34int tiledef_count(void);
35int tiledef_number(const struct tiledef *td);
36struct tiledef *tiledef_by_number(int id);
37
38/* For optimization purposes (being able to have it as macro instead of function
39 * call) this is now same as tiledef_number(). tiledef.c does have semantically
40 * correct implementation too. */
41#define tiledef_index(_td_) (_td_)->id
42
43const char *tiledef_name_translation(const struct tiledef *td);
44const char *tiledef_rule_name(const struct tiledef *td);
45struct tiledef *tiledef_by_rule_name(const char *name);
46struct tiledef *tiledef_by_translated_name(const char *name);
47
48#define tiledef_iterate(_p) \
49{ \
50 int _i_##_p; \
51 for (_i_##_p = 0; _i_##_p < game.control.num_tiledef_types; _i_##_p++) { \
52 struct tiledef *_p = tiledef_by_number(_i_##_p);
53
54#define tiledef_iterate_end \
55 } \
56}
57
58bool tile_matches_tiledef(const struct tiledef *td, const struct tile *ptile)
59 fc__attribute((nonnull (1, 2)));
60
61#ifdef __cplusplus
62}
63#endif /* __cplusplus */
64
65#endif /* FC__TILEDEF_H */
char * incite_cost
Definition comments.c:76
const char * name
Definition inputfile.c:127
Definition tile.h:50
struct name_translation name
Definition tiledef.h:26
int id
Definition tiledef.h:25
struct extra_type_list * extras
Definition tiledef.h:28
#define fc__attribute(x)
Definition support.h:99
const char * tiledef_rule_name(const struct tiledef *td)
Definition tiledef.c:103
int tiledef_number(const struct tiledef *td)
Definition tiledef.c:61
struct tiledef * tiledef_by_number(int id)
Definition tiledef.c:83
struct tiledef * tiledef_by_rule_name(const char *name)
Definition tiledef.c:112
int tiledef_count(void)
Definition tiledef.c:53
bool tile_matches_tiledef(const struct tiledef *td, const struct tile *ptile) fc__attribute((nonnull(1
void tiledefs_init(void)
Definition tiledef.c:28
void tiledefs_free(void)
Definition tiledef.c:41
struct tiledef * tiledef_by_translated_name(const char *name)
Definition tiledef.c:135
const char * tiledef_name_translation(const struct tiledef *td)
Definition tiledef.c:94