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#include "terrain.h"
23
34
35void tiledefs_init(void);
36void tiledefs_free(void);
37
38int tiledef_count(void);
39int tiledef_number(const struct tiledef *td);
40struct tiledef *tiledef_by_number(int id);
41
42/* For optimization purposes (being able to have it as macro instead of function
43 * call) this is now same as tiledef_number(). tiledef.c does have semantically
44 * correct implementation too. */
45#define tiledef_index(_td_) (_td_)->id
46
47const char *tiledef_name_translation(const struct tiledef *td);
48const char *tiledef_rule_name(const struct tiledef *td);
49struct tiledef *tiledef_by_rule_name(const char *name);
50struct tiledef *tiledef_by_translated_name(const char *name);
51
52#define tiledef_iterate(_p) \
53{ \
54 int _i_##_p; \
55 for (_i_##_p = 0; _i_##_p < game.control.num_tiledef_types; _i_##_p++) { \
56 struct tiledef *_p = tiledef_by_number(_i_##_p);
57
58#define tiledef_iterate_end \
59 } \
60}
61
62bool tile_matches_tiledef(const struct tiledef *td, const struct tile *ptile,
63 const struct player *pplayer)
64 fc__attribute((nonnull (1, 2)));
65
66bool is_tiledef_card_near(const struct civ_map *nmap, const struct tile *ptile,
67 const struct tiledef *ptd, const struct player *pplayer);
68bool is_tiledef_near_tile(const struct civ_map *nmap, const struct tile *ptile,
69 const struct tiledef *ptd, const struct player *pplayer);
70
71#ifdef __cplusplus
72}
73#endif /* __cplusplus */
74
75#endif /* FC__TILEDEF_H */
char * incite_cost
Definition comments.c:77
const char * name
Definition inputfile.c:127
Definition tile.h:50
struct name_translation name
Definition tiledef.h:27
enum terrain_flag_id terr_flag
Definition tiledef.h:29
int id
Definition tiledef.h:26
struct extra_type_list * extras
Definition tiledef.h:30
bool known
Definition tiledef.h:31
bool owned
Definition tiledef.h:32
#define fc__attribute(x)
Definition support.h:99
const char * tiledef_rule_name(const struct tiledef *td)
Definition tiledef.c:104
int tiledef_number(const struct tiledef *td)
Definition tiledef.c:62
struct tiledef * tiledef_by_number(int id)
Definition tiledef.c:84
bool tile_matches_tiledef(const struct tiledef *td, const struct tile *ptile, const struct player *pplayer) fc__attribute((nonnull(1
struct tiledef * tiledef_by_rule_name(const char *name)
Definition tiledef.c:113
int tiledef_count(void)
Definition tiledef.c:54
bool is_tiledef_near_tile(const struct civ_map *nmap, const struct tile *ptile, const struct tiledef *ptd, const struct player *pplayer)
Definition tiledef.c:198
void tiledefs_init(void)
Definition tiledef.c:29
void tiledefs_free(void)
Definition tiledef.c:42
struct tiledef * tiledef_by_translated_name(const char *name)
Definition tiledef.c:136
const char * tiledef_name_translation(const struct tiledef *td)
Definition tiledef.c:95
bool bool is_tiledef_card_near(const struct civ_map *nmap, const struct tile *ptile, const struct tiledef *ptd, const struct player *pplayer)
Definition tiledef.c:182