Micropolis
micropolis.h File Reference

Header file for Micropolis game engine. More...

#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <math.h>
#include <cstdarg>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/file.h>
#include <sys/types.h>
#include <string>
#include <vector>
#include <map>
#include <emscripten.h>
#include <emscripten/bind.h>
#include "data_types.h"
#include "map_type.h"
#include "position.h"
#include "text.h"
#include "frontendmessage.h"
#include "tool.h"
#include "callback.h"

Go to the source code of this file.

Classes

class  SimSprite
 
class  Micropolis
 

Macros

#define IS_INTEL   1
 
#define LENGTH_OF(array)   (sizeof(array) / sizeof((array)[0]))
 
#define NOT_REACHED()   not_reached(__LINE__, __FILE__)
 

Enumerations

enum  HistoryType {
  HISTORY_TYPE_RES , HISTORY_TYPE_COM , HISTORY_TYPE_IND , HISTORY_TYPE_MONEY ,
  HISTORY_TYPE_CRIME , HISTORY_TYPE_POLLUTION , HISTORY_TYPE_COUNT
}
 
enum  HistoryScale { HISTORY_SCALE_SHORT , HISTORY_SCALE_LONG , HISTORY_SCALE_COUNT }
 
enum  MapType {
  MAP_TYPE_ALL , MAP_TYPE_RES , MAP_TYPE_COM , MAP_TYPE_IND ,
  MAP_TYPE_POWER , MAP_TYPE_ROAD , MAP_TYPE_POPULATION_DENSITY , MAP_TYPE_RATE_OF_GROWTH ,
  MAP_TYPE_TRAFFIC_DENSITY , MAP_TYPE_POLLUTION , MAP_TYPE_CRIME , MAP_TYPE_LAND_VALUE ,
  MAP_TYPE_FIRE_RADIUS , MAP_TYPE_POLICE_RADIUS , MAP_TYPE_DYNAMIC , MAP_TYPE_COUNT
}
 
enum  SpriteType {
  SPRITE_NOTUSED = 0 , SPRITE_TRAIN , SPRITE_HELICOPTER , SPRITE_AIRPLANE ,
  SPRITE_SHIP , SPRITE_MONSTER , SPRITE_TORNADO , SPRITE_EXPLOSION ,
  SPRITE_BUS , SPRITE_COUNT
}
 
enum  ConnectTileCommand {
  CONNECT_TILE_FIX , CONNECT_TILE_BULLDOZE , CONNECT_TILE_ROAD , CONNECT_TILE_RAILROAD ,
  CONNECT_TILE_WIRE
}
 
enum  ToolResult { TOOLRESULT_NO_MONEY = -2 , TOOLRESULT_NEED_BULLDOZE = -1 , TOOLRESULT_FAILED = 0 , TOOLRESULT_OK = 1 }
 
enum  Tiles {
  DIRT = 0 , RIVER = 2 , REDGE = 3 , CHANNEL = 4 ,
  FIRSTRIVEDGE = 5 , LASTRIVEDGE = 20 , WATER_LOW = RIVER , WATER_HIGH = LASTRIVEDGE ,
  TREEBASE = 21 , WOODS_LOW = TREEBASE , LASTTREE = 36 , WOODS = 37 ,
  UNUSED_TRASH1 = 38 , UNUSED_TRASH2 = 39 , WOODS_HIGH = UNUSED_TRASH2 , WOODS2 = 40 ,
  WOODS3 = 41 , WOODS4 = 42 , WOODS5 = 43 , RUBBLE = 44 ,
  LASTRUBBLE = 47 , FLOOD = 48 , LASTFLOOD = 51 , RADTILE = 52 ,
  UNUSED_TRASH3 = 53 , UNUSED_TRASH4 = 54 , UNUSED_TRASH5 = 55 , FIRE = 56 ,
  FIREBASE = FIRE , LASTFIRE = 63 , HBRIDGE = 64 , ROADBASE = HBRIDGE ,
  VBRIDGE = 65 , ROADS = 66 , ROADS2 = 67 , ROADS3 = 68 ,
  ROADS4 = 69 , ROADS5 = 70 , ROADS6 = 71 , ROADS7 = 72 ,
  ROADS8 = 73 , ROADS9 = 74 , ROADS10 = 75 , INTERSECTION = 76 ,
  HROADPOWER = 77 , VROADPOWER = 78 , BRWH = 79 , LTRFBASE = 80 ,
  BRWV = 95 , BRWXXX1 = 111 , BRWXXX2 = 127 , BRWXXX3 = 143 ,
  HTRFBASE = 144 , BRWXXX4 = 159 , BRWXXX5 = 175 , BRWXXX6 = 191 ,
  LASTROAD = 206 , BRWXXX7 = 207 , HPOWER = 208 , VPOWER = 209 ,
  LHPOWER = 210 , LVPOWER = 211 , LVPOWER2 = 212 , LVPOWER3 = 213 ,
  LVPOWER4 = 214 , LVPOWER5 = 215 , LVPOWER6 = 216 , LVPOWER7 = 217 ,
  LVPOWER8 = 218 , LVPOWER9 = 219 , LVPOWER10 = 220 , RAILHPOWERV = 221 ,
  RAILVPOWERH = 222 , POWERBASE = HPOWER , LASTPOWER = RAILVPOWERH , UNUSED_TRASH6 = 223 ,
  HRAIL = 224 , VRAIL = 225 , LHRAIL = 226 , LVRAIL = 227 ,
  LVRAIL2 = 228 , LVRAIL3 = 229 , LVRAIL4 = 230 , LVRAIL5 = 231 ,
  LVRAIL6 = 232 , LVRAIL7 = 233 , LVRAIL8 = 234 , LVRAIL9 = 235 ,
  LVRAIL10 = 236 , HRAILROAD = 237 , VRAILROAD = 238 , RAILBASE = HRAIL ,
  LASTRAIL = 238 , ROADVPOWERH = 239 , RESBASE = 240 , FREEZ = 244 ,
  HOUSE = 249 , LHTHR = HOUSE , HHTHR = 260 , RZB = 265 ,
  HOSPITALBASE = 405 , HOSPITAL = 409 , CHURCHBASE = 414 , CHURCH0BASE = 414 ,
  CHURCH = 418 , CHURCH0 = 418 , COMBASE = 423 , COMCLR = 427 ,
  CZB = 436 , COMLAST = 609 , INDBASE = 612 , INDCLR = 616 ,
  LASTIND = 620 , IND1 = 621 , IZB = 625 , IND2 = 641 ,
  IND3 = 644 , IND4 = 649 , IND5 = 650 , IND6 = 676 ,
  IND7 = 677 , IND8 = 686 , IND9 = 689 , PORTBASE = 693 ,
  PORT = 698 , LASTPORT = 708 , AIRPORTBASE = 709 , RADAR = 711 ,
  AIRPORT = 716 , COALBASE = 745 , POWERPLANT = 750 , LASTPOWERPLANT = 760 ,
  FIRESTBASE = 761 , FIRESTATION = 765 , POLICESTBASE = 770 , POLICESTATION = 774 ,
  STADIUMBASE = 779 , STADIUM = 784 , FULLSTADIUM = 800 , NUCLEARBASE = 811 ,
  NUCLEAR = 816 , LASTZONE = 826 , LIGHTNINGBOLT = 827 , HBRDG0 = 828 ,
  HBRDG1 = 829 , HBRDG2 = 830 , HBRDG3 = 831 , HBRDG_END = 832 ,
  RADAR0 = 832 , RADAR1 = 833 , RADAR2 = 834 , RADAR3 = 835 ,
  RADAR4 = 836 , RADAR5 = 837 , RADAR6 = 838 , RADAR7 = 839 ,
  FOUNTAIN = 840 , INDBASE2 = 844 , TELEBASE = 844 , TELELAST = 851 ,
  SMOKEBASE = 852 , TINYEXP = 860 , SOMETINYEXP = 864 , LASTTINYEXP = 867 ,
  TINYEXPLAST = 883 , COALSMOKE1 = 916 , COALSMOKE2 = 920 , COALSMOKE3 = 924 ,
  COALSMOKE4 = 928 , FOOTBALLGAME1 = 932 , FOOTBALLGAME2 = 940 , VBRDG0 = 948 ,
  VBRDG1 = 949 , VBRDG2 = 950 , VBRDG3 = 951 , NUKESWIRL1 = 952 ,
  NUKESWIRL2 = 953 , NUKESWIRL3 = 954 , NUKESWIRL4 = 955 , CHURCH1BASE = 956 ,
  CHURCH1 = 960 , CHURCH2BASE = 965 , CHURCH2 = 969 , CHURCH3BASE = 974 ,
  CHURCH3 = 978 , CHURCH4BASE = 983 , CHURCH4 = 987 , CHURCH5BASE = 992 ,
  CHURCH5 = 996 , CHURCH6BASE = 1001 , CHURCH6 = 1005 , CHURCH7BASE = 1010 ,
  CHURCH7 = 1014 , CHURCH7LAST = 1018 , TILE_COUNT = 1024 , TILE_INVALID = -1
}
 
enum  Scenario {
  SC_NONE , SC_DULLSVILLE , SC_SAN_FRANCISCO , SC_HAMBURG ,
  SC_BERN , SC_TOKYO , SC_DETROIT , SC_BOSTON ,
  SC_RIO , SC_COUNT
}
 
enum  ZoneType { ZT_COMMERCIAL , ZT_INDUSTRIAL , ZT_RESIDENTIAL , ZT_NUM_DESTINATIONS }
 
enum  CityVotingProblems {
  CVP_CRIME , CVP_POLLUTION , CVP_HOUSING , CVP_TAXES ,
  CVP_TRAFFIC , CVP_UNEMPLOYMENT , CVP_FIRE , CVP_NUMPROBLEMS ,
  CVP_PROBLEM_COMPLAINTS = 4 , PROBNUM = 10
}
 
enum  CityClass {
  CC_VILLAGE , CC_TOWN , CC_CITY , CC_CAPITAL ,
  CC_METROPOLIS , CC_MEGALOPOLIS , CC_NUM_CITIES
}
 
enum  GameLevel {
  LEVEL_EASY , LEVEL_MEDIUM , LEVEL_HARD , LEVEL_COUNT ,
  LEVEL_FIRST = LEVEL_EASY , LEVEL_LAST = LEVEL_HARD
}
 

Functions

template<typename T >
static T min (const T a, const T b)
 
template<typename T >
static T max (const T a, const T b)
 
template<typename T >
static T clamp (const T val, const T lower, const T upper)
 
template<typename T >
static T absoluteValue (const T val)
 
static void not_reached (int line, const char *fname)
 

Variables

static const int BITS_PER_TILE = 16
 
static const int BYTES_PER_TILE = 2
 
static const int WORLD_W_2 = WORLD_W / 2
 
static const int WORLD_H_2 = WORLD_H / 2
 
static const int WORLD_W_4 = WORLD_W / 4
 
static const int WORLD_H_4 = WORLD_H / 4
 
static const int WORLD_W_8 = WORLD_W / 8
 
static const int WORLD_H_8 = (WORLD_H + 7) / 8
 
static const int EDITOR_TILE_SIZE = 16
 
static const int PASSES_PER_CITYTIME = 16
 
static const int CITYTIMES_PER_MONTH = 4
 
static const int CITYTIMES_PER_YEAR = CITYTIMES_PER_MONTH * 12
 
static const int HISTORY_LENGTH = 480
 
static const int MISC_HISTORY_LENGTH = 240
 
static const int HISTORY_COUNT = 120
 
static const int POWER_STACK_SIZE = (WORLD_W * WORLD_H) / 4
 
static const int NOWHERE = -1
 
static const int ISLAND_RADIUS = 18
 
static const int MAX_TRAFFIC_DISTANCE = 30
 
static const int MAX_ROAD_EFFECT = 32
 
static const int MAX_POLICE_STATION_EFFECT = 1000
 
static const int MAX_FIRE_STATION_EFFECT = 1000
 
static const int RES_VALVE_RANGE = 2000
 
static const int COM_VALVE_RANGE = 1500
 
static const int IND_VALVE_RANGE = 1500
 

Detailed Description

Header file for Micropolis game engine.

This file contains class and method declarations, constant definitions, enumerations, and other essential elements for the Micropolis game engine. It serves as the central include file that brings together various components of the simulation, such as map handling, disaster events, budgeting, and zone management. It also defines key data structures, such as the SimSprite class for handling sprites within the game. This header file is crucial for providing the necessary declarations for different parts of the game engine to interact and function cohesively.

Definition in file micropolis.h.

Macro Definition Documentation

◆ IS_INTEL

#define IS_INTEL   1

Used to determine byte order.

Todo:
Determine byte order a better way.

Definition at line 126 of file micropolis.h.

◆ LENGTH_OF

#define LENGTH_OF (   array)    (sizeof(array) / sizeof((array)[0]))

Compute length of array

Parameters
arrayArray to get length from
Note
Macro only works for statically allocated arrays

Definition at line 842 of file micropolis.h.

◆ NOT_REACHED

#define NOT_REACHED ( )    not_reached(__LINE__, __FILE__)

Give a fatal error and exit.

Definition at line 847 of file micropolis.h.

Enumeration Type Documentation

◆ CityClass

enum CityClass

Available classes of cities

Enumerator
CC_VILLAGE 

Village.

CC_TOWN 

Town, > 2000 citizens.

CC_CITY 

City, > 10000 citizens.

CC_CAPITAL 

Capital, > 50000 citizens.

CC_METROPOLIS 

Metropolis, > 100000 citizens.

CC_MEGALOPOLIS 

Megalopolis, > 500000 citizens.

CC_NUM_CITIES 

Number of city classes.

Definition at line 750 of file micropolis.h.

◆ CityVotingProblems

Problems in the city where citizens vote on

Todo:
Eliminate PROBNUM
Enumerator
CVP_CRIME 

Crime.

CVP_POLLUTION 

Pollution.

CVP_HOUSING 

Housing.

CVP_TAXES 

Taxes.

CVP_TRAFFIC 

Traffic.

CVP_UNEMPLOYMENT 

Unemployment.

CVP_FIRE 

Fire.

CVP_NUMPROBLEMS 

Number of problems.

CVP_PROBLEM_COMPLAINTS 

Number of problems to complain about.

Definition at line 733 of file micropolis.h.

◆ ConnectTileCommand

Connect tile commands.

Enumerator
CONNECT_TILE_FIX 

Fix zone (connect wire, road, and rail).

CONNECT_TILE_BULLDOZE 

Bulldoze and fix zone.

CONNECT_TILE_ROAD 

Lay road and fix zone.

CONNECT_TILE_RAILROAD 

Lay rail and fix zone.

CONNECT_TILE_WIRE 

Lay wire and fix zone.

Definition at line 350 of file micropolis.h.

◆ GameLevel

enum GameLevel

Game levels

Enumerator
LEVEL_EASY 

Simple game level.

LEVEL_MEDIUM 

Intermediate game level.

LEVEL_HARD 

Difficult game level.

LEVEL_COUNT 

Number of game levels.

LEVEL_FIRST 

First game level value.

LEVEL_LAST 

Last game level value.

Definition at line 762 of file micropolis.h.

◆ HistoryScale

Available historic scales.

Enumerator
HISTORY_SCALE_SHORT 

Short scale data (10 years)

HISTORY_SCALE_LONG 

Long scale data (120 years)

HISTORY_SCALE_COUNT 

Number of history scales available.

Definition at line 296 of file micropolis.h.

◆ HistoryType

Available types of historic data.

Enumerator
HISTORY_TYPE_RES 

Residiential history type.

HISTORY_TYPE_COM 

Commercial history type.

HISTORY_TYPE_IND 

Industry history type.

HISTORY_TYPE_MONEY 

Money history type.

HISTORY_TYPE_CRIME 

Crime history type.

HISTORY_TYPE_POLLUTION 

Pollution history type.

HISTORY_TYPE_COUNT 

Number of history types.

Definition at line 282 of file micropolis.h.

◆ MapType

enum MapType

Available map types.

Enumerator
MAP_TYPE_ALL 

All zones.

MAP_TYPE_RES 

Residential zones.

MAP_TYPE_COM 

Commercial zones.

MAP_TYPE_IND 

Industrial zones.

MAP_TYPE_POWER 

Power connectivity.

MAP_TYPE_ROAD 

Roads.

MAP_TYPE_POPULATION_DENSITY 

Population density.

MAP_TYPE_RATE_OF_GROWTH 

Rate of growth.

MAP_TYPE_TRAFFIC_DENSITY 

Traffic.

MAP_TYPE_POLLUTION 

Pollution.

MAP_TYPE_CRIME 

Crime rate.

MAP_TYPE_LAND_VALUE 

Land value.

MAP_TYPE_FIRE_RADIUS 

Fire station coverage radius.

MAP_TYPE_POLICE_RADIUS 

Police station coverage radius.

MAP_TYPE_DYNAMIC 

Dynamic filter.

MAP_TYPE_COUNT 

Number of map types.

Definition at line 306 of file micropolis.h.

◆ Scenario

enum Scenario

Available scenarios

Enumerator
SC_NONE 

No scenario (free playing)

SC_DULLSVILLE 

Dullsville (boredom)

SC_SAN_FRANCISCO 

San francisco (earthquake)

SC_HAMBURG 

Hamburg (fire bombs)

SC_BERN 

Bern (traffic)

SC_TOKYO 

Tokyo (scary monster)

SC_DETROIT 

Detroit (crime)

SC_BOSTON 

Boston (nuclear meltdown)

SC_RIO 

Rio (flooding)

SC_COUNT 

Number of scenarios.

Definition at line 697 of file micropolis.h.

◆ SpriteType

enum SpriteType
Enumerator
SPRITE_TRAIN 

Train sprite.

SPRITE_HELICOPTER 

Helicopter sprite.

SPRITE_AIRPLANE 

Airplane sprite.

SPRITE_SHIP 

Ship.

SPRITE_MONSTER 

Scary monster.

SPRITE_TORNADO 

Tornado sprite.

SPRITE_EXPLOSION 

Explosion sprite.

SPRITE_BUS 

Bus sprite.

SPRITE_COUNT 

Number of sprite objects.

Definition at line 328 of file micropolis.h.

◆ Tiles

enum Tiles

Characters of the map tiles, the lower 10 bits (0–9).

See also
LOMASK MapTileBitmasks
Todo:

Add TILE_ prefix

Make LOW/BASE and LAST/HIGH consistent everywhere?

Figure out what sprite groups really exist (maybe we can learn more by examining the actual sprites, and/or by using hexadecimal or bite-wise notation?)

Add comments for each sprite (0–1023)

Enumerator
DIRT 

Clear tile.

WATER_LOW 

First water tile.

WATER_HIGH 

Last water tile (inclusive)

RADTILE 

Radio-active contaminated tile.

HBRIDGE 

Horizontal bridge.

VBRIDGE 

Vertical bridge.

LTRFBASE 

First tile with low traffic.

HTRFBASE 

First tile with high traffic.

RAILHPOWERV 

Horizontal rail, vertical power.

RAILVPOWERH 

Vertical rail, horizontal power.

INDBASE 

Top-left tile of empty industrial zone.

INDCLR 

Center tile of empty industrial zone.

LASTIND 

Last tile of empty industrial zone.

IND1 

Top-left tile of first non-empty industry zone.

IZB 

Center tile of first non-empty industry zone.

PORTBASE 

Top-left tile of the seaport.

PORT 

Center tile of the seaport.

LASTPORT 

Last tile of the seaport.

COALBASE 

First tile of coal power plant.

POWERPLANT 

'Center' tile of coal power plant.

LASTPOWERPLANT 

Last tile of coal power plant.

FIRESTBASE 

First tile of fire station.

FIRESTATION 

'Center tile' of fire station.

STADIUMBASE 

First tile stadium.

STADIUM 

'Center tile' stadium.

NUCLEARBASE 

First tile nuclear power plant.

NUCLEAR 

'Center' tile nuclear power plant.

LASTZONE 

Also last tile nuclear power plant.

COALSMOKE1 

919 last animation tile for chimney at coal power plant (2, 0).

Chimney animation at coal power plant (2, 0).

COALSMOKE2 

923 last animation tile for chimney at coal power plant (3, 0).

Chimney animation at coal power plant (3, 0).

COALSMOKE3 

927 last animation tile for chimney at coal power plant (2, 1).

Chimney animation at coal power plant (2, 1).

COALSMOKE4 

931 last animation tile for chimney at coal power plant (3, 1).

Chimney animation at coal power plant (3, 1).

TILE_INVALID 

Invalid tile (not used in the world map).

Definition at line 381 of file micropolis.h.

◆ ToolResult

enum ToolResult

Tool result.

Todo:
Make the rest of the code use this instead of magic numbers.
Enumerator
TOOLRESULT_NO_MONEY 

User has not enough money for tool.

TOOLRESULT_NEED_BULLDOZE 

Clear the area first.

TOOLRESULT_FAILED 

Cannot build here.

TOOLRESULT_OK 

Build succeeded.

Definition at line 363 of file micropolis.h.

◆ ZoneType

enum ZoneType

Available zone types

Enumerator
ZT_COMMERCIAL 

Commercial zone.

ZT_INDUSTRIAL 

Industrial zone.

ZT_RESIDENTIAL 

Residential zone.

ZT_NUM_DESTINATIONS 

Number of available zones.

Definition at line 717 of file micropolis.h.

Function Documentation

◆ absoluteValue()

template<typename T >
static T absoluteValue ( const T  val)
inlinestatic

Compute absolute value.

Parameters
valInput value.
Returns
Absolute value of val.

Definition at line 825 of file micropolis.h.

Referenced by Micropolis::getBoatDistance(), Micropolis::getDir(), Micropolis::getDistance(), and Micropolis::toolDrag().

◆ clamp()

template<typename T >
static T clamp ( const T  val,
const T  lower,
const T  upper 
)
inlinestatic

Clamp value between lower and upper bound.

Parameters
valValue.
lowerLower bound (inclusive).
upperUpper bound (inclusive).
Returns
val, limited to the range given by the lower and upper bound.

Definition at line 808 of file micropolis.h.

Referenced by Micropolis::crimeScan(), Micropolis::decRateOfGrowthMap(), Micropolis::drawMonth(), Micropolis::fireZone(), Micropolis::incRateOfGrowth(), Micropolis::setValves(), Micropolis::startFireInZone(), and Micropolis::take10Census().

◆ max()

template<typename T >
static T max ( const T  a,
const T  b 
)
inlinestatic

Compute maximal value.

Parameters
aFirst value.
bSecond value.
Returns
Maximum of a and b.

Definition at line 795 of file micropolis.h.

Referenced by Micropolis::getHistoryRange(), Micropolis::initGraphMax(), Micropolis::loadFile(), Micropolis::setValves(), and Micropolis::take10Census().

◆ min()

template<typename T >
static T min ( const T  a,
const T  b 
)
inlinestatic

◆ not_reached()

static void not_reached ( int  line,
const char *  fname 
)
inlinestatic

Give a fatal error and exit the program.

Parameters
lineSource line number of the fatal error.
fnameFilename of the source file.
Returns
Does not return to the caller.
Todo:
Generalize error handling/exiting of the simulator.

Definition at line 857 of file micropolis.h.

Variable Documentation

◆ BITS_PER_TILE

const int BITS_PER_TILE = 16
static

The number of bits per tile.

Todo:
Only used in python/micropolisdrawingarea.py

Definition at line 137 of file micropolis.h.

◆ BYTES_PER_TILE

const int BYTES_PER_TILE = 2
static

The number of bytes per tile.

Todo:
Only used in python/micropolisdrawingarea.py

Definition at line 143 of file micropolis.h.

◆ CITYTIMES_PER_MONTH

const int CITYTIMES_PER_MONTH = 4
static

The number of #cityTime units per month.

Definition at line 200 of file micropolis.h.

◆ CITYTIMES_PER_YEAR

const int CITYTIMES_PER_YEAR = CITYTIMES_PER_MONTH * 12
static

The number of #cityTime units per year.

Definition at line 205 of file micropolis.h.

◆ EDITOR_TILE_SIZE

const int EDITOR_TILE_SIZE = 16
static

The size of the editor view tiles, in pixels.

Definition at line 190 of file micropolis.h.

◆ HISTORY_COUNT

const int HISTORY_COUNT = 120
static

Length of the history tables.

Todo:
It is not really a count of histories, rename to something else?

Definition at line 221 of file micropolis.h.

Referenced by Micropolis::getHistory(), Micropolis::getHistoryRange(), and Micropolis::setHistory().

◆ HISTORY_LENGTH

const int HISTORY_LENGTH = 480
static

The number of history entries.

Definition at line 210 of file micropolis.h.

Referenced by Micropolis::initMapArrays(), Micropolis::loadFileData(), and Micropolis::saveFile().

◆ ISLAND_RADIUS

const int ISLAND_RADIUS = 18
static

The default radius of an island, used by the terrain generator.

Definition at line 239 of file micropolis.h.

Referenced by Micropolis::makeNakedIsland().

◆ MAX_FIRE_STATION_EFFECT

const int MAX_FIRE_STATION_EFFECT = 1000
static

◆ MAX_POLICE_STATION_EFFECT

const int MAX_POLICE_STATION_EFFECT = 1000
static

◆ MAX_ROAD_EFFECT

◆ MAX_TRAFFIC_DISTANCE

const int MAX_TRAFFIC_DISTANCE = 30
static

Maximal number of map tiles to drive, looking for a destination

Definition at line 248 of file micropolis.h.

Referenced by Micropolis::pushPos(), and Micropolis::tryDrive().

◆ MISC_HISTORY_LENGTH

const int MISC_HISTORY_LENGTH = 240
static

The number of miscellaneous history entries.

Definition at line 215 of file micropolis.h.

Referenced by Micropolis::initMapArrays(), Micropolis::loadFileData(), and Micropolis::saveFile().

◆ NOWHERE

const int NOWHERE = -1
static

A constant used in place of an x or y position to indicate "nowhere".

Definition at line 233 of file micropolis.h.

Referenced by Micropolis::checkGrowth(), Micropolis::doScenarioScore(), Micropolis::toolDown(), and Micropolis::updateDate().

◆ PASSES_PER_CITYTIME

const int PASSES_PER_CITYTIME = 16
static

The number of simulator passes per #cityTime unit.

Definition at line 195 of file micropolis.h.

◆ POWER_STACK_SIZE

const int POWER_STACK_SIZE = (WORLD_W * WORLD_H) / 4
static

The size of the power stack.

Definition at line 226 of file micropolis.h.

Referenced by Micropolis::pushPowerStack().

◆ WORLD_H_2

const int WORLD_H_2 = WORLD_H / 2
static

Vertical size of the world for a map that stores a value for every 2x2 square.

Definition at line 157 of file micropolis.h.

Referenced by Micropolis::doBusSprite().

◆ WORLD_H_4

const int WORLD_H_4 = WORLD_H / 4
static

Vertical size of the world for a map that stores a value for every 4x4 square.

Definition at line 171 of file micropolis.h.

◆ WORLD_H_8

const int WORLD_H_8 = (WORLD_H + 7) / 8
static

Vertical size of the world for a map that stores a value for every 8x8 square.

Definition at line 185 of file micropolis.h.

◆ WORLD_W_2

const int WORLD_W_2 = WORLD_W / 2
static

Horizontal size of the world for a map that stores a value for every 2x2 square.

Todo:
Make a Map class that keeps its 2x2 square storage details internally, so the code doesn't need to bother with it.

Definition at line 151 of file micropolis.h.

◆ WORLD_W_4

const int WORLD_W_4 = WORLD_W / 4
static

Horizontal size of the world for a map that stores a value for every 4x4 square.

Todo:
Make a Map class that keeps its 4x4 square storage details internally, so the code doesn't need to bother with it.

Definition at line 165 of file micropolis.h.

◆ WORLD_W_8

const int WORLD_W_8 = WORLD_W / 8
static

Horizontal size of the world for a map that stores a value for every 8x8 square.

Todo:
Make a Map class that keeps its 8x8 square storage details internally, so the code doesn't need to bother with it.

Definition at line 179 of file micropolis.h.