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__MAP_TYPES_H
14 #define FC__MAP_TYPES_H
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif /* __cplusplus */
19 
20 /* utility */
21 #include "randseed.h"
22 
23 /****************************************************************
24   Miscellaneous terrain information
25 *****************************************************************/
26 #define terrain_misc packet_ruleset_terrain_control
27 
28 /* Some types used below. */
29 struct nation_hash;
30 struct nation_type;
31 struct packet_edit_startpos_full;
32 struct startpos;
33 struct startpos_hash;
34 
35 enum mapsize_type {
36   MAPSIZE_FULLSIZE = 0, /* Using the number of tiles / 1000. */
37   MAPSIZE_PLAYER,       /* Define the number of (land) tiles per player;
38                          * the setting 'landmass' and the number of players
39                          * are used to calculate the map size. */
40   MAPSIZE_XYSIZE        /* 'xsize' and 'ysize' are defined. */
41 };
42 
43 enum map_generator {
44   MAPGEN_SCENARIO = 0,
45   MAPGEN_RANDOM,
46   MAPGEN_FRACTAL,
47   MAPGEN_ISLAND,
48   MAPGEN_FAIR
49 };
50 
51 enum map_startpos {
52   MAPSTARTPOS_DEFAULT = 0,      /* Generator's choice. */
53   MAPSTARTPOS_SINGLE,           /* One player per continent. */
54   MAPSTARTPOS_2or3,             /* Two on three players per continent. */
55   MAPSTARTPOS_ALL,              /* All players on a single continent. */
56   MAPSTARTPOS_VARIABLE,         /* Depending on size of continents. */
57 };
58 
59 #define SPECENUM_NAME team_placement
60 #define SPECENUM_VALUE0 TEAM_PLACEMENT_DISABLED
61 #define SPECENUM_VALUE1 TEAM_PLACEMENT_CLOSEST
62 #define SPECENUM_VALUE2 TEAM_PLACEMENT_CONTINENT
63 #define SPECENUM_VALUE3 TEAM_PLACEMENT_HORIZONTAL
64 #define SPECENUM_VALUE4 TEAM_PLACEMENT_VERTICAL
65 #include "specenum_gen.h"
66 
67 struct civ_map {
68   int topology_id;
69   enum direction8 valid_dirs[8], cardinal_dirs[8];
70   int num_valid_dirs, num_cardinal_dirs;
71   struct iter_index *iterate_outwards_indices;
72   int num_iterate_outwards_indices;
73   int xsize, ysize; /* native dimensions */
74   int num_continents;
75   int num_oceans;               /* not updated at the client */
76   struct tile *tiles;
77   struct startpos_hash *startpos_table;
78 
79   union {
80     struct {
81       enum mapsize_type mapsize; /* how the map size is defined */
82       int size; /* used to calculate [xy]size */
83       int tilesperplayer; /* tiles per player; used to calculate size */
84       randseed seed_setting;
85       randseed seed;
86       int riches;
87       int huts;
88       int huts_absolute; /* For compatibility conversion from pre-2.6 savegames */
89       int animals;
90       int landpercent;
91       enum map_generator generator;
92       enum map_startpos startpos;
93       bool tinyisles;
94       bool separatepoles;
95       int flatpoles;
96       bool single_pole;
97       bool alltemperate;
98       int temperature;
99       int wetness;
100       int steepness;
101       bool ocean_resources;         /* Resources in the middle of the ocean */
102       bool have_huts;
103       bool have_resources;
104       enum team_placement team_placement;
105     } server;
106 
107     /* Add client side when needed */
108   };
109 };
110 
111 #ifdef __cplusplus
112 }
113 #endif /* __cplusplus */
114 
115 #endif  /* FC__MAP_H */
116