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
33
34void tiledefs_init(void);
35void tiledefs_free(void);
36
37int tiledef_count(void);
38int tiledef_number(const struct tiledef *td);
39struct tiledef *tiledef_by_number(int id);
40
41/* For optimization purposes (being able to have it as macro instead of function
42 * call) this is now same as tiledef_number(). tiledef.c does have semantically
43 * correct implementation too. */
44#define tiledef_index(_td_) (_td_)->id
45
46const char *tiledef_name_translation(const struct tiledef *td);
47const char *tiledef_rule_name(const struct tiledef *td);
48struct tiledef *tiledef_by_rule_name(const char *name);
49struct tiledef *tiledef_by_translated_name(const char *name);
50
51#define tiledef_iterate(_p) \
52{ \
53 int _i_##_p; \
54 for (_i_##_p = 0; _i_##_p < game.control.num_tiledef_types; _i_##_p++) { \
55 struct tiledef *_p = tiledef_by_number(_i_##_p);
56
57#define tiledef_iterate_end \
58 } \
59}
60
61bool tile_matches_tiledef(const struct tiledef *td, const struct tile *ptile,
62 const struct player *pplayer)
63 fc__attribute((nonnull (1, 2)));
64
65bool is_tiledef_card_near(const struct civ_map *nmap, const struct tile *ptile,
66 const struct tiledef *ptd, const struct player *pplayer);
67bool is_tiledef_near_tile(const struct civ_map *nmap, const struct tile *ptile,
68 const struct tiledef *ptd, const struct player *pplayer);
69
70#ifdef __cplusplus
71}
72#endif /* __cplusplus */
73
74#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
#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:193
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:177