Freeciv-3.3
Loading...
Searching...
No Matches
mapgen_topology.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__MAPGEN_TOPOLOGY_H
14#define FC__MAPGEN_TOPOLOGY_H
15
16/* utility */
17#include "support.h" /* bool type */
18
19/* This is the maximal colatitude at equators returned by map_colatitude()
20 * When changing this, make sure colat_from_abs_lat() still works */
21#define MAX_COLATITUDE MAP_MAX_LATITUDE
22
23#if MAX_COLATITUDE == MAP_MAX_LATITUDE
24#define colat_from_abs_lat(_lat) (MAX_COLATITUDE - _lat)
25#else
26#define colat_from_abs_lat(_lat) \
27 (MAX_COLATITUDE - (_lat * MAX_COLATITUDE / MAP_MAX_LATITUDE))
28#endif
29
30/* Maximum and minimum colatitude actually present in the world */
31#define MAX_REAL_COLATITUDE(_nmap) \
32 colat_from_abs_lat(MAP_MIN_ABS_LATITUDE(_nmap))
33#define MIN_REAL_COLATITUDE(_nmap) \
34 colat_from_abs_lat(MAP_MAX_ABS_LATITUDE(_nmap))
35#define REAL_COLATITUDE_RANGE(_nmap) \
36 (MAX_REAL_COLATITUDE(_nmap) - MIN_REAL_COLATITUDE(_nmap))
37
38int get_sqsize(void);
39
40/* Size safe Unit of colatitude. 0 is not allowed due to possibility of
41 * division by 0 in mapgen.c */
42#define L_UNIT MAX(1, wld.map.server.size * MAX_COLATITUDE / (30 * get_sqsize()))
43
44/* define the 3 regions of a Earth like map:
45 0 - COLD_LV: cold region
46 COLD_LV - TREOPICAL_LV: temperate wet region
47 TROPICAL_LV - MAX_COLATITUDE: tropical wet region
48 and a dry region, this last one can ovelap others
49 DRY_MIN_LEVEL- DRY_MAX_LEVEL */
50#define COLD_LEVEL \
51 (MAX(0, MAX_COLATITUDE * (60*7 - wld.map.server.temperature * 6 ) / 700))
52#define TROPICAL_LEVEL \
53 (MIN(MAX_COLATITUDE * 9 /10, \
54 MAX_COLATITUDE * (143*7 - wld.map.server.temperature * 10) / 700))
55#define DRY_MIN_LEVEL \
56 (MAX_COLATITUDE * (7300 - wld.map.server.temperature * 18 ) / 10000)
57#define DRY_MAX_LEVEL \
58 (MAX_COLATITUDE * (7300 + wld.map.server.temperature * 17 ) / 10000)
59
60/* used to create the poles and for separating them. In a
61 * mercator projection map we don't want the poles to be too big. */
62extern int ice_base_colatitude;
63#define ICE_BASE_LEVEL ice_base_colatitude
64
65int map_colatitude(const struct tile *ptile);
66bool near_singularity(const struct tile *ptile);
68
69#endif /* FC__MAPGEN_TOPOLOGY_H */
char * incite_cost
Definition comments.c:76
void generator_init_topology(bool autosize)
int get_sqsize(void)
int ice_base_colatitude
int map_colatitude(const struct tile *ptile)
bool near_singularity(const struct tile *ptile)
Definition tile.h:50