Micropolis
micropolis.h
Go to the documentation of this file.
1/* micropolis.h
2 *
3 * Micropolis, Unix Version. This game was released for the Unix platform
4 * in or about 1990 and has been modified for inclusion in the One Laptop
5 * Per Child program. Copyright (C) 1989 - 2007 Electronic Arts Inc. If
6 * you need assistance with this program, you may contact:
7 * http://wiki.laptop.org/go/Micropolis or email micropolis@laptop.org.
8 *
9 * This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or (at
12 * your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details. You should have received a
18 * copy of the GNU General Public License along with this program. If
19 * not, see <http://www.gnu.org/licenses/>.
20 *
21 * ADDITIONAL TERMS per GNU GPL Section 7
22 *
23 * No trademark or publicity rights are granted. This license does NOT
24 * give you any right, title or interest in the trademark SimCity or any
25 * other Electronic Arts trademark. You may not distribute any
26 * modification of this program using the trademark SimCity or claim any
27 * affliation or association with Electronic Arts Inc. or its employees.
28 *
29 * Any propagation or conveyance of this program must include this
30 * copyright notice and these terms.
31 *
32 * If you convey this program (or any modifications of it) and assume
33 * contractual liability for the program to recipients of it, you agree
34 * to indemnify Electronic Arts for any liability that those contractual
35 * assumptions impose on Electronic Arts.
36 *
37 * You may not misrepresent the origins of this program; modified
38 * versions of the program must be marked as such and not identified as
39 * the original program.
40 *
41 * This disclaimer supplements the one included in the General Public
42 * License. TO THE FULLEST EXTENT PERMISSIBLE UNDER APPLICABLE LAW, THIS
43 * PROGRAM IS PROVIDED TO YOU "AS IS," WITH ALL FAULTS, WITHOUT WARRANTY
44 * OF ANY KIND, AND YOUR USE IS AT YOUR SOLE RISK. THE ENTIRE RISK OF
45 * SATISFACTORY QUALITY AND PERFORMANCE RESIDES WITH YOU. ELECTRONIC ARTS
46 * DISCLAIMS ANY AND ALL EXPRESS, IMPLIED OR STATUTORY WARRANTIES,
47 * INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY, SATISFACTORY QUALITY,
48 * FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT OF THIRD PARTY
49 * RIGHTS, AND WARRANTIES (IF ANY) ARISING FROM A COURSE OF DEALING,
50 * USAGE, OR TRADE PRACTICE. ELECTRONIC ARTS DOES NOT WARRANT AGAINST
51 * INTERFERENCE WITH YOUR ENJOYMENT OF THE PROGRAM; THAT THE PROGRAM WILL
52 * MEET YOUR REQUIREMENTS; THAT OPERATION OF THE PROGRAM WILL BE
53 * UNINTERRUPTED OR ERROR-FREE, OR THAT THE PROGRAM WILL BE COMPATIBLE
54 * WITH THIRD PARTY SOFTWARE OR THAT ANY ERRORS IN THE PROGRAM WILL BE
55 * CORRECTED. NO ORAL OR WRITTEN ADVICE PROVIDED BY ELECTRONIC ARTS OR
56 * ANY AUTHORIZED REPRESENTATIVE SHALL CREATE A WARRANTY. SOME
57 * JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF OR LIMITATIONS ON IMPLIED
58 * WARRANTIES OR THE LIMITATIONS ON THE APPLICABLE STATUTORY RIGHTS OF A
59 * CONSUMER, SO SOME OR ALL OF THE ABOVE EXCLUSIONS AND LIMITATIONS MAY
60 * NOT APPLY TO YOU.
61 */
62
79#ifndef H_MICROPOLIS
80#define H_MICROPOLIS
81
82
84// Includes
85
86
87#include <stdio.h>
88#include <stdlib.h>
89#include <assert.h>
90#include <string.h>
91#include <ctype.h>
92#include <errno.h>
93#include <math.h>
94#include <cstdarg>
95#include <sys/stat.h>
96#include <unistd.h>
97#include <sys/time.h>
98#include <sys/file.h>
99#include <sys/types.h>
100
101#include <string>
102#include <vector>
103#include <map>
104
105#include <emscripten.h>
106#include <emscripten/bind.h>
107
108#include "data_types.h"
109#include "map_type.h"
110#include "position.h"
111#include "text.h"
112#include "frontendmessage.h"
113#include "tool.h"
114#include "callback.h"
115
116
118// Definitions
119
120
126#define IS_INTEL 1
127
128
130// Constants
131
132
137static const int BITS_PER_TILE = 16;
138
143static const int BYTES_PER_TILE = 2;
144
151static const int WORLD_W_2 = WORLD_W / 2;
152
157static const int WORLD_H_2 = WORLD_H / 2;
158
165static const int WORLD_W_4 = WORLD_W / 4;
166
171static const int WORLD_H_4 = WORLD_H / 4;
172
179static const int WORLD_W_8 = WORLD_W / 8;
180
185static const int WORLD_H_8 = (WORLD_H + 7) / 8;
186
190static const int EDITOR_TILE_SIZE = 16;
191
195static const int PASSES_PER_CITYTIME = 16;
196
200static const int CITYTIMES_PER_MONTH = 4;
201
206
210static const int HISTORY_LENGTH = 480;
211
215static const int MISC_HISTORY_LENGTH = 240;
216
221static const int HISTORY_COUNT = 120;
222
226static const int POWER_STACK_SIZE = (WORLD_W * WORLD_H) / 4;
227
228
233static const int NOWHERE = -1;
234
235
239static const int ISLAND_RADIUS = 18;
240
241
243// Traffic
244
248static const int MAX_TRAFFIC_DISTANCE = 30;
249
253static const int MAX_ROAD_EFFECT = 32;
254
258static const int MAX_POLICE_STATION_EFFECT = 1000;
259
263static const int MAX_FIRE_STATION_EFFECT = 1000;
264
265
267// Valves
268
269
270static const int RES_VALVE_RANGE = 2000;
271static const int COM_VALVE_RANGE = 1500;
272static const int IND_VALVE_RANGE = 1500;
273
274
276// Enumerated types.
277
278
292
302
325
326/* Object & Sound Numbers */
327
342
343
345// Tiles
346
357
358
369
370
381enum Tiles {
382 DIRT = 0,
383 // tile 1 ?
384
385 /* Water */
386 RIVER = 2,
387 REDGE = 3,
388 CHANNEL = 4,
389 FIRSTRIVEDGE = 5,
390 // tile 6 -- 19 ?
391 LASTRIVEDGE = 20,
392 WATER_LOW = RIVER,
393 WATER_HIGH = LASTRIVEDGE,
394
395 TREEBASE = 21,
396 WOODS_LOW = TREEBASE,
397 LASTTREE = 36,
398 WOODS = 37,
399 UNUSED_TRASH1 = 38,
400 UNUSED_TRASH2 = 39,
401 WOODS_HIGH = UNUSED_TRASH2, // Why is an 'UNUSED' tile used?
402 WOODS2 = 40,
403 WOODS3 = 41,
404 WOODS4 = 42,
405 WOODS5 = 43,
406
407 /* Rubble (4 tiles) */
408 RUBBLE = 44,
409 LASTRUBBLE = 47,
410
411 FLOOD = 48,
412 // tile 49, 50 ?
413 LASTFLOOD = 51,
414
415 RADTILE = 52,
416
417 UNUSED_TRASH3 = 53,
418 UNUSED_TRASH4 = 54,
419 UNUSED_TRASH5 = 55,
420
421 /* Fire animation (8 tiles) */
422 FIRE = 56,
423 FIREBASE = FIRE,
424 LASTFIRE = 63,
425
426 HBRIDGE = 64,
427 ROADBASE = HBRIDGE,
428 VBRIDGE = 65,
429 ROADS = 66,
430 ROADS2 = 67,
431 ROADS3 = 68,
432 ROADS4 = 69,
433 ROADS5 = 70,
434 ROADS6 = 71,
435 ROADS7 = 72,
436 ROADS8 = 73,
437 ROADS9 = 74,
438 ROADS10 = 75,
439 INTERSECTION = 76,
440 HROADPOWER = 77,
441 VROADPOWER = 78,
442 BRWH = 79,
443 LTRFBASE = 80,
444 // tile 81 -- 94 ?
445 BRWV = 95,
446 // tile 96 -- 110 ?
447 BRWXXX1 = 111,
448 // tile 96 -- 110 ?
449 BRWXXX2 = 127,
450 // tile 96 -- 110 ?
451 BRWXXX3 = 143,
452 HTRFBASE = 144,
453 // tile 145 -- 158 ?
454 BRWXXX4 = 159,
455 // tile 160 -- 174 ?
456 BRWXXX5 = 175,
457 // tile 176 -- 190 ?
458 BRWXXX6 = 191,
459 // tile 192 -- 205 ?
460 LASTROAD = 206,
461 BRWXXX7 = 207,
462
463 /* Power lines */
464 HPOWER = 208,
465 VPOWER = 209,
466 LHPOWER = 210,
467 LVPOWER = 211,
468 LVPOWER2 = 212,
469 LVPOWER3 = 213,
470 LVPOWER4 = 214,
471 LVPOWER5 = 215,
472 LVPOWER6 = 216,
473 LVPOWER7 = 217,
474 LVPOWER8 = 218,
475 LVPOWER9 = 219,
476 LVPOWER10 = 220,
479 POWERBASE = HPOWER,
480 LASTPOWER = RAILVPOWERH,
481
482 UNUSED_TRASH6 = 223,
483
484 /* Rail */
485 HRAIL = 224,
486 VRAIL = 225,
487 LHRAIL = 226,
488 LVRAIL = 227,
489 LVRAIL2 = 228,
490 LVRAIL3 = 229,
491 LVRAIL4 = 230,
492 LVRAIL5 = 231,
493 LVRAIL6 = 232,
494 LVRAIL7 = 233,
495 LVRAIL8 = 234,
496 LVRAIL9 = 235,
497 LVRAIL10 = 236,
498 HRAILROAD = 237,
499 VRAILROAD = 238,
500 RAILBASE = HRAIL,
501 LASTRAIL = 238,
502
503 ROADVPOWERH = 239, /* bogus? */
504
505 // Residential zone tiles
506
507 RESBASE = 240, // Empty residential, tiles 240--248
508 FREEZ = 244, // center-tile of 3x3 empty residential
509
510 HOUSE = 249, // Single tile houses until 260
511 LHTHR = HOUSE,
512 HHTHR = 260,
513
514 RZB = 265, // center tile first 3x3 tile residential
515
516 HOSPITALBASE = 405, // Center of hospital (tiles 405--413)
517 HOSPITAL = 409, // Center of hospital (tiles 405--413)
518
519 CHURCHBASE = 414, // Center of church (tiles 414--422)
520 CHURCH0BASE = 414, // numbered alias
521 CHURCH = 418, // Center of church (tiles 414--422)
522 CHURCH0 = 418, // numbered alias
523
524 // Commercial zone tiles
525
526 COMBASE = 423, // Empty commercial, tiles 423--431
527 // tile 424 -- 426 ?
528 COMCLR = 427,
529 // tile 428 -- 435 ?
530 CZB = 436,
531 // tile 437 -- 608 ?
532 COMLAST = 609,
533 // tile 610, 611 ?
534
535 // Industrial zone tiles.
536 INDBASE = 612,
537 INDCLR = 616,
538 LASTIND = 620,
539
540 // Industrial zone population 0, value 0: 621 -- 629
541 IND1 = 621,
542 IZB = 625,
543
544 // Industrial zone population 1, value 0: 630 -- 638
545
546 // Industrial zone population 2, value 0: 639 -- 647
547 IND2 = 641,
548 IND3 = 644,
549
550 // Industrial zone population 3, value 0: 648 -- 656
551 IND4 = 649,
552 IND5 = 650,
553
554 // Industrial zone population 0, value 1: 657 -- 665
555
556 // Industrial zone population 1, value 1: 666 -- 674
557
558 // Industrial zone population 2, value 1: 675 -- 683
559 IND6 = 676,
560 IND7 = 677,
561
562 // Industrial zone population 3, value 1: 684 -- 692
563 IND8 = 686,
564 IND9 = 689,
565
566 // Seaport
567 PORTBASE = 693,
568 PORT = 698,
569 LASTPORT = 708,
570
571 AIRPORTBASE = 709,
572 // tile 710 ?
573 RADAR = 711,
574 // tile 712 -- 715 ?
575 AIRPORT = 716,
576 // tile 717 -- 744 ?
577
578 // Coal power plant (4x4).
579 COALBASE = 745,
582
583 // Fire station (3x3).
586 // 769 last tile fire station.
587
588 POLICESTBASE = 770,
589 // tile 771 -- 773 ?
590 POLICESTATION = 774,
591 // tile 775 -- 778 ?
592
593 // Stadium (4x4).
595 STADIUM = 784,
596 // Last tile stadium 794.
597
598 // tile 785 -- 799 ?
599 FULLSTADIUM = 800,
600 // tile 801 -- 810 ?
601
602 // Nuclear power plant (4x4).
604 NUCLEAR = 816,
605 LASTZONE = 826,
606
607 LIGHTNINGBOLT = 827,
608 HBRDG0 = 828,
609 HBRDG1 = 829,
610 HBRDG2 = 830,
611 HBRDG3 = 831,
612 HBRDG_END = 832,
613 RADAR0 = 832,
614 RADAR1 = 833,
615 RADAR2 = 834,
616 RADAR3 = 835,
617 RADAR4 = 836,
618 RADAR5 = 837,
619 RADAR6 = 838,
620 RADAR7 = 839,
621 FOUNTAIN = 840,
622 // tile 841 -- 843: fountain animation.
623 INDBASE2 = 844,
624 TELEBASE = 844,
625 // tile 845 -- 850 ?
626 TELELAST = 851,
627 SMOKEBASE = 852,
628 // tile 853 -- 859 ?
629 TINYEXP = 860,
630 // tile 861 -- 863 ?
631 SOMETINYEXP = 864,
632 // tile 865 -- 866 ?
633 LASTTINYEXP = 867,
634 // tile 868 -- 882 ?
635 TINYEXPLAST = 883,
636 // tile 884 -- 915 ?
637
638 COALSMOKE1 = 916,
640
641 COALSMOKE2 = 920,
643
644 COALSMOKE3 = 924,
646
647 COALSMOKE4 = 928,
649
650 FOOTBALLGAME1 = 932,
651 // tile 933 -- 939 ?
652 FOOTBALLGAME2 = 940,
653 // tile 941 -- 947 ?
654 VBRDG0 = 948,
655 VBRDG1 = 949,
656 VBRDG2 = 950,
657 VBRDG3 = 951,
658
659 NUKESWIRL1 = 952,
660 NUKESWIRL2 = 953,
661 NUKESWIRL3 = 954,
662 NUKESWIRL4 = 955,
663
664 // Tiles 956-959 unused (originally)
665// TILE_COUNT = 960,
666
667 // Extended zones: 956-1019
668
669 CHURCH1BASE = 956,
670 CHURCH1 = 960,
671 CHURCH2BASE = 965,
672 CHURCH2 = 969,
673 CHURCH3BASE = 974,
674 CHURCH3 = 978,
675 CHURCH4BASE = 983,
676 CHURCH4 = 987,
677 CHURCH5BASE = 992,
678 CHURCH5 = 996,
679 CHURCH6BASE = 1001,
680 CHURCH6 = 1005,
681 CHURCH7BASE = 1010,
682 CHURCH7 = 1014,
683 CHURCH7LAST = 1018,
684
685 // Tiles 1020-1023 unused
686
687 USED_TILE_COUNT = 1019,
688 TILE_COUNT = 1024,
689
691};
692
693
695// Scenarios
696
712
713
715// Zones
716
725
726
728// City problems
729
749
761
773
775// Inline functions
776
783template <typename T>
784static inline T min(const T a, const T b)
785{
786 return (a < b) ? a : b;
787}
788
795template <typename T>
796static inline T max(const T a, const T b)
797{
798 return (a > b) ? a : b;
799}
800
808template <typename T>
809static inline T clamp(const T val, const T lower, const T upper)
810{
811 if (val < lower) {
812 return lower;
813 }
814 if (val > upper) {
815 return upper;
816 }
817 return val;
818}
819
825template <typename T>
826static inline T absoluteValue(const T val)
827{
828 if (val < 0) {
829 return -val;
830 }
831 return val;
832}
833
835// Macros
836
837
843#define LENGTH_OF(array) (sizeof(array) / sizeof((array)[0]))
844
848#define NOT_REACHED() not_reached(__LINE__, __FILE__)
849
850
858static inline void not_reached(int line, const char *fname)
859{
860 fprintf(stderr, "Code unexpectedly executed at line %d, at file %s\n", line, fname);
861 exit(1);
862}
863
864
866// Forward class definitions
867
868
869class Micropolis;
870class Callback;
871class ConsoleCallback;
872class ToolEffects;
874
875
877// Classes
878
879
885
886public:
887
889 std::string name;
890 int type;
891 int frame;
892 int x;
893 int y;
894 int width;
895 int height;
896 int xOffset;
897 int yOffset;
898 int xHot;
899 int yHot;
900 int origX;
901 int origY;
902 int destX;
903 int destY;
904 int count;
905 int soundCount;
906 int dir;
907 int newDir;
908 int step;
909 int flag;
910 int control;
911 int turn;
912 int accel;
913 int speed;
914};
915
916
925
926
927public:
928
929
931
932
933 Micropolis();
934
935 ~Micropolis();
936
937 void setCallback(Callback *callback, emscripten::val callbackVal);
938
939 void init();
940
941
942private:
943
944 void destroy();
945
947 // allocate.cpp
948
949public:
950
951
956
957
965
972
976 short firePop;
977
983 short resPop;
984
990 short comPop;
991
997 short indPop;
998
1006
1013
1017
1022
1025 short faith;
1027
1032
1037
1042
1047
1052
1057
1065
1074
1082
1085
1094
1100
1106
1111
1113
1114 /* Maps */
1115
1121 unsigned short *map[WORLD_W];
1122 unsigned short *mop[WORLD_W];
1123
1128
1133
1138
1143
1148
1153
1160
1163
1168
1173
1178
1185
1192
1199
1204
1209
1214
1222
1226 short cityTax;
1227
1240
1242
1245
1251
1258
1265
1272
1279
1284
1293
1304
1309
1320
1325
1333
1335
1336
1339
1343 short *resHist;
1344
1348 short *comHist;
1349
1353 short *indHist;
1354
1359
1364
1369
1373 short *miscHist;
1374
1376
1377
1378private:
1379
1386
1393
1394
1398 unsigned short *mapBase;
1399 unsigned short *mopBase;
1400
1401
1402 void initMapArrays();
1403
1404 void destroyMapArrays();
1405
1406
1408 // animate.cpp
1409
1410public:
1411
1412
1413 void animateTiles();
1414
1415 static int getNextAnimatedTile(int index);
1416
1417
1419 // budget.cpp
1420
1421public:
1422
1423
1431
1439
1447
1452
1457
1462
1467
1468
1469 void initFundingLevel();
1470
1471 void doBudget();
1472
1473 void doBudgetFromMenu();
1474
1475 void doBudgetNow(bool fromMenu);
1476
1477 void updateBudget();
1478
1479 void showBudgetWindowAndStartWaiting();
1480
1481 void setCityTax(short tax);
1482
1483
1485 // connect.cpp
1486
1487private:
1488
1489
1490 ToolResult connectTile(short x, short y,
1491 ConnectTileCommand cmd, ToolEffects *effects);
1492
1493 ToolResult layDoze(int x, int y, ToolEffects *effects);
1494
1495 ToolResult layRoad(int x, int y, ToolEffects *effects);
1496
1497 ToolResult layRail(int x, int y, ToolEffects *effects);
1498
1499 ToolResult layWire(int x, int y, ToolEffects *effects);
1500
1501 void fixZone(int x, int y, ToolEffects *effects);
1502
1503 void fixSingle(int x, int y, ToolEffects *effects);
1504
1505
1507 // disasters.cpp
1508
1509public:
1510
1511
1516
1517
1518 void makeMeltdown();
1519
1520 void makeFireBombs();
1521
1522 void makeEarthquake();
1523
1524 void makeFire();
1525
1526 void makeFlood();
1527
1528 void setFire();
1529
1530 void fireBomb();
1531
1532 private:
1533
1534 void doDisasters();
1535
1536 void scenarioDisaster();
1537
1538 bool vulnerable(int tem);
1539
1540 void doFlood(const Position &pos);
1541
1542
1544 // evaluate.cpp
1545
1546public:
1547
1548
1554 short cityYes;
1555
1562 short problemVotes[PROBNUM];
1563
1571
1578
1585
1595
1597
1608
1615
1622
1623
1624 void cityEvaluation();
1625
1626 void evalInit();
1627
1628 void doScoreCard();
1629
1630 void changeEval();
1631
1632 void scoreDoer();
1633
1634 int countProblems();
1635
1636 int getProblemNumber(int i);
1637
1638 int getProblemVotes(int i);
1639
1640
1641private:
1642
1643 void getAssessedValue();
1644
1645 void doPopNum();
1646
1647 Quad getPopulation();
1649
1650 void doProblems(short problemTable[PROBNUM]);
1651
1652 void voteProblems(const short problemTable[PROBNUM]);
1653
1654 short getTrafficAverage();
1655
1656 short getUnemployment();
1657
1658 short getFireSeverity();
1659
1660 void getScore(const short problemTable[PROBNUM]);
1661
1662 void doVotes();
1663
1665 // fileio.cpp
1666
1667public:
1668
1669
1670 bool loadFileData(const std::string &filename);
1671
1672 bool loadFile(const std::string &filename);
1673
1674 bool saveFile(const std::string &filename);
1675
1676 void loadScenario(Scenario s);
1677
1678 void didLoadScenario(int s, const std::string name, const std::string fname);
1679
1680 bool loadCity(const std::string &filename);
1681
1682 void didLoadCity(const std::string &filename);
1683
1684 void didntLoadCity(const std::string &msg);
1685
1686 void saveCity();
1687
1688 void doSaveCityAs(const std::string &filename);
1689
1690 void didSaveCity(const std::string &filename);
1691
1692 void didntSaveCity(const std::string &msg);
1693
1694 void saveCityAs(const std::string &filename);
1695
1696
1698 // generate.cpp
1699
1700public:
1701
1715
1721
1727
1733
1739
1744
1746
1747 void clearMap();
1748
1749 void clearUnnatural();
1750
1751 void makeIsland();
1752
1753 void treeSplash(short xloc, short yloc);
1754
1755 void makeSingleLake(const Position &pos);
1756
1757 void plopBRiver(const Position &pos);
1758 void plopSRiver(const Position &pos);
1759
1760 void generateSomeCity(int seed);
1761
1762 void generateMap(int seed);
1763
1764private:
1765
1766 void makeNakedIsland();
1767
1768 void doTrees();
1769
1770 bool isTree(MapValue cell);
1771
1772 void smoothTrees();
1773
1774 void smoothTreesAt(int x, int y, bool preserve);
1775 void smoothTreesAt(int x, int y, bool preserve, ToolEffects *effects);
1776
1777 void makeLakes();
1778
1779 void doRivers(const Position &terrainPos);
1780
1781 Direction2 doBRiver(const Position &riverPos,
1782 Direction2 riverDir, Direction2 terrainDir);
1783 Direction2 doSRiver(const Position &riverPos,
1784 Direction2 riverDir, Direction2 terrainDir);
1785
1786 void smoothRiver();
1787
1788 void smoothWater();
1789
1790 void putOnMap(MapValue mChar, short xLoc, short yLoc);
1791
1793
1795 // graph.cpp
1796
1797public:
1798
1799
1804
1809
1814
1815
1816 void drawMonth(short *hist, unsigned char *s, float scale);
1817
1818 void changeCensus();
1819
1820 void graphDoer();
1821
1822 void initGraphs();
1823
1824 void initGraphMax();
1825
1826#ifdef SWIG
1827// This tells SWIG that minValResult, maxValResult are output parameters,
1828// which will be returned in a tuple of length two.
1829%apply short *OUTPUT { short *minValResult };
1830%apply short *OUTPUT { short *maxValResult };
1831#endif
1832
1833 void getHistoryRange(int historyType, int historyScale,
1834 short *minValResult, short *maxValResult);
1835
1836 short getHistory(int historyType, int historyScale,
1837 int historyIndex);
1838
1839 void setHistory(int historyType, int historyScale,
1840 int historyIndex, short historyValue);
1841
1842
1844 // initialize.cpp
1845
1846private:
1847
1848
1849 void initWillStuff();
1850
1851 void resetMapState();
1852
1853 void resetEditorState();
1854
1855
1857 // micropolis.cpp
1858
1859public:
1860
1861
1862 int simLoops;
1863
1868
1873
1879
1880 int simPausedSpeed;
1881
1883
1889
1891
1893
1894
1895 std::string getMicropolisVersion();
1896
1897 void simUpdate();
1898
1899 void simTick();
1900
1901 void simulateRobots();
1902
1903 long getMapAddress();
1904
1905 long getMapSize();
1906
1907 long getMopAddress();
1908
1909 long getMopSize();
1910
1911public:
1912
1913 std::string cityFileName;
1914
1918 std::string cityName;
1919
1924
1929
1934
1939
1940private:
1941
1942 short *cellSrc;
1943
1944 short *cellDst;
1945
1946
1947 void simInit();
1948
1949 void simHeat();
1950
1951 void simLoop(bool doSim);
1952
1953
1955 // message.cpp
1956
1957public:
1958
1959
1962
1970
1971
1972 void sendMessages();
1973
1974 void checkGrowth();
1975
1976 void doScenarioScore(Scenario type);
1977
1978 void sendMessage(
1979 short Mnum,
1980 short x=NOWHERE, short y=NOWHERE,
1981 bool picture=false, bool important=false);
1982
1983 void doMakeSound(int mesgNum, int x, int y);
1984
1985 void doAutoGoto(short x, short y, const std::string &message);
1986
1987 void doLoseGame();
1988 void doWinGame();
1989
1990
1992 // power.cpp
1993
1994private:
1995
1996
2001
2003
2006
2007
2008 void doPowerScan();
2009
2010 bool testForConductive(const Position &pos, Direction2 testDir);
2011
2012 void pushPowerStack(const Position &pos);
2013
2015
2017
2018
2020 // random.cpp
2021
2022public:
2023
2024
2025 UQuad nextRandom;
2026
2027 int simRandom();
2028
2029 short getRandom(short range);
2030
2031 int getRandom16();
2032 int getRandom16Signed();
2033
2034 short getERandom(short limit);
2035
2036 void randomlySeedRandom();
2037
2038 void seedRandom(int seed);
2039
2040
2042 // scan.cpp
2043
2044public:
2045
2047 short newMap;
2048
2051
2054
2057
2060
2065
2066
2067 void fireAnalysis();
2068
2069 void populationDensityScan();
2070
2071 int getPopulationDensity(const Position &pos, MapTile tile);
2072
2073 void pollutionTerrainLandValueScan();
2074
2075 int getPollutionValue(int loc);
2076
2077 int getCityCenterDistance(int x, int y);
2078
2079 void crimeScan();
2080
2081 void smoothTerrain();
2082
2083 void doSmooth1();
2084
2085 void doSmooth2();
2086
2087 void computeComRateMap();
2088
2090 // simulate.cpp
2091
2092public:
2093
2094
2095 bool valveFlag;
2096
2097 short crimeRamp;
2098
2099 short pollutionRamp;
2100
2101 bool resCap;
2102 bool comCap;
2103 bool indCap;
2104
2105 short cashFlow;
2106
2107 float externalMarket;
2108
2111
2114
2117
2118 bool newPower; /* post */
2119
2120 short cityTaxAverage;
2121
2122 short simCycle;
2123
2124 short phaseCycle;
2125
2126 short speedCycle;
2127
2129
2131
2132public:
2133
2134 short resValve;
2135 short comValve;
2136 short indValve;
2137
2138
2139public:
2140
2141 void updateFundEffects();
2142
2143
2144private:
2145
2148 {
2149 return (FIRE + (getRandom16() & 7)) | ANIMBIT;
2150 };
2151
2154 {
2155 return (RUBBLE + (getRandom16() & 3)) | BULLBIT;
2156 };
2157
2158 void simFrame();
2159
2160 void simulate();
2161
2162 void doSimInit();
2163
2164 void doNilPower();
2165
2166 void decTrafficMap();
2167
2168 void decRateOfGrowthMap();
2169
2170 void initSimMemory();
2171
2172 void simLoadInit();
2173
2174 void setCommonInits();
2175
2176 void setValves();
2177
2178 void clearCensus();
2179
2180 void take10Census();
2181
2182 void take120Census();
2183
2184 void collectTax();
2185
2186 void mapScan(int x1, int x2);
2187
2188 void doRail(const Position &pos);
2189
2190 void doRadTile(const Position &pos);
2191
2192 void doRoad(const Position &pos);
2193
2194 bool doBridge(const Position &pos, MapTile tile);
2195
2196 int getBoatDistance(const Position &pos);
2197
2198 void doFire(const Position &pos);
2199
2200 void fireZone(const Position &pos, MapValue ch);
2201
2202 void repairZone(const Position &pos, MapTile zCent, short zSize);
2203
2204 void doSpecialZone(const Position &pos, bool PwrOn);
2205
2206 void drawStadium(const Position &center, MapTile z);
2207
2208 void doAirport(const Position &pos);
2209
2210 void coalSmoke(const Position &pos);
2211
2212 void doMeltdown(const Position &pos);
2213
2214
2216 // sprite.cpp
2217
2218public:
2219
2220
2222
2223
2224 SimSprite *newSprite(const std::string &name, int type, int x, int y);
2225
2226 void initSprite(SimSprite *sprite, int x, int y);
2227
2228 void destroyAllSprites();
2229
2230 void destroySprite(SimSprite *sprite);
2231
2232 SimSprite *getSprite(int type);
2233
2234 SimSprite *makeSprite(int type, int x, int y);
2235
2236
2237private:
2238
2240
2241 SimSprite *globalSprites[SPRITE_COUNT];
2242
2243 int absDist;
2244
2245 short spriteCycle;
2246
2247
2248public:
2249
2250 short getChar(int x, int y);
2251
2252 short turnTo(int p, int d);
2253
2254 bool tryOther(int Tpoo, int Told, int Tnew);
2255
2256 bool spriteNotInBounds(SimSprite *sprite);
2257
2258 short getDir(int orgX, int orgY, int desX, int desY);
2259
2260 int getDistance(int x1, int y1, int x2, int y2);
2261
2263
2264 void moveObjects();
2265
2266 void doTrainSprite(SimSprite *sprite);
2267
2268 void doCopterSprite(SimSprite *sprite);
2269
2270 void doAirplaneSprite(SimSprite *sprite);
2271
2272 void doShipSprite(SimSprite *sprite);
2273
2274 void doMonsterSprite(SimSprite *sprite);
2275
2276 void doTornadoSprite(SimSprite *sprite);
2277
2278 void doExplosionSprite(SimSprite *sprite);
2279
2280 void doBusSprite(SimSprite *sprite);
2281
2282 int canDriveOn(int x, int y);
2283
2284 void explodeSprite(SimSprite *sprite);
2285
2286 bool checkWet(int x);
2287
2288 void destroyMapTile(int ox, int oy);
2289
2290 void startFireInZone(int Xloc, int Yloc, int ch);
2291
2292 void startFire(int x, int y);
2293
2294 void generateTrain(int x, int y);
2295
2296 void generateBus(int x, int y);
2297
2298 void generateShip();
2299
2300 void makeShipHere(int x, int y);
2301
2302 void makeMonster();
2303
2304 void makeMonsterAt(int x, int y);
2305
2306 void generateCopter(const Position &pos);
2307
2308 void generatePlane(const Position &pos);
2309
2310 void makeTornado();
2311
2312 void makeExplosion(int x, int y);
2313
2314 void makeExplosionAt(int x, int y);
2315
2316
2318 // stubs.cpp
2319
2320public:
2321
2322
2324
2332
2339
2340 Quad messageTimeLast;
2341
2343
2344 short initSimLoad;
2345
2347
2348 short simSpeed;
2349
2350 short simSpeedMeta;
2351
2353
2355
2356 short messageNumber;
2357
2359
2364
2365 emscripten::val callbackVal;
2366
2372
2378
2379
2386 static inline bool testBounds(int wx, int wy)
2387 {
2388 return (wx >= 0 && wx < WORLD_W && wy >= 0 && wy < WORLD_H);
2389 };
2390
2391 void spend(int dollars);
2392
2393 void setFunds(int dollars);
2394
2395 Quad tickCount();
2396
2397 Ptr newPtr(int size);
2398
2399 void freePtr(void *data);
2400
2401 void doStartScenario(int scenario);
2402
2403 void doStartGame();
2404
2405 void initGame();
2406
2407 void doEarthquake(int strength);
2408
2409 void invalidateMaps();
2410
2411 void makeSound(
2412 const std::string &channel,
2413 const std::string &sound,
2414 int x=-1,
2415 int y=-1);
2416
2417 // Map
2418
2419 int getTile(int x, int y);
2420
2421 void setTile(int x, int y, int tile);
2422
2423 void *getMapBuffer();
2424
2425 // Residential.
2426
2427 // Commercial.
2428
2429 // Industrial.
2430
2431 // Power.
2432
2433 int getPowerGrid(int x, int y);
2434
2435 void setPowerGrid(int x, int y, int power);
2436
2437 void *getPowerGridMapBuffer();
2438
2439 // Roads.
2440
2441 // Population density.
2442
2443 int getPopulationDensity(int x, int y);
2444
2445 void setPopulationDensity(int x, int y, int density);
2446
2448
2449 // Rate of growth.
2450
2451 int getRateOfGrowth(int x, int y);
2452
2453 void setRateOfGrowth(int x, int y, int rate);
2454
2456
2457 // Traffic density.
2458
2459 int getTrafficDensity(int x, int y);
2460
2461 void setTrafficDensity(int x, int y, int density);
2462
2464
2465 // Pollution density.
2466
2467 int getPollutionDensity(int x, int y);
2468
2469 void setPollutionDensity(int x, int y, int density);
2470
2472
2473 // Crime rate.
2474
2475 int getCrimeRate(int x, int y);
2476
2477 void setCrimeRate(int x, int y, int rate);
2478
2479 void *getCrimeRateMapBuffer();
2480
2481 // Land value.
2482
2483 int getLandValue(int x, int y);
2484
2485 void setLandValue(int x, int y, int value);
2486
2487 void *getLandValueMapBuffer();
2488
2489 // Fire coverage.
2490
2491 int getFireCoverage(int x, int y);
2492
2493 void setFireCoverage(int x, int y, int coverage);
2494
2496
2497 // Police coverage.
2498
2499 int getPoliceCoverage(int x, int y);
2500
2501 void setPoliceCoverage(int x, int y, int coverage);
2502
2504
2505
2507 // tool.cpp
2508
2509public:
2510
2511 ToolResult doTool(EditingTool tool, short tileX, short tileY);
2512
2513 void toolDown(EditingTool tool, short tileX, short tileY);
2514
2515 void toolDrag(EditingTool tool, short fromX, short fromY,
2516 short toX, short toY);
2517
2518 void didTool(std::string name, short x, short y);
2519
2520private:
2521
2522 ToolResult queryTool(short x, short y);
2523
2524 ToolResult bulldozerTool(short x, short y);
2525 ToolResult bulldozerTool(short x, short y, ToolEffects *effects);
2526
2527 ToolResult roadTool(short x, short y, ToolEffects *effects);
2528
2529 ToolResult railroadTool(short x, short y, ToolEffects *effects);
2530
2531 ToolResult wireTool(short x, short y, ToolEffects *effects);
2532
2533 ToolResult parkTool(short x, short y, ToolEffects *effects);
2534
2535 ToolResult buildBuildingTool(short x, short y,
2536 const BuildingProperties *bprops,
2537 ToolEffects *effects);
2538
2539
2540 ToolResult networkTool(short x, short y, ToolEffects *effects);
2541
2542 ToolResult waterTool(short x, short y, ToolEffects *effects);
2543
2544 ToolResult landTool(short x, short y, ToolEffects *effects);
2545
2546 ToolResult forestTool(short x, short y, ToolEffects *effects);
2547
2548 ToolResult putDownPark(short mapH, short mapV, ToolEffects *effects);
2549
2550 ToolResult putDownNetwork(short mapH, short mapV, ToolEffects *effects);
2551
2552 ToolResult putDownWater(short mapH, short mapV, ToolEffects *effects);
2553
2554 ToolResult putDownLand(short mapH, short mapV, ToolEffects *effects);
2555
2556 ToolResult putDownForest(short mapH, short mapV, ToolEffects *effects);
2557
2558 void doZoneStatus(short mapH, short mapV);
2559
2560 void doShowZoneStatus(
2561 int tileCategoryIndex,
2562 int populationDensityIndex,
2563 int landValueIndex,
2564 int crimeRateIndex,
2565 int pollutionIndex,
2566 int growthRateIndex,
2567 int x,
2568 int y);
2569
2570 void putBuilding(int leftX, int topY, int sizeX, int sizeY,
2571 MapTile baseTile, bool aniFlag,
2572 ToolEffects *effects);
2573
2574 ToolResult prepareBuildingSite(int leftX, int topY, int sizeX, int sizeY,
2575 ToolEffects *effects);
2576
2577 ToolResult buildBuilding(int mapH, int mapV,
2578 const BuildingProperties *bprops,
2579 ToolEffects *effects);
2580
2581 int getDensity(short catNo, short mapH, short mapV);
2582
2583 bool tally(short tileValue);
2584
2585 short checkSize(short tileValue);
2586
2587 void checkBorder(short xMap, short yMap, int sizeX, int sizeY,
2588 ToolEffects *effects);
2589
2590 void putRubble(int x, int y, int size, ToolEffects *effects);
2591
2592
2594 // traffic.cpp
2595
2596public:
2597
2598 short makeTrafficAt(int x, int y, ZoneType dest);
2599
2600 short makeTraffic(int x, int y, ZoneType dest);
2601
2602
2603private:
2604
2605 short makeTraffic(const Position &startPos, ZoneType dest);
2606
2607 /* Position stack */
2608
2612
2613 short trafMaxX;
2614 short trafMaxY;
2615
2617
2618 void pushPos(const Position &pos);
2619
2620 Position pullPos();
2621
2622 bool findPerimeterRoad(Position *pos);
2623
2624 bool findPerimeterTelecom(const Position &pos);
2625
2626 bool tryDrive(const Position &startPos, ZoneType destZone);
2627
2628 Direction2 tryGo(const Position &pos, Direction2 dirLast);
2629
2630 MapTile getTileFromMap(const Position &pos,
2631 Direction2 dir, MapTile defaultTile);
2632
2633 bool driveDone(const Position &pos, ZoneType destZone);
2634
2635 bool roadTest(MapValue tile);
2636
2637
2639 // update.cpp
2640
2641public:
2642
2643
2644 bool mustUpdateFunds;
2645
2647
2648 Quad cityTimeLast;
2649
2650 Quad cityYearLast;
2651
2652 Quad cityMonthLast;
2653
2654 Quad totalFundsLast;
2655
2656 Quad resLast;
2657
2658 Quad comLast;
2659
2660 Quad indLast;
2661
2662
2663 void doUpdateHeads();
2664
2665 void updateMaps();
2666
2667 void updateGraphs();
2668
2669 void updateEvaluation();
2670
2671 void updateHeads();
2672
2673 void updateFunds();
2674
2675 void reallyUpdateFunds();
2676
2677 void doTimeStuff();
2678
2679 void updateDate();
2680
2681 void showValves();
2682
2683 void drawValve();
2684
2685 void setDemand(float r, float c, float i);
2686
2687 void updateOptions();
2688
2689 void updateUserInterface();
2690
2691
2693 // utilities.cpp
2694
2695public:
2696
2697 void pause();
2698
2699 void resume();
2700
2701 void setSpeed(short speed);
2702
2703 void setPasses(int passes);
2704
2705 void setGameLevelFunds(GameLevel level);
2706
2707 void setGameLevel(GameLevel level);
2708
2709 void updateGameLevel();
2710
2711 void setCityName(const std::string &name);
2712
2713 void setCleanCityName(const std::string &name);
2714
2715 void setYear(int year);
2716
2717 int currentYear();
2718
2719 void doNewGame();
2720
2721 void setEnableDisasters(bool value);
2722
2723 void setAutoBudget(bool value);
2724
2725 void setAutoBulldoze(bool value);
2726
2727 void setAutoGoto(bool value);
2728
2729 void setEnableSound(bool value);
2730
2731 void setDoAnimation(bool value);
2732
2733 void setDoMessages(bool value);
2734
2735 void setDoNotices(bool value);
2736
2737#ifdef SWIG
2738// This tells SWIG that resDemandResult, comDemandResult and indDemandResult
2739// are output parameters, which will be returned in a tuple of length three.
2740%apply float *OUTPUT { float *resDemandResult };
2741%apply float *OUTPUT { float *comDemandResult };
2742%apply float *OUTPUT { float *indDemandResult };
2743#endif
2744
2745 void getDemands(
2746 float *resDemandResult,
2747 float *comDemandResult,
2748 float *indDemandResult);
2749
2750
2751private:
2752
2753 std::string makeDollarDecimalStr(const std::string &numStr);
2754
2755
2757 // zone.cpp
2758
2759private:
2760
2761
2762 void doZone(const Position &pos);
2763
2764 void doHospitalChurch(const Position &pos);
2765
2766 void setSmoke(const Position &pos, bool zonePower);
2767
2768 void makeHospital(const Position &pos);
2769
2770 short getLandPollutionValue(const Position &pos);
2771
2772 void incRateOfGrowth(const Position &pos, int amount);
2773
2774 bool zonePlop(const Position &pos, int base);
2775
2776 short doFreePop(const Position &pos);
2777
2778 bool setZonePower(const Position& pos);
2779
2780 void buildHouse(const Position &pos, int value);
2781
2782 short evalLot(int x, int y);
2783
2784 void doResidential(const Position &pos, bool zonePower);
2785
2786 void doResIn(const Position &pos, int pop, int value);
2787
2788 void doResOut(const Position &pos, int pop, int value);
2789
2790 short getResZonePop(MapTile mapTile);
2791
2792 void resPlop(const Position &pos, int Den, int Value);
2793
2794 short evalRes(const Position &pos, int traf);
2795
2796 // Commercial zone handling
2797
2798 void doCommercial(const Position &pos, bool zonePower);
2799
2800 void doComIn(const Position &pos, int pop, int value);
2801
2802 void doComOut(const Position &pos, int pop, int value);
2803
2804 short getComZonePop(MapTile tile);
2805
2806 void comPlop(const Position &pos, int Den, int Value);
2807
2808 short evalCom(const Position &pos, int traf);
2809
2810 // Industrial zone handling
2811
2812 void doIndustrial(const Position &pos, bool zonePower);
2813
2814 void doIndIn(const Position &pos, int pop, int value);
2815
2816 void doIndOut(const Position &pos, int pop, int value);
2817
2818 short getIndZonePop(MapTile tile);
2819
2820 void indPlop(const Position &pos, int den, int value);
2821
2822 short evalInd(int traf);
2823
2824
2826
2827
2828};
2829
2830
2832
2833
2834#endif
Interface for callbacks in the Micropolis game engine.
void doScenarioScore(Scenario type)
Definition message.cpp:313
void makeSingleLake(const Position &pos)
Definition generate.cpp:283
void toolDown(EditingTool tool, short tileX, short tileY)
Definition tool.cpp:1509
short crimeMaxX
X coordinate of most criminal area. Not used.
void doCopterSprite(SimSprite *sprite)
Definition sprite.cpp:695
Quad roadEffect
void setGameLevelFunds(GameLevel level)
void fixZone(int x, int y, ToolEffects *effects)
Definition connect.cpp:565
void scenarioDisaster()
SimSprite * spriteList
List of active sprites.
int terrainCreateIsland
short getLandPollutionValue(const Position &pos)
Definition zone.cpp:323
void generateCopter(const Position &pos)
Definition sprite.cpp:1969
void explodeSprite(SimSprite *sprite)
Definition sprite.cpp:1654
void doTornadoSprite(SimSprite *sprite)
Definition sprite.cpp:1239
short problemVotes[PROBNUM]
void doAirplaneSprite(SimSprite *sprite)
Definition sprite.cpp:800
void makeMeltdown()
int getCrimeRate(int x, int y)
float firePercent
void * getPopulationDensityMapBuffer()
bool doInitialEval
Need to perform initial city evaluation.
void doZoneStatus(short mapH, short mapV)
Definition tool.cpp:838
void didntLoadCity(const std::string &msg)
Definition fileio.cpp:578
bool loadFileData(const std::string &filename)
Definition fileio.cpp:213
int mustDrawBudget
void generateSomeCity(int seed)
Definition generate.cpp:102
void changeEval()
Definition evaluate.cpp:507
void makeEarthquake()
void doMeltdown(const Position &pos)
short indPop
Definition micropolis.h:997
void doSaveCityAs(const std::string &filename)
Definition fileio.cpp:613
MapShort8 policeStationEffectMap
short getResZonePop(MapTile mapTile)
Definition zone.cpp:711
short stadiumPop
Number of stadiums.
void resetMapState()
void initGraphs()
Definition graph.cpp:142
bool driveDone(const Position &pos, ZoneType destZone)
Definition traffic.cpp:453
short doFreePop(const Position &pos)
Definition zone.cpp:409
bool checkSpriteCollision(SimSprite *s1, SimSprite *s2)
Definition sprite.cpp:537
short indZonePop
Number of industrial zones.
void startFireInZone(int Xloc, int Yloc, int ch)
Definition sprite.cpp:1764
void setTile(int x, int y, int tile)
void evalInit()
Definition evaluate.cpp:136
void setPoliceCoverage(int x, int y, int coverage)
ToolResult buildBuilding(int mapH, int mapV, const BuildingProperties *bprops, ToolEffects *effects)
Definition tool.cpp:711
void didSaveCity(const std::string &filename)
Definition fileio.cpp:623
void makeHospital(const Position &pos)
Definition zone.cpp:292
void resPlop(const Position &pos, int Den, int Value)
Definition zone.cpp:724
Scenario scoreType
The type of score table to use.
Position pullPowerStack()
Definition power.cpp:187
void coalSmoke(const Position &pos)
short blinkFlag
short turnTo(int p, int d)
Definition sprite.cpp:396
bool tally(short tileValue)
Definition tool.cpp:535
void setDoAnimation(bool value)
Position pullPos()
Definition traffic.cpp:223
void seedRandom(int seed)
Definition random.cpp:177
void doRadTile(const Position &pos)
void initSprite(SimSprite *sprite, int x, int y)
Definition sprite.cpp:136
void simUpdate()
bool findPerimeterTelecom(const Position &pos)
Definition traffic.cpp:274
void doRivers(const Position &terrainPos)
Definition generate.cpp:489
short indHist10Max
short getFireSeverity()
Definition evaluate.cpp:361
void setHistory(int historyType, int historyScale, int historyIndex, short historyValue)
Definition graph.cpp:348
short crimeAverage
void setDoNotices(bool value)
int terrainTreeLevel
void makeFireBombs()
Quad cityPopDelta
void putOnMap(MapValue mChar, short xLoc, short yLoc)
Definition generate.cpp:593
void doZone(const Position &pos)
Definition zone.cpp:91
GameLevel gameLevel
Difficulty level of the game (0..2)
ToolResult wireTool(short x, short y, ToolEffects *effects)
Definition tool.cpp:1172
Scenario scenario
Scenario being played.
void buildHouse(const Position &pos, int value)
Definition zone.cpp:459
short getIndZonePop(MapTile tile)
Definition zone.cpp:1001
bool tryDrive(const Position &startPos, ZoneType destZone)
Definition traffic.cpp:309
void pushPos(const Position &pos)
Definition traffic.cpp:210
void generateSomeRandomCity()
Definition generate.cpp:92
void setPollutionDensity(int x, int y, int density)
ToolResult putDownNetwork(short mapH, short mapV, ToolEffects *effects)
Definition tool.cpp:282
int getTrafficDensity(int x, int y)
void doResidential(const Position &pos, bool zonePower)
Definition zone.cpp:548
void simLoadInit()
Definition simulate.cpp:440
short poweredZoneCount
Number of powered tiles in all zone.
Quad policeEffect
void take10Census()
Definition simulate.cpp:730
void doLoseGame()
Definition message.cpp:464
CityClass getCityClass(Quad cityPop)
Definition evaluate.cpp:210
void doSpecialZone(const Position &pos, bool PwrOn)
Quad tickCount()
short * resHist
void setTrafficDensity(int x, int y, int density)
void makeExplosion(int x, int y)
Definition sprite.cpp:2020
void changeCensus()
Definition graph.cpp:122
Direction2 doSRiver(const Position &riverPos, Direction2 riverDir, Direction2 terrainDir)
Definition generate.cpp:552
Callback * callback
Definition micropolis.h:955
int powerStackPointer
Stack counter, points to top-most item.
void destroySprite(SimSprite *sprite)
Definition sprite.cpp:313
short graph10Max
MapByte1 powerGridMap
bool tilesAnimated
void voteProblems(const short problemTable[PROBNUM])
Definition evaluate.cpp:288
MapTile getTileFromMap(const Position &pos, Direction2 dir, MapTile defaultTile)
Definition traffic.cpp:407
void indPlop(const Position &pos, int den, int value)
Definition zone.cpp:1017
MapByte2 crimeRateMap
Crime rate map.
void saveCity()
Definition fileio.cpp:589
std::string cityFileName
Filename of the last loaded city.
void * getRateOfGrowthMapBuffer()
Quad policeValue
MapByte4 terrainDensityMap
SimSprite * freeSprites
Pool of free SimSprite objects.
short getDir(int orgX, int orgY, int desX, int desY)
Definition sprite.cpp:477
short unpoweredZoneCount
Number of unpowered tiles in all zones.
void updateBudget()
Definition budget.cpp:327
ToolResult networkTool(short x, short y, ToolEffects *effects)
Definition tool.cpp:1286
ToolResult railroadTool(short x, short y, ToolEffects *effects)
Definition tool.cpp:1146
void * getTrafficDensityMapBuffer()
bool setZonePower(const Position &pos)
Definition zone.cpp:433
void scoreDoer()
Definition evaluate.cpp:515
void doRoad(const Position &pos)
void comPlop(const Position &pos, int Den, int Value)
Definition zone.cpp:883
short newMapFlags[MAP_TYPE_COUNT]
short churchPop
Number of churches.
void checkBorder(short xMap, short yMap, int sizeX, int sizeY, ToolEffects *effects)
Definition tool.cpp:575
bool evalChanged
The evaluation window should be shown to the user.
short firePop
Definition micropolis.h:976
void graphDoer()
Definition graph.cpp:132
Position powerStackXY[POWER_STACK_SIZE]
short * moneyHist
ToolResult queryTool(short x, short y)
Definition tool.cpp:972
short faith
Faith bias.
ToolResult layDoze(int x, int y, ToolEffects *effects)
Definition connect.cpp:222
int terrainCurveLevel
float roadPercent
void makeMonster()
Definition sprite.cpp:1917
MapShort8 comRateMap
short cityCenterY
Y coordinate of city center.
void simInit()
void makeMonsterAt(int x, int y)
Definition sprite.cpp:1956
void getDemands(float *resDemandResult, float *comDemandResult, float *indDemandResult)
short makeTraffic(int x, int y, ZoneType dest)
Definition traffic.cpp:118
short evalCom(const Position &pos, int traf)
Definition zone.cpp:897
void startFire(int x, int y)
Definition sprite.cpp:1805
void getScore(const short problemTable[PROBNUM])
Definition evaluate.cpp:371
MapShort8 fireStationEffectMap
ToolResult connectTile(short x, short y, ConnectTileCommand cmd, ToolEffects *effects)
Definition connect.cpp:133
void loadScenario(Scenario s)
Definition fileio.cpp:429
void * getLandValueMapBuffer()
void * getCrimeRateMapBuffer()
short resPop
Definition micropolis.h:983
short getRandom(short range)
Definition random.cpp:110
Position curMapStackXY[MAX_TRAFFIC_DISTANCE+1]
Position stack.
bool vulnerable(int tem)
short pollutionMaxY
Y coordinate of most polluted area.
void didntSaveCity(const std::string &msg)
Definition fileio.cpp:633
void moveObjects()
Definition sprite.cpp:553
void doIndustrial(const Position &pos, bool zonePower)
Definition zone.cpp:917
void setAutoGoto(bool value)
void sendMessages()
Definition message.cpp:87
bool doAnimation
int countProblems()
Definition evaluate.cpp:528
ToolResult putDownLand(short mapH, short mapV, ToolEffects *effects)
Definition tool.cpp:333
short getUnemployment()
Definition evaluate.cpp:341
void fireAnalysis()
Definition scan.cpp:120
int getBoatDistance(const Position &pos)
int getRandom16()
Definition random.cpp:130
void decRateOfGrowthMap()
Definition simulate.cpp:371
short problemOrder[CVP_PROBLEM_COMPLAINTS]
void * getPowerGridMapBuffer()
bool enableDisasters
Enable disasters.
bool loadFile(const std::string &filename)
Definition fileio.cpp:276
short cityScoreDelta
ToolResult layWire(int x, int y, ToolEffects *effects)
Definition connect.cpp:460
ToolResult putDownPark(short mapH, short mapV, ToolEffects *effects)
Definition tool.cpp:252
void generatePlane(const Position &pos)
Definition sprite.cpp:1985
MapByte4 tempMap3
int getRateOfGrowth(int x, int y)
Quad cityPopLast
Population of last city class check.
short getTrafficAverage()
Definition evaluate.cpp:315
void doVotes()
Definition evaluate.cpp:464
void setSmoke(const Position &pos, bool zonePower)
Definition zone.cpp:237
int canDriveOn(int x, int y)
Definition sprite.cpp:1626
void fireBomb()
void makeIsland()
Definition generate.cpp:248
ToolResult putDownForest(short mapH, short mapV, ToolEffects *effects)
Definition tool.cpp:366
void setValves()
Definition simulate.cpp:564
Quad getPopulation()
Definition evaluate.cpp:197
short graph120Max
void doAutoGoto(short x, short y, const std::string &message)
Definition message.cpp:457
bool zonePlop(const Position &pos, int base)
Definition zone.cpp:366
ToolResult layRail(int x, int y, ToolEffects *effects)
Definition connect.cpp:364
short scoreWait
Time to wait before computing the score.
bool historyInitialized
short pollutionMaxX
X coordinate of most polluted area.
void * getPoliceCoverageMapBuffer()
void fireZone(const Position &pos, MapValue ch)
void doDisasters()
Definition disasters.cpp:92
short totalZonePop
ToolResult parkTool(short x, short y, ToolEffects *effects)
Definition tool.cpp:1198
void doShipSprite(SimSprite *sprite)
Definition sprite.cpp:867
short resZonePop
Number of residential zones.
short pollutionAverage
void collectTax()
Definition simulate.cpp:856
void drawStadium(const Position &center, MapTile z)
short evalRes(const Position &pos, int traf)
Definition zone.cpp:736
short trafMaxY
Y coordinate of a position with heavy traffic.
void pushPowerStack(const Position &pos)
Definition power.cpp:173
int getPollutionValue(int loc)
Definition scan.cpp:341
short resHist120Max
bool indCap
Block industrial growth.
Quad fireEffect
void resetEditorState()
void updateUserInterface()
Definition update.cpp:261
void computeComRateMap()
Definition scan.cpp:585
short totalPopLast
void * callbackData
bool resCap
Block residential growth.
void * getMapBuffer()
short trafMaxX
X coordinate of a position with heavy traffic.
short * crimeHist
short * pollutionHist
void doProblems(short problemTable[PROBNUM])
Definition evaluate.cpp:241
short airportPop
void doExplosionSprite(SimSprite *sprite)
Definition sprite.cpp:1306
std::string cityName
Name of the city.
short getHistory(int historyType, int historyScale, int historyIndex)
Definition graph.cpp:288
void setFunds(int dollars)
void updateGameLevel()
void generateShip()
Definition sprite.cpp:1858
short evalInd(int traf)
Definition zone.cpp:1029
short policeStationPop
void updateFunds()
Definition update.cpp:127
int getProblemNumber(int i)
Definition evaluate.cpp:545
void makeLakes()
Definition generate.cpp:259
void didLoadCity(const std::string &filename)
Definition fileio.cpp:568
int currentYear()
void doIndIn(const Position &pos, int pop, int value)
Definition zone.cpp:967
int generatedCitySeed
void doIndOut(const Position &pos, int pop, int value)
Definition zone.cpp:981
void drawMonth(short *hist, unsigned char *s, float scale)
Definition graph.cpp:107
MapValue randomFire()
void setAutoBulldoze(bool value)
void repairZone(const Position &pos, MapTile zCent, short zSize)
short disasterWait
Count-down timer for the disaster.
void setEnableSound(bool value)
ToolResult prepareBuildingSite(int leftX, int topY, int sizeX, int sizeY, ToolEffects *effects)
Definition tool.cpp:657
void doTrainSprite(SimSprite *sprite)
Definition sprite.cpp:623
SimSprite * getSprite(int type)
Definition sprite.cpp:338
int getPoliceCoverage(int x, int y)
bool mustUpdateOptions
Options displayed at user need updating.
void doResOut(const Position &pos, int pop, int value)
Definition zone.cpp:655
void getAssessedValue()
Definition evaluate.cpp:159
short checkSize(short tileValue)
Definition tool.cpp:548
bool tryOther(int Tpoo, int Told, int Tnew)
Definition sprite.cpp:431
void doComOut(const Position &pos, int pop, int value)
Definition zone.cpp:846
void setEnableDisasters(bool value)
int getFireCoverage(int x, int y)
void saveCityAs(const std::string &filename)
Definition fileio.cpp:646
short getComZonePop(MapTile tile)
Definition zone.cpp:866
void doBudgetFromMenu()
Definition budget.cpp:104
MapShort8 fireStationMap
int getDistance(int x1, int y1, int x2, int y2)
Definition sprite.cpp:525
short cityCenterX
X coordinate of city center.
short totalPop
void getHistoryRange(int historyType, int historyScale, short *minValResult, short *maxValResult)
Definition graph.cpp:218
short cityYes
void checkGrowth()
Definition message.cpp:250
int getLandValue(int x, int y)
void * userData
void setFire()
Quad cityAssessedValue
short landValueAverage
unsigned short * map[WORLD_W]
void randomlySeedRandom()
Definition random.cpp:165
bool doMessages
void doPopNum()
Definition evaluate.cpp:182
void setFireCoverage(int x, int y, int coverage)
void initMapArrays()
Definition allocate.cpp:88
void doMakeSound(int mesgNum, int x, int y)
Definition message.cpp:402
short makeTrafficAt(int x, int y, ZoneType dest)
Definition traffic.cpp:95
void simHeat()
Direction2 tryGo(const Position &pos, Direction2 dirLast)
Definition traffic.cpp:356
short coalPowerPop
void pause()
void destroyAllSprites()
Definition sprite.cpp:298
bool testForConductive(const Position &pos, Direction2 testDir)
Definition power.cpp:104
void doStartGame()
short hospitalPop
Number of hospitals.
void doResIn(const Position &pos, int pop, int value)
Definition zone.cpp:614
void crimeScan()
Definition scan.cpp:413
bool censusChanged
int terrainLakeLevel
short * indHist
void generateMap(int seed)
Definition generate.cpp:129
ToolResult doTool(EditingTool tool, short tileX, short tileY)
Definition tool.cpp:1397
void makeTornado()
Definition sprite.cpp:1996
void doBusSprite(SimSprite *sprite)
Definition sprite.cpp:1342
short trafficAverage
void generateTrain(int x, int y)
Definition sprite.cpp:1836
int mapSerial
The invalidateMaps method increases the map serial number every time the maps changes.
short comHist10Max
int simRandom()
Definition random.cpp:98
void destroyMapArrays()
Definition allocate.cpp:121
short * comHist
short startingYear
bool enableSound
Enable sound.
void sendMessage(short Mnum, short x=NOWHERE, short y=NOWHERE, bool picture=false, bool important=false)
Definition message.cpp:390
void doAirport(const Position &pos)
Scenario disasterEvent
The disaster for which a count-down is running.
void doScoreCard()
Definition evaluate.cpp:479
unsigned short * mapBase
void doHospitalChurch(const Position &pos)
Definition zone.cpp:147
MapShort8 policeStationMap
void makeSound(const std::string &channel, const std::string &sound, int x=-1, int y=-1)
bool saveFile(const std::string &filename)
Definition fileio.cpp:364
void setGameLevel(GameLevel level)
MapByte2 pollutionDensityMap
Pollution density map.
short getChar(int x, int y)
Definition sprite.cpp:375
int getProblemVotes(int i)
Definition evaluate.cpp:562
int getDensity(short catNo, short mapH, short mapV)
Definition tool.cpp:788
void generateBus(int x, int y)
Definition sprite.cpp:1849
SimSprite * newSprite(const std::string &name, int type, int x, int y)
Definition sprite.cpp:104
MapByte2 trafficDensityMap
Traffic density map.
bool autoBudget
void doTrees()
Definition generate.cpp:340
ToolResult putDownWater(short mapH, short mapV, ToolEffects *effects)
Definition tool.cpp:310
int getTile(int x, int y)
short cityScore
short categoryLast
City class of last city class check.
void toolDrag(EditingTool tool, short fromX, short fromY, short toX, short toY)
Definition tool.cpp:1538
bool comCap
Block commercial growth.
void decTrafficMap()
Definition simulate.cpp:339
void doFire(const Position &pos)
int getPollutionDensity(int x, int y)
Quad policeSpend
void * getFireCoverageMapBuffer()
CityClass cityClass
City class, affected by city population.
short nuclearPowerPop
void resume()
void makeFire()
void spend(int dollars)
Direction2 doBRiver(const Position &riverPos, Direction2 riverDir, Direction2 terrainDir)
Definition generate.cpp:512
static bool testBounds(int wx, int wy)
void makeNakedIsland()
Definition generate.cpp:204
void invalidateMaps()
void doWinGame()
Definition message.cpp:471
MapByte2 tempMap1
short floodCount
void fixSingle(int x, int y, ToolEffects *effects)
Definition connect.cpp:593
void doMonsterSprite(SimSprite *sprite)
Definition sprite.cpp:1007
void clearMap()
Definition generate.cpp:175
void plopSRiver(const Position &pos)
Definition generate.cpp:650
void setPopulationDensity(int x, int y, int density)
int getCityCenterDistance(int x, int y)
Definition scan.cpp:392
void makeExplosionAt(int x, int y)
Definition sprite.cpp:2033
ToolResult layRoad(int x, int y, ToolEffects *effects)
Definition connect.cpp:271
short fireStationPop
SimSprite * makeSprite(int type, int x, int y)
Definition sprite.cpp:355
void doBudgetNow(bool fromMenu)
Definition budget.cpp:116
void doStartScenario(int scenario)
void freePtr(void *data)
void didLoadScenario(int s, const std::string name, const std::string fname)
Definition fileio.cpp:522
void putRubble(int x, int y, int size, ToolEffects *effects)
Definition tool.cpp:923
int getRandom16Signed()
Definition random.cpp:137
void addToTrafficDensityMap()
Definition traffic.cpp:165
Ptr newPtr(int size)
void * getPollutionDensityMapBuffer()
short curMapStackPointer
void treeSplash(short xloc, short yloc)
Definition generate.cpp:310
short comPop
Definition micropolis.h:990
void doNilPower()
Definition simulate.cpp:323
void setCleanCityName(const std::string &name)
int getPowerGrid(int x, int y)
ToolResult landTool(short x, short y, ToolEffects *effects)
Definition tool.cpp:1328
void clearUnnatural()
Definition generate.cpp:188
short needHospital
short evalLot(int x, int y)
Definition zone.cpp:514
int getPopulationDensity(const Position &pos, MapTile tile)
Definition scan.cpp:198
MapByte2 populationDensityMap
Population density map.
void initWillStuff()
bool loadCity(const std::string &filename)
Definition fileio.cpp:536
void incRateOfGrowth(const Position &pos, int amount)
Definition zone.cpp:351
void doCommercial(const Position &pos, bool zonePower)
Definition zone.cpp:765
void makeFlood()
MapByte2 landValueMap
Land value map.
Quad policeFund
short needChurch
MapShort8 rateOfGrowthMap
void setRateOfGrowth(int x, int y, int rate)
void makeShipHere(int x, int y)
Definition sprite.cpp:1905
MapByte2 tempMap2
void setCrimeRate(int x, int y, int rate)
void putBuilding(int leftX, int topY, int sizeX, int sizeY, MapTile baseTile, bool aniFlag, ToolEffects *effects)
Definition tool.cpp:617
void doNewGame()
void smoothTreesAt(int x, int y, bool preserve)
Definition generate.cpp:429
void didTool(std::string name, short x, short y)
Definition tool.cpp:947
bool doBridge(const Position &pos, MapTile tile)
short cityTax
void setPowerGrid(int x, int y, int power)
short railTotal
Definition micropolis.h:971
short getERandom(short limit)
Definition random.cpp:155
bool roadTest(MapValue tile)
Definition traffic.cpp:503
MapValue randomRubble()
ToolResult roadTool(short x, short y, ToolEffects *effects)
Definition tool.cpp:1120
void doPowerScan()
Definition power.cpp:125
short * miscHist
void initGraphMax()
Definition graph.cpp:151
short crimeMaxY
Y coordinate of most criminal area. Not used.
bool spriteNotInBounds(SimSprite *sprite)
Definition sprite.cpp:459
void updateFundEffects()
Definition simulate.cpp:912
short comZonePop
Number of commercial zones.
void populationDensityScan()
Definition scan.cpp:136
void doComIn(const Position &pos, int pop, int value)
Definition zone.cpp:823
void doFlood(const Position &pos)
void plopBRiver(const Position &pos)
Definition generate.cpp:623
void doShowZoneStatus(int tileCategoryIndex, int populationDensityIndex, int landValueIndex, int crimeRateIndex, int pollutionIndex, int growthRateIndex, int x, int y)
Definition tool.cpp:903
short seaportPop
short roadTotal
Definition micropolis.h:964
void doRail(const Position &pos)
float policePercent
Quad totalFunds
Funds of the player.
void updateDate()
Definition update.cpp:159
short comHist120Max
void cityEvaluation()
Definition evaluate.cpp:110
void doBudget()
Definition budget.cpp:97
void setDoMessages(bool value)
void destroyMapTile(int ox, int oy)
Definition sprite.cpp:1714
bool findPerimeterRoad(Position *pos)
Definition traffic.cpp:239
bool autoBulldoze
void doEarthquake(int strength)
void doSimInit()
Definition simulate.cpp:288
short resHist10Max
short indHist120Max
ToolResult forestTool(short x, short y, ToolEffects *effects)
Definition tool.cpp:1351
ToolResult buildBuildingTool(short x, short y, const BuildingProperties *bprops, ToolEffects *effects)
Definition tool.cpp:1225
void setAutoBudget(bool value)
void setLandValue(int x, int y, int value)
int x
X coordinate of the sprite in pixels?
Definition micropolis.h:892
int destX
Destination X coordinate of the sprite.
Definition micropolis.h:902
int yHot
Offset of the hot-spot relative to SimSprite::y?
Definition micropolis.h:899
int type
Type of the sprite (TRA – BUS).
Definition micropolis.h:890
int destY
Destination Y coordinate of the sprite.
Definition micropolis.h:903
SimSprite * next
Pointer to next SimSprite object in the list.
Definition micropolis.h:888
std::string name
Name of the sprite.
Definition micropolis.h:889
int y
Y coordinate of the sprite in pixels?
Definition micropolis.h:893
int frame
Frame (0 means non-active sprite)
Definition micropolis.h:891
int xHot
Offset of the hot-spot relative to SimSprite::x?
Definition micropolis.h:898
Commonly used data types in Micropolis game engine.
Defines classes for handling messages between the game engine and the GUI frontend.
Map data structures for the Micropolis game engine.
static const int WORLD_H
Definition map_type.h:95
static const int WORLD_W
Definition map_type.h:90
static const int CITYTIMES_PER_YEAR
Definition micropolis.h:205
static const int WORLD_H_8
Definition micropolis.h:185
Scenario
Definition micropolis.h:698
@ SC_TOKYO
Tokyo (scary monster)
Definition micropolis.h:705
@ SC_NONE
No scenario (free playing)
Definition micropolis.h:699
@ SC_BOSTON
Boston (nuclear meltdown)
Definition micropolis.h:707
@ SC_BERN
Bern (traffic)
Definition micropolis.h:704
@ SC_COUNT
Number of scenarios.
Definition micropolis.h:710
@ SC_SAN_FRANCISCO
San francisco (earthquake)
Definition micropolis.h:702
@ SC_RIO
Rio (flooding)
Definition micropolis.h:708
@ SC_HAMBURG
Hamburg (fire bombs)
Definition micropolis.h:703
@ SC_DULLSVILLE
Dullsville (boredom)
Definition micropolis.h:701
@ SC_DETROIT
Detroit (crime)
Definition micropolis.h:706
static const int HISTORY_LENGTH
Definition micropolis.h:210
ZoneType
Definition micropolis.h:718
@ ZT_RESIDENTIAL
Residential zone.
Definition micropolis.h:721
@ ZT_COMMERCIAL
Commercial zone.
Definition micropolis.h:719
@ ZT_INDUSTRIAL
Industrial zone.
Definition micropolis.h:720
@ ZT_NUM_DESTINATIONS
Number of available zones.
Definition micropolis.h:723
static const int WORLD_W_2
Definition micropolis.h:151
static const int PASSES_PER_CITYTIME
Definition micropolis.h:195
ConnectTileCommand
Definition micropolis.h:350
@ CONNECT_TILE_FIX
Fix zone (connect wire, road, and rail).
Definition micropolis.h:351
@ CONNECT_TILE_ROAD
Lay road and fix zone.
Definition micropolis.h:353
@ CONNECT_TILE_WIRE
Lay wire and fix zone.
Definition micropolis.h:355
@ CONNECT_TILE_RAILROAD
Lay rail and fix zone.
Definition micropolis.h:354
@ CONNECT_TILE_BULLDOZE
Bulldoze and fix zone.
Definition micropolis.h:352
static void not_reached(int line, const char *fname)
Definition micropolis.h:858
static const int POWER_STACK_SIZE
Definition micropolis.h:226
MapType
Definition micropolis.h:306
@ MAP_TYPE_POLLUTION
Pollution.
Definition micropolis.h:316
@ MAP_TYPE_POPULATION_DENSITY
Population density.
Definition micropolis.h:313
@ MAP_TYPE_DYNAMIC
Dynamic filter.
Definition micropolis.h:321
@ MAP_TYPE_LAND_VALUE
Land value.
Definition micropolis.h:318
@ MAP_TYPE_FIRE_RADIUS
Fire station coverage radius.
Definition micropolis.h:319
@ MAP_TYPE_CRIME
Crime rate.
Definition micropolis.h:317
@ MAP_TYPE_ALL
All zones.
Definition micropolis.h:307
@ MAP_TYPE_IND
Industrial zones.
Definition micropolis.h:310
@ MAP_TYPE_COM
Commercial zones.
Definition micropolis.h:309
@ MAP_TYPE_RES
Residential zones.
Definition micropolis.h:308
@ MAP_TYPE_ROAD
Roads.
Definition micropolis.h:312
@ MAP_TYPE_POWER
Power connectivity.
Definition micropolis.h:311
@ MAP_TYPE_COUNT
Number of map types.
Definition micropolis.h:323
@ MAP_TYPE_RATE_OF_GROWTH
Rate of growth.
Definition micropolis.h:314
@ MAP_TYPE_TRAFFIC_DENSITY
Traffic.
Definition micropolis.h:315
@ MAP_TYPE_POLICE_RADIUS
Police station coverage radius.
Definition micropolis.h:320
static const int CITYTIMES_PER_MONTH
Definition micropolis.h:200
HistoryType
Definition micropolis.h:282
@ HISTORY_TYPE_CRIME
Crime history type.
Definition micropolis.h:287
@ HISTORY_TYPE_MONEY
Money history type.
Definition micropolis.h:286
@ HISTORY_TYPE_POLLUTION
Pollution history type.
Definition micropolis.h:288
@ HISTORY_TYPE_IND
Industry history type.
Definition micropolis.h:285
@ HISTORY_TYPE_COUNT
Number of history types.
Definition micropolis.h:290
@ HISTORY_TYPE_RES
Residiential history type.
Definition micropolis.h:283
@ HISTORY_TYPE_COM
Commercial history type.
Definition micropolis.h:284
static const int HISTORY_COUNT
Definition micropolis.h:221
Tiles
Definition micropolis.h:381
@ LASTPOWERPLANT
Last tile of coal power plant.
Definition micropolis.h:581
@ NUCLEARBASE
First tile nuclear power plant.
Definition micropolis.h:603
@ COALBASE
First tile of coal power plant.
Definition micropolis.h:579
@ HTRFBASE
First tile with high traffic.
Definition micropolis.h:452
@ WATER_LOW
First water tile.
Definition micropolis.h:392
@ FIRESTBASE
First tile of fire station.
Definition micropolis.h:584
@ RAILHPOWERV
Horizontal rail, vertical power.
Definition micropolis.h:477
@ HBRIDGE
Horizontal bridge.
Definition micropolis.h:426
@ WATER_HIGH
Last water tile (inclusive)
Definition micropolis.h:393
@ STADIUMBASE
First tile stadium.
Definition micropolis.h:594
@ VBRIDGE
Vertical bridge.
Definition micropolis.h:428
@ LASTZONE
Also last tile nuclear power plant.
Definition micropolis.h:605
@ STADIUM
'Center tile' stadium.
Definition micropolis.h:595
@ NUCLEAR
'Center' tile nuclear power plant.
Definition micropolis.h:604
@ PORTBASE
Top-left tile of the seaport.
Definition micropolis.h:567
@ IZB
Center tile of first non-empty industry zone.
Definition micropolis.h:542
@ PORT
Center tile of the seaport.
Definition micropolis.h:568
@ COALSMOKE3
927 last animation tile for chimney at coal power plant (2, 1).
Definition micropolis.h:644
@ POWERPLANT
'Center' tile of coal power plant.
Definition micropolis.h:580
@ INDCLR
Center tile of empty industrial zone.
Definition micropolis.h:537
@ COALSMOKE4
931 last animation tile for chimney at coal power plant (3, 1).
Definition micropolis.h:647
@ RADTILE
Radio-active contaminated tile.
Definition micropolis.h:415
@ FIRESTATION
'Center tile' of fire station.
Definition micropolis.h:585
@ LTRFBASE
First tile with low traffic.
Definition micropolis.h:443
@ DIRT
Clear tile.
Definition micropolis.h:382
@ INDBASE
Top-left tile of empty industrial zone.
Definition micropolis.h:536
@ IND1
Top-left tile of first non-empty industry zone.
Definition micropolis.h:541
@ COALSMOKE1
919 last animation tile for chimney at coal power plant (2, 0).
Definition micropolis.h:638
@ RAILVPOWERH
Vertical rail, horizontal power.
Definition micropolis.h:478
@ LASTIND
Last tile of empty industrial zone.
Definition micropolis.h:538
@ TILE_INVALID
Invalid tile (not used in the world map).
Definition micropolis.h:690
@ LASTPORT
Last tile of the seaport.
Definition micropolis.h:569
@ COALSMOKE2
923 last animation tile for chimney at coal power plant (3, 0).
Definition micropolis.h:641
static const int ISLAND_RADIUS
Definition micropolis.h:239
static const int BYTES_PER_TILE
Definition micropolis.h:143
static const int WORLD_H_2
Definition micropolis.h:157
CityClass
Definition micropolis.h:751
@ CC_CAPITAL
Capital, > 50000 citizens.
Definition micropolis.h:755
@ CC_MEGALOPOLIS
Megalopolis, > 500000 citizens.
Definition micropolis.h:757
@ CC_METROPOLIS
Metropolis, > 100000 citizens.
Definition micropolis.h:756
@ CC_CITY
City, > 10000 citizens.
Definition micropolis.h:754
@ CC_VILLAGE
Village.
Definition micropolis.h:752
@ CC_TOWN
Town, > 2000 citizens.
Definition micropolis.h:753
@ CC_NUM_CITIES
Number of city classes.
Definition micropolis.h:759
static const int WORLD_W_8
Definition micropolis.h:179
static const int MAX_FIRE_STATION_EFFECT
Definition micropolis.h:263
HistoryScale
Definition micropolis.h:296
@ HISTORY_SCALE_SHORT
Short scale data (10 years)
Definition micropolis.h:297
@ HISTORY_SCALE_COUNT
Number of history scales available.
Definition micropolis.h:300
@ HISTORY_SCALE_LONG
Long scale data (120 years)
Definition micropolis.h:298
static const int EDITOR_TILE_SIZE
Definition micropolis.h:190
GameLevel
Definition micropolis.h:763
@ LEVEL_FIRST
First game level value.
Definition micropolis.h:770
@ LEVEL_MEDIUM
Intermediate game level.
Definition micropolis.h:765
@ LEVEL_EASY
Simple game level.
Definition micropolis.h:764
@ LEVEL_HARD
Difficult game level.
Definition micropolis.h:766
@ LEVEL_LAST
Last game level value.
Definition micropolis.h:771
@ LEVEL_COUNT
Number of game levels.
Definition micropolis.h:768
ToolResult
Definition micropolis.h:363
@ TOOLRESULT_FAILED
Cannot build here.
Definition micropolis.h:366
@ TOOLRESULT_OK
Build succeeded.
Definition micropolis.h:367
@ TOOLRESULT_NEED_BULLDOZE
Clear the area first.
Definition micropolis.h:365
@ TOOLRESULT_NO_MONEY
User has not enough money for tool.
Definition micropolis.h:364
static T min(const T a, const T b)
Definition micropolis.h:784
static const int NOWHERE
Definition micropolis.h:233
CityVotingProblems
Definition micropolis.h:734
@ CVP_NUMPROBLEMS
Number of problems.
Definition micropolis.h:743
@ CVP_FIRE
Fire.
Definition micropolis.h:741
@ CVP_POLLUTION
Pollution.
Definition micropolis.h:736
@ CVP_TAXES
Taxes.
Definition micropolis.h:738
@ CVP_HOUSING
Housing.
Definition micropolis.h:737
@ CVP_UNEMPLOYMENT
Unemployment.
Definition micropolis.h:740
@ CVP_TRAFFIC
Traffic.
Definition micropolis.h:739
@ CVP_PROBLEM_COMPLAINTS
Number of problems to complain about.
Definition micropolis.h:745
@ CVP_CRIME
Crime.
Definition micropolis.h:735
static const int MAX_ROAD_EFFECT
Definition micropolis.h:253
SpriteType
Definition micropolis.h:328
@ SPRITE_AIRPLANE
Airplane sprite.
Definition micropolis.h:333
@ SPRITE_TORNADO
Tornado sprite.
Definition micropolis.h:336
@ SPRITE_MONSTER
Scary monster.
Definition micropolis.h:335
@ SPRITE_TRAIN
Train sprite.
Definition micropolis.h:331
@ SPRITE_HELICOPTER
Helicopter sprite.
Definition micropolis.h:332
@ SPRITE_BUS
Bus sprite.
Definition micropolis.h:338
@ SPRITE_SHIP
Ship.
Definition micropolis.h:334
@ SPRITE_EXPLOSION
Explosion sprite.
Definition micropolis.h:337
@ SPRITE_COUNT
Number of sprite objects.
Definition micropolis.h:340
static const int WORLD_H_4
Definition micropolis.h:171
static const int BITS_PER_TILE
Definition micropolis.h:137
static const int MISC_HISTORY_LENGTH
Definition micropolis.h:215
static const int MAX_POLICE_STATION_EFFECT
Definition micropolis.h:258
static T clamp(const T val, const T lower, const T upper)
Definition micropolis.h:809
static T absoluteValue(const T val)
Definition micropolis.h:826
static const int WORLD_W_4
Definition micropolis.h:165
static const int MAX_TRAFFIC_DISTANCE
Definition micropolis.h:248
static T max(const T a, const T b)
Definition micropolis.h:796
Defines position handling and direction enumeration for the Micropolis game engine.
Direction2
Definition position.h:86
Defines string identification numbers for texts used in the Micropolis game engine.
Defines tools, building properties, and tool effects for the Micropolis game.
unsigned short MapTile
Definition tool.h:108
@ BULLBIT
bit 12, tile is bulldozable.
Definition tool.h:123
@ ANIMBIT
bit 11, tile is animated.
Definition tool.h:124
unsigned short MapValue
Definition tool.h:101
EditingTool
Definition tool.h:142