Main Page | Data Structures | Directories | File List | Data Fields | Globals

power.h

Go to the documentation of this file.
00001 #ifndef _POWER_H
00002 #define _POWER_H
00003 
00004 #undef DEBUG_POWER
00005 
00006 struct grid_struct {
00007   int power_lines;
00008   long total_power; 
00009   long avail_power; /* Capacity available */
00010   long max_power;
00011   long demand;
00012   short powered;
00013 };
00014 
00015 typedef struct grid_struct Grid;
00016 
00017 /* public */
00018 #define MAX_GRIDS 128 // How many grids in the array, not how many to allocate
00019 extern Grid * grid[MAX_GRIDS];
00020 
00021 void map_power_grid(void);
00022 int get_power (int x, int y, int power, int block_industry);
00023 void do_windmill(int x, int y);
00024 void do_power_substation(int x, int y);
00025 void do_power_source(int x, int y);
00026 void do_power_source_coal(int x, int y);
00027 void do_power_line(int x, int y);
00028 void power_time_step ();
00029 
00030 /* intended private */
00031 void recurse_power_grid (int startx, int starty, int steps);
00032 int check_grid(int x, int y, int xi, int yi);
00033 void project_power(int x, int y);
00034 
00035 /* #ifdef POWER_LINE_CAPACITY
00036 #undef POWER_LINE_CAPACITY
00037 #endif */
00038 
00039 #define POWER_LINE_LOSS 1 /* one KW */
00040 
00041 #define WEST 1
00042 #define NORTH 2
00043 #define EAST 3
00044 #define SOUTH 4
00045 
00046 #define XY_IS_GRID(x,y) \
00047 ((MP_GROUP(x,y) == GROUP_COAL_POWER) ||\
00048  (MP_GROUP(x,y) == GROUP_WINDMILL) || \
00049  (MP_GROUP(x,y) == GROUP_POWER_LINE) || \
00050  (MP_GROUP(x,y) == GROUP_SOLAR_POWER) || \
00051  (MP_GROUP(x,y) == GROUP_SUBSTATION))
00052 
00053 #define XY_IS_WATER(x,y) (MP_GROUP(x,y) == GROUP_WATER)
00054 
00055 #define IS_POWER_SOURCE(x,y) \
00056 ((MP_GROUP(x,y) == GROUP_COAL_POWER) || \
00057  (MP_GROUP(x,y) == GROUP_SOLAR_POWER) || \
00058  (MP_GROUP(x,y) == GROUP_WINDMILL))
00059 
00060 #define IS_POWER_LINE(x,y) (MP_GROUP(x,y) == GROUP_POWER_LINE)
00061 
00062 #define IS_OLD_WINDMILL(x,y) \
00063 ((MP_GROUP(x,y) == GROUP_WINDMILL) && \
00064  (MP_TYPE(x,y) != CST_USED) && \
00065  (MP_INFO(x,y).int_2 < MODERN_WINDMILL_TECH))
00066 
00067 #define GRID_CURRENT(x,y) (MP_INFO(x,y).int_7 == grid_inc)
00068 
00069 /*** JOBS ***/
00070 #define SOLAR_POWER_JOBS 50
00071 
00072 #endif

Generated on Sun Dec 26 11:23:26 2004 for lincity by  doxygen 1.3.9.1