00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00067
00068
00069
00070
00071 #include <stdio.h>
00072 #include <stdlib.h>
00073 #include <assert.h>
00074 #include <string.h>
00075 #include <ctype.h>
00076 #include <errno.h>
00077 #include <math.h>
00078 #include <cstdarg>
00079
00080 #ifdef _WIN32
00081
00082 #include <winsock2.h>
00083 #include <sys/stat.h>
00084 #include <time.h>
00085
00086 #ifndef S_ISDIR
00087 #define S_ISDIR(x) (((x) & S_IFMT) == S_IFDIR)
00088 #endif
00089
00090 #else
00091
00092 #ifdef __APPLE__
00093 #include <sys/stat.h>
00094 #endif
00095
00096 #include <unistd.h>
00097 #include <sys/time.h>
00098 #include <sys/file.h>
00099 #include <sys/types.h>
00100
00101 #endif
00102
00103 #include <string>
00104 #include <vector>
00105 #include <map>
00106
00107 #include "data_types.h"
00108 #include "map_type.h"
00109 #include "position.h"
00110
00112
00113
00114
00120 #define IS_INTEL 1
00121
00125 #define MICROPOLIS_VERSION "5.0"
00126
00127
00129
00130
00131
00136 static const int BITS_PER_TILE = 16;
00137
00142 static const int BYTES_PER_TILE = 2;
00143
00150 static const int WORLD_W_2 = WORLD_W / 2;
00151
00156 static const int WORLD_H_2 = WORLD_H / 2;
00157
00164 static const int WORLD_W_4 = WORLD_W / 4;
00165
00170 static const int WORLD_H_4 = WORLD_H / 4;
00171
00178 static const int WORLD_W_8 = WORLD_W / 8;
00179
00184 static const int WORLD_H_8 = (WORLD_H + 7) / 8;
00185
00189 static const int EDITOR_TILE_SIZE = 16;
00190
00194 static const int PASSES_PER_CITYTIME = 16;
00195
00199 static const int CITYTIMES_PER_MONTH = 4;
00200
00204 static const int CITYTIMES_PER_YEAR = CITYTIMES_PER_MONTH * 12;
00205
00209 static const int HISTORY_LENGTH = 480;
00210
00214 static const int MISC_HISTORY_LENGTH = 240;
00215
00220 static const int HISTORY_COUNT = 120;
00221
00225 static const int POWER_STACK_SIZE = (WORLD_W * WORLD_H) / 4;
00226
00227
00232 static const int NOWHERE = -1;
00233
00234
00236
00237
00241 static const int MAX_TRAFFIC_DISTANCE = 30;
00242
00246 static const int MAX_ROAD_EFFECT = 32;
00247
00251 static const int MAX_POLICE_STATION_EFFECT = 1000;
00252
00256 static const int MAX_FIRE_STATION_EFFECT = 1000;
00257
00258
00260
00261
00262
00263 static const int RES_VALVE_RANGE = 2000;
00264 static const int COM_VALVE_RANGE = 1500;
00265 static const int IND_VALVE_RANGE = 1500;
00266
00267
00269
00270
00271
00275 enum HistoryType {
00276 HISTORY_TYPE_RES,
00277 HISTORY_TYPE_COM,
00278 HISTORY_TYPE_IND,
00279 HISTORY_TYPE_MONEY,
00280 HISTORY_TYPE_CRIME,
00281 HISTORY_TYPE_POLLUTION,
00282
00283 HISTORY_TYPE_COUNT,
00284 };
00285
00289 enum HistoryScale {
00290 HISTORY_SCALE_SHORT,
00291 HISTORY_SCALE_LONG,
00292
00293 HISTORY_SCALE_COUNT,
00294 };
00295
00299 enum MapType {
00300 MAP_TYPE_ALL,
00301 MAP_TYPE_RES,
00302 MAP_TYPE_COM,
00303 MAP_TYPE_IND,
00304 MAP_TYPE_POWER,
00305 MAP_TYPE_ROAD,
00306 MAP_TYPE_POPULATION_DENSITY,
00307 MAP_TYPE_RATE_OF_GROWTH,
00308 MAP_TYPE_TRAFFIC_DENSITY,
00309 MAP_TYPE_POLLUTION,
00310 MAP_TYPE_CRIME,
00311 MAP_TYPE_LAND_VALUE,
00312 MAP_TYPE_FIRE_RADIUS,
00313 MAP_TYPE_POLICE_RADIUS,
00314 MAP_TYPE_DYNAMIC,
00315
00316 MAP_TYPE_COUNT,
00317 };
00318
00319
00320
00321 enum SpriteType {
00322 SPRITE_NOTUSED = 0,
00323
00324 SPRITE_TRAIN,
00325 SPRITE_HELICOPTER,
00326 SPRITE_AIRPLANE,
00327 SPRITE_SHIP,
00328 SPRITE_MONSTER,
00329 SPRITE_TORNADO,
00330 SPRITE_EXPLOSION,
00331 SPRITE_BUS,
00332
00333 SPRITE_COUNT,
00334 };
00335
00336
00338
00339
00341 typedef unsigned short MapValue;
00342
00347 typedef unsigned short MapTile;
00348
00357 enum MapTileBits {
00358 PWRBIT = 0x8000,
00359 CONDBIT = 0x4000,
00360 BURNBIT = 0x2000,
00361 BULLBIT = 0x1000,
00362 ANIMBIT = 0x0800,
00363 ZONEBIT = 0x0400,
00364
00366 ALLBITS = ZONEBIT | ANIMBIT | BULLBIT | BURNBIT | CONDBIT | PWRBIT,
00367 LOMASK = 0x03ff,
00368
00369 BLBNBIT = BULLBIT | BURNBIT,
00370 BLBNCNBIT = BULLBIT | BURNBIT | CONDBIT,
00371 BNCNBIT = BURNBIT | CONDBIT,
00372 };
00373
00374
00378 enum ConnectTileCommand {
00379 CONNECT_TILE_FIX,
00380 CONNECT_TILE_BULLDOZE,
00381 CONNECT_TILE_ROAD,
00382 CONNECT_TILE_RAILROAD,
00383 CONNECT_TILE_WIRE,
00384 };
00385
00386
00391 enum ToolResult {
00392 TOOLRESULT_NO_MONEY = -2,
00393 TOOLRESULT_NEED_BULLDOZE = -1,
00394 TOOLRESULT_FAILED = 0,
00395 TOOLRESULT_OK = 1,
00396 };
00397
00398
00409 enum MapTileCharacters {
00410 DIRT = 0,
00411
00412
00413
00414 RIVER = 2,
00415 REDGE = 3,
00416 CHANNEL = 4,
00417 FIRSTRIVEDGE = 5,
00418
00419 LASTRIVEDGE = 20,
00420 WATER_LOW = RIVER,
00421 WATER_HIGH = LASTRIVEDGE,
00422
00423 TREEBASE = 21,
00424 WOODS_LOW = TREEBASE,
00425 LASTTREE = 36,
00426 WOODS = 37,
00427 UNUSED_TRASH1 = 38,
00428 UNUSED_TRASH2 = 39,
00429 WOODS_HIGH = UNUSED_TRASH2,
00430 WOODS2 = 40,
00431 WOODS3 = 41,
00432 WOODS4 = 42,
00433 WOODS5 = 43,
00434
00435
00436 RUBBLE = 44,
00437 LASTRUBBLE = 47,
00438
00439 FLOOD = 48,
00440
00441 LASTFLOOD = 51,
00442
00443 RADTILE = 52,
00444
00445 UNUSED_TRASH3 = 53,
00446 UNUSED_TRASH4 = 54,
00447 UNUSED_TRASH5 = 55,
00448
00449
00450 FIRE = 56,
00451 FIREBASE = FIRE,
00452 LASTFIRE = 63,
00453
00454 HBRIDGE = 64,
00455 ROADBASE = HBRIDGE,
00456 VBRIDGE = 65,
00457 ROADS = 66,
00458 ROADS2 = 67,
00459 ROADS3 = 68,
00460 ROADS4 = 69,
00461 ROADS5 = 70,
00462 ROADS6 = 71,
00463 ROADS7 = 72,
00464 ROADS8 = 73,
00465 ROADS9 = 74,
00466 ROADS10 = 75,
00467 INTERSECTION = 76,
00468 HROADPOWER = 77,
00469 VROADPOWER = 78,
00470 BRWH = 79,
00471 LTRFBASE = 80,
00472
00473 BRWV = 95,
00474
00475 BRWXXX1 = 111,
00476
00477 BRWXXX2 = 127,
00478
00479 BRWXXX3 = 143,
00480 HTRFBASE = 144,
00481
00482 BRWXXX4 = 159,
00483
00484 BRWXXX5 = 175,
00485
00486 BRWXXX6 = 191,
00487
00488 LASTROAD = 206,
00489 BRWXXX7 = 207,
00490
00491
00492 HPOWER = 208,
00493 VPOWER = 209,
00494 LHPOWER = 210,
00495 LVPOWER = 211,
00496 LVPOWER2 = 212,
00497 LVPOWER3 = 213,
00498 LVPOWER4 = 214,
00499 LVPOWER5 = 215,
00500 LVPOWER6 = 216,
00501 LVPOWER7 = 217,
00502 LVPOWER8 = 218,
00503 LVPOWER9 = 219,
00504 LVPOWER10 = 220,
00505 RAILHPOWERV = 221,
00506 RAILVPOWERH = 222,
00507 POWERBASE = HPOWER,
00508 LASTPOWER = RAILVPOWERH,
00509
00510 UNUSED_TRASH6 = 223,
00511
00512
00513 HRAIL = 224,
00514 VRAIL = 225,
00515 LHRAIL = 226,
00516 LVRAIL = 227,
00517 LVRAIL2 = 228,
00518 LVRAIL3 = 229,
00519 LVRAIL4 = 230,
00520 LVRAIL5 = 231,
00521 LVRAIL6 = 232,
00522 LVRAIL7 = 233,
00523 LVRAIL8 = 234,
00524 LVRAIL9 = 235,
00525 LVRAIL10 = 236,
00526 HRAILROAD = 237,
00527 VRAILROAD = 238,
00528 RAILBASE = HRAIL,
00529 LASTRAIL = 238,
00530
00531 ROADVPOWERH = 239,
00532
00533
00534
00535 RESBASE = 240,
00536 FREEZ = 244,
00537
00538 HOUSE = 249,
00539 LHTHR = HOUSE,
00540 HHTHR = 260,
00541
00542 RZB = 265,
00543
00544 HOSPITALBASE = 405,
00545 HOSPITAL = 409,
00546
00547 CHURCHBASE = 414,
00548 CHURCH0BASE = 414,
00549 CHURCH = 418,
00550 CHURCH0 = 418,
00551
00552
00553
00554 COMBASE = 423,
00555
00556 COMCLR = 427,
00557
00558 CZB = 436,
00559
00560 COMLAST = 609,
00561
00562
00563
00564 INDBASE = 612,
00565 INDCLR = 616,
00566 LASTIND = 620,
00567
00568
00569 IND1 = 621,
00570 IZB = 625,
00571
00572
00573
00574
00575 IND2 = 641,
00576 IND3 = 644,
00577
00578
00579 IND4 = 649,
00580 IND5 = 650,
00581
00582
00583
00584
00585
00586
00587 IND6 = 676,
00588 IND7 = 677,
00589
00590
00591 IND8 = 686,
00592 IND9 = 689,
00593
00594
00595 PORTBASE = 693,
00596 PORT = 698,
00597 LASTPORT = 708,
00598
00599 AIRPORTBASE = 709,
00600
00601 RADAR = 711,
00602
00603 AIRPORT = 716,
00604
00605
00606
00607 COALBASE = 745,
00608 POWERPLANT = 750,
00609 LASTPOWERPLANT = 760,
00610
00611
00612 FIRESTBASE = 761,
00613 FIRESTATION = 765,
00614
00615
00616 POLICESTBASE = 770,
00617
00618 POLICESTATION = 774,
00619
00620
00621
00622 STADIUMBASE = 779,
00623 STADIUM = 784,
00624
00625
00626
00627 FULLSTADIUM = 800,
00628
00629
00630
00631 NUCLEARBASE = 811,
00632 NUCLEAR = 816,
00633 LASTZONE = 826,
00634
00635 LIGHTNINGBOLT = 827,
00636 HBRDG0 = 828,
00637 HBRDG1 = 829,
00638 HBRDG2 = 830,
00639 HBRDG3 = 831,
00640 HBRDG_END = 832,
00641 RADAR0 = 832,
00642 RADAR1 = 833,
00643 RADAR2 = 834,
00644 RADAR3 = 835,
00645 RADAR4 = 836,
00646 RADAR5 = 837,
00647 RADAR6 = 838,
00648 RADAR7 = 839,
00649 FOUNTAIN = 840,
00650
00651 INDBASE2 = 844,
00652 TELEBASE = 844,
00653
00654 TELELAST = 851,
00655 SMOKEBASE = 852,
00656
00657 TINYEXP = 860,
00658
00659 SOMETINYEXP = 864,
00660
00661 LASTTINYEXP = 867,
00662
00663 TINYEXPLAST = 883,
00664
00665
00666 COALSMOKE1 = 916,
00667
00668
00669 COALSMOKE2 = 920,
00670
00671
00672 COALSMOKE3 = 924,
00673
00674
00675 COALSMOKE4 = 928,
00676
00677
00678 FOOTBALLGAME1 = 932,
00679
00680 FOOTBALLGAME2 = 940,
00681
00682 VBRDG0 = 948,
00683 VBRDG1 = 949,
00684 VBRDG2 = 950,
00685 VBRDG3 = 951,
00686
00687 NUKESWIRL1 = 952,
00688 NUKESWIRL2 = 953,
00689 NUKESWIRL3 = 954,
00690 NUKESWIRL4 = 955,
00691
00692
00693
00694
00695
00696
00697 CHURCH1BASE = 956,
00698 CHURCH1 = 960,
00699 CHURCH2BASE = 965,
00700 CHURCH2 = 969,
00701 CHURCH3BASE = 974,
00702 CHURCH3 = 978,
00703 CHURCH4BASE = 983,
00704 CHURCH4 = 987,
00705 CHURCH5BASE = 992,
00706 CHURCH5 = 996,
00707 CHURCH6BASE = 1001,
00708 CHURCH6 = 1005,
00709 CHURCH7BASE = 1010,
00710 CHURCH7 = 1014,
00711 CHURCH7LAST = 1018,
00712
00713
00714
00715 TILE_COUNT = 1024,
00716
00717 TILE_INVALID = -1,
00718 };
00719
00725 enum EditingTool {
00726 TOOL_RESIDENTIAL,
00727 TOOL_COMMERCIAL,
00728 TOOL_INDUSTRIAL,
00729 TOOL_FIRESTATION,
00730 TOOL_POLICESTATION,
00731 TOOL_QUERY,
00732 TOOL_WIRE,
00733 TOOL_BULLDOZER,
00734 TOOL_RAILROAD,
00735 TOOL_ROAD,
00736 TOOL_STADIUM,
00737 TOOL_PARK,
00738 TOOL_SEAPORT,
00739 TOOL_COALPOWER,
00740 TOOL_NUCLEARPOWER,
00741 TOOL_AIRPORT,
00742 TOOL_NETWORK,
00743 TOOL_WATER,
00744 TOOL_LAND,
00745 TOOL_FOREST,
00746
00747 TOOL_COUNT,
00748 TOOL_FIRST = TOOL_RESIDENTIAL,
00749 TOOL_LAST = TOOL_FOREST,
00750 };
00751
00752
00754
00755
00757 enum Scenario {
00758 SC_NONE,
00759
00760 SC_DULLSVILLE,
00761 SC_SAN_FRANCISCO,
00762 SC_HAMBURG,
00763 SC_BERN,
00764 SC_TOKYO,
00765 SC_DETROIT,
00766 SC_BOSTON,
00767 SC_RIO,
00768
00769 SC_COUNT,
00770 };
00771
00772
00774
00775
00777 enum ZoneType {
00778 ZT_COMMERCIAL,
00779 ZT_INDUSTRIAL,
00780 ZT_RESIDENTIAL,
00781
00782 ZT_NUM_DESTINATIONS,
00783 };
00784
00785
00787
00788
00793 enum CityVotingProblems {
00794 CVP_CRIME,
00795 CVP_POLLUTION,
00796 CVP_HOUSING,
00797 CVP_TAXES,
00798 CVP_TRAFFIC,
00799 CVP_UNEMPLOYMENT,
00800 CVP_FIRE,
00801
00802 CVP_NUMPROBLEMS,
00803
00804 CVP_PROBLEM_COMPLAINTS = 4,
00805
00806 PROBNUM = 10,
00807 };
00808
00810 enum CityClass {
00811 CC_VILLAGE,
00812 CC_TOWN,
00813 CC_CITY,
00814 CC_CAPITAL,
00815 CC_METROPOLIS,
00816 CC_MEGALOPOLIS,
00817
00818 CC_NUM_CITIES,
00819 };
00820
00822 enum GameLevel {
00823 LEVEL_EASY,
00824 LEVEL_MEDIUM,
00825 LEVEL_HARD,
00826
00827 LEVEL_COUNT,
00828
00829 LEVEL_FIRST = LEVEL_EASY,
00830 LEVEL_LAST = LEVEL_HARD,
00831 };
00832
00834
00835
00836
00837 #ifndef _WIN32
00838
00845 template <typename T>
00846 static inline T min(const T a, const T b)
00847 {
00848 return (a < b) ? a : b;
00849 }
00850
00857 template <typename T>
00858 static inline T max(const T a, const T b)
00859 {
00860 return (a > b) ? a : b;
00861 }
00862
00863 #endif // _WIN32
00864
00872 template <typename T>
00873 static inline T clamp(const T val, const T lower, const T upper)
00874 {
00875 if (val < lower) {
00876 return lower;
00877 }
00878 if (val > upper) {
00879 return upper;
00880 }
00881 return val;
00882 }
00883
00889 template <typename T>
00890 static inline T absoluteValue(const T val)
00891 {
00892 if (val < 0) {
00893 return -val;
00894 }
00895 return val;
00896 }
00897
00899
00900
00901
00907 #define LENGTH_OF(array) (sizeof(array) / sizeof((array)[0]))
00908
00912 #define NOT_REACHED() not_reached(__LINE__, __FILE__)
00913
00914
00922 static inline void not_reached(int line, const char *fname)
00923 {
00924 fprintf(stderr, "Code unexpectedly executed at line %d, at file %s\n", line, fname);
00925 exit(1);
00926 }
00927
00928
00930
00931
00932
00933 class Micropolis;
00934 class ToolEffects;
00935 class BuildingProperties;
00936
00937
00939
00940
00941
00942
00943
00944 typedef void (*CallbackFunction)(
00945 Micropolis *micropolis,
00946 void *data,
00947 const char *name,
00948 const char *params,
00949 va_list arglist);
00950
00951
00953
00954
00955
00957 class Resource {
00958
00959 public:
00960
00961 char *buf;
00962 Quad size;
00963 char name[4];
00964 Quad id;
00965 Resource *next;
00966 };
00967
00968
00970 class StringTable {
00971
00972 public:
00973
00974 Quad id;
00975 int lines;
00976 char **strings;
00977 StringTable *next;
00978 };
00979
00980
00985 class SimSprite {
00986
00987 public:
00988
00989 SimSprite *next;
00990 char *name;
00991 int type;
00992 int frame;
00993 int x;
00994 int y;
00995 int width;
00996 int height;
00997 int xOffset;
00998 int yOffset;
00999 int xHot;
01000 int yHot;
01001 int origX;
01002 int origY;
01003 int destX;
01004 int destY;
01005 int count;
01006 int soundCount;
01007 int dir;
01008 int newDir;
01009 int step;
01010 int flag;
01011 int control;
01012 int turn;
01013 int accel;
01014 int speed;
01015 };
01016
01017
01025 class Micropolis {
01026
01027
01028 public:
01029
01030
01032
01033
01034 Micropolis();
01035
01036 ~Micropolis();
01037
01038 private:
01039
01040 void init();
01041
01042 void destroy();
01043
01044
01046
01047
01048 public:
01049
01050
01057 short roadTotal;
01058
01064 short railTotal;
01065
01069 short firePop;
01070
01076 short resPop;
01077
01083 short comPop;
01084
01090 short indPop;
01091
01098 short totalPop;
01099
01105 short totalPopLast;
01106
01107 short resZonePop;
01108 short comZonePop;
01109 short indZonePop;
01110
01114 short totalZonePop;
01115
01116 short hospitalPop;
01117 short churchPop;
01118 short faith;
01119 short stadiumPop;
01120
01124 short policeStationPop;
01125
01129 short fireStationPop;
01130
01134 short coalPowerPop;
01135
01139 short nuclearPowerPop;
01140
01144 short seaportPop;
01145
01149 short airportPop;
01150
01157 short crimeAverage;
01158
01166 short pollutionAverage;
01167
01174 short landValueAverage;
01175
01178
01186 Quad cityTime;
01187
01192 Quad cityMonth;
01193
01198 Quad cityYear;
01199
01203 short startingYear;
01204
01206
01207
01208
01214 unsigned short *map[WORLD_W];
01215
01219 short resHist10Max;
01220
01224 short resHist120Max;
01225
01229 short comHist10Max;
01230
01234 short comHist120Max;
01235
01239 short indHist10Max;
01240
01244 short indHist120Max;
01245
01251 bool censusChanged;
01252
01255
01259 Quad roadSpend;
01260
01264 Quad policeSpend;
01265
01269 Quad fireSpend;
01270
01276 Quad roadFund;
01277
01283 Quad policeFund;
01284
01290 Quad fireFund;
01291
01295 Quad roadEffect;
01296
01300 Quad policeEffect;
01301
01305 Quad fireEffect;
01306
01313 Quad taxFund;
01314
01318 short cityTax;
01319
01331 bool taxFlag;
01332
01334
01337
01338 MapByte2 populationDensityMap;
01339 MapByte2 trafficDensityMap;
01340 MapByte2 pollutionDensityMap;
01341 MapByte2 landValueMap;
01342 MapByte2 crimeRateMap;
01343
01349 MapByte4 terrainDensityMap;
01350
01356 MapByte2 tempMap1;
01357
01363 MapByte2 tempMap2;
01364
01370 MapByte4 tempMap3;
01371
01375 MapByte1 powerGridMap;
01376
01384 MapShort8 rateOfGrowthMap;
01385
01395 MapShort8 fireStationMap;
01396
01400 MapShort8 fireStationEffectMap;
01401
01411 MapShort8 policeStationMap;
01412
01416 MapShort8 policeStationEffectMap;
01417
01424 MapShort8 comRateMap;
01425
01427
01428
01431
01435 short *resHist;
01436
01440 short *comHist;
01441
01445 short *indHist;
01446
01450 short *moneyHist;
01451
01455 short *pollutionHist;
01456
01460 short *crimeHist;
01461
01465 short *miscHist;
01466
01468
01469
01470 private:
01471
01477 short needHospital;
01478
01484 short needChurch;
01485
01486
01490 unsigned short *mapBase;
01491
01492
01493 void initMapArrays();
01494
01495 void destroyMapArrays();
01496
01497
01499
01500
01501 public:
01502
01503
01504 void animateTiles();
01505
01506 static int getNextAnimatedTile(int index);
01507
01508
01510
01511
01512 public:
01513
01514
01521 float roadPercent;
01522
01529 float policePercent;
01530
01537 float firePercent;
01538
01542 Quad roadValue;
01543
01547 Quad policeValue;
01548
01552 Quad fireValue;
01553
01557 int mustDrawBudget;
01558
01559
01560 void initFundingLevel();
01561
01562 void doBudget();
01563
01564 void doBudgetFromMenu();
01565
01566 void doBudgetNow(bool fromMenu);
01567
01568 void updateBudget();
01569
01570 void showBudgetWindowAndStartWaiting();
01571
01572 void setCityTax(short tax);
01573
01574
01576
01577
01578 private:
01579
01580
01581 ToolResult connectTile(short x, short y,
01582 ConnectTileCommand cmd, ToolEffects *effects);
01583
01584 ToolResult layDoze(int x, int y, ToolEffects *effects);
01585
01586 ToolResult layRoad(int x, int y, ToolEffects *effects);
01587
01588 ToolResult layRail(int x, int y, ToolEffects *effects);
01589
01590 ToolResult layWire(int x, int y, ToolEffects *effects);
01591
01592 void fixZone(int x, int y, ToolEffects *effects);
01593
01594 void fixSingle(int x, int y, ToolEffects *effects);
01595
01596
01598
01599
01600 public:
01601
01602
01606 short floodCount;
01607
01608
01609 void makeMeltdown();
01610
01611 void makeFireBombs();
01612
01613 void makeEarthquake();
01614
01615 void makeFire();
01616
01617 void makeFlood();
01618
01619 void setFire();
01620
01621 void fireBomb();
01622
01623 private:
01624
01625 void doDisasters();
01626
01627 void scenarioDisaster();
01628
01629 bool vulnerable(int tem);
01630
01631 void doFlood(const Position &pos);
01632
01633
01635
01636
01637 public:
01638
01639
01645 short cityYes;
01646
01653 short problemVotes[PROBNUM];
01654
01661 short problemOrder[CVP_PROBLEM_COMPLAINTS];
01662
01668 Quad cityPop;
01669
01675 Quad cityPopDelta;
01676
01685 Quad cityAssessedValue;
01686
01687 CityClass cityClass;
01688
01698 short cityScore;
01699
01705 short cityScoreDelta;
01706
01712 short trafficAverage;
01713
01714
01715 void cityEvaluation();
01716
01717 void evalInit();
01718
01719 void doScoreCard();
01720
01721 void changeEval();
01722
01723 void scoreDoer();
01724
01725 int countProblems();
01726
01727 int getProblemNumber(int i);
01728
01729 int getProblemVotes(int i);
01730
01731
01732 private:
01733
01734 void getAssessedValue();
01735
01736 void doPopNum();
01737
01738 Quad getPopulation();
01739 CityClass getCityClass(Quad cityPop);
01740
01741 void doProblems(short problemTable[PROBNUM]);
01742
01743 void voteProblems(const short problemTable[PROBNUM]);
01744
01745 short getTrafficAverage();
01746
01747 short getUnemployment();
01748
01749 short getFireSeverity();
01750
01751 void getScore(const short problemTable[PROBNUM]);
01752
01753 void doVotes();
01754
01756
01757
01758 public:
01759
01760
01761 bool loadFileDir(const char *filename, const char *dir);
01762
01763 bool loadFile(const char *filename);
01764
01765 bool saveFile(const char *filename);
01766
01767 void loadScenario(Scenario s);
01768
01769 void didLoadScenario();
01770
01771 bool loadCity(const char *filename);
01772
01773 void didLoadCity();
01774
01775 void didntLoadCity(const char *msg);
01776
01777 void saveCity();
01778
01779 void doSaveCityAs();
01780
01781 void didSaveCity();
01782
01783 void didntSaveCity(const char *msg);
01784
01785 void saveCityAs(const char *filename);
01786
01787
01789
01790
01791 public:
01792
01806
01811 int terrainTreeLevel;
01812
01817 int terrainLakeLevel;
01818
01823 int terrainCurveLevel;
01824
01829 int terrainCreateIsland;
01830
01831
01832 void generateMap() ;
01833
01834 void clearMap();
01835
01836 void clearUnnatural();
01837
01838 void makeIsland();
01839
01840 void treeSplash(short xloc, short yloc);
01841
01842 void makeSingleLake(const Position &pos);
01843
01844 void plopBRiver(const Position &pos);
01845 void plopSRiver(const Position &pos);
01846
01847 void generateSomeCity(int seed);
01848
01849 private:
01850
01851 void generateMap(int seed);
01852
01853 void makeNakedIsland();
01854
01855 void doTrees();
01856
01857 bool isTree(MapValue cell);
01858
01859 void smoothTrees();
01860
01861 void smoothTreesAt(int x, int y, bool preserve);
01862 void smoothTreesAt(int x, int y, bool preserve, ToolEffects *effects);
01863
01864 void makeLakes();
01865
01866 void doRivers(const Position &terrainPos);
01867
01868 Direction2 doBRiver(const Position &riverPos,
01869 Direction2 riverDir, Direction2 terrainDir);
01870 Direction2 doSRiver(const Position &riverPos,
01871 Direction2 riverDir, Direction2 terrainDir);
01872
01873 void smoothRiver();
01874
01875 void smoothWater();
01876
01877 void putOnMap(MapValue mChar, short xLoc, short yLoc);
01878
01880
01882
01883
01884 public:
01885
01886
01890 bool historyInitialized;
01891
01895 short graph10Max;
01896
01900 short graph120Max;
01901
01902
01903 void drawMonth(short *hist, unsigned char *s, float scale);
01904
01905 void changeCensus();
01906
01907 void graphDoer();
01908
01909 void initGraphs();
01910
01911 void initGraphMax();
01912
01913 #ifdef SWIG
01914
01915
01916 %apply short *OUTPUT { short *minValResult };
01917 %apply short *OUTPUT { short *maxValResult };
01918 #endif
01919
01920 void getHistoryRange(int historyType, int historyScale,
01921 short *minValResult, short *maxValResult);
01922
01923 short getHistory(int historyType, int historyScale,
01924 int historyIndex);
01925
01926 void setHistory(int historyType, int historyScale,
01927 int historyIndex, short historyValue);
01928
01929
01931
01932
01933 private:
01934
01935
01936 void initWillStuff();
01937
01938 void resetMapState();
01939
01940 void resetEditorState();
01941
01942
01944
01945
01946 public:
01947
01948
01949 int simLoops;
01950
01954 int simPasses;
01955
01959 int simPass;
01960
01965 bool simPaused;
01966
01967 int simPausedSpeed;
01968
01969 bool tilesAnimated;
01970
01975 bool doAnimation;
01976
01977 bool doMessages;
01978
01979 bool doNotices;
01980
01981
01982 const char *getMicropolisVersion();
01983
01984 void simUpdate();
01985
01986 void simTick();
01987
01988 void simRobots();
01989
01990 public:
01991
01992 std::string cityFileName;
01993
01998 std::string cityName;
01999
02000 private:
02001
02002 int heatSteps;
02003
02007 int heatFlow;
02008
02009 int heatRule;
02010
02014 int heatWrap;
02015
02016 short *cellSrc;
02017
02018 short *cellDst;
02019
02020
02021 void environmentInit();
02022
02023 void simInit();
02024
02025 void simHeat();
02026
02027 void simLoop(bool doSim);
02028
02029
02030 #if 0
02031
02033
02034
02035
02036
02037
02038 public:
02039
02040
02041 int dynamicData[32];
02042
02043
02044 void drawAll();
02045
02046 void drawRes();
02047
02048 void drawCom();
02049
02050 void drawInd();
02051
02052 void drawLilTransMap();
02053
02054 void drawPower();
02055
02056 bool dynamicFilter(int col, int row);
02057
02058 void drawDynamic();
02059
02060 short getCI(short x);
02061
02062 void drawPopulationDensity();
02063
02064 void drawRateOfGrowth();
02065
02066 void drawTrafficDensityMap();
02067
02068 void drawPollutionDensityMap();
02069
02070 void drawCrimeRateMap();
02071
02072 void drawLandValueMap();
02073
02074 void drawFireRadius();
02075
02076 void drawPoliceRadius();
02077
02078 void memDrawMap();
02079
02080 void ditherMap();
02081
02082 void maybeDrawRect(
02083 int val,
02084 int x,
02085 int y,
02086 int w,
02087 int h);
02088
02089 void drawRect(
02090 int pixel,
02091 int solid,
02092 int x,
02093 int y,
02094 int w,
02095 int h);
02096
02097 #endif
02098
02099
02101
02102
02103 public:
02104
02105
02106 Quad cityPopLast;
02107 short categoryLast;
02108
02115 bool autoGoto;
02116
02117
02118 void sendMessages();
02119
02120 void checkGrowth();
02121
02122 void doScenarioScore(Scenario type);
02123
02124 void sendMessage(
02125 short Mnum,
02126 short x=NOWHERE, short y=NOWHERE,
02127 bool picture=false, bool important=false);
02128
02129 void doMakeSound(int mesgNum, int x, int y);
02130
02131 void doAutoGoto(short x, short y, char *msg);
02132
02133 void doLoseGame();
02134 void doWinGame();
02135
02136
02138
02139
02140 private:
02141
02142
02147
02148 int powerStackPointer;
02149
02151 Position powerStackXY[POWER_STACK_SIZE];
02152
02153
02154 void doPowerScan();
02155
02156 bool testForConductive(const Position &pos, Direction2 testDir);
02157
02158 void pushPowerStack(const Position &pos);
02159
02160 Position pullPowerStack();
02161
02163
02164
02166
02167
02168 private:
02169
02170
02171 UQuad nextRandom;
02172
02173
02174 int simRandom();
02175
02176 short getRandom(short range);
02177
02178 int getRandom16();
02179
02180 int getRandom16Signed();
02181
02182 short getERandom(short limit);
02183
02184 void randomlySeedRandom();
02185
02186 void seedRandom(int seed);
02187
02188
02190
02191
02192 public:
02193
02194
02196 std::string homeDir;
02197
02199 std::string resourceDir;
02200
02201 Resource *resources;
02202 StringTable *stringTables;
02203
02204
02205 Resource *getResource(const char *name, Quad id);
02206
02207 void getIndString(char *str, int id, short num);
02208
02209
02211
02212
02213 private:
02214
02215
02217 short newMap;
02218
02220 short newMapFlags[MAP_TYPE_COUNT];
02221
02222 short cityCenterX;
02223 short cityCenterY;
02224
02225 short pollutionMaxX;
02226 short pollutionMaxY;
02227
02228 short crimeMaxX;
02229 short crimeMaxY;
02230
02236 Quad donDither;
02237
02238
02239 void fireAnalysis();
02240
02241 void populationDensityScan();
02242
02243 int getPopulationDensity(const Position &pos, MapTile tile);
02244
02245 void pollutionTerrainLandValueScan();
02246
02247 int getPollutionValue(int loc);
02248
02249 int getCityCenterDistance(int x, int y);
02250
02251 void crimeScan();
02252
02253 void smoothTerrain();
02254
02255 void doSmooth1();
02256
02257 void doSmooth2();
02258
02259 void computeComRateMap();
02260
02262
02263
02264 public:
02265
02266
02267 bool valveFlag;
02268
02269 short crimeRamp;
02270
02271 short pollutionRamp;
02272
02273 bool resCap;
02274 bool comCap;
02275 bool indCap;
02276
02277 short cashFlow;
02278
02279 float externalMarket;
02280
02281 Scenario disasterEvent;
02282 short disasterWait;
02283
02284 Scenario scoreType;
02285 short scoreWait;
02286
02287 short poweredZoneCount;
02288 short unpoweredZoneCount;
02289
02290 bool newPower;
02291
02292 short cityTaxAverage;
02293
02294 short simCycle;
02295
02296 short phaseCycle;
02297
02298 short speedCycle;
02299
02300 bool doInitialEval;
02301
02302 int mapSerial;
02303
02304 private:
02305
02306 short resValve;
02307 short comValve;
02308 short indValve;
02309
02310
02311 public:
02312
02313 void updateFundEffects();
02314
02315
02316 private:
02317
02319 inline MapValue randomFire()
02320 {
02321 return (FIRE + (getRandom16() & 7)) | ANIMBIT;
02322 };
02323
02325 inline MapValue randomRubble()
02326 {
02327 return (RUBBLE + (getRandom16() & 3)) | BULLBIT;
02328 };
02329
02330 void simFrame();
02331
02332 void simulate();
02333
02334 void doSimInit();
02335
02336 void doNilPower();
02337
02338 void decTrafficMap();
02339
02340 void decRateOfGrowthMap();
02341
02342 void initSimMemory();
02343
02344 void simLoadInit();
02345
02346 void setCommonInits();
02347
02348 void setValves();
02349
02350 void clearCensus();
02351
02352 void take10Census();
02353
02354 void take120Census();
02355
02356 void collectTax();
02357
02358 void mapScan(int x1, int x2);
02359
02360 void doRail(const Position &pos);
02361
02362 void doRadTile(const Position &pos);
02363
02364 void doRoad(const Position &pos);
02365
02366 bool doBridge(const Position &pos, MapTile tile);
02367
02368 int getBoatDistance(const Position &pos);
02369
02370 void doFire(const Position &pos);
02371
02372 void fireZone(const Position &pos, MapValue ch);
02373
02374 void repairZone(const Position &pos, MapTile zCent, short zSize);
02375
02376 void doSpecialZone(const Position &pos, bool PwrOn);
02377
02378 void drawStadium(const Position ¢er, MapTile z);
02379
02380 void doAirport(const Position &pos);
02381
02382 void coalSmoke(const Position &pos);
02383
02384 void doMeltdown(const Position &pos);
02385
02386
02388
02389
02390 public:
02391
02392
02393 SimSprite *spriteList;
02394
02395
02396 SimSprite *newSprite(const char *name, int type, int x, int y);
02397
02398 void initSprite(SimSprite *sprite, int x, int y);
02399
02400 void destroyAllSprites();
02401
02402 void destroySprite(SimSprite *sprite);
02403
02404 SimSprite *getSprite(int type);
02405
02406 SimSprite *makeSprite(int type, int x, int y);
02407
02408
02409 private:
02410
02411 SimSprite *freeSprites;
02412
02413 SimSprite *globalSprites[SPRITE_COUNT];
02414
02415 int absDist;
02416
02417 short spriteCycle;
02418
02419
02420 public:
02421
02422 short getChar(int x, int y);
02423
02424 short turnTo(int p, int d);
02425
02426 bool tryOther(int Tpoo, int Told, int Tnew);
02427
02428 bool spriteNotInBounds(SimSprite *sprite);
02429
02430 short getDir(int orgX, int orgY, int desX, int desY);
02431
02432 int getDistance(int x1, int y1, int x2, int y2);
02433
02434 bool checkSpriteCollision(SimSprite *s1, SimSprite *s2);
02435
02436 void moveObjects();
02437
02438 void doTrainSprite(SimSprite *sprite);
02439
02440 void doCopterSprite(SimSprite *sprite);
02441
02442 void doAirplaneSprite(SimSprite *sprite);
02443
02444 void doShipSprite(SimSprite *sprite);
02445
02446 void doMonsterSprite(SimSprite *sprite);
02447
02448 void doTornadoSprite(SimSprite *sprite);
02449
02450 void doExplosionSprite(SimSprite *sprite);
02451
02452 void doBusSprite(SimSprite *sprite);
02453
02454 int canDriveOn(int x, int y);
02455
02456 void explodeSprite(SimSprite *sprite);
02457
02458 bool checkWet(int x);
02459
02460 void destroyMapTile(int ox, int oy);
02461
02462 void startFireInZone(int Xloc, int Yloc, int ch);
02463
02464 void startFire(int x, int y);
02465
02466 void generateTrain(int x, int y);
02467
02468 void generateBus(int x, int y);
02469
02470 void generateShip();
02471
02472 void makeShipHere(int x, int y);
02473
02474 void makeMonster();
02475
02476 void makeMonsterAt(int x, int y);
02477
02478 void generateCopter(const Position &pos);
02479
02480 void generatePlane(const Position &pos);
02481
02482 void makeTornado();
02483
02484 void makeExplosion(int x, int y);
02485
02486 void makeExplosionAt(int x, int y);
02487
02488
02490
02491
02492 public:
02493
02494
02495 Quad totalFunds;
02496
02503 bool autoBulldoze;
02504
02510 bool autoBudget;
02511
02512 Quad messageTimeLast;
02513
02514 GameLevel gameLevel;
02515
02516 short initSimLoad;
02517
02518 Scenario scenario;
02519
02520 short simSpeed;
02521
02522 short simSpeedMeta;
02523
02524 bool enableSound;
02525
02526 bool enableDisasters;
02527
02528 short messageNumber;
02529
02530 bool evalChanged;
02531
02535 short blinkFlag;
02536
02541 CallbackFunction callbackHook;
02542
02547 void *callbackData;
02548
02553 void *userData;
02554
02555
02562 static inline bool testBounds(int wx, int wy)
02563 {
02564 return (wx >= 0 && wx < WORLD_W && wy >= 0 && wy < WORLD_H);
02565 };
02566
02567 void spend(int dollars);
02568
02569 void setFunds(int dollars);
02570
02571 Quad tickCount();
02572
02573 Ptr newPtr(int size);
02574
02575 void freePtr(void *data);
02576
02577 void doPlayNewCity();
02578
02579 void doReallyStartGame();
02580
02581 void doStartLoad();
02582
02583 void doStartScenario(int scenario);
02584
02585 void initGame();
02586
02587 void callback(const char *name, const char *params, ...);
02588
02589 void doEarthquake(int strength);
02590
02591 void invalidateMaps();
02592
02593 void makeSound(
02594 const char *channel,
02595 const char *sound,
02596 int x=-1,
02597 int y=-1);
02598
02599
02600
02601 int getTile(int x, int y);
02602
02603 void setTile(int x, int y, int tile);
02604
02605 void *getMapBuffer();
02606
02607
02608
02609
02610
02611
02612
02613
02614
02615 int getPowerGrid(int x, int y);
02616
02617 void setPowerGrid(int x, int y, int power);
02618
02619 void *getPowerGridMapBuffer();
02620
02621
02622
02623
02624
02625 int getPopulationDensity(int x, int y);
02626
02627 void setPopulationDensity(int x, int y, int density);
02628
02629 void *getPopulationDensityMapBuffer();
02630
02631
02632
02633 int getRateOfGrowth(int x, int y);
02634
02635 void setRateOfGrowth(int x, int y, int rate);
02636
02637 void *getRateOfGrowthMapBuffer();
02638
02639
02640
02641 int getTrafficDensity(int x, int y);
02642
02643 void setTrafficDensity(int x, int y, int density);
02644
02645 void *getTrafficDensityMapBuffer();
02646
02647
02648
02649 int getPollutionDensity(int x, int y);
02650
02651 void setPollutionDensity(int x, int y, int density);
02652
02653 void *getPollutionDensityMapBuffer();
02654
02655
02656
02657 int getCrimeRate(int x, int y);
02658
02659 void setCrimeRate(int x, int y, int rate);
02660
02661 void *getCrimeRateMapBuffer();
02662
02663
02664
02665 int getLandValue(int x, int y);
02666
02667 void setLandValue(int x, int y, int value);
02668
02669 void *getLandValueMapBuffer();
02670
02671
02672
02673 int getFireCoverage(int x, int y);
02674
02675 void setFireCoverage(int x, int y, int coverage);
02676
02677 void *getFireCoverageMapBuffer();
02678
02679
02680
02681 int getPoliceCoverage(int x, int y);
02682
02683 void setPoliceCoverage(int x, int y, int coverage);
02684
02685 void *getPoliceCoverageMapBuffer();
02686
02687
02689
02690
02691 public:
02692
02693 ToolResult doTool(EditingTool tool, short tileX, short tileY);
02694
02695 void toolDown(EditingTool tool, short tileX, short tileY);
02696
02697 void toolDrag(EditingTool tool, short fromX, short fromY,
02698 short toX, short toY);
02699
02700 void didTool(const char *name, short x, short y);
02701
02702 private:
02703
02704 ToolResult queryTool(short x, short y);
02705
02706 ToolResult bulldozerTool(short x, short y);
02707 ToolResult bulldozerTool(short x, short y, ToolEffects *effects);
02708
02709 ToolResult roadTool(short x, short y, ToolEffects *effects);
02710
02711 ToolResult railroadTool(short x, short y, ToolEffects *effects);
02712
02713 ToolResult wireTool(short x, short y, ToolEffects *effects);
02714
02715 ToolResult parkTool(short x, short y, ToolEffects *effects);
02716
02717 ToolResult buildBuildingTool(short x, short y,
02718 const BuildingProperties *bprops,
02719 ToolEffects *effects);
02720
02721
02722 ToolResult networkTool(short x, short y, ToolEffects *effects);
02723
02724 ToolResult waterTool(short x, short y, ToolEffects *effects);
02725
02726 ToolResult landTool(short x, short y, ToolEffects *effects);
02727
02728 ToolResult forestTool(short x, short y, ToolEffects *effects);
02729
02730 ToolResult putDownPark(short mapH, short mapV, ToolEffects *effects);
02731
02732 ToolResult putDownNetwork(short mapH, short mapV, ToolEffects *effects);
02733
02734 ToolResult putDownWater(short mapH, short mapV, ToolEffects *effects);
02735
02736 ToolResult putDownLand(short mapH, short mapV, ToolEffects *effects);
02737
02738 ToolResult putDownForest(short mapH, short mapV, ToolEffects *effects);
02739
02740 void doZoneStatus(short mapH, short mapV);
02741
02742 void doShowZoneStatus(
02743 char *str,
02744 char *s0, char *s1, char *s2, char *s3, char *s4,
02745 int x, int y);
02746
02747 void putBuilding(int leftX, int topY, int sizeX, int sizeY,
02748 MapTile baseTile, bool aniFlag,
02749 ToolEffects *effects);
02750
02751 ToolResult prepareBuildingSite(int leftX, int topY, int sizeX, int sizeY,
02752 ToolEffects *effects);
02753
02754 ToolResult buildBuilding(int mapH, int mapV,
02755 const BuildingProperties *bprops,
02756 ToolEffects *effects);
02757
02758 int getDensityStr(short catNo, short mapH, short mapV);
02759
02760 bool tally(short tileValue);
02761
02762 short checkSize(short tileValue);
02763
02764 void checkBorder(short xMap, short yMap, int sizeX, int sizeY,
02765 ToolEffects *effects);
02766
02767 void putRubble(int x, int y, int size, ToolEffects *effects);
02768
02769
02771
02772
02773 public:
02774
02775 short makeTrafficAt(int x, int y, ZoneType dest);
02776
02777 short makeTraffic(int x, int y, ZoneType dest);
02778
02779
02780 private:
02781
02782 short makeTraffic(const Position &startPos, ZoneType dest);
02783
02784
02785
02787 short curMapStackPointer;
02788 Position curMapStackXY[MAX_TRAFFIC_DISTANCE + 1];
02789
02790 short trafMaxX;
02791 short trafMaxY;
02792
02793
02794 void addToTrafficDensityMap();
02795
02796 void pushPos(const Position &pos);
02797
02798 Position pullPos();
02799
02800 bool findPerimeterRoad(Position *pos);
02801
02802 bool findPerimeterTelecom(const Position &pos);
02803
02804 bool tryDrive(const Position &startPos, ZoneType destZone);
02805
02806 Direction2 tryGo(const Position &pos, Direction2 dirLast);
02807
02808 MapTile getTileFromMap(const Position &pos,
02809 Direction2 dir, MapTile defaultTile);
02810
02811 bool driveDone(const Position &pos, ZoneType destZone);
02812
02813 bool roadTest(MapValue tile);
02814
02815
02817
02818
02819 public:
02820
02821
02822 bool mustUpdateFunds;
02823
02824 bool mustUpdateOptions;
02825
02826 Quad cityTimeLast;
02827
02828 Quad cityYearLast;
02829
02830 Quad cityMonthLast;
02831
02832 Quad totalFundsLast;
02833
02834 Quad resLast;
02835
02836 Quad comLast;
02837
02838 Quad indLast;
02839
02840
02841 void doUpdateHeads();
02842
02843 void updateMaps();
02844
02845 void updateGraphs();
02846
02847 void updateEvaluation();
02848
02849 void updateHeads();
02850
02851 void updateFunds();
02852
02853 void reallyUpdateFunds();
02854
02855 void doTimeStuff();
02856
02857 void updateDate();
02858
02859 void showValves();
02860
02861 void drawValve();
02862
02863 void setDemand(float r, float c, float i);
02864
02865 void updateOptions();
02866
02867 void updateUserInterface();
02868
02869
02871
02872
02873 public:
02874
02875 void pause();
02876
02877 void resume();
02878
02879 void setSpeed(short speed);
02880
02881 void setPasses(int passes);
02882
02883 void setGameLevelFunds(GameLevel level);
02884
02885 void setGameLevel(GameLevel level);
02886
02887 void updateGameLevel();
02888
02889 void setCityName(const std::string &name);
02890
02891 void setCleanCityName(const std::string &name);
02892
02893 void setYear(int year);
02894
02895 int currentYear();
02896
02897 void doNewGame();
02898
02899 void setEnableDisasters(bool value);
02900
02901 void setAutoBudget(bool value);
02902
02903 void setAutoBulldoze(bool value);
02904
02905 void setAutoGoto(bool value);
02906
02907 void setEnableSound(bool value);
02908
02909 void setDoAnimation(bool value);
02910
02911 void setDoMessages(bool value);
02912
02913 void setDoNotices(bool value);
02914
02915 #ifdef SWIG
02916
02917
02918 %apply float *OUTPUT { float *resDemandResult };
02919 %apply float *OUTPUT { float *comDemandResult };
02920 %apply float *OUTPUT { float *indDemandResult };
02921 #endif
02922
02923 void getDemands(
02924 float *resDemandResult,
02925 float *comDemandResult,
02926 float *indDemandResult);
02927
02928
02929 private:
02930
02931 void makeDollarDecimalStr(char *numStr, char *dollarStr);
02932
02933
02935
02936
02937 private:
02938
02939
02940 void doZone(const Position &pos);
02941
02942 void doHospitalChurch(const Position &pos);
02943
02944 void setSmoke(const Position &pos, bool zonePower);
02945
02946 void makeHospital(const Position &pos);
02947
02948 short getLandPollutionValue(const Position &pos);
02949
02950 void incRateOfGrowth(const Position &pos, int amount);
02951
02952 bool zonePlop(const Position &pos, int base);
02953
02954 short doFreePop(const Position &pos);
02955
02956 bool setZonePower(const Position& pos);
02957
02958 void buildHouse(const Position &pos, int value);
02959
02960 short evalLot(int x, int y);
02961
02962 void doResidential(const Position &pos, bool zonePower);
02963
02964 void doResIn(const Position &pos, int pop, int value);
02965
02966 void doResOut(const Position &pos, int pop, int value);
02967
02968 short getResZonePop(MapTile mapTile);
02969
02970 void resPlop(const Position &pos, int Den, int Value);
02971
02972 short evalRes(const Position &pos, int traf);
02973
02974
02975
02976 void doCommercial(const Position &pos, bool zonePower);
02977
02978 void doComIn(const Position &pos, int pop, int value);
02979
02980 void doComOut(const Position &pos, int pop, int value);
02981
02982 short getComZonePop(MapTile tile);
02983
02984 void comPlop(const Position &pos, int Den, int Value);
02985
02986 short evalCom(const Position &pos, int traf);
02987
02988
02989
02990 void doIndustrial(const Position &pos, bool zonePower);
02991
02992 void doIndIn(const Position &pos, int pop, int value);
02993
02994 void doIndOut(const Position &pos, int pop, int value);
02995
02996 short getIndZonePop(MapTile tile);
02997
02998 void indPlop(const Position &pos, int den, int value);
02999
03000 short evalInd(int traf);
03001
03002
03004
03005
03006 };
03007
03008