Freeciv-3.3
Loading...
Searching...
No Matches
world_object.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__WORLD_OBJECT_H
14#define FC__WORLD_OBJECT_H
15
16#ifdef __cplusplus
17extern "C" {
18#endif /* __cplusplus */
19
20/* common */
21#include "map_types.h"
22
23
24/* struct city_hash. */
25#define SPECHASH_TAG city
26#define SPECHASH_INT_KEY_TYPE
27#define SPECHASH_IDATA_TYPE struct city *
28#include "spechash.h"
29
30/* struct unit_hash. */
31#define SPECHASH_TAG unit
32#define SPECHASH_INT_KEY_TYPE
33#define SPECHASH_IDATA_TYPE struct unit *
34#include "spechash.h"
35
36struct world
37{
38 struct civ_map map;
41};
42
43extern struct world wld; /* In game.c */
44
45
46#define MAP_IS_ISOMETRIC (CURRENT_TOPOLOGY & (TF_ISO + TF_HEX))
47
48#define CURRENT_TOPOLOGY (wld.map.topology_id)
49#define CURRENT_WRAP (wld.map.wrap_id)
50
51/* Number of index coordinates (for sanity checks and allocations) */
52#define MAP_INDEX_SIZE (wld.map.xsize * wld.map.ysize)
53
54/* Width and height of the map, in native coordinates. */
55#define MAP_NATIVE_WIDTH wld.map.xsize
56#define MAP_NATIVE_HEIGHT wld.map.ysize
57
58/* Width and height of the map, in natural coordinates. */
59#define MAP_NATURAL_WIDTH (MAP_IS_ISOMETRIC ? 2 * wld.map.xsize : wld.map.xsize)
60#define MAP_NATURAL_HEIGHT wld.map.ysize
61
62#define MAP_CARDINAL_DIRS wld.map.cardinal_dirs
63#define MAP_NUM_CARDINAL_DIRS wld.map.num_cardinal_dirs
64#define MAP_VALID_DIRS wld.map.valid_dirs
65#define MAP_NUM_VALID_DIRS wld.map.num_valid_dirs
66#define MAP_ITERATE_OUTWARDS_INDICES wld.map.iterate_outwards_indices
67#define MAP_NUM_ITERATE_OUTWARDS_INDICES wld.map.num_iterate_outwards_indices
68
69#ifdef __cplusplus
70}
71#endif /* __cplusplus */
72
73#endif /* FC__WORLD_OBJECT_H */
char * incite_cost
Definition comments.c:76
struct unit_hash * units
struct city_hash * cities
struct civ_map map
struct world wld
Definition game.c:62