1 /* ---------------------------------------------------------------------- *
2  * lintypes.h
3  * This file is part of lincity.
4  * Lincity is copyright (c) I J Peters 1995-1997, (c) Greg Sharp 1997-2001.
5  * ---------------------------------------------------------------------- */
6 #ifndef __lintypes_h__
7 #define __lintypes_h__
8 
9 int get_group_of_type(short selected_type);
10 void set_map_groups(void);
11 int get_type_cost(short type);
12 int get_group_cost(short group);
13 void get_type_name(short type, char *s);
14 
15 /********** Data structures ***************/
16 
17 struct GROUP {
18     const char *name;           /* name of group */
19     unsigned short no_credit;   /* TRUE if need credit to build */
20     unsigned short group;       /* This is redundant: it must match
21                                    the index into the table */
22     unsigned short size;
23     int colour;                 /* summary map colour */
24     int cost_mul;               /* group cost multiplier */
25     int bul_cost;               /* group bulldoze cost */
26     int fire_chance;            /* probability of fire */
27     int cost;                   /* group cost */
28     int tech;                   /* group cost */
29 };
30 
31 struct TYPE {
32     int group;                  /* What group does this type belong to? */
33     char *graphic;              /* Bitmap of the graphic */
34 };
35 
36 struct map_point_info_struct {
37     int population;
38     int flags;
39     unsigned short coal_reserve;
40     unsigned short ore_reserve;
41     int int_1;
42     int int_2;
43     int int_3;
44     int int_4;
45     int int_5;
46     int int_6;
47     int int_7;
48 };
49 typedef struct map_point_info_struct Map_Point_Info;
50 
51 /* Set these flags to true when they need to be updated on the screen */
52 struct update_scoreboard_struct {
53     int mps;
54     int mini;
55     int date;
56     int money;
57     int monthly;
58     int yearly_1;
59     int yearly_2;
60     long int message_area;
61 };
62 typedef struct update_scoreboard_struct Update_Scoreboard;
63 
64 /* GCS -- One of these days I will get this right. */
65 struct map_struct {
66     short type[WORLD_SIDE_LEN][WORLD_SIDE_LEN];
67     short group[WORLD_SIDE_LEN][WORLD_SIDE_LEN];
68     int pollution[WORLD_SIDE_LEN][WORLD_SIDE_LEN];
69     Map_Point_Info info[WORLD_SIDE_LEN][WORLD_SIDE_LEN];
70     int date[WORLD_SIDE_LEN][WORLD_SIDE_LEN];
71     int tech[WORLD_SIDE_LEN][WORLD_SIDE_LEN];
72     int anim[WORLD_SIDE_LEN][WORLD_SIDE_LEN];
73     int im_index[WORLD_SIDE_LEN][WORLD_SIDE_LEN];
74     int activity[WORLD_SIDE_LEN][WORLD_SIDE_LEN];
75 };
76 typedef struct map_struct Map;
77 
78 
79 #define MP_TYPE(x,y)   map.type[x][y]
80 #define MP_GROUP(x,y)  map.group[x][y]
81 #define MP_POL(x,y)    map.pollution[x][y]
82 #define MP_INFO(x,y)   map.info[x][y]
83 #define MP_DATE(x,y)   map.date[x][y] // date of built
84 #define MP_TECH(x,y)   map.tech[x][y] // Tech at build time
85 #define MP_ANIM(x,y)   map.anim[x][y] // real_time for next anim    //does not need to be saved
86 
87 #define MP_SIZE(x,y)   main_groups[MP_GROUP(x,y)].size
88 #define MP_COLOR(x,y)  main_groups[MP_GROUP(x,y)].colour
89 #define MP_GROUP_IS_RESIDENCE(x,y)  (GROUP_IS_RESIDENCE(MP_GROUP(x,y)))
90 #define HAS_UGWATER(x,y) (MP_INFO(x,y).flags & FLAG_HAS_UNDERGROUND_WATER)
91 
92 struct ground_struct {
93     int altitude;       //surface of ground. unused currently
94     int ecotable;       //done at init time: pointer to the table for vegetation
95     int wastes;         //wastes underground
96     int pollution;      //pollution underground
97     int water_alt;      //altitude of water (needed to know drainage basin)
98     int water_pol;      //pollution of water
99     int water_wast;     //wastes in water
100     int water_next;     //next tile(s) where the water will go from here
101     int int1;           //reserved for future (?) use
102     int int2;
103     int int3;
104     int int4;           //used as tmp in setup_ground  //FIXME : this is too ugly
105 };
106 #define ALT(x,y) ground[x][y].altitude
107 
108 
109 #endif /* __lintypes_h__ */
110