Micropolis
Micropolis Class Reference

#include <micropolis.h>

Public Member Functions

 Micropolis ()
 
 ~Micropolis ()
 
void setCallback (Callback *callback, emscripten::val callbackVal)
 
void init ()
 

Public Attributes

Callbackcallback
 
short roadTotal
 
short railTotal
 
short firePop
 
short resPop
 
short comPop
 
short indPop
 
short totalPop
 
short totalPopLast
 
short resZonePop
 Number of residential zones.
 
short comZonePop
 Number of commercial zones.
 
short indZonePop
 Number of industrial zones.
 
short totalZonePop
 
short hospitalPop
 Number of hospitals.
 
short churchPop
 Number of churches.
 
short faith
 Faith bias.
 
short stadiumPop
 Number of stadiums.
 
short policeStationPop
 
short fireStationPop
 
short coalPowerPop
 
short nuclearPowerPop
 
short seaportPop
 
short airportPop
 
short crimeAverage
 
short pollutionAverage
 
short landValueAverage
 
Dates
Quad cityTime
 
Quad cityMonth
 
Quad cityYear
 
short startingYear
 
unsigned short * map [WORLD_W]
 
unsigned short * mop [WORLD_W]
 
short resHist10Max
 
short resHist120Max
 
short comHist10Max
 
short comHist120Max
 
short indHist10Max
 
short indHist120Max
 
bool censusChanged
 
Budget
Quad roadSpend
 
Quad policeSpend
 
Quad fireSpend
 
Quad roadFund
 
Quad policeFund
 
Quad fireFund
 
Quad roadEffect
 
Quad policeEffect
 
Quad fireEffect
 
Quad taxFund
 
short cityTax
 
bool taxFlag
 
Maps
MapByte2 populationDensityMap
 Population density map.
 
MapByte2 trafficDensityMap
 Traffic density map.
 
MapByte2 pollutionDensityMap
 Pollution density map.
 
MapByte2 landValueMap
 Land value map.
 
MapByte2 crimeRateMap
 Crime rate map.
 
MapByte4 terrainDensityMap
 
MapByte2 tempMap1
 
MapByte2 tempMap2
 
MapByte4 tempMap3
 
MapByte1 powerGridMap
 
MapShort8 rateOfGrowthMap
 
MapShort8 fireStationMap
 
MapShort8 fireStationEffectMap
 
MapShort8 policeStationMap
 
MapShort8 policeStationEffectMap
 
MapShort8 comRateMap
 

Private Member Functions

void destroy ()
 

Historic graphs.

short * resHist
 
short * comHist
 
short * indHist
 
short * moneyHist
 
short * pollutionHist
 
short * crimeHist
 
short * miscHist
 
float roadPercent
 
float policePercent
 
float firePercent
 
Quad roadValue
 
Quad policeValue
 
Quad fireValue
 
int mustDrawBudget
 
short floodCount
 
short cityYes
 
short problemVotes [PROBNUM]
 
short problemOrder [CVP_PROBLEM_COMPLAINTS]
 
Quad cityPop
 
Quad cityPopDelta
 
Quad cityAssessedValue
 
CityClass cityClass
 City class, affected by city population.
 
short cityScore
 
short cityScoreDelta
 
short trafficAverage
 
short needHospital
 
short needChurch
 
unsigned short * mapBase
 
unsigned short * mopBase
 
void animateTiles ()
 
void initFundingLevel ()
 
void doBudget ()
 
void doBudgetFromMenu ()
 
void doBudgetNow (bool fromMenu)
 
void updateBudget ()
 
void showBudgetWindowAndStartWaiting ()
 
void setCityTax (short tax)
 
void makeMeltdown ()
 
void makeFireBombs ()
 
void makeEarthquake ()
 
void makeFire ()
 
void makeFlood ()
 
void setFire ()
 
void fireBomb ()
 
void cityEvaluation ()
 
void evalInit ()
 
void doScoreCard ()
 
void changeEval ()
 
void scoreDoer ()
 
int countProblems ()
 
int getProblemNumber (int i)
 
int getProblemVotes (int i)
 
bool loadFileData (const std::string &filename)
 
bool loadFile (const std::string &filename)
 
bool saveFile (const std::string &filename)
 
void loadScenario (Scenario s)
 
void didLoadScenario (int s, const std::string name, const std::string fname)
 
bool loadCity (const std::string &filename)
 
void didLoadCity (const std::string &filename)
 
void didntLoadCity (const std::string &msg)
 
void saveCity ()
 
void doSaveCityAs (const std::string &filename)
 
void didSaveCity (const std::string &filename)
 
void didntSaveCity (const std::string &msg)
 
void saveCityAs (const std::string &filename)
 
void initMapArrays ()
 
void destroyMapArrays ()
 
ToolResult connectTile (short x, short y, ConnectTileCommand cmd, ToolEffects *effects)
 
ToolResult layDoze (int x, int y, ToolEffects *effects)
 
ToolResult layRoad (int x, int y, ToolEffects *effects)
 
ToolResult layRail (int x, int y, ToolEffects *effects)
 
ToolResult layWire (int x, int y, ToolEffects *effects)
 
void fixZone (int x, int y, ToolEffects *effects)
 
void fixSingle (int x, int y, ToolEffects *effects)
 
void doDisasters ()
 
void scenarioDisaster ()
 
bool vulnerable (int tem)
 
void doFlood (const Position &pos)
 
void getAssessedValue ()
 
void doPopNum ()
 
Quad getPopulation ()
 
CityClass getCityClass (Quad cityPop)
 
void doProblems (short problemTable[PROBNUM])
 
void voteProblems (const short problemTable[PROBNUM])
 
short getTrafficAverage ()
 
short getUnemployment ()
 
short getFireSeverity ()
 
void getScore (const short problemTable[PROBNUM])
 
void doVotes ()
 
static int getNextAnimatedTile (int index)
 

Terrain generator.

features available incrementally as city building tools.

The user should be able to place water and trees, and it should dynamically smooth the edges.

The user interface could restrict the user to only drawing terrain before any zones were built, but it would be best if the terrain editing tools worked properly when there were zones built (by automatically bulldozing zones whose underlying terrain it's modifying).

int terrainTreeLevel
 
int terrainLakeLevel
 
int terrainCurveLevel
 
int terrainCreateIsland
 
int generatedCitySeed
 
bool historyInitialized
 
short graph10Max
 
short graph120Max
 
int simLoops
 
int simPasses
 
int simPass
 
bool simPaused
 
int simPausedSpeed
 
bool tilesAnimated
 
bool doAnimation
 
bool doMessages
 
bool doNotices
 
std::string cityFileName
 Filename of the last loaded city.
 
std::string cityName
 Name of the city.
 
int heatSteps
 
int heatFlow
 
int heatRule
 
int heatWrap
 
Quad cityPopLast
 Population of last city class check.
 
short categoryLast
 City class of last city class check.
 
bool autoGoto
 
short * cellSrc
 
short * cellDst
 
void generateSomeRandomCity ()
 
void clearMap ()
 
void clearUnnatural ()
 
void makeIsland ()
 
void treeSplash (short xloc, short yloc)
 
void makeSingleLake (const Position &pos)
 
void plopBRiver (const Position &pos)
 
void plopSRiver (const Position &pos)
 
void generateSomeCity (int seed)
 
void generateMap (int seed)
 
void drawMonth (short *hist, unsigned char *s, float scale)
 
void changeCensus ()
 
void graphDoer ()
 
void initGraphs ()
 
void initGraphMax ()
 
void getHistoryRange (int historyType, int historyScale, short *minValResult, short *maxValResult)
 
short getHistory (int historyType, int historyScale, int historyIndex)
 
void setHistory (int historyType, int historyScale, int historyIndex, short historyValue)
 
std::string getMicropolisVersion ()
 
void simUpdate ()
 
void simTick ()
 
void simulateRobots ()
 
long getMapAddress ()
 
long getMapSize ()
 
long getMopAddress ()
 
long getMopSize ()
 
void sendMessages ()
 
void checkGrowth ()
 
void doScenarioScore (Scenario type)
 
void sendMessage (short Mnum, short x=NOWHERE, short y=NOWHERE, bool picture=false, bool important=false)
 
void doMakeSound (int mesgNum, int x, int y)
 
void doAutoGoto (short x, short y, const std::string &message)
 
void doLoseGame ()
 
void doWinGame ()
 
void makeNakedIsland ()
 
void doTrees ()
 
bool isTree (MapValue cell)
 
void smoothTrees ()
 
void smoothTreesAt (int x, int y, bool preserve)
 
void smoothTreesAt (int x, int y, bool preserve, ToolEffects *effects)
 
void makeLakes ()
 
void doRivers (const Position &terrainPos)
 
Direction2 doBRiver (const Position &riverPos, Direction2 riverDir, Direction2 terrainDir)
 
Direction2 doSRiver (const Position &riverPos, Direction2 riverDir, Direction2 terrainDir)
 
void smoothRiver ()
 
void smoothWater ()
 
void putOnMap (MapValue mChar, short xLoc, short yLoc)
 
void initWillStuff ()
 
void resetMapState ()
 
void resetEditorState ()
 
void simInit ()
 
void simHeat ()
 
void simLoop (bool doSim)
 

Power stack

Stack used to find powered tiles by tracking conductive tiles.

UQuad nextRandom
 
short newMap
 
short newMapFlags [MAP_TYPE_COUNT]
 
short cityCenterX
 X coordinate of city center.
 
short cityCenterY
 Y coordinate of city center.
 
short pollutionMaxX
 X coordinate of most polluted area.
 
short pollutionMaxY
 Y coordinate of most polluted area.
 
short crimeMaxX
 X coordinate of most criminal area. Not used.
 
short crimeMaxY
 Y coordinate of most criminal area. Not used.
 
Quad donDither
 
bool valveFlag
 
short crimeRamp
 
short pollutionRamp
 
bool resCap
 Block residential growth.
 
bool comCap
 Block commercial growth.
 
bool indCap
 Block industrial growth.
 
short cashFlow
 
float externalMarket
 
Scenario disasterEvent
 The disaster for which a count-down is running.
 
short disasterWait
 Count-down timer for the disaster.
 
Scenario scoreType
 The type of score table to use.
 
short scoreWait
 Time to wait before computing the score.
 
short poweredZoneCount
 Number of powered tiles in all zone.
 
short unpoweredZoneCount
 Number of unpowered tiles in all zones.
 
bool newPower
 
short cityTaxAverage
 
short simCycle
 
short phaseCycle
 
short speedCycle
 
bool doInitialEval
 Need to perform initial city evaluation.
 
int mapSerial
 The invalidateMaps method increases the map serial number every time the maps changes.
 
short resValve
 
short comValve
 
short indValve
 
SimSpritespriteList
 List of active sprites.
 
Quad totalFunds
 Funds of the player.
 
bool autoBulldoze
 
bool autoBudget
 
Quad messageTimeLast
 
GameLevel gameLevel
 Difficulty level of the game (0..2)
 
short initSimLoad
 
Scenario scenario
 Scenario being played.
 
short simSpeed
 
short simSpeedMeta
 
bool enableSound
 Enable sound.
 
bool enableDisasters
 Enable disasters.
 
short messageNumber
 
bool evalChanged
 The evaluation window should be shown to the user.
 
short blinkFlag
 
emscripten::val callbackVal
 
void * callbackData
 
void * userData
 
bool mustUpdateFunds
 
bool mustUpdateOptions
 Options displayed at user need updating.
 
Quad cityTimeLast
 
Quad cityYearLast
 
Quad cityMonthLast
 
Quad totalFundsLast
 
Quad resLast
 
Quad comLast
 
Quad indLast
 
int powerStackPointer
 Stack counter, points to top-most item.
 
Position powerStackXY [POWER_STACK_SIZE]
 
SimSpritefreeSprites
 Pool of free SimSprite objects.
 
SimSpriteglobalSprites [SPRITE_COUNT]
 
int absDist
 
short spriteCycle
 
short curMapStackPointer
 
Position curMapStackXY [MAX_TRAFFIC_DISTANCE+1]
 Position stack.
 
short trafMaxX
 X coordinate of a position with heavy traffic.
 
short trafMaxY
 Y coordinate of a position with heavy traffic.
 
int simRandom ()
 
short getRandom (short range)
 
int getRandom16 ()
 
int getRandom16Signed ()
 
short getERandom (short limit)
 
void randomlySeedRandom ()
 
void seedRandom (int seed)
 
void fireAnalysis ()
 
void populationDensityScan ()
 
int getPopulationDensity (const Position &pos, MapTile tile)
 
void pollutionTerrainLandValueScan ()
 
int getPollutionValue (int loc)
 
int getCityCenterDistance (int x, int y)
 
void crimeScan ()
 
void smoothTerrain ()
 
void doSmooth1 ()
 
void doSmooth2 ()
 
void computeComRateMap ()
 
void updateFundEffects ()
 
SimSpritenewSprite (const std::string &name, int type, int x, int y)
 
void initSprite (SimSprite *sprite, int x, int y)
 
void destroyAllSprites ()
 
void destroySprite (SimSprite *sprite)
 
SimSpritegetSprite (int type)
 
SimSpritemakeSprite (int type, int x, int y)
 
short getChar (int x, int y)
 
short turnTo (int p, int d)
 
bool tryOther (int Tpoo, int Told, int Tnew)
 
bool spriteNotInBounds (SimSprite *sprite)
 
short getDir (int orgX, int orgY, int desX, int desY)
 
int getDistance (int x1, int y1, int x2, int y2)
 
bool checkSpriteCollision (SimSprite *s1, SimSprite *s2)
 
void moveObjects ()
 
void doTrainSprite (SimSprite *sprite)
 
void doCopterSprite (SimSprite *sprite)
 
void doAirplaneSprite (SimSprite *sprite)
 
void doShipSprite (SimSprite *sprite)
 
void doMonsterSprite (SimSprite *sprite)
 
void doTornadoSprite (SimSprite *sprite)
 
void doExplosionSprite (SimSprite *sprite)
 
void doBusSprite (SimSprite *sprite)
 
int canDriveOn (int x, int y)
 
void explodeSprite (SimSprite *sprite)
 
bool checkWet (int x)
 
void destroyMapTile (int ox, int oy)
 
void startFireInZone (int Xloc, int Yloc, int ch)
 
void startFire (int x, int y)
 
void generateTrain (int x, int y)
 
void generateBus (int x, int y)
 
void generateShip ()
 
void makeShipHere (int x, int y)
 
void makeMonster ()
 
void makeMonsterAt (int x, int y)
 
void generateCopter (const Position &pos)
 
void generatePlane (const Position &pos)
 
void makeTornado ()
 
void makeExplosion (int x, int y)
 
void makeExplosionAt (int x, int y)
 
void spend (int dollars)
 
void setFunds (int dollars)
 
Quad tickCount ()
 
Ptr newPtr (int size)
 
void freePtr (void *data)
 
void doStartScenario (int scenario)
 
void doStartGame ()
 
void initGame ()
 
void doEarthquake (int strength)
 
void invalidateMaps ()
 
void makeSound (const std::string &channel, const std::string &sound, int x=-1, int y=-1)
 
int getTile (int x, int y)
 
void setTile (int x, int y, int tile)
 
void * getMapBuffer ()
 
int getPowerGrid (int x, int y)
 
void setPowerGrid (int x, int y, int power)
 
void * getPowerGridMapBuffer ()
 
int getPopulationDensity (int x, int y)
 
void setPopulationDensity (int x, int y, int density)
 
void * getPopulationDensityMapBuffer ()
 
int getRateOfGrowth (int x, int y)
 
void setRateOfGrowth (int x, int y, int rate)
 
void * getRateOfGrowthMapBuffer ()
 
int getTrafficDensity (int x, int y)
 
void setTrafficDensity (int x, int y, int density)
 
void * getTrafficDensityMapBuffer ()
 
int getPollutionDensity (int x, int y)
 
void setPollutionDensity (int x, int y, int density)
 
void * getPollutionDensityMapBuffer ()
 
int getCrimeRate (int x, int y)
 
void setCrimeRate (int x, int y, int rate)
 
void * getCrimeRateMapBuffer ()
 
int getLandValue (int x, int y)
 
void setLandValue (int x, int y, int value)
 
void * getLandValueMapBuffer ()
 
int getFireCoverage (int x, int y)
 
void setFireCoverage (int x, int y, int coverage)
 
void * getFireCoverageMapBuffer ()
 
int getPoliceCoverage (int x, int y)
 
void setPoliceCoverage (int x, int y, int coverage)
 
void * getPoliceCoverageMapBuffer ()
 
ToolResult doTool (EditingTool tool, short tileX, short tileY)
 
void toolDown (EditingTool tool, short tileX, short tileY)
 
void toolDrag (EditingTool tool, short fromX, short fromY, short toX, short toY)
 
void didTool (std::string name, short x, short y)
 
short makeTrafficAt (int x, int y, ZoneType dest)
 
short makeTraffic (int x, int y, ZoneType dest)
 
void doUpdateHeads ()
 
void updateMaps ()
 
void updateGraphs ()
 
void updateEvaluation ()
 
void updateHeads ()
 
void updateFunds ()
 
void reallyUpdateFunds ()
 
void doTimeStuff ()
 
void updateDate ()
 
void showValves ()
 
void drawValve ()
 
void setDemand (float r, float c, float i)
 
void updateOptions ()
 
void updateUserInterface ()
 
void pause ()
 
void resume ()
 
void setSpeed (short speed)
 
void setPasses (int passes)
 
void setGameLevelFunds (GameLevel level)
 
void setGameLevel (GameLevel level)
 
void updateGameLevel ()
 
void setCityName (const std::string &name)
 
void setCleanCityName (const std::string &name)
 
void setYear (int year)
 
int currentYear ()
 
void doNewGame ()
 
void setEnableDisasters (bool value)
 
void setAutoBudget (bool value)
 
void setAutoBulldoze (bool value)
 
void setAutoGoto (bool value)
 
void setEnableSound (bool value)
 
void setDoAnimation (bool value)
 
void setDoMessages (bool value)
 
void setDoNotices (bool value)
 
void getDemands (float *resDemandResult, float *comDemandResult, float *indDemandResult)
 
void doPowerScan ()
 
bool testForConductive (const Position &pos, Direction2 testDir)
 
void pushPowerStack (const Position &pos)
 
Position pullPowerStack ()
 
MapValue randomFire ()
 
MapValue randomRubble ()
 
void simFrame ()
 
void simulate ()
 
void doSimInit ()
 
void doNilPower ()
 
void decTrafficMap ()
 
void decRateOfGrowthMap ()
 
void initSimMemory ()
 
void simLoadInit ()
 
void setCommonInits ()
 
void setValves ()
 
void clearCensus ()
 
void take10Census ()
 
void take120Census ()
 
void collectTax ()
 
void mapScan (int x1, int x2)
 
void doRail (const Position &pos)
 
void doRadTile (const Position &pos)
 
void doRoad (const Position &pos)
 
bool doBridge (const Position &pos, MapTile tile)
 
int getBoatDistance (const Position &pos)
 
void doFire (const Position &pos)
 
void fireZone (const Position &pos, MapValue ch)
 
void repairZone (const Position &pos, MapTile zCent, short zSize)
 
void doSpecialZone (const Position &pos, bool PwrOn)
 
void drawStadium (const Position &center, MapTile z)
 
void doAirport (const Position &pos)
 
void coalSmoke (const Position &pos)
 
void doMeltdown (const Position &pos)
 
ToolResult queryTool (short x, short y)
 
ToolResult bulldozerTool (short x, short y)
 
ToolResult bulldozerTool (short x, short y, ToolEffects *effects)
 
ToolResult roadTool (short x, short y, ToolEffects *effects)
 
ToolResult railroadTool (short x, short y, ToolEffects *effects)
 
ToolResult wireTool (short x, short y, ToolEffects *effects)
 
ToolResult parkTool (short x, short y, ToolEffects *effects)
 
ToolResult buildBuildingTool (short x, short y, const BuildingProperties *bprops, ToolEffects *effects)
 
ToolResult networkTool (short x, short y, ToolEffects *effects)
 
ToolResult waterTool (short x, short y, ToolEffects *effects)
 
ToolResult landTool (short x, short y, ToolEffects *effects)
 
ToolResult forestTool (short x, short y, ToolEffects *effects)
 
ToolResult putDownPark (short mapH, short mapV, ToolEffects *effects)
 
ToolResult putDownNetwork (short mapH, short mapV, ToolEffects *effects)
 
ToolResult putDownWater (short mapH, short mapV, ToolEffects *effects)
 
ToolResult putDownLand (short mapH, short mapV, ToolEffects *effects)
 
ToolResult putDownForest (short mapH, short mapV, ToolEffects *effects)
 
void doZoneStatus (short mapH, short mapV)
 
void doShowZoneStatus (int tileCategoryIndex, int populationDensityIndex, int landValueIndex, int crimeRateIndex, int pollutionIndex, int growthRateIndex, int x, int y)
 
void putBuilding (int leftX, int topY, int sizeX, int sizeY, MapTile baseTile, bool aniFlag, ToolEffects *effects)
 
ToolResult prepareBuildingSite (int leftX, int topY, int sizeX, int sizeY, ToolEffects *effects)
 
ToolResult buildBuilding (int mapH, int mapV, const BuildingProperties *bprops, ToolEffects *effects)
 
int getDensity (short catNo, short mapH, short mapV)
 
bool tally (short tileValue)
 
short checkSize (short tileValue)
 
void checkBorder (short xMap, short yMap, int sizeX, int sizeY, ToolEffects *effects)
 
void putRubble (int x, int y, int size, ToolEffects *effects)
 
short makeTraffic (const Position &startPos, ZoneType dest)
 
void addToTrafficDensityMap ()
 
void pushPos (const Position &pos)
 
Position pullPos ()
 
bool findPerimeterRoad (Position *pos)
 
bool findPerimeterTelecom (const Position &pos)
 
bool tryDrive (const Position &startPos, ZoneType destZone)
 
Direction2 tryGo (const Position &pos, Direction2 dirLast)
 
MapTile getTileFromMap (const Position &pos, Direction2 dir, MapTile defaultTile)
 
bool driveDone (const Position &pos, ZoneType destZone)
 
bool roadTest (MapValue tile)
 
std::string makeDollarDecimalStr (const std::string &numStr)
 
void doZone (const Position &pos)
 
void doHospitalChurch (const Position &pos)
 
void setSmoke (const Position &pos, bool zonePower)
 
void makeHospital (const Position &pos)
 
short getLandPollutionValue (const Position &pos)
 
void incRateOfGrowth (const Position &pos, int amount)
 
bool zonePlop (const Position &pos, int base)
 
short doFreePop (const Position &pos)
 
bool setZonePower (const Position &pos)
 
void buildHouse (const Position &pos, int value)
 
short evalLot (int x, int y)
 
void doResidential (const Position &pos, bool zonePower)
 
void doResIn (const Position &pos, int pop, int value)
 
void doResOut (const Position &pos, int pop, int value)
 
short getResZonePop (MapTile mapTile)
 
void resPlop (const Position &pos, int Den, int Value)
 
short evalRes (const Position &pos, int traf)
 
void doCommercial (const Position &pos, bool zonePower)
 
void doComIn (const Position &pos, int pop, int value)
 
void doComOut (const Position &pos, int pop, int value)
 
short getComZonePop (MapTile tile)
 
void comPlop (const Position &pos, int Den, int Value)
 
short evalCom (const Position &pos, int traf)
 
void doIndustrial (const Position &pos, bool zonePower)
 
void doIndIn (const Position &pos, int pop, int value)
 
void doIndOut (const Position &pos, int pop, int value)
 
short getIndZonePop (MapTile tile)
 
void indPlop (const Position &pos, int den, int value)
 
short evalInd (int traf)
 
static bool testBounds (int wx, int wy)
 

Detailed Description

Main simulator class

Todo:

Modify Micropolis::roadPercent, Micropolis::policePercent, and Micropolis::firePercent to hold real percentage from 0 to 100 instead of a floating point fraction

Micropolis::crimeMaxX and Micropolis::crimeMaxY seem unused.

Definition at line 924 of file micropolis.h.

Constructor & Destructor Documentation

◆ Micropolis()

Micropolis::Micropolis ( )

Simulator constructor.

Definition at line 88 of file micropolis.cpp.

References initMapArrays().

◆ ~Micropolis()

Micropolis::~Micropolis ( )

Simulator destructor.

Definition at line 111 of file micropolis.cpp.

Member Function Documentation

◆ addToTrafficDensityMap()

◆ animateTiles()

void Micropolis::animateTiles ( )

Definition at line 211 of file animate.cpp.

◆ buildBuilding()

ToolResult Micropolis::buildBuilding ( int  mapH,
int  mapV,
const BuildingProperties buildingProps,
ToolEffects effects 
)
private

Build a building.

Parameters
mapHHorizontal position of the 'center' tile in the world.
mapVVertical position of the 'center' tile in the world.
buildingPropsBuilding properties of the building being constructed.
effectsStorage of effects of putting down the building.
Returns
Tool result.
Todo:

Give putBuilding a BuildingProperties pointer instead.

Move cost into building properties?

Definition at line 711 of file tool.cpp.

References ToolEffects::addCost(), BuildingProperties::baseTile, BuildingProperties::buildingIsAnimated, checkBorder(), gCostOf, prepareBuildingSite(), putBuilding(), BuildingProperties::sizeX, BuildingProperties::sizeY, BuildingProperties::tool, and TOOLRESULT_OK.

Referenced by buildBuildingTool().

◆ buildBuildingTool()

ToolResult Micropolis::buildBuildingTool ( short  x,
short  y,
const BuildingProperties buildingProps,
ToolEffects effects 
)
private

Build a building.

Parameters
xHorizontal position of center tile of the new building.
yVertical position of center tile of the new building.
buildingPropsBuilding properties of the building being constructed.
effectsStorage of effects of putting down the building.
Returns
Tool result.

Definition at line 1225 of file tool.cpp.

References ToolEffects::addFrontendMessage(), buildBuilding(), BuildingProperties::toolName, and TOOLRESULT_OK.

Referenced by doTool().

◆ buildHouse()

void Micropolis::buildHouse ( const Position pos,
int  value 
)
private

Try to build a house at the zone at pos.

Parameters
posCenter tile of the zone.
valueValue to build (land value?)
Todo:
Have some form of looking around the center tile (like getFromMap())
Bug:
score is never 0 !!
Todo:
Move the code below to a better place. If we just updated hscore above, we could
Todo:
Is HOUSE the proper constant here?

Definition at line 459 of file zone.cpp.

References evalLot(), getRandom(), getRandom16(), map, Position::posX, Position::posY, and testBounds().

Referenced by doResIn().

◆ bulldozerTool() [1/2]

ToolResult Micropolis::bulldozerTool ( short  x,
short  y 
)
private

Definition at line 984 of file tool.cpp.

◆ bulldozerTool() [2/2]

ToolResult Micropolis::bulldozerTool ( short  x,
short  y,
ToolEffects effects 
)
private

Apply bulldozer tool.

Parameters
xX coordinate of the position of the query.
yY coordinate of the position of the query.
Returns
Tool result.
Todo:
Code is too complex/long.
Bug:

Tool does not return TOOLRESULT_NO_MONEY.

Sometimes we can delete parts of a residential zone, but not always. Decide what rule we should have, and fix accordingly.

Note
Auto-bulldoze functionality is in Micropolis::prepareBuildingSite()

Definition at line 1010 of file tool.cpp.

References ToolEffects::addCost(), ToolEffects::addFrontendMessage(), checkBigZone(), checkSize(), CONNECT_TILE_BULLDOZE, connectTile(), didTool(), gCostOf, ToolEffects::getMapTile(), ToolEffects::getMapValue(), LOMASK, NOT_REACHED, putRubble(), testBounds(), TOOLRESULT_FAILED, TOOLRESULT_OK, and ZONEBIT.

◆ canDriveOn()

int Micropolis::canDriveOn ( int  x,
int  y 
)

Can one drive at the specified tile?

Parameters
xX coordinate at map.
yY coordinate at map.
Returns
0 if not, 1 if you can, -1 otherwise

Definition at line 1626 of file sprite.cpp.

References DIRT, LOMASK, map, tally(), and testBounds().

Referenced by doBusSprite().

◆ changeCensus()

void Micropolis::changeCensus ( )

Set flag that graph data has been changed and graphs should be updated.

Todo:
Rename function.

Definition at line 122 of file graph.cpp.

References censusChanged.

Referenced by loadFile(), and take10Census().

◆ changeEval()

void Micropolis::changeEval ( )

Request that new score is displayed to the user.

Definition at line 507 of file evaluate.cpp.

References evalChanged.

Referenced by cityEvaluation(), and simInit().

◆ checkBorder()

void Micropolis::checkBorder ( short  xMap,
short  yMap,
int  sizeX,
int  sizeY,
ToolEffects effects 
)
private

Check and connect a new zone around the border.

Parameters
xMapX coordinate of top-left tile.
yMapY coordinate of top-left tile.
sizeXHorizontal size of the new zone.
sizeYVertical size of the new zone.
effectsStorage of the effects.

Definition at line 575 of file tool.cpp.

References CONNECT_TILE_FIX, and connectTile().

Referenced by buildBuilding().

◆ checkGrowth()

void Micropolis::checkGrowth ( )

Detect a change in city class, and produce a message if the player has reached the next class.

Todo:
This code is very closely related to Micropolis::doPopNum(). Maybe merge both in some way? (This function gets called much more often however then doPopNum(). Also, at the first call, the difference between thisCityPop and cityPop is huge.)

Definition at line 250 of file message.cpp.

References categoryLast, CC_CAPITAL, CC_CITY, CC_MEGALOPOLIS, CC_METROPOLIS, CC_TOWN, CC_VILLAGE, cityPopLast, cityTime, getCityClass(), getPopulation(), MESSAGE_REACHED_CAPITAL, MESSAGE_REACHED_CITY, MESSAGE_REACHED_MEGALOPOLIS, MESSAGE_REACHED_METROPOLIS, MESSAGE_REACHED_TOWN, NOT_REACHED, NOWHERE, and sendMessage().

Referenced by sendMessages().

◆ checkSize()

short Micropolis::checkSize ( short  tileValue)
private

Return the size of the zone that the tile belongs to.

Parameters
tileValueValue of the tile in the zone.
Returns
Size of the zone if it is a known tile value, else 0.

Definition at line 548 of file tool.cpp.

References COALBASE, LASTPORT, LASTPOWERPLANT, LASTZONE, PORTBASE, and STADIUMBASE.

Referenced by bulldozerTool().

◆ checkSpriteCollision()

bool Micropolis::checkSpriteCollision ( SimSprite s1,
SimSprite s2 
)

Check whether two sprites collide with each other.

Parameters
s1First sprite.
s2Second sprite.
Returns
Sprites are colliding.

Definition at line 537 of file sprite.cpp.

References SimSprite::frame, getDistance(), SimSprite::x, SimSprite::xHot, SimSprite::y, and SimSprite::yHot.

Referenced by doAirplaneSprite(), doBusSprite(), doMonsterSprite(), and doTornadoSprite().

◆ checkWet()

bool Micropolis::checkWet ( int  x)

Definition at line 1698 of file sprite.cpp.

◆ cityEvaluation()

void Micropolis::cityEvaluation ( )
Todo:
: These strings should not be hard coded into the core simulator. The scripting language should look them up in translation files.

Evaluate city

Todo:
Handle lack of voting explicitly

Definition at line 110 of file evaluate.cpp.

References changeEval(), cityYes, doPopNum(), doProblems(), doVotes(), evalInit(), getAssessedValue(), getScore(), and totalPop.

◆ clearCensus()

void Micropolis::clearCensus ( )
private

Definition at line 692 of file simulate.cpp.

◆ clearMap()

void Micropolis::clearMap ( )

Clear the whole world to DIRT tiles

Definition at line 175 of file generate.cpp.

References DIRT, map, WORLD_H, and WORLD_W.

Referenced by generateMap(), and simInit().

◆ clearUnnatural()

void Micropolis::clearUnnatural ( )

Clear everything from all land

Definition at line 188 of file generate.cpp.

References DIRT, map, WORLD_H, and WORLD_W.

◆ coalSmoke()

void Micropolis::coalSmoke ( const Position pos)
private

Draw coal smoke tiles around given position (of a coal power plant).

Parameters
posCenter tile of the coal power plant

Definition at line 1668 of file simulate.cpp.

References ANIMBIT, BURNBIT, COALSMOKE1, COALSMOKE2, COALSMOKE3, COALSMOKE4, CONDBIT, map, Position::posX, Position::posY, and PWRBIT.

Referenced by doSpecialZone().

◆ collectTax()

void Micropolis::collectTax ( )
private

Collect taxes

Bug:

Function seems to be doing different things depending on Micropolis::totalPop value. With an non-empty city it does fund calculations. For an empty city, it immediately sets effects of funding, which seems inconsistent at least, and may be wrong

If Micropolis::taxFlag is set, no variable is touched which seems non-robust at least

Todo:
Break out so the user interface can configure this.
Todo:
Apparently taxFlag is never set to true in MicropolisEngine or the TCL code, so this always runs.
Todo:
Todo:
Check old Mac code to see if it's ever set, and why.
Todo:
Do something with z? Check old Mac code to see if it's used.

Definition at line 856 of file simulate.cpp.

References cityTax, doBudget(), fireEffect, fireFund, fireStationPop, gameLevel, landValueAverage, LENGTH_OF, LEVEL_COUNT, MAX_FIRE_STATION_EFFECT, MAX_POLICE_STATION_EFFECT, MAX_ROAD_EFFECT, policeEffect, policeFund, policeStationPop, railTotal, roadEffect, roadFund, roadTotal, taxFlag, taxFund, and totalPop.

◆ comPlop()

void Micropolis::comPlop ( const Position pos,
int  Den,
int  Value 
)
private

Build a commercial zone.

Parameters
posPosition of the commercial zone.
DenDensity
ValueLand value corrected for pollution.

Definition at line 883 of file zone.cpp.

References zonePlop().

Referenced by doComIn(), and doComOut().

◆ computeComRateMap()

void Micropolis::computeComRateMap ( )

Compute distance to city center for the entire map.

See also
comRateMap

Definition at line 585 of file scan.cpp.

References comRateMap, getCityCenterDistance(), Map< DATA, BLKSIZE >::MAP_H, Map< DATA, BLKSIZE >::MAP_W, and Map< DATA, BLKSIZE >::set().

Referenced by populationDensityScan().

◆ connectTile()

ToolResult Micropolis::connectTile ( short  x,
short  y,
ConnectTileCommand  cmd,
ToolEffects effects 
)
private

Perform the command, and fix wire/road/rail/zone connections around it. Store modification in the effects object.

Parameters
xX world position to perform the command.
yY world position to perform the command.
cmdCommand to perform.
effectsModification collecting object.
Returns
Tool result.

Definition at line 133 of file connect.cpp.

References ToolEffects::addCost(), autoBulldoze, BULLBIT, CONNECT_TILE_BULLDOZE, CONNECT_TILE_FIX, CONNECT_TILE_RAILROAD, CONNECT_TILE_ROAD, CONNECT_TILE_WIRE, DIRT, fixZone(), ToolEffects::getMapValue(), HBRIDGE, layDoze(), layRail(), layRoad(), layWire(), LOMASK, neutralizeRoad(), NOT_REACHED, ToolEffects::setMapValue(), testBounds(), TOOLRESULT_FAILED, and TOOLRESULT_OK.

Referenced by bulldozerTool(), checkBorder(), railroadTool(), roadTool(), and wireTool().

◆ countProblems()

int Micropolis::countProblems ( )

Return number of problem in the city.

Returns
Number of problems.

Definition at line 528 of file evaluate.cpp.

References CVP_NUMPROBLEMS, CVP_PROBLEM_COMPLAINTS, and problemOrder.

◆ crimeScan()

◆ currentYear()

int Micropolis::currentYear ( )

Get the current year.

Returns
The current game year.

Definition at line 297 of file utilities.cpp.

References cityTime, and startingYear.

◆ decRateOfGrowthMap()

void Micropolis::decRateOfGrowthMap ( )
private

Decrease rate of grow.

Todo:
Limiting rate should not be done here, but when we add a new value to it.

Definition at line 371 of file simulate.cpp.

References clamp(), Map< DATA, BLKSIZE >::get(), Map< DATA, BLKSIZE >::MAP_H, Map< DATA, BLKSIZE >::MAP_W, rateOfGrowthMap, and Map< DATA, BLKSIZE >::set().

◆ decTrafficMap()

void Micropolis::decTrafficMap ( )
private

◆ destroy()

void Micropolis::destroy ( )
private

Definition at line 680 of file micropolis.cpp.

◆ destroyAllSprites()

void Micropolis::destroyAllSprites ( )

Destroy all sprites by de-activating them all (setting their SimSprite::frame to 0).

Definition at line 298 of file sprite.cpp.

References SimSprite::frame, SimSprite::next, and spriteList.

Referenced by initWillStuff().

◆ destroyMapArrays()

◆ destroyMapTile()

void Micropolis::destroyMapTile ( int  ox,
int  oy 
)

Destroy a map tile.

Parameters
oxX coordinate in pixels.
oyY coordinate in pixels.

Definition at line 1714 of file sprite.cpp.

References ANIMBIT, BULLBIT, BURNBIT, doAnimation, LOMASK, makeExplosionAt(), map, startFireInZone(), testBounds(), and ZONEBIT.

Referenced by doMonsterSprite(), doShipSprite(), and doTornadoSprite().

◆ destroySprite()

void Micropolis::destroySprite ( SimSprite sprite)

Destroy the sprite by taking it out of the active list.

Parameters
spriteSprite to destroy.
Todo:
Break the connection between any views that are following this sprite.

Definition at line 313 of file sprite.cpp.

References freeSprites, SimSprite::next, spriteList, and SimSprite::type.

Referenced by moveObjects().

◆ didLoadCity()

void Micropolis::didLoadCity ( const std::string &  filename)

Report to the frontend that the game was successfully loaded.

Definition at line 568 of file fileio.cpp.

References callback.

Referenced by loadCity().

◆ didLoadScenario()

void Micropolis::didLoadScenario ( int  s,
const std::string  name,
const std::string  fname 
)

Report to the front-end that the scenario was loaded.

Definition at line 522 of file fileio.cpp.

References callback.

Referenced by loadScenario().

◆ didntLoadCity()

void Micropolis::didntLoadCity ( const std::string &  filename)

Report to the frontend that the game failed to load.

Parameters
msgFile that attempted to load

Definition at line 578 of file fileio.cpp.

References callback.

Referenced by loadCity().

◆ didntSaveCity()

void Micropolis::didntSaveCity ( const std::string &  filename)

Report to the frontend that the city could not be saved.

Parameters
filenameName of the file used

Definition at line 633 of file fileio.cpp.

References callback.

Referenced by saveCity(), and saveCityAs().

◆ didSaveCity()

void Micropolis::didSaveCity ( const std::string &  filename)

Report to the frontend that the city was saved successfully.

Parameters
filenameName of the file used

Definition at line 623 of file fileio.cpp.

References callback.

Referenced by saveCity(), and saveCityAs().

◆ didTool()

void Micropolis::didTool ( std::string  name,
short  x,
short  y 
)

Report to the front-end that a tool was used.

Parameters
nameName of the tool.
xX coordinate of where the tool was applied.
yY coordinate of where the tool was applied.

Definition at line 947 of file tool.cpp.

References callback.

Referenced by bulldozerTool(), queryTool(), and FrontendMessageDidTool::sendMessage().

◆ doAirplaneSprite()

void Micropolis::doAirplaneSprite ( SimSprite sprite)

Move airplane sprite.

Parameters
spriteAirplane sprite.
Todo:

Remove local magic constants and document the code.

absDist gets updated by Micropolis::getDir(), which is not always called before reading it (or worse, we just turned towards the old destination).

Definition at line 800 of file sprite.cpp.

References checkSpriteCollision(), SimSprite::destX, SimSprite::destY, enableDisasters, explodeSprite(), SimSprite::frame, getDir(), getRandom(), SimSprite::next, SPRITE_AIRPLANE, SPRITE_HELICOPTER, spriteList, spriteNotInBounds(), turnTo(), SimSprite::type, WORLD_H, WORLD_W, SimSprite::x, and SimSprite::y.

Referenced by moveObjects().

◆ doAirport()

void Micropolis::doAirport ( const Position pos)
private

Generate a airplane or helicopter every now and then.

Parameters
posPosition of the airport to start from.

Definition at line 1651 of file simulate.cpp.

References generateCopter(), generatePlane(), and getRandom().

Referenced by doSpecialZone().

◆ doAutoGoto()

void Micropolis::doAutoGoto ( short  x,
short  y,
const std::string &  message 
)

Tell the front-end that it should perform an auto-goto

Parameters
xX position at the map
yY position at the map
messageMessage

Definition at line 457 of file message.cpp.

References callback.

◆ doBridge()

bool Micropolis::doBridge ( const Position pos,
MapTile  tile 
)
private

Handle a bridge.

Parameters
posPosition of the bridge.
tileTile value of the bridge.
Returns
???
Todo:

What does this function return?

Discover the structure of all the magic constants.

Definition at line 1145 of file simulate.cpp.

References BULLBIT, getBoatDistance(), getRandom16(), HBRIDGE, LOMASK, map, Position::posX, Position::posY, testBounds(), VBRIDGE, and WORLD_W.

Referenced by doRoad().

◆ doBRiver()

Direction2 Micropolis::doBRiver ( const Position riverPos,
Direction2  riverDir,
Direction2  terrainDir 
)
private

Make a big river.

Parameters
posStart position of making a river.
riverDirGlobal direction of the river.
terrainDirLocal direction of the terrain.
Returns
Last used local terrain direction.

Definition at line 512 of file generate.cpp.

References getRandom(), Position::move(), plopBRiver(), Position::posX, Position::posY, rotate45(), terrainCurveLevel, and testBounds().

Referenced by doRivers().

◆ doBudget()

void Micropolis::doBudget ( )

Game decided to show the budget window

Definition at line 97 of file budget.cpp.

References doBudgetNow().

Referenced by collectTax().

◆ doBudgetFromMenu()

void Micropolis::doBudgetFromMenu ( )

User queried the budget window

Definition at line 104 of file budget.cpp.

References doBudgetNow().

◆ doBudgetNow()

void Micropolis::doBudgetNow ( bool  fromMenu)

Handle budget window.

Parameters
fromMenuUser requested the budget window.
Todo:
Simplify this code. Instead of this nested mess, make a sequence of assigning funds to road, fire, and police.
Todo:
Why are we not subtracting from yumDuckets what we spend, like the code below is doing?

Definition at line 116 of file budget.cpp.

References autoBudget, fireFund, firePercent, fireSpend, fireValue, MESSAGE_NO_MONEY, mustDrawBudget, mustUpdateOptions, NOWHERE, policeFund, policePercent, policeSpend, policeValue, roadFund, roadPercent, roadSpend, roadValue, sendMessage(), setAutoBudget(), spend(), taxFund, and totalFunds.

Referenced by doBudget(), and doBudgetFromMenu().

◆ doBusSprite()

void Micropolis::doBusSprite ( SimSprite sprite)

◆ doComIn()

void Micropolis::doComIn ( const Position pos,
int  pop,
int  value 
)
private

Handle immigration of commercial zone.

Parameters
posPosition of the commercial zone.
popPopulation ?
valueLand value corrected for pollution.

Definition at line 823 of file zone.cpp.

References comPlop(), incRateOfGrowth(), landValueMap, Position::posX, Position::posY, and Map< DATA, BLKSIZE >::worldGet().

Referenced by doCommercial().

◆ doCommercial()

void Micropolis::doCommercial ( const Position pos,
bool  zonePower 
)
private

Handle commercial zone.

Parameters
posPosition of the commercial zone.
zonePwrFlgDoes the zone have power?
Todo:
Make zonePwrFlg a boolean.

Definition at line 765 of file zone.cpp.

References comPop, comZonePop, doComIn(), doComOut(), evalCom(), getComZonePop(), getLandPollutionValue(), getRandom(), getRandom16(), getRandom16Signed(), LOMASK, makeTraffic(), map, Position::posX, Position::posY, and ZT_INDUSTRIAL.

Referenced by doZone().

◆ doComOut()

void Micropolis::doComOut ( const Position pos,
int  pop,
int  value 
)
private

Handle emigration of commercial zone.

Parameters
posPosition of the commercial zone.
popPopulation ?
valueLand value corrected for pollution.

Definition at line 846 of file zone.cpp.

References comPlop(), incRateOfGrowth(), and zonePlop().

Referenced by doCommercial().

◆ doCopterSprite()

void Micropolis::doCopterSprite ( SimSprite sprite)

Move helicopter sprite.

Parameters
spriteHelicopter sprite.
Todo:
Remove local magic constants and document the code.

Definition at line 695 of file sprite.cpp.

References SimSprite::destX, SimSprite::destY, SimSprite::frame, getDir(), getRandom16(), getSprite(), makeSound(), MESSAGE_HEAVY_TRAFFIC, sendMessage(), SPRITE_MONSTER, SPRITE_TORNADO, trafficDensityMap, turnTo(), WORLD_H, Map< DATA, BLKSIZE >::worldGet(), SimSprite::x, and SimSprite::y.

Referenced by moveObjects().

◆ doDisasters()

void Micropolis::doDisasters ( )
private

Let disasters happen.

Todo:
Decide what to do with the 'nothing happens' disaster (since the chance that a disaster happens is expressed in the DisChance table).

Definition at line 92 of file disasters.cpp.

References disasterEvent, enableDisasters, floodCount, gameLevel, getRandom(), LENGTH_OF, LEVEL_COUNT, LEVEL_EASY, LEVEL_LAST, makeEarthquake(), makeFlood(), makeMonster(), makeTornado(), pollutionAverage, SC_NONE, scenarioDisaster(), and setFire().

◆ doEarthquake()

void Micropolis::doEarthquake ( int  strength)

Tell the front-end to show an earthquake to the user (shaking the map for some time).

Definition at line 1114 of file micropolis.cpp.

References callback, and makeSound().

Referenced by makeEarthquake().

◆ doExplosionSprite()

void Micropolis::doExplosionSprite ( SimSprite sprite)

'Move' fire sprite.

Parameters
spriteFire sprite.

Definition at line 1306 of file sprite.cpp.

References SimSprite::frame, makeSound(), MESSAGE_EXPLOSION_REPORTED, sendMessage(), startFire(), SimSprite::x, and SimSprite::y.

Referenced by moveObjects().

◆ doFire()

void Micropolis::doFire ( const Position pos)
private

Handle tile being on fire.

Parameters
posPosition of the fire.
Todo:

Needs a notion of iterative neighbour tiles computing.

Use a getFromMap()-like function here.

Extract constants of fire station effectiveness from here.

Definition at line 1300 of file simulate.cpp.

References BURNBIT, fireStationEffectMap, fireZone(), getRandom(), getRandom16(), IZB, LOMASK, makeExplosionAt(), map, Position::posX, Position::posY, randomFire(), randomRubble(), testBounds(), Map< DATA, BLKSIZE >::worldGet(), and ZONEBIT.

◆ doFlood()

void Micropolis::doFlood ( const Position pos)
private

Flood around the given position.

Parameters
posPosition around which to flood further.
Todo:
Use some form of rotating around a position.

Definition at line 385 of file disasters.cpp.

References BURNBIT, DIRT, fireZone(), floodCount, getRandom(), getRandom16(), LOMASK, map, Position::posX, Position::posY, testBounds(), and ZONEBIT.

◆ doFreePop()

short Micropolis::doFreePop ( const Position pos)
private

Count the number of single tile houses in a residential zone.

Parameters
posPosition of the residential zone.
Returns
Number of single tile houses.

Definition at line 409 of file zone.cpp.

References LOMASK, map, Position::posX, Position::posY, and WORLD_H.

Referenced by doResidential(), and getPopulationDensity().

◆ doHospitalChurch()

void Micropolis::doHospitalChurch ( const Position pos)
private

Handle repairing or removing of hospitals and churches.

Parameters
posPosition of the hospital or church.

Definition at line 147 of file zone.cpp.

References callback, churchPop, cityTime, getRandom(), hospitalPop, LOMASK, map, needChurch, needHospital, Position::posX, Position::posY, repairZone(), and zonePlop().

Referenced by doZone().

◆ doIndIn()

void Micropolis::doIndIn ( const Position pos,
int  pop,
int  value 
)
private

Handle immigration of industrial zone.

Parameters
posPosition of the center tile of the industrial tile.
posPopulation value of the industrial zone.
valueRandom land value (it seems).

Definition at line 967 of file zone.cpp.

References incRateOfGrowth(), and indPlop().

Referenced by doIndustrial().

◆ doIndOut()

void Micropolis::doIndOut ( const Position pos,
int  pop,
int  value 
)
private

Handle industrial zone emigration.

Parameters
posPosition of the center tile of the industrial tile.
posPopulation value of the industrial zone.
valueRandom land value (it seems).

Definition at line 981 of file zone.cpp.

References incRateOfGrowth(), INDBASE, indPlop(), and zonePlop().

Referenced by doIndustrial().

◆ doIndustrial()

void Micropolis::doIndustrial ( const Position pos,
bool  zonePower 
)
private

Handle industrial zone.

Parameters
posPosition of the industrial zone.
zonePwrFlgDoes the zone have power?
Todo:
Make zonePwrFlg a boolean.

Definition at line 917 of file zone.cpp.

References doIndIn(), doIndOut(), evalInd(), getIndZonePop(), getRandom(), getRandom16(), getRandom16Signed(), indPop, indZonePop, LOMASK, makeTraffic(), map, Position::posX, Position::posY, setSmoke(), and ZT_RESIDENTIAL.

Referenced by doZone().

◆ doLoseGame()

void Micropolis::doLoseGame ( )

Tell the front-end that the player has lost the game

Definition at line 464 of file message.cpp.

References callback.

Referenced by doScenarioScore().

◆ doMakeSound()

void Micropolis::doMakeSound ( int  mesgNum,
int  x,
int  y 
)

Make a sound for message mesgNum if appropriate.

Parameters
mesgNumMessage number displayed.
xHorizontal coordinate in the city of the sound.
yVertical coordinate in the city of the sound.

Definition at line 402 of file message.cpp.

References getRandom(), makeSound(), MESSAGE_EARTHQUAKE, MESSAGE_FIRE_REPORTED, MESSAGE_FIREBOMBING, MESSAGE_HELICOPTER_CRASHED, MESSAGE_HIGH_CRIME, MESSAGE_MONSTER_SIGHTED, MESSAGE_NUCLEAR_MELTDOWN, MESSAGE_PLANE_CRASHED, MESSAGE_RIOTS_REPORTED, MESSAGE_SHIP_CRASHED, MESSAGE_TORNADO_SIGHTED, MESSAGE_TRAFFIC_JAMS, and MESSAGE_TRAIN_CRASHED.

◆ doMeltdown()

void Micropolis::doMeltdown ( const Position pos)
private

Perform a nuclear melt-down disaster

Parameters
posPosition of the nuclear power plant that melts.

Definition at line 1688 of file simulate.cpp.

References BURNBIT, DIRT, getRandom(), makeExplosion(), map, MESSAGE_NUCLEAR_MELTDOWN, Position::posX, Position::posY, RADTILE, randomFire(), sendMessage(), testBounds(), and ZONEBIT.

Referenced by doSpecialZone(), and makeMeltdown().

◆ doMonsterSprite()

void Micropolis::doMonsterSprite ( SimSprite sprite)

Move monster sprite.

There are 16 monster sprite frames:

Frame 0: NorthEast Left Foot Frame 1: NorthEast Both Feet Frame 2: NorthEast Right Foot Frame 3: SouthEast Right Foot Frame 4: SouthEast Both Feet Frame 5: SouthEast Left Foot Frame 6: SouthWest Right Foot Frame 7: SouthWest Both Feet Frame 8: SouthWest Left Foot Frame 9: NorthWest Left Foot Frame 10: NorthWest Both Feet Frame 11: NorthWest Right Foot Frame 12: North Left Foot Frame 13: East Left Foot Frame 14: South Right Foot Frame 15: West Right Foot

Parameters
spriteMonster sprite.
Todo:
Remove local magic constants and document the code.

Definition at line 1007 of file sprite.cpp.

References checkSpriteCollision(), destroyMapTile(), SimSprite::destX, SimSprite::destY, explodeSprite(), SimSprite::frame, getChar(), getDir(), getRandom(), getRandom16(), makeSound(), SimSprite::next, SPRITE_AIRPLANE, SPRITE_HELICOPTER, SPRITE_SHIP, SPRITE_TRAIN, spriteList, SimSprite::type, SimSprite::x, SimSprite::xHot, SimSprite::y, and SimSprite::yHot.

Referenced by moveObjects().

◆ doNewGame()

void Micropolis::doNewGame ( )

Notify the user interface to start a new game.

Definition at line 306 of file utilities.cpp.

References callback.

Referenced by initWillStuff().

◆ doNilPower()

void Micropolis::doNilPower ( )
private

Copy bits from powerGridMap to the PWRBIT in the map for all zones in the world.

Definition at line 323 of file simulate.cpp.

References map, setZonePower(), WORLD_H, WORLD_W, and ZONEBIT.

Referenced by simLoadInit().

◆ doPopNum()

void Micropolis::doPopNum ( )
private

Compute city population and city classification.

See also
cityPop cityClass.

Definition at line 182 of file evaluate.cpp.

References cityClass, cityPop, cityPopDelta, getCityClass(), and getPopulation().

Referenced by cityEvaluation().

◆ doPowerScan()

void Micropolis::doPowerScan ( )
private

◆ doProblems()

void Micropolis::doProblems ( short  problemTable[PROBNUM])
private

Evaluate problems of the city, take votes, and decide which are the most important ones.

Parameters
problemTableStorage of how bad each problem is.
Postcondition
problemTable contains severity of each problem, problemVotes contains votes of each problem, problemOrder contains (in decreasing order) the worst problems.

Definition at line 241 of file evaluate.cpp.

References cityTax, crimeAverage, CVP_CRIME, CVP_FIRE, CVP_HOUSING, CVP_NUMPROBLEMS, CVP_POLLUTION, CVP_PROBLEM_COMPLAINTS, CVP_TAXES, CVP_TRAFFIC, CVP_UNEMPLOYMENT, getFireSeverity(), getTrafficAverage(), getUnemployment(), landValueAverage, pollutionAverage, problemOrder, problemVotes, and voteProblems().

Referenced by cityEvaluation().

◆ doRadTile()

void Micropolis::doRadTile ( const Position pos)
private

Handle decay of radio-active tile

Parameters
posPosition of the radio-active tile.

Definition at line 1060 of file simulate.cpp.

References DIRT, getRandom16(), map, Position::posX, and Position::posY.

◆ doRail()

void Micropolis::doRail ( const Position pos)
private

Handle rail track. Generate a train, and handle road deteriorating effects.

Parameters
posPosition of the rail.

Definition at line 1025 of file simulate.cpp.

References CONDBIT, generateTrain(), getRandom16(), LOMASK, map, MAX_ROAD_EFFECT, Position::posX, Position::posY, railTotal, randomRubble(), and roadEffect.

◆ doResidential()

void Micropolis::doResidential ( const Position pos,
bool  zonePower 
)
private

Handle residential zone.

Parameters
posCenter tile of the residential zone.
zonePwrFlgDoes the zone have power?

Definition at line 548 of file zone.cpp.

References doFreePop(), doResIn(), doResOut(), evalRes(), getLandPollutionValue(), getRandom(), getRandom16(), getRandom16Signed(), getResZonePop(), LOMASK, makeHospital(), makeTraffic(), map, Position::posX, Position::posY, resPop, resZonePop, and ZT_COMMERCIAL.

Referenced by doZone().

◆ doResIn()

void Micropolis::doResIn ( const Position pos,
int  pop,
int  value 
)
private

Perform residential immigration into the current residential tile.

Parameters
posPosition of the tile.
popPopulation ?
valueLand value corrected for pollution.

Definition at line 614 of file zone.cpp.

References buildHouse(), incRateOfGrowth(), LOMASK, map, pollutionDensityMap, populationDensityMap, Position::posX, Position::posY, resPlop(), and Map< DATA, BLKSIZE >::worldGet().

Referenced by doResidential().

◆ doResOut()

void Micropolis::doResOut ( const Position pos,
int  pop,
int  value 
)
private

Perform residential emigration from the current residential tile.

Parameters
posPosition of the tile.
popPopulation ?
valueLand value corrected for pollution.

Definition at line 655 of file zone.cpp.

References getRandom(), incRateOfGrowth(), LOMASK, map, Position::posX, Position::posY, resPlop(), testBounds(), and ZONEBIT.

Referenced by doResidential().

◆ doRivers()

void Micropolis::doRivers ( const Position terrainPos)
private

Construct rivers.

Parameters
terrainPosCoordinate to start making a river.

Definition at line 489 of file generate.cpp.

References DIR2_NORTH, doBRiver(), doSRiver(), getRandom(), and rotate180().

Referenced by generateMap().

◆ doRoad()

void Micropolis::doRoad ( const Position pos)
private

◆ doSaveCityAs()

void Micropolis::doSaveCityAs ( const std::string &  filename)

Report to the frontend that the city is being saved.

Parameters
filenameName of the file used

Definition at line 613 of file fileio.cpp.

References callback.

Referenced by saveCity().

◆ doScenarioScore()

void Micropolis::doScenarioScore ( Scenario  type)

Compute score for each scenario

Parameters
typeScenario used
Note
Parameter type may not be SC_NONE

Definition at line 313 of file message.cpp.

References CC_METROPOLIS, cityClass, cityScore, crimeAverage, doLoseGame(), MESSAGE_SCENARIO_LOST, MESSAGE_SCENARIO_WON, NOT_REACHED, NOWHERE, SC_BERN, SC_BOSTON, SC_DETROIT, SC_DULLSVILLE, SC_HAMBURG, SC_RIO, SC_SAN_FRANCISCO, SC_TOKYO, sendMessage(), and trafficAverage.

Referenced by sendMessages().

◆ doScoreCard()

void Micropolis::doScoreCard ( )

Push new score to the user

Definition at line 479 of file evaluate.cpp.

References callback.

Referenced by scoreDoer().

◆ doShipSprite()

void Micropolis::doShipSprite ( SimSprite sprite)

Move ship sprite.

Parameters
spriteShip sprite.
Todo:
Remove local magic constants and document the code.

Definition at line 867 of file sprite.cpp.

References destroyMapTile(), explodeSprite(), SimSprite::frame, getRandom(), getRandom16(), LOMASK, makeSound(), map, SC_SAN_FRANCISCO, scenario, spriteNotInBounds(), testBounds(), tryOther(), turnTo(), SimSprite::x, and SimSprite::y.

Referenced by moveObjects().

◆ doShowZoneStatus()

void Micropolis::doShowZoneStatus ( int  tileCategoryIndex,
int  populationDensityIndex,
int  landValueIndex,
int  crimeRateIndex,
int  pollutionIndex,
int  growthRateIndex,
int  x,
int  y 
)
private

Tell front-end to report on status of a tile.

Parameters
tileCategoryIndexCategory of the tile text index.
populationDensityIndexPopulation density text index.
landValueIndexLand value text index.
crimeRateIndexCrime rate text index.
pollutionIndexPollution text index.
growthRateIndexGrow rate text index.
xX coordinate of the tile.
yY coordinate of the tile.

Definition at line 903 of file tool.cpp.

References callback.

Referenced by doZoneStatus().

◆ doSimInit()

void Micropolis::doSimInit ( )
private

Initialize simulation.

Todo:
Create constants for initSimLoad.

Definition at line 288 of file simulate.cpp.

References censusChanged, crimeScan(), doInitialEval, doPowerScan(), fireAnalysis(), newMap, populationDensityScan(), setValves(), simLoadInit(), totalPop, and WORLD_W.

Referenced by generateSomeCity(), init(), loadCity(), loadFile(), and loadScenario().

◆ doSmooth1()

void Micropolis::doSmooth1 ( )

Definition at line 568 of file scan.cpp.

◆ doSmooth2()

void Micropolis::doSmooth2 ( )

Definition at line 575 of file scan.cpp.

◆ doSpecialZone()

◆ doSRiver()

Direction2 Micropolis::doSRiver ( const Position riverPos,
Direction2  riverDir,
Direction2  terrainDir 
)
private

Make a small river.

Parameters
posStart position of making a river.
riverDirGlobal direction of the river.
terrainDirLocal direction of the terrain.
Returns
Last used local terrain direction.

Definition at line 552 of file generate.cpp.

References getRandom(), Position::move(), plopSRiver(), Position::posX, Position::posY, rotate45(), terrainCurveLevel, and testBounds().

Referenced by doRivers().

◆ doStartGame()

void Micropolis::doStartGame ( )

Tell the front-end a game is started.

Definition at line 1104 of file micropolis.cpp.

References callback.

Referenced by simLoadInit().

◆ doStartScenario()

void Micropolis::doStartScenario ( int  scenario)

Tell the front-end a scenario is started.

Parameters
scenarioThe scenario being started.
See also
Scenario.

Definition at line 1095 of file micropolis.cpp.

References callback, and scenario.

Referenced by simLoadInit().

◆ doTimeStuff()

void Micropolis::doTimeStuff ( )

Definition at line 150 of file update.cpp.

◆ doTool()

ToolResult Micropolis::doTool ( EditingTool  tool,
short  tileX,
short  tileY 
)

◆ doTornadoSprite()

void Micropolis::doTornadoSprite ( SimSprite sprite)

Move tornado.

Parameters
spriteTornado sprite to move.
Todo:
Remove local magic constants and document the code.

Definition at line 1239 of file sprite.cpp.

References checkSpriteCollision(), destroyMapTile(), explodeSprite(), SimSprite::frame, getRandom(), SimSprite::next, SPRITE_AIRPLANE, SPRITE_HELICOPTER, SPRITE_SHIP, SPRITE_TRAIN, spriteList, spriteNotInBounds(), SimSprite::type, SimSprite::x, and SimSprite::y.

Referenced by moveObjects().

◆ doTrainSprite()

void Micropolis::doTrainSprite ( SimSprite sprite)

Move train sprite.

Parameters
spriteTrain sprite.
Todo:
Remove local magic constants and document the code.

Definition at line 623 of file sprite.cpp.

References SimSprite::frame, getChar(), getRandom16(), RAILHPOWERV, RAILVPOWERH, SimSprite::x, and SimSprite::y.

Referenced by moveObjects().

◆ doTrees()

void Micropolis::doTrees ( )
private

Splash trees around the world.

Definition at line 340 of file generate.cpp.

References getRandom(), terrainTreeLevel, treeSplash(), WORLD_H, and WORLD_W.

Referenced by generateMap(), and makeIsland().

◆ doUpdateHeads()

void Micropolis::doUpdateHeads ( )

Definition at line 88 of file update.cpp.

◆ doVotes()

void Micropolis::doVotes ( )
private

Vote whether the mayor is doing a good job

Postcondition
cityYes contains the number of 'yes' votes

Definition at line 464 of file evaluate.cpp.

References cityScore, cityYes, and getRandom().

Referenced by cityEvaluation().

◆ doWinGame()

void Micropolis::doWinGame ( )
Todo:
This may not be called. Call it when appropriate.

Tell the front-end that the player has won the game

Definition at line 471 of file message.cpp.

References callback.

◆ doZone()

void Micropolis::doZone ( const Position pos)
private

◆ doZoneStatus()

void Micropolis::doZoneStatus ( short  mapH,
short  mapV 
)
private

Report about the status of a tile.

Parameters
mapHX coordinate of the tile.
mapVY coordinate of the tile.
Bug:
Program breaks for status on 'dirt'

Definition at line 838 of file tool.cpp.

References clamp(), COALBASE, COALSMOKE1, doShowZoneStatus(), getDensity(), LOMASK, and map.

Referenced by queryTool().

◆ drawMonth()

void Micropolis::drawMonth ( short *  hist,
unsigned char *  s,
float  scale 
)

Copy history data to new array, scaling as needed.

Parameters
histSource history data.
sDestination byte array.
scaleScale factor.
Todo:
Figure out why we copy data.

Definition at line 107 of file graph.cpp.

References clamp().

◆ drawStadium()

void Micropolis::drawStadium ( const Position center,
MapTile  z 
)
private

Draw a stadium (either full or empty).

Parameters
centerCenter tile position of the stadium.
zBase tile value.
Todo:
Merge with zonePlop()-like function.

Definition at line 1630 of file simulate.cpp.

References map, Position::posX, Position::posY, PWRBIT, and ZONEBIT.

Referenced by doSpecialZone().

◆ drawValve()

void Micropolis::drawValve ( )

Definition at line 195 of file update.cpp.

◆ driveDone()

bool Micropolis::driveDone ( const Position pos,
ZoneType  destZone 
)
private

Has the journey arrived at its destination?

Parameters
posCurrent position.
destZoneZonetype to drive to.
Returns
Destination has been reached.

Definition at line 453 of file traffic.cpp.

References LENGTH_OF, LOMASK, map, NUCLEAR, PORT, Position::posX, Position::posY, WORLD_H, WORLD_W, and ZT_NUM_DESTINATIONS.

Referenced by tryDrive().

◆ evalCom()

short Micropolis::evalCom ( const Position pos,
int  traf 
)
private

Compute evaluation of a commercial zone.

Parameters
trafResult if traffic attempt.
Returns
Evaluation value of the commercial zone.

Definition at line 897 of file zone.cpp.

References comRateMap, Position::posX, Position::posY, and Map< DATA, BLKSIZE >::worldGet().

Referenced by doCommercial().

◆ evalInd()

short Micropolis::evalInd ( int  traf)
private

Compute evaluation of an industrial zone.

Parameters
trafResult if traffic attempt.
Returns
Evaluation value of the industrial zone.

Definition at line 1029 of file zone.cpp.

Referenced by doIndustrial().

◆ evalInit()

void Micropolis::evalInit ( )

Initialize evaluation variables

Definition at line 136 of file evaluate.cpp.

References CC_VILLAGE, cityAssessedValue, cityClass, cityPop, cityPopDelta, cityScore, cityScoreDelta, cityYes, CVP_NUMPROBLEMS, CVP_PROBLEM_COMPLAINTS, problemOrder, and problemVotes.

Referenced by cityEvaluation().

◆ evalLot()

short Micropolis::evalLot ( int  x,
int  y 
)
private

Evaluate suitability of the position for placing a new house.

Returns
Suitability.

Definition at line 514 of file zone.cpp.

References DIRT, LOMASK, map, and testBounds().

Referenced by buildHouse().

◆ evalRes()

short Micropolis::evalRes ( const Position pos,
int  traf 
)
private

Evaluate residential zone.

Definition at line 736 of file zone.cpp.

References landValueMap, min(), pollutionDensityMap, Position::posX, Position::posY, and Map< DATA, BLKSIZE >::worldGet().

Referenced by doResidential().

◆ explodeSprite()

void Micropolis::explodeSprite ( SimSprite sprite)

◆ findPerimeterRoad()

bool Micropolis::findPerimeterRoad ( Position pos)
private

Find a connection to a road at the perimeter.

Parameters
posStarting position. Gets updated when a perimeter has been found.
Returns
Indication that a connection has been found.
Todo:
We could randomize the search.

Definition at line 239 of file traffic.cpp.

References map, Position::posX, Position::posY, roadTest(), and testBounds().

Referenced by doSpecialZone(), and makeTraffic().

◆ findPerimeterTelecom()

bool Micropolis::findPerimeterTelecom ( const Position pos)
private

Find a telecom connection at the perimeter.

Parameters
posPosition to start searching.
Returns
A telecom connection has been found.
Todo:
Decide whether we want telecomm code.

Definition at line 274 of file traffic.cpp.

References LOMASK, map, Position::posX, and testBounds().

Referenced by makeTraffic().

◆ fireAnalysis()

void Micropolis::fireAnalysis ( )

Make firerate map from firestation map.

Todo:
Comment seems wrong; what's a firerate map?

Definition at line 120 of file scan.cpp.

References fireStationEffectMap, fireStationMap, MAP_TYPE_DYNAMIC, MAP_TYPE_FIRE_RADIUS, newMapFlags, and smoothStationMap().

Referenced by doSimInit().

◆ fireBomb()

void Micropolis::fireBomb ( )

Let a fire bomb explode at a random location

Definition at line 233 of file disasters.cpp.

References getRandom(), makeExplosion(), MESSAGE_FIREBOMBING, sendMessage(), WORLD_H, and WORLD_W.

Referenced by makeFireBombs().

◆ fireZone()

void Micropolis::fireZone ( const Position pos,
MapValue  ch 
)
private

Handle a zone on fire.

Decreases rate of growth of the zone, and makes remaining tiles bulldozable.

Parameters
posPosition of the zone on fire.
chCharacter of the zone.

Definition at line 1363 of file simulate.cpp.

References BULLBIT, clamp(), LOMASK, map, PORTBASE, Position::posX, Position::posY, rateOfGrowthMap, testBounds(), Map< DATA, BLKSIZE >::worldGet(), and Map< DATA, BLKSIZE >::worldSet().

Referenced by doFire(), and doFlood().

◆ fixSingle()

void Micropolis::fixSingle ( int  x,
int  y,
ToolEffects effects 
)
private

Modify road, rails, and wire connections at a given tile.

Parameters
xX map coordinate.
yY map coordinate.
effectsModification collecting object.

Definition at line 593 of file connect.cpp.

References BULLBIT, BURNBIT, CONDBIT, ToolEffects::getMapTile(), ToolEffects::getMapValue(), LOMASK, neutralizeRoad(), RAILHPOWERV, RAILVPOWERH, ToolEffects::setMapValue(), VBRIDGE, WORLD_H, and WORLD_W.

Referenced by fixZone().

◆ fixZone()

void Micropolis::fixZone ( int  x,
int  y,
ToolEffects effects 
)
private

Update connections (rails, and wire connections) to a zone.

Parameters
xX map coordinate
yY map coordinate.
effectsModification collecting object.

Definition at line 565 of file connect.cpp.

References fixSingle(), WORLD_H, and WORLD_W.

Referenced by connectTile().

◆ forestTool()

ToolResult Micropolis::forestTool ( short  x,
short  y,
ToolEffects effects 
)
private
Todo:
bulldozer should be free in terrain mode or from a free tool.

Definition at line 1351 of file tool.cpp.

References ToolEffects::addFrontendMessage(), DIRT, ToolEffects::getMapValue(), LOMASK, putDownForest(), testBounds(), TOOLRESULT_FAILED, and TOOLRESULT_OK.

Referenced by doTool().

◆ freePtr()

void Micropolis::freePtr ( void *  data)

Release claimed memory.

Parameters
dataPointer to previously claimed memory.

Definition at line 1084 of file micropolis.cpp.

Referenced by destroyMapArrays().

◆ generateBus()

void Micropolis::generateBus ( int  x,
int  y 
)

Try to start a new bus sprite at the given map tile.

Parameters
xX coordinate in map coordinate.
yY coordinate in map coordinate.

Definition at line 1849 of file sprite.cpp.

References getRandom(), getSprite(), makeSprite(), and SPRITE_BUS.

◆ generateCopter()

void Micropolis::generateCopter ( const Position pos)

Ensure a helicopter sprite exists.

If it does not exist, create one at the given coordinates.

Parameters
posStart position in map coordinates.

Definition at line 1969 of file sprite.cpp.

References getSprite(), makeSprite(), Position::posX, Position::posY, and SPRITE_HELICOPTER.

Referenced by doAirport().

◆ generateMap()

void Micropolis::generateMap ( int  seed)

Generate a map.

Parameters
seedInitialization seed for the random generator.

Definition at line 129 of file generate.cpp.

References clearMap(), doRivers(), doTrees(), generatedCitySeed, getRandom(), makeIsland(), makeLakes(), makeNakedIsland(), seedRandom(), terrainCreateIsland, terrainCurveLevel, terrainLakeLevel, terrainTreeLevel, WORLD_H, and WORLD_W.

Referenced by generateSomeCity().

◆ generatePlane()

void Micropolis::generatePlane ( const Position pos)

Ensure an airplane sprite exists.

If it does not exist, create one at the given coordinates.

Parameters
posStart position in map coordinates.

Definition at line 1985 of file sprite.cpp.

References getSprite(), makeSprite(), Position::posX, Position::posY, and SPRITE_AIRPLANE.

Referenced by doAirport().

◆ generateShip()

void Micropolis::generateShip ( )

Try to construct a new ship sprite

Definition at line 1858 of file sprite.cpp.

References getRandom16(), makeShipHere(), map, WORLD_H, and WORLD_W.

Referenced by doSpecialZone().

◆ generateSomeCity()

void Micropolis::generateSomeCity ( int  seed)

Generate a map for a city.

Parameters
seedRandom number generator initializing seed

Definition at line 102 of file generate.cpp.

References callback, cityFileName, cityTime, doInitialEval, doSimInit(), generateMap(), initWillStuff(), invalidateMaps(), resetEditorState(), resetMapState(), SC_NONE, scenario, simUpdate(), and updateFunds().

Referenced by generateSomeRandomCity().

◆ generateSomeRandomCity()

void Micropolis::generateSomeRandomCity ( )

Create a new map for a city.

Bug:
We use a random number generator to draw a seed for initializing the random number generator?

Definition at line 92 of file generate.cpp.

References generateSomeCity(), and getRandom16().

◆ generateTrain()

void Micropolis::generateTrain ( int  x,
int  y 
)

Try to start a new train sprite at the given map tile.

Parameters
xX coordinate in map coordinate.
yY coordinate in map coordinate.

Definition at line 1836 of file sprite.cpp.

References getRandom(), getSprite(), makeSprite(), SPRITE_TRAIN, and totalPop.

Referenced by doRail().

◆ getAssessedValue()

void Micropolis::getAssessedValue ( )
private

Assess value of the city.

Postcondition
cityAssessedValue contains the total city value.
Todo:
Make function return the value, or change the name of the function.

Definition at line 159 of file evaluate.cpp.

References airportPop, cityAssessedValue, coalPowerPop, fireStationPop, hospitalPop, nuclearPowerPop, policeStationPop, railTotal, roadTotal, seaportPop, and stadiumPop.

Referenced by cityEvaluation().

◆ getBoatDistance()

int Micropolis::getBoatDistance ( const Position pos)
private

Compute distance to nearest boat from a given bridge.

Parameters
posPosition of bridge.
Returns
Distance to nearest boat.

Definition at line 1270 of file simulate.cpp.

References absoluteValue(), SimSprite::frame, min(), SimSprite::next, Position::posX, Position::posY, SPRITE_SHIP, spriteList, SimSprite::type, SimSprite::x, SimSprite::xHot, SimSprite::y, and SimSprite::yHot.

Referenced by doBridge().

◆ getChar()

short Micropolis::getChar ( int  x,
int  y 
)

Get character from the map.

Parameters
xX coordinate in pixels.
yY coordinate in pixels.
Returns
Map character if on-map, or -1 if off-map.

Definition at line 375 of file sprite.cpp.

References LOMASK, map, and testBounds().

Referenced by doMonsterSprite(), and doTrainSprite().

◆ getCityCenterDistance()

int Micropolis::getCityCenterDistance ( int  x,
int  y 
)

Compute Manhattan distance between given world position and center of the city.

Parameters
xX world coordinate of given position.
yY world coordinate of given position.
Returns
Manhattan distance (dx+dy ) between both positions.
Note
For long distances (> 64), value 64 is returned.

Definition at line 392 of file scan.cpp.

References cityCenterX, cityCenterY, and min().

Referenced by computeComRateMap().

◆ getCityClass()

CityClass Micropolis::getCityClass ( Quad  cityPopulation)
private

Classify the city based on its population.

Parameters
cityPopulationNumber of people in the city.
Returns
City classification.
Todo:
Put people counts into a table.

Definition at line 210 of file evaluate.cpp.

References CC_CAPITAL, CC_CITY, CC_MEGALOPOLIS, CC_METROPOLIS, CC_TOWN, and CC_VILLAGE.

Referenced by checkGrowth(), and doPopNum().

◆ getComZonePop()

short Micropolis::getComZonePop ( MapTile  tile)
private

Get commercial zone population number.

Parameters
tileTile of the commercial zone.
Returns
Population number of the zone.

Definition at line 866 of file zone.cpp.

Referenced by doCommercial(), and getPopulationDensity().

◆ getCrimeRate()

int Micropolis::getCrimeRate ( int  x,
int  y 
)

Get a value from the crime rate map.

Parameters
xX coordinate of the position to get, 0 to WORLD_W_2.
yY coordinate of the position to get, 0 to WORLD_H_2.
Returns
Value of the population density map at the given position.
Note
Off-map positions are considered to contain 0.
Todo:
Use world coordinates instead (use crimeRateMap.worldGet() instead).

Definition at line 1403 of file micropolis.cpp.

References crimeRateMap, and Map< DATA, BLKSIZE >::get().

◆ getCrimeRateMapBuffer()

void * Micropolis::getCrimeRateMapBuffer ( )

Get the address of the internal buffer containing the crime rate map. This is used to enable the tile engine to access the crime rate map directly.

Returns
Pointer to the start of the crime rate map buffer.

Definition at line 1429 of file micropolis.cpp.

References crimeRateMap, and Map< DATA, BLKSIZE >::getBase().

◆ getDemands()

void Micropolis::getDemands ( float *  resDemandResult,
float *  comDemandResult,
float *  indDemandResult 
)

Return the residential, commercial and industrial development demands, as floating point numbers from -1 (lowest demand) to 1 (highest demand).

Definition at line 424 of file utilities.cpp.

◆ getDensity()

int Micropolis::getDensity ( short  catNo,
short  mapH,
short  mapV 
)
private

Get string index for a status report on tile mapH, mapV on a given status category.

Parameters
catNoCategory number: 0: population density 1: land value. 2: crime rate. 3: pollution. 4: growth rate.
mapHX coordinate of the tile.
mapVY coordinate of the tile.
Returns
Index into stri.202 file.

Definition at line 788 of file tool.cpp.

References crimeRateMap, landValueMap, pollutionDensityMap, populationDensityMap, rateOfGrowthMap, STR202_CRIME_NONE, STR202_GROWRATE_DECLINING, STR202_GROWRATE_FASTGROWTH, STR202_GROWRATE_SLOWGROWTH, STR202_GROWRATE_STABLE, STR202_LANDVALUE_HIGH_CLASS, STR202_LANDVALUE_LOWER_CLASS, STR202_LANDVALUE_MIDDLE_CLASS, STR202_LANDVALUE_SLUM, STR202_POLLUTION_NONE, STR202_POPULATIONDENSITY_LOW, and Map< DATA, BLKSIZE >::worldGet().

Referenced by doZoneStatus().

◆ getDir()

short Micropolis::getDir ( int  orgX,
int  orgY,
int  desX,
int  desY 
)

Get direction (0..8?) to get from starting point to destination point.

Parameters
orgXX coordinate starting point.
orgYY coordinate starting point.
desXX coordinate destination point.
desYY coordinate destination point.
Returns
Direction to go in.
Todo:
Remove local magic constants and document the code.
Bug:
Has a condition that never holds.

Definition at line 477 of file sprite.cpp.

References absoluteValue().

Referenced by doAirplaneSprite(), doCopterSprite(), and doMonsterSprite().

◆ getDistance()

int Micropolis::getDistance ( int  x1,
int  y1,
int  x2,
int  y2 
)

Compute Manhattan distance between two points.

Parameters
x1X coordinate first point.
y1Y coordinate first point.
x2X coordinate second point.
y2Y coordinate second point.
Returns
Manhattan distance between both points.

Definition at line 525 of file sprite.cpp.

References absoluteValue().

Referenced by checkSpriteCollision().

◆ getERandom()

short Micropolis::getERandom ( short  limit)

Get a random number within a given range, with a preference to smaller values.

Parameters
limitUpper bound of the range (inclusive).
Returns
Random number between 0 and limit (inclusive).

Definition at line 155 of file random.cpp.

References getRandom(), and min().

Referenced by makeNakedIsland().

◆ getFireCoverage()

int Micropolis::getFireCoverage ( int  x,
int  y 
)

Get a value from the fire coverage map.

Parameters
xX coordinate of the position to get, 0 to WORLD_W_8.
yY coordinate of the position to get, 0 to WORLD_H_8.
Returns
Value of the fir coverage map at the given position.
Note
Off-map positions are considered to contain 0.
Todo:
Use world coordinates instead (use fireStationEffectMap.worldGet() instead).

Definition at line 1483 of file micropolis.cpp.

References fireStationEffectMap, and Map< DATA, BLKSIZE >::get().

◆ getFireCoverageMapBuffer()

void * Micropolis::getFireCoverageMapBuffer ( )

Get the address of the internal buffer containing the fire coverage map. This is used to enable the tile engine to access the fire coverage map directly.

Returns
Pointer to the start of the fire coverage map buffer.

Definition at line 1509 of file micropolis.cpp.

References fireStationEffectMap, and Map< DATA, BLKSIZE >::getBase().

◆ getFireSeverity()

short Micropolis::getFireSeverity ( )
private

Compute severity of fire

Returns
Value representing the severity of fire problems

Definition at line 361 of file evaluate.cpp.

References firePop, and min().

Referenced by doProblems(), and getScore().

◆ getHistory()

short Micropolis::getHistory ( int  historyType,
int  historyScale,
int  historyIndex 
)

Get a value from the history tables.

Parameters
historyTypeType of history information.
See also
HistoryType
Parameters
historyScaleScale of history data.
See also
HistoryScale
Parameters
historyIndexIndex in the data to obtain
Returns
Historic data value of the requested graph

Definition at line 288 of file graph.cpp.

References comHist, crimeHist, HISTORY_COUNT, HISTORY_SCALE_COUNT, HISTORY_SCALE_LONG, HISTORY_SCALE_SHORT, HISTORY_TYPE_COM, HISTORY_TYPE_COUNT, HISTORY_TYPE_CRIME, HISTORY_TYPE_IND, HISTORY_TYPE_MONEY, HISTORY_TYPE_POLLUTION, HISTORY_TYPE_RES, indHist, moneyHist, NOT_REACHED, pollutionHist, and resHist.

◆ getHistoryRange()

void Micropolis::getHistoryRange ( int  historyType,
int  historyScale,
short *  minValResult,
short *  maxValResult 
)

Get the minimal and maximal values of a historic graph.

Parameters
historyTypeType of history information.
See also
HistoryType
Parameters
historyScaleScale of history data.
See also
HistoryScale
Parameters
minValResultPointer to variable to write minimal value to.
maxValResultPointer to variable to write maximal value to.

Definition at line 218 of file graph.cpp.

References comHist, crimeHist, HISTORY_COUNT, HISTORY_SCALE_COUNT, HISTORY_SCALE_LONG, HISTORY_SCALE_SHORT, HISTORY_TYPE_COM, HISTORY_TYPE_COUNT, HISTORY_TYPE_CRIME, HISTORY_TYPE_IND, HISTORY_TYPE_MONEY, HISTORY_TYPE_POLLUTION, HISTORY_TYPE_RES, indHist, max(), min(), moneyHist, NOT_REACHED, pollutionHist, and resHist.

◆ getIndZonePop()

short Micropolis::getIndZonePop ( MapTile  tile)
private

Get the population value for the given industrial tile.

Parameters
tileCenter tile value of the industrial zone.
Returns
Population value.

Definition at line 1001 of file zone.cpp.

References INDCLR, and IZB.

Referenced by doIndustrial(), and getPopulationDensity().

◆ getLandPollutionValue()

short Micropolis::getLandPollutionValue ( const Position pos)
private

Compute land value at pos, taking pollution into account.

Parameters
posPosition of interest.
Returns
Indication of land-value adjusted for pollution (0 => low value, 3 => high value)

Definition at line 323 of file zone.cpp.

References landValueMap, pollutionDensityMap, Position::posX, Position::posY, and Map< DATA, BLKSIZE >::worldGet().

Referenced by doCommercial(), and doResidential().

◆ getLandValue()

int Micropolis::getLandValue ( int  x,
int  y 
)

Get a value from the land value map.

Parameters
xX coordinate of the position to get, 0 to WORLD_W_2.
yY coordinate of the position to get, 0 to WORLD_H_2.
Returns
Value of the land value map at the given position.
Note
Off-map positions are considered to contain 0.
Todo:
Use world coordinates instead (use landValueMap.worldGet() instead).

Definition at line 1443 of file micropolis.cpp.

References Map< DATA, BLKSIZE >::get(), and landValueMap.

◆ getLandValueMapBuffer()

void * Micropolis::getLandValueMapBuffer ( )

Get the address of the internal buffer containing the land value map. This is used to enable the tile engine to access the land value map directly.

Returns
Pointer to the start of the land value map buffer.

Definition at line 1469 of file micropolis.cpp.

References Map< DATA, BLKSIZE >::getBase(), and landValueMap.

◆ getMapAddress()

long Micropolis::getMapAddress ( )

Definition at line 1554 of file micropolis.cpp.

◆ getMapBuffer()

void * Micropolis::getMapBuffer ( )

Get the address of the internal buffer containing the map. This is used to enable the tile engine to access the tiles directly.

Returns
Pointer to the start of the world map buffer.

Definition at line 1189 of file micropolis.cpp.

References mapBase.

◆ getMapSize()

long Micropolis::getMapSize ( )

Definition at line 1560 of file micropolis.cpp.

◆ getMopAddress()

long Micropolis::getMopAddress ( )

Definition at line 1566 of file micropolis.cpp.

◆ getMopSize()

long Micropolis::getMopSize ( )

Definition at line 1572 of file micropolis.cpp.

◆ getNextAnimatedTile()

int Micropolis::getNextAnimatedTile ( int  index)
static

Definition at line 234 of file animate.cpp.

◆ getPoliceCoverage()

int Micropolis::getPoliceCoverage ( int  x,
int  y 
)

Get a value from the police coverage map.

Parameters
xX coordinate of the position to get, 0 to WORLD_W_8.
yY coordinate of the position to get, 0 to WORLD_H_8.
Returns
Value of the fir coverage map at the given position.
Note
Off-map positions are considered to contain 0.
Todo:
Use world coordinates instead (use policeStationEffectMap.worldGet() instead).

Definition at line 1522 of file micropolis.cpp.

References Map< DATA, BLKSIZE >::get(), and policeStationEffectMap.

◆ getPoliceCoverageMapBuffer()

void * Micropolis::getPoliceCoverageMapBuffer ( )

Get the address of the internal buffer containing the police coverage map. This is used to enable the tile engine to access the police coverage map directly.

Returns
Pointer to the start of the police coverage map buffer.

Definition at line 1548 of file micropolis.cpp.

References Map< DATA, BLKSIZE >::getBase(), and policeStationEffectMap.

◆ getPollutionDensity()

int Micropolis::getPollutionDensity ( int  x,
int  y 
)

Get a value from the pollution density map.

Parameters
xX coordinate of the position to get, 0 to WORLD_W_2.
yY coordinate of the position to get, 0 to WORLD_H_2.
Returns
Value of the rate of pollution density map at the given position.
Note
Off-map positions are considered to contain 0.
Todo:
Use world coordinates instead (use pollutionDensityMap.worldGet() instead).

Definition at line 1363 of file micropolis.cpp.

References Map< DATA, BLKSIZE >::get(), and pollutionDensityMap.

◆ getPollutionDensityMapBuffer()

void * Micropolis::getPollutionDensityMapBuffer ( )

Get the address of the internal buffer containing the pollution density map. This is used to enable the tile engine to access the pollution density map directly.

Returns
Pointer to the start of the pollution density map buffer.

Definition at line 1389 of file micropolis.cpp.

References Map< DATA, BLKSIZE >::getBase(), and pollutionDensityMap.

◆ getPollutionValue()

int Micropolis::getPollutionValue ( int  loc)

Return pollution of a tile value

Parameters
locTile character
Returns
Value of the pollution (0..255, bigger is worse)

Definition at line 341 of file scan.cpp.

References HTRFBASE, LASTIND, LASTPOWERPLANT, LTRFBASE, PORTBASE, and RADTILE.

◆ getPopulation()

Quad Micropolis::getPopulation ( )
private

Compute city population.

Definition at line 197 of file evaluate.cpp.

References comPop, indPop, and resPop.

Referenced by checkGrowth(), and doPopNum().

◆ getPopulationDensity() [1/2]

int Micropolis::getPopulationDensity ( const Position pos,
MapTile  tile 
)

Get population of a zone.

Parameters
posPosition of the zone to count.
tileTile of the zone.
Returns
Population of the zone.

Definition at line 198 of file scan.cpp.

References doFreePop(), getComZonePop(), getIndZonePop(), getResZonePop(), INDBASE, and PORTBASE.

Referenced by populationDensityScan().

◆ getPopulationDensity() [2/2]

int Micropolis::getPopulationDensity ( int  x,
int  y 
)

Get a value from the population density map.

Parameters
xX coordinate of the position to get, 0 to WORLD_W_2.
yY coordinate of the position to get, 0 to WORLD_H_2.
Returns
Value of the population density map at the given position.
Note
Off-map positions are considered to contain 0.
Todo:
Use world coordinates instead (use populationDensityMap.worldGet() instead).

Definition at line 1243 of file micropolis.cpp.

References Map< DATA, BLKSIZE >::get(), and populationDensityMap.

◆ getPopulationDensityMapBuffer()

void * Micropolis::getPopulationDensityMapBuffer ( )

Get the address of the internal buffer containing the population density map. This is used to enable the tile engine to access the population density map directly.

Returns
Pointer to the start of the population density map buffer.

Definition at line 1269 of file micropolis.cpp.

References Map< DATA, BLKSIZE >::getBase(), and populationDensityMap.

◆ getPowerGrid()

int Micropolis::getPowerGrid ( int  x,
int  y 
)

Get a value from the power grid map.

Parameters
xX coordinate of the position to get, 0 to WORLD_W.
yY coordinate of the position to get, 0 to WORLD_H.
Returns
Value of the power grid map at the given position.
Note
Off-map positions are considered to contain 0.
Todo:
Use world coordinates instead (use powerGridMap.worldGet() instead).

Definition at line 1203 of file micropolis.cpp.

References powerGridMap, and Map< DATA, BLKSIZE >::worldGet().

◆ getPowerGridMapBuffer()

void * Micropolis::getPowerGridMapBuffer ( )

Get the address of the internal buffer containing the power grid map. This is used to enable the tile engine to access the power grid map directly.

Returns
Pointer to the start of the power grid map buffer.

Definition at line 1229 of file micropolis.cpp.

References Map< DATA, BLKSIZE >::getBase(), and powerGridMap.

◆ getProblemNumber()

int Micropolis::getProblemNumber ( int  i)

Return the index of the i-th worst problem.

Parameters
iNumber of the problem.
Returns
Index into the problemOrder table of the i-th problem. Returns -1 if such a problem does not exist.

Definition at line 545 of file evaluate.cpp.

References CVP_NUMPROBLEMS, CVP_PROBLEM_COMPLAINTS, and problemOrder.

◆ getProblemVotes()

int Micropolis::getProblemVotes ( int  i)

Return number of votes to solve the i-th worst problem.

Parameters
iNumber of the problem.
Returns
Number of votes to solve the i-th worst problem. Returns -1 if such a problem does not exist.

Definition at line 562 of file evaluate.cpp.

References CVP_NUMPROBLEMS, CVP_PROBLEM_COMPLAINTS, problemOrder, and problemVotes.

◆ getRandom()

◆ getRandom16()

◆ getRandom16Signed()

int Micropolis::getRandom16Signed ( )

Get signed 16 bit random number.

Definition at line 137 of file random.cpp.

References getRandom16().

Referenced by doCommercial(), doIndustrial(), and doResidential().

◆ getRateOfGrowth()

int Micropolis::getRateOfGrowth ( int  x,
int  y 
)

Get a value from the rate of growth map.

Parameters
xX coordinate of the position to get, 0 to WORLD_W_8.
yY coordinate of the position to get, 0 to WORLD_H_8.
Returns
Value of the rate of growth map at the given position.
Note
Off-map positions are considered to contain 0.
Todo:
Use world coordinates instead (use rateOfGrowthMap.worldGet() instead).

Definition at line 1283 of file micropolis.cpp.

References Map< DATA, BLKSIZE >::get(), and rateOfGrowthMap.

◆ getRateOfGrowthMapBuffer()

void * Micropolis::getRateOfGrowthMapBuffer ( )

Get the address of the internal buffer containing the rate of growth map. This is used to enable the tile engine to access the rate of growth map directly.

Returns
Pointer to the start of the rate of growth map buffer.

Definition at line 1309 of file micropolis.cpp.

References Map< DATA, BLKSIZE >::getBase(), and rateOfGrowthMap.

◆ getResZonePop()

short Micropolis::getResZonePop ( MapTile  mapTile)
private

Return population of a residential zone center tile (RZB, RZB+9, ..., HOSPITAL - 9).

Parameters
mapTileCenter tile of a residential zone.
Returns
Population of the residential zone. (16, 24, 32, 40, 16, ..., 40 )

Definition at line 711 of file zone.cpp.

Referenced by doResidential(), and getPopulationDensity().

◆ getScore()

void Micropolis::getScore ( const short  problemTable[PROBNUM])
private

Compute total score

Parameters
problemTableStorage of how bad each problem is.
Todo:
Should this expression depend on CVP_NUMPROBLEMS?

Definition at line 371 of file evaluate.cpp.

References cityPop, cityPopDelta, cityScore, cityScoreDelta, cityTax, clamp(), comCap, CVP_NUMPROBLEMS, fireEffect, getFireSeverity(), indCap, MAX_FIRE_STATION_EFFECT, MAX_POLICE_STATION_EFFECT, MAX_ROAD_EFFECT, min(), policeEffect, poweredZoneCount, resCap, roadEffect, and unpoweredZoneCount.

Referenced by cityEvaluation().

◆ getSprite()

SimSprite * Micropolis::getSprite ( int  type)

Return the sprite of the give type, if available.

Parameters
typeType of the sprite.
Returns
Pointer to the active sprite if avaiable, else NULL.

Definition at line 338 of file sprite.cpp.

References SimSprite::frame.

Referenced by addToTrafficDensityMap(), doCopterSprite(), doSpecialZone(), generateBus(), generateCopter(), generatePlane(), generateTrain(), makeMonster(), and makeTornado().

◆ getTile()

int Micropolis::getTile ( int  x,
int  y 
)

Get a tile from the map.

Parameters
xX coordinate of the position to get, 0 to WORLD_W.
yY coordinate of the position to get, 0 to WORLD_H.
Returns
Value of the map at the given position.
Note
Off-map positions are considered to contain DIRT.

Definition at line 1157 of file micropolis.cpp.

References DIRT, map, and testBounds().

◆ getTileFromMap()

MapTile Micropolis::getTileFromMap ( const Position pos,
Direction2  dir,
MapTile  defaultTile 
)
private

Get neighbouring tile from the map.

Parameters
posCurrent position.
dirDirection of neighbouring tile, only horizontal and vertical directions are supported.
defaultTileTile to return if off-map.
Returns
The tile in the indicated direction. If tile is off-world or an incorrect direction is given, DIRT is returned.

Definition at line 407 of file traffic.cpp.

References DIR2_EAST, DIR2_NORTH, DIR2_SOUTH, DIR2_WEST, LOMASK, map, Position::posX, Position::posY, WORLD_H, and WORLD_W.

Referenced by tryGo().

◆ getTrafficAverage()

short Micropolis::getTrafficAverage ( )
private

Compute average traffic in the city.

Returns
Value representing how large the traffic problem is.

Definition at line 315 of file evaluate.cpp.

References landValueMap, Map< DATA, BLKSIZE >::MAP_BLOCKSIZE, trafficAverage, trafficDensityMap, WORLD_H, WORLD_W, and Map< DATA, BLKSIZE >::worldGet().

Referenced by doProblems().

◆ getTrafficDensity()

int Micropolis::getTrafficDensity ( int  x,
int  y 
)

Get a value from the traffic density map.

Parameters
xX coordinate of the position to get, 0 to WORLD_W_2.
yY coordinate of the position to get, 0 to WORLD_H_2.
Returns
Value of the traffic density at the given position.
Note
Off-map positions are considered to contain 0.
Todo:
Use world coordinates instead (use trafficDensityMap.worldGet() instead).

Definition at line 1323 of file micropolis.cpp.

References Map< DATA, BLKSIZE >::get(), and trafficDensityMap.

◆ getTrafficDensityMapBuffer()

void * Micropolis::getTrafficDensityMapBuffer ( )

Get the address of the internal buffer containing the traffic density map. This is used to enable the tile engine to access the traffic density map directly.

Returns
Pointer to the start of the traffic density map buffer.

Definition at line 1349 of file micropolis.cpp.

References Map< DATA, BLKSIZE >::getBase(), and trafficDensityMap.

◆ getUnemployment()

short Micropolis::getUnemployment ( )
private

Compute severity of unemployment

Returns
Value representing the severity of unemployment problems

Definition at line 341 of file evaluate.cpp.

References comPop, indPop, min(), and resPop.

Referenced by doProblems().

◆ graphDoer()

void Micropolis::graphDoer ( )

If graph data has been changed, update all graphs. If graphs have been changed, tell the user front-end about it.

Definition at line 132 of file graph.cpp.

References callback, and censusChanged.

Referenced by simUpdate().

◆ incRateOfGrowth()

void Micropolis::incRateOfGrowth ( const Position pos,
int  amount 
)
private

Update the rate of growth at position pos by amount.

Parameters
posPosition to modify.
amountAmount of change (can both be positive and negative).

Definition at line 351 of file zone.cpp.

References clamp(), Position::posX, Position::posY, rateOfGrowthMap, Map< DATA, BLKSIZE >::worldGet(), and Map< DATA, BLKSIZE >::worldSet().

Referenced by doComIn(), doComOut(), doIndIn(), doIndOut(), doResIn(), and doResOut().

◆ indPlop()

void Micropolis::indPlop ( const Position pos,
int  den,
int  value 
)
private

Place an industrial zone around center tile pos.

Parameters
posCenter of the industrial zone.
denPopulation density of the industrial zone (0, 1, 2, or 3).
valueLandvalue of the industrial zone (0 or 1).

Definition at line 1017 of file zone.cpp.

References IND1, and zonePlop().

Referenced by doIndIn(), and doIndOut().

◆ init()

void Micropolis::init ( )

Initialize simulator variables to a sane default.

Definition at line 129 of file micropolis.cpp.

References airportPop, autoBudget, autoBulldoze, autoGoto, blinkFlag, categoryLast, CC_VILLAGE, censusChanged, churchPop, cityAssessedValue, cityCenterX, cityCenterY, cityClass, cityFileName, cityMonth, cityName, cityPop, cityPopDelta, cityPopLast, cityScore, cityScoreDelta, cityTax, cityTime, cityYear, cityYes, Map< DATA, BLKSIZE >::clear(), coalPowerPop, comCap, comHist10Max, comHist120Max, comPop, comRateMap, comZonePop, crimeAverage, crimeMaxX, crimeMaxY, crimeRateMap, curMapStackPointer, curMapStackXY, CVP_PROBLEM_COMPLAINTS, disasterEvent, disasterWait, doAnimation, doInitialEval, doMessages, donDither, doNotices, doSimInit(), enableDisasters, enableSound, evalChanged, faith, fireEffect, fireFund, firePercent, firePop, fireSpend, fireStationEffectMap, fireStationMap, fireStationPop, fireValue, floodCount, freeSprites, gameLevel, graph10Max, graph120Max, heatFlow, heatRule, heatSteps, heatWrap, hospitalPop, indCap, indHist10Max, indHist120Max, indPop, indZonePop, landValueAverage, landValueMap, LEVEL_EASY, MAP_TYPE_COUNT, mapSerial, MAX_TRAFFIC_DISTANCE, mustDrawBudget, mustUpdateOptions, needChurch, needHospital, newMap, newMapFlags, nuclearPowerPop, policeEffect, policeFund, policePercent, policeSpend, policeStationEffectMap, policeStationMap, policeStationPop, policeValue, pollutionAverage, pollutionDensityMap, pollutionMaxX, pollutionMaxY, populationDensityMap, POWER_STACK_SIZE, poweredZoneCount, powerGridMap, powerStackPointer, powerStackXY, problemOrder, problemVotes, railTotal, rateOfGrowthMap, resCap, resHist10Max, resHist120Max, resPop, resZonePop, roadEffect, roadFund, roadPercent, roadSpend, roadTotal, roadValue, SC_NONE, scenario, scoreType, scoreWait, seaportPop, simInit(), simPass, simPasses, simPaused, SPRITE_COUNT, spriteList, stadiumPop, startingYear, taxFlag, taxFund, terrainCreateIsland, terrainCurveLevel, terrainDensityMap, terrainLakeLevel, terrainTreeLevel, tilesAnimated, totalFunds, totalPop, totalPopLast, totalZonePop, trafficAverage, trafficDensityMap, trafMaxX, trafMaxY, and unpoweredZoneCount.

◆ initFundingLevel()

void Micropolis::initFundingLevel ( )

Definition at line 85 of file budget.cpp.

◆ initGraphMax()

void Micropolis::initGraphMax ( )

Compute various max ranges of graphs

Definition at line 151 of file graph.cpp.

References comHist, comHist10Max, comHist120Max, graph10Max, graph120Max, indHist, indHist10Max, indHist120Max, max(), resHist, resHist10Max, and resHist120Max.

Referenced by initWillStuff().

◆ initGraphs()

void Micropolis::initGraphs ( )

Initialize graphs

Definition at line 142 of file graph.cpp.

References historyInitialized.

Referenced by simInit().

◆ initMapArrays()

void Micropolis::initMapArrays ( )
private

Allocate and initialize arrays for the maps

Definition at line 88 of file allocate.cpp.

References comHist, crimeHist, HISTORY_LENGTH, indHist, map, mapBase, MISC_HISTORY_LENGTH, miscHist, moneyHist, newPtr(), pollutionHist, resHist, WORLD_H, and WORLD_W.

Referenced by Micropolis().

◆ initSimMemory()

void Micropolis::initSimMemory ( )
private

Definition at line 401 of file simulate.cpp.

◆ initSprite()

void Micropolis::initSprite ( SimSprite sprite,
int  x,
int  y 
)

Re-initialize an existing sprite.

Parameters
spriteSprite to re-use.
xNew x coordinate of the sprite (in pixels?).
yNew y coordinate of the sprite (in pixels?).
Todo:

Make derived classes for each type.

Move code to (derived) SimSprite methods.

Definition at line 136 of file sprite.cpp.

References SimSprite::destX, SimSprite::destY, SimSprite::frame, getRandom(), pollutionMaxX, pollutionMaxY, SPRITE_AIRPLANE, SPRITE_BUS, SPRITE_EXPLOSION, SPRITE_HELICOPTER, SPRITE_MONSTER, SPRITE_SHIP, SPRITE_TORNADO, SPRITE_TRAIN, SimSprite::type, WORLD_H, WORLD_W, SimSprite::x, SimSprite::xHot, SimSprite::y, and SimSprite::yHot.

Referenced by makeSprite(), and newSprite().

◆ initWillStuff()

◆ invalidateMaps()

void Micropolis::invalidateMaps ( )

Tell the front-end that the maps are not valid any more

Definition at line 1123 of file micropolis.cpp.

References callback, and mapSerial.

Referenced by generateSomeCity(), loadFile(), loadScenario(), toolDown(), and toolDrag().

◆ isTree()

bool Micropolis::isTree ( MapValue  cell)
private

Definition at line 406 of file generate.cpp.

◆ landTool()

ToolResult Micropolis::landTool ( short  x,
short  y,
ToolEffects effects 
)
private
Todo:
: Is this good? It is not auto-bulldoze!!
Todo:
Todo:
: Handle result value (probably)

Definition at line 1328 of file tool.cpp.

References ToolEffects::addFrontendMessage(), putDownLand(), testBounds(), TOOLRESULT_FAILED, and TOOLRESULT_OK.

Referenced by doTool().

◆ layDoze()

ToolResult Micropolis::layDoze ( int  x,
int  y,
ToolEffects effects 
)
private

Builldoze a tile (make it a RIVER or DIRT).

Parameters
xX map coordinate.
yY map coordinate.
effectsModification collecting object.
Returns
Tool result.

Definition at line 222 of file connect.cpp.

References ToolEffects::addCost(), BULLBIT, DIRT, ToolEffects::getMapValue(), HBRIDGE, LOMASK, neutralizeRoad(), ToolEffects::setMapValue(), TOOLRESULT_FAILED, TOOLRESULT_OK, and VBRIDGE.

Referenced by connectTile().

◆ layRail()

ToolResult Micropolis::layRail ( int  x,
int  y,
ToolEffects effects 
)
private

Lay a rail, and update connections (rail, road, and wire) around it.

Parameters
xX map coordinate.
yY map coordinate.
effectsModification collecting object.
Returns
Tool result.

Definition at line 364 of file connect.cpp.

References ToolEffects::addCost(), BULLBIT, BURNBIT, CONDBIT, DIRT, ToolEffects::getMapTile(), neutralizeRoad(), RAILHPOWERV, RAILVPOWERH, ToolEffects::setMapValue(), TOOLRESULT_FAILED, TOOLRESULT_OK, WORLD_H, and WORLD_W.

Referenced by connectTile().

◆ layRoad()

ToolResult Micropolis::layRoad ( int  x,
int  y,
ToolEffects effects 
)
private

Lay a road, and update road around it.

Parameters
xX map coordinate.
yY map coordinate.
effectsModification collecting object.
Returns
Tool result.

Definition at line 271 of file connect.cpp.

References ToolEffects::addCost(), BULLBIT, BURNBIT, CONDBIT, DIRT, ToolEffects::getMapTile(), HBRIDGE, neutralizeRoad(), ToolEffects::setMapValue(), TOOLRESULT_FAILED, TOOLRESULT_OK, VBRIDGE, WORLD_H, and WORLD_W.

Referenced by connectTile().

◆ layWire()

ToolResult Micropolis::layWire ( int  x,
int  y,
ToolEffects effects 
)
private

Lay a wire, and update connections (rail, road, and wire) around it.

Parameters
xX map coordinate.
yY map coordinate.
effectsModification collecting object.
Returns
Tool result.

Definition at line 460 of file connect.cpp.

References ToolEffects::addCost(), BULLBIT, BURNBIT, CONDBIT, DIRT, ToolEffects::getMapTile(), ToolEffects::getMapValue(), LOMASK, neutralizeRoad(), RAILHPOWERV, RAILVPOWERH, ToolEffects::setMapValue(), TOOLRESULT_FAILED, TOOLRESULT_OK, WORLD_H, and WORLD_W.

Referenced by connectTile().

◆ loadCity()

bool Micropolis::loadCity ( const std::string &  filename)

Try to load a new game from disk.

Parameters
filenameName of the file to load.
Returns
Game was loaded successfully.
Todo:

In what state is the game left when loading fails?

String normalization code is duplicated in Micropolis::saveCityAs(). Extract to a sub-function.

Bug:
Function fails if lastDot<lastSlash (ie with "x.y/bla" )

Definition at line 536 of file fileio.cpp.

References cityFileName, didLoadCity(), didntLoadCity(), doSimInit(), and loadFile().

◆ loadFile()

bool Micropolis::loadFile ( const std::string &  filename)

Load a file, and initialize the game variables.

Parameters
filenameName of the file to load.
Returns
Load was succesfull.

Definition at line 276 of file fileio.cpp.

References changeCensus(), cityTax, cityTime, doInitialEval, doSimInit(), firePercent, HALF_SWAP_LONGS, initWillStuff(), invalidateMaps(), loadFileData(), max(), miscHist, mustUpdateOptions, policePercent, roadPercent, SC_NONE, scenario, setAutoBudget(), setAutoBulldoze(), setAutoGoto(), setEnableSound(), and setFunds().

Referenced by loadCity().

◆ loadFileData()

bool Micropolis::loadFileData ( const std::string &  filename)

Load a city file from a given filename and (optionally) directory.

Parameters
filenameName of the file to load.
dirIf not NULL, name of the directory containing the file.
Returns
Load was succesfull.

Definition at line 213 of file fileio.cpp.

References comHist, crimeHist, HISTORY_LENGTH, indHist, load_short(), mapBase, MISC_HISTORY_LENGTH, miscHist, moneyHist, pollutionHist, resHist, WORLD_H, and WORLD_W.

Referenced by loadFile(), and loadScenario().

◆ loadScenario()

void Micropolis::loadScenario ( Scenario  s)

◆ makeDollarDecimalStr()

std::string Micropolis::makeDollarDecimalStr ( const std::string &  numStr)
private

Definition at line 89 of file utilities.cpp.

◆ makeEarthquake()

void Micropolis::makeEarthquake ( )

Change random tiles to fire or dirt as result of the earthquake

Definition at line 257 of file disasters.cpp.

References cityCenterX, cityCenterY, doEarthquake(), getRandom(), map, MESSAGE_EARTHQUAKE, randomFire(), randomRubble(), sendMessage(), vulnerable(), WORLD_H, and WORLD_W.

Referenced by doDisasters(), and scenarioDisaster().

◆ makeExplosion()

void Micropolis::makeExplosion ( int  x,
int  y 
)

Construct an explosion sprite.

Parameters
xX coordinate of the explosion (in map coordinates).
yY coordinate of the explosion (in map coordinates).

Definition at line 2020 of file sprite.cpp.

References makeExplosionAt(), and testBounds().

Referenced by doMeltdown(), and fireBomb().

◆ makeExplosionAt()

void Micropolis::makeExplosionAt ( int  x,
int  y 
)

Construct an explosion sprite.

Parameters
xX coordinate of the explosion (in pixels).
yY coordinate of the explosion (in pixels).

Definition at line 2033 of file sprite.cpp.

References newSprite(), and SPRITE_EXPLOSION.

Referenced by destroyMapTile(), doFire(), explodeSprite(), and makeExplosion().

◆ makeFire()

void Micropolis::makeFire ( )

Start a fire at a random place, requested by user

Definition at line 304 of file disasters.cpp.

References BURNBIT, getRandom(), LASTZONE, LOMASK, map, MESSAGE_FIRE_REPORTED, randomFire(), sendMessage(), WORLD_H, WORLD_W, and ZONEBIT.

◆ makeFireBombs()

void Micropolis::makeFireBombs ( )

Throw several bombs onto the city.

Definition at line 243 of file disasters.cpp.

References fireBomb(), and getRandom16().

Referenced by scenarioDisaster().

◆ makeFlood()

void Micropolis::makeFlood ( )

Flood many tiles

Todo:
Use Direction and some form of XYPosition class here

Definition at line 346 of file disasters.cpp.

References BULLBIT, BURNBIT, DIRT, floodCount, getRandom(), LOMASK, map, MESSAGE_FLOODING_REPORTED, sendMessage(), testBounds(), WATER_HIGH, WORLD_H, and WORLD_W.

Referenced by doDisasters(), and scenarioDisaster().

◆ makeHospital()

void Micropolis::makeHospital ( const Position pos)
private

If needed, add a new hospital or a new church.

Parameters
posCenter position of the new hospital or church.

Definition at line 292 of file zone.cpp.

References getRandom(), needChurch, needHospital, and zonePlop().

Referenced by doResidential().

◆ makeIsland()

void Micropolis::makeIsland ( )

Construct a new world as an island

Definition at line 248 of file generate.cpp.

References doTrees(), and makeNakedIsland().

Referenced by generateMap().

◆ makeLakes()

void Micropolis::makeLakes ( )
private

Make a number of lakes, depending on the Micropolis::terrainLakeLevel.

Definition at line 259 of file generate.cpp.

References getRandom(), makeSingleLake(), terrainLakeLevel, WORLD_H, and WORLD_W.

Referenced by generateMap().

◆ makeMeltdown()

void Micropolis::makeMeltdown ( )

Make a nuclear power plant melt

Todo:
Randomize which nuke plant melts down.

Definition at line 217 of file disasters.cpp.

References doMeltdown(), LOMASK, map, NUCLEAR, WORLD_H, and WORLD_W.

Referenced by scenarioDisaster().

◆ makeMonster()

void Micropolis::makeMonster ( )

Start a new monster sprite.

Todo:
Make monster over land, because it disappears if it's made over water. Better yet make monster not disappear for a while after it's created, over land or water. Should never disappear prematurely.

Definition at line 1917 of file sprite.cpp.

References BULLBIT, SimSprite::destX, SimSprite::destY, getRandom(), getSprite(), makeMonsterAt(), map, pollutionMaxX, pollutionMaxY, SPRITE_MONSTER, WORLD_H, and WORLD_W.

Referenced by doDisasters(), and scenarioDisaster().

◆ makeMonsterAt()

void Micropolis::makeMonsterAt ( int  x,
int  y 
)

Start a new monster sprite at the given map tile.

Parameters
xX coordinate in map coordinate.
yY coordinate in map coordinate.

Definition at line 1956 of file sprite.cpp.

References makeSprite(), MESSAGE_MONSTER_SIGHTED, sendMessage(), and SPRITE_MONSTER.

Referenced by makeMonster().

◆ makeNakedIsland()

void Micropolis::makeNakedIsland ( )
private

Construct a plain island as world, surrounded by 5 tiles of river.

Definition at line 204 of file generate.cpp.

References DIRT, getERandom(), ISLAND_RADIUS, map, plopBRiver(), plopSRiver(), WORLD_H, and WORLD_W.

Referenced by generateMap(), and makeIsland().

◆ makeShipHere()

void Micropolis::makeShipHere ( int  x,
int  y 
)

Start a new ship sprite at the given map tile.

Parameters
xX coordinate in map coordinate.
yY coordinate in map coordinate.

Definition at line 1905 of file sprite.cpp.

References makeSprite(), and SPRITE_SHIP.

Referenced by generateShip().

◆ makeSingleLake()

void Micropolis::makeSingleLake ( const Position pos)

Make a random lake at pos.

Parameters
posRough position of the lake.

Definition at line 283 of file generate.cpp.

References getRandom(), plopBRiver(), and plopSRiver().

Referenced by makeLakes().

◆ makeSound()

void Micropolis::makeSound ( const std::string &  channel,
const std::string &  sound,
int  x = -1,
int  y = -1 
)

Instruct the front-end to make a sound.

Parameters
channelName of the sound channel, which can effect the sound (location, volume, spatialization, etc). Use "city" for city sounds effects, and "interface" for user interface sounds.
soundName of the sound.
xTile X position of sound, 0 to WORLD_W, or -1 for everywhere.
yTile Y position of sound, 0 to WORLD_H, or -1 for everywhere.

Definition at line 1140 of file micropolis.cpp.

References callback, and enableSound.

Referenced by doCopterSprite(), doEarthquake(), doExplosionSprite(), doMakeSound(), doMonsterSprite(), doShipSprite(), explodeSprite(), FrontendMessageMakeSound::sendMessage(), and toolDown().

◆ makeSprite()

SimSprite * Micropolis::makeSprite ( int  type,
int  x,
int  y 
)

Make a sprite either by re-using the old one, or by making a new one.

Parameters
typeSprite type of the new sprite.
xX coordinate of the new sprite.
yY coordinate of the new sprite.

Definition at line 355 of file sprite.cpp.

References initSprite(), and newSprite().

Referenced by generateBus(), generateCopter(), generatePlane(), generateTrain(), makeMonsterAt(), makeShipHere(), and makeTornado().

◆ makeTornado()

void Micropolis::makeTornado ( )

Ensure a tornado sprite exists.

Definition at line 1996 of file sprite.cpp.

References getRandom(), getSprite(), makeSprite(), MESSAGE_TORNADO_SIGHTED, sendMessage(), SPRITE_TORNADO, WORLD_H, and WORLD_W.

Referenced by doDisasters().

◆ makeTraffic() [1/2]

short Micropolis::makeTraffic ( const Position startPos,
ZoneType  dest 
)
private

Find a connection over a road from startPos to a specified zone type.

Parameters
startPosStart position of the attempt.
destZone type to go to.
Returns
1 if connection found, 0 if not found, -1 if no connection to road found.

Definition at line 134 of file traffic.cpp.

References addToTrafficDensityMap(), curMapStackPointer, findPerimeterRoad(), findPerimeterTelecom(), getRandom(), and tryDrive().

◆ makeTraffic() [2/2]

short Micropolis::makeTraffic ( int  x,
int  y,
ZoneType  dest 
)

Find a connection over a road from position x y to a specified zone type.

Parameters
xStart x position of the attempt
yStart y position of the attempt
destZone type to go to.
Returns
1 if connection found, 0 if not found, -1 if no connection to road found.

Definition at line 118 of file traffic.cpp.

References makeTraffic(), Position::posX, and Position::posY.

Referenced by doCommercial(), doIndustrial(), doResidential(), and makeTraffic().

◆ makeTrafficAt()

short Micropolis::makeTrafficAt ( int  x,
int  y,
ZoneType  dest 
)

Makes traffic starting from the road tile at \x, \y.

Parameters
xStart x position of the attempt
yStart y position of the attempt
destZone type to go to.
Returns
1 if connection found, 0 if not found, -1 if no connection to road found.

Definition at line 95 of file traffic.cpp.

References addToTrafficDensityMap(), Position::posX, Position::posY, and tryDrive().

◆ mapScan()

void Micropolis::mapScan ( int  x1,
int  x2 
)
private

Definition at line 947 of file simulate.cpp.

◆ moveObjects()

◆ networkTool()

ToolResult Micropolis::networkTool ( short  x,
short  y,
ToolEffects effects 
)
private

Put down a network.

Todo:
Is this ever used?

Definition at line 1286 of file tool.cpp.

References ToolEffects::addFrontendMessage(), putDownNetwork(), testBounds(), TOOLRESULT_FAILED, and TOOLRESULT_OK.

Referenced by doTool().

◆ newPtr()

Ptr Micropolis::newPtr ( int  size)

Claim size bytes of memory.

Parameters
sizeNumber of bytes to claim.
Returns
Pointer to the claimed memory.

Definition at line 1074 of file micropolis.cpp.

Referenced by initMapArrays(), newSprite(), and simHeat().

◆ newSprite()

SimSprite * Micropolis::newSprite ( const std::string &  name,
int  type,
int  x,
int  y 
)

Create and initialize a sprite.

Parameters
nameName of the sprite (always "").
typeType pf the sprite.
See also
SpriteType.
Parameters
xX coordinate of the sprite (in pixels).
yY coordinate of the sprite (in pixels).
Returns
New sprite object.

Definition at line 104 of file sprite.cpp.

References freeSprites, initSprite(), SimSprite::name, newPtr(), SimSprite::next, spriteList, and SimSprite::type.

Referenced by makeExplosionAt(), and makeSprite().

◆ parkTool()

ToolResult Micropolis::parkTool ( short  x,
short  y,
ToolEffects effects 
)
private

Build a park.

Parameters
xHorizontal position of 'center tile' of the park.
yVertical position of 'center tile' of the park.
effectsStorage of effects of putting down the park.
Returns
Tool result.

Definition at line 1198 of file tool.cpp.

References ToolEffects::addFrontendMessage(), putDownPark(), testBounds(), TOOLRESULT_FAILED, and TOOLRESULT_OK.

Referenced by doTool().

◆ pause()

void Micropolis::pause ( )

Pause a simulation

See also
resume

Definition at line 148 of file utilities.cpp.

References callback, and simPaused.

◆ plopBRiver()

void Micropolis::plopBRiver ( const Position pos)

Put down a big river diamond-like shape.

Parameters
posBase coordinate of the blob (top-left position).

Definition at line 623 of file generate.cpp.

References Position::posX, Position::posY, and putOnMap().

Referenced by doBRiver(), makeNakedIsland(), and makeSingleLake().

◆ plopSRiver()

void Micropolis::plopSRiver ( const Position pos)

Put down a small river diamond-like shape.

Parameters
posBase coordinate of the blob (top-left position).

Definition at line 650 of file generate.cpp.

References Position::posX, Position::posY, and putOnMap().

Referenced by doSRiver(), makeNakedIsland(), and makeSingleLake().

◆ pollutionTerrainLandValueScan()

void Micropolis::pollutionTerrainLandValueScan ( )

Definition at line 227 of file scan.cpp.

◆ populationDensityScan()

◆ prepareBuildingSite()

ToolResult Micropolis::prepareBuildingSite ( int  leftX,
int  topY,
int  sizeX,
int  sizeY,
ToolEffects effects 
)
private

Prepare the site where a building is about to be put down.

This function performs some basic sanity checks, and implements the auto-bulldoze functionality to prepare the site. All effects are stored in the effects object.

Parameters
leftXPosition of left column of tiles of the building.
topYPosition of top row of tiles of the building.
sizeXHorizontal size of the building.
sizeYVertical size of the building.
effectsStorage of effects of preparing the site.
Returns
: Result of preparation.

Definition at line 657 of file tool.cpp.

References ToolEffects::addCost(), autoBulldoze, DIRT, gCostOf, ToolEffects::getMapTile(), ToolEffects::setMapValue(), tally(), TOOLRESULT_FAILED, TOOLRESULT_NEED_BULLDOZE, TOOLRESULT_OK, WORLD_H, and WORLD_W.

Referenced by buildBuilding().

◆ pullPos()

Position Micropolis::pullPos ( )
private

Pull top-most position from the position stack.

Returns
Pulled position.
Precondition
Stack may not be empty (curMapStackPointer > 0)

Definition at line 223 of file traffic.cpp.

References curMapStackPointer, and curMapStackXY.

Referenced by addToTrafficDensityMap().

◆ pullPowerStack()

Position Micropolis::pullPowerStack ( )
private

Pull a position from the power stack.

Returns
Pulled position.
Precondition
Stack must be non-empty (powerStackPointer > 0).

Definition at line 187 of file power.cpp.

References powerStackPointer, and powerStackXY.

Referenced by doPowerScan().

◆ pushPos()

void Micropolis::pushPos ( const Position pos)
private

Push a position onto the position stack.

Parameters
posPosition to push.
Precondition
Stack may not be full.

Definition at line 210 of file traffic.cpp.

References curMapStackPointer, curMapStackXY, and MAX_TRAFFIC_DISTANCE.

Referenced by tryDrive().

◆ pushPowerStack()

void Micropolis::pushPowerStack ( const Position pos)
private

Push position pos onto the power stack if there is room.

Parameters
posPosition to push.

Definition at line 173 of file power.cpp.

References POWER_STACK_SIZE, powerStackPointer, and powerStackXY.

Referenced by doPowerScan(), and doSpecialZone().

◆ putBuilding()

void Micropolis::putBuilding ( int  leftX,
int  topY,
int  sizeX,
int  sizeY,
MapTile  baseTile,
bool  aniFlag,
ToolEffects effects 
)
private

Put down a building, starting at (leftX, topY) with size (sizeX, sizeY).

Parameters
leftXPosition of left column of tiles of the building.
topYPosition of top row of tiles of the building.
sizeXHorizontal size of the building.
sizeYVertical size of the building.
baseTileTile value to use at the top-left position. Tiles are laid in column major mode.
aniFlagSet animation flag at relative position (1, 2)
effectsStorage of the effects.
Precondition
All tiles are within world boundaries.
Todo:
We should ask the buildings themselves how they should be drawn.

Definition at line 617 of file tool.cpp.

References ANIMBIT, ToolEffects::setMapValue(), and ZONEBIT.

Referenced by buildBuilding().

◆ putDownForest()

ToolResult Micropolis::putDownForest ( short  mapH,
short  mapV,
ToolEffects effects 
)
private

Put down a forest tile.

Parameters
mapHX coordinate of the tile.
mapVY coordinate of the tile.
Returns
Tool result.
Todo:
Auto-bulldoze deducts always 1.

Definition at line 366 of file tool.cpp.

References ToolEffects::addCost(), gCostOf, ToolEffects::setMapValue(), smoothTreesAt(), testBounds(), and TOOLRESULT_OK.

Referenced by forestTool().

◆ putDownLand()

ToolResult Micropolis::putDownLand ( short  mapH,
short  mapV,
ToolEffects effects 
)
private

Put down a land tile.

Parameters
mapHX coordinate of the tile.
mapVY coordinate of the tile.
Returns
Tool result.
Todo:

Auto-bulldoze deducts always 1.

Auto-bulldoze costs should be pulled from a table/constant.

Definition at line 333 of file tool.cpp.

References ToolEffects::addCost(), DIRT, gCostOf, ToolEffects::getMapTile(), ToolEffects::setMapValue(), TOOLRESULT_FAILED, and TOOLRESULT_OK.

Referenced by landTool().

◆ putDownNetwork()

ToolResult Micropolis::putDownNetwork ( short  mapH,
short  mapV,
ToolEffects effects 
)
private

Put down a communication network.

Parameters
mapHX coordinate of the tile.
mapVY coordinate of the tile.
Returns
Tool result.
Parameters
effectsStorage of effects of putting down the park.
Todo:
Auto-bulldoze costs should be pulled from a table/constant.

Definition at line 282 of file tool.cpp.

References ToolEffects::addCost(), ANIMBIT, BULLBIT, BURNBIT, CONDBIT, DIRT, gCostOf, ToolEffects::getMapTile(), ToolEffects::setMapValue(), tally(), TOOLRESULT_NEED_BULLDOZE, and TOOLRESULT_OK.

Referenced by networkTool().

◆ putDownPark()

ToolResult Micropolis::putDownPark ( short  mapH,
short  mapV,
ToolEffects effects 
)
private

Put a park down at the give tile.

Parameters
mapHX coordinate of the tile.
mapVY coordinate of the tile.
effectsStorage of effects of putting down the park.
Returns
Tool result.
Todo:
Add auto-bulldoze? (seems to be missing).

Definition at line 252 of file tool.cpp.

References ToolEffects::addCost(), ANIMBIT, BULLBIT, BURNBIT, DIRT, gCostOf, ToolEffects::getMapValue(), getRandom(), ToolEffects::setMapValue(), TOOLRESULT_NEED_BULLDOZE, and TOOLRESULT_OK.

Referenced by parkTool().

◆ putDownWater()

ToolResult Micropolis::putDownWater ( short  mapH,
short  mapV,
ToolEffects effects 
)
private

Put down a water tile.

Parameters
mapHX coordinate of the tile.
mapVY coordinate of the tile.
Returns
Tool result.

Definition at line 310 of file tool.cpp.

References ToolEffects::addCost(), gCostOf, ToolEffects::getMapTile(), ToolEffects::setMapValue(), TOOLRESULT_FAILED, and TOOLRESULT_OK.

◆ putOnMap()

void Micropolis::putOnMap ( MapValue  mChar,
short  xLoc,
short  yLoc 
)
private

Put mChar onto the map at position xLoc, yLoc if possible.

Parameters
mCharMap value to put ont the map.
xLocHorizontal position at the map to put mChar.
yLocVertical position at the map to put mChar.

Definition at line 593 of file generate.cpp.

References DIRT, LOMASK, map, and testBounds().

Referenced by plopBRiver(), and plopSRiver().

◆ putRubble()

void Micropolis::putRubble ( int  x,
int  y,
int  size,
ToolEffects effects 
)
private

Make a size by size tiles square of rubble

Parameters
xHorizontal position of the left-most tile
yVertical position of the left-most tile
sizeSize of the rubble square

Definition at line 923 of file tool.cpp.

References ANIMBIT, BULLBIT, DIRT, doAnimation, ToolEffects::getMapTile(), getRandom(), RADTILE, ToolEffects::setMapValue(), and testBounds().

Referenced by bulldozerTool().

◆ queryTool()

ToolResult Micropolis::queryTool ( short  x,
short  y 
)
private

Do query tool.

Parameters
xX coordinate of the position of the query.
yY coordinate of the position of the query.
Returns
Tool result.

Definition at line 972 of file tool.cpp.

References didTool(), doZoneStatus(), testBounds(), TOOLRESULT_FAILED, and TOOLRESULT_OK.

Referenced by doTool().

◆ railroadTool()

ToolResult Micropolis::railroadTool ( short  x,
short  y,
ToolEffects effects 
)
private

Build a rail track at a tile.

Parameters
xHorizontal position of the tile.
yVertical position of the tile.
effectsStorage of effects of laying the rail.
Returns
Tool result.

Definition at line 1146 of file tool.cpp.

References ToolEffects::addFrontendMessage(), CONNECT_TILE_RAILROAD, connectTile(), testBounds(), TOOLRESULT_FAILED, and TOOLRESULT_OK.

Referenced by doTool().

◆ randomFire()

MapValue Micropolis::randomFire ( )
inlineprivate

Generate a random animated Tiles::FIRE tile

Definition at line 2147 of file micropolis.h.

References ANIMBIT, and getRandom16().

Referenced by doFire(), doMeltdown(), makeEarthquake(), makeFire(), setFire(), and startFire().

◆ randomlySeedRandom()

void Micropolis::randomlySeedRandom ( )

Initialize the random number generator with a 'random' seed.

Definition at line 165 of file random.cpp.

References seedRandom().

Referenced by initWillStuff().

◆ randomRubble()

MapValue Micropolis::randomRubble ( )
inlineprivate

Generate a random Tiles::RUBBLE tile

Definition at line 2153 of file micropolis.h.

References BULLBIT, and getRandom16().

Referenced by doFire(), doRail(), doRoad(), and makeEarthquake().

◆ reallyUpdateFunds()

void Micropolis::reallyUpdateFunds ( )

Definition at line 133 of file update.cpp.

◆ repairZone()

void Micropolis::repairZone ( const Position pos,
MapTile  zCent,
short  zSize 
)
private

Repair a zone at pos.

Parameters
posCenter-tile position of the zone.
zCentValue of the center tile.
zSizeSize of the zone (in both directions).

Definition at line 1410 of file simulate.cpp.

References ANIMBIT, BURNBIT, CONDBIT, LOMASK, map, Position::posX, Position::posY, testBounds(), and ZONEBIT.

Referenced by doHospitalChurch(), and doSpecialZone().

◆ resetEditorState()

void Micropolis::resetEditorState ( )
private

Reset all tools in the simulator editor.

Note
Function is empty
Todo:
What should be done with this empty function?

Definition at line 141 of file initialize.cpp.

Referenced by generateSomeCity(), and simInit().

◆ resetMapState()

void Micropolis::resetMapState ( )
private

Reset all maps in the simulator.

Note
Function is empty
Todo:
What should be done with this empty function?

Definition at line 131 of file initialize.cpp.

Referenced by generateSomeCity(), and simInit().

◆ resPlop()

void Micropolis::resPlop ( const Position pos,
int  den,
int  value 
)
private

Put down a residential zone.

Parameters
posCenter tile of the residential zone.
denPopulation density (0..3)
valueLand value - pollution (0..3), higher is better.

Definition at line 724 of file zone.cpp.

References zonePlop().

Referenced by doResIn(), and doResOut().

◆ resume()

void Micropolis::resume ( )

Resume simulation after pausing it

See also
pause

Definition at line 164 of file utilities.cpp.

References callback, and simPaused.

◆ roadTest()

bool Micropolis::roadTest ( MapValue  mv)
private

Can the given tile be used as road?

Parameters
mvValue from the map.
Returns
Indication that you can drive on the given tile

Definition at line 503 of file traffic.cpp.

References LOMASK.

Referenced by findPerimeterRoad(), and tryGo().

◆ roadTool()

ToolResult Micropolis::roadTool ( short  x,
short  y,
ToolEffects effects 
)
private

Build a road at a tile.

Parameters
xHorizontal position of the tile to lay road.
yVertical position of the tile to lay road.
effectsStorage of effects of laying raod at the tile.
Returns
Tool result.
Todo:
Merge roadTool, railroadTool, wireTool, and parkTool functions.

Definition at line 1120 of file tool.cpp.

References ToolEffects::addFrontendMessage(), CONNECT_TILE_ROAD, connectTile(), testBounds(), TOOLRESULT_FAILED, and TOOLRESULT_OK.

Referenced by doTool().

◆ saveCity()

void Micropolis::saveCity ( )

Try to save the game.

Todo:
This is a no-op if the Micropolis::cityFileName is empty. In that case, we should probably warn the user about the failure.

Definition at line 589 of file fileio.cpp.

References cityFileName, didntSaveCity(), didSaveCity(), doSaveCityAs(), and saveFile().

◆ saveCityAs()

void Micropolis::saveCityAs ( const std::string &  filename)

Save the city under a new name (?)

Parameters
filenameName of the file to use for storing the game.
Todo:
String normalization code is duplicated in Micropolis::loadCity(). Extract to a sub-function.
Bug:
Function fails if lastDot<lastSlash (ie with "x.y/bla" )

Definition at line 646 of file fileio.cpp.

References cityFileName, cityName, didntSaveCity(), didSaveCity(), and saveFile().

◆ saveFile()

bool Micropolis::saveFile ( const std::string &  filename)

Save a game to disk.

Parameters
filenameName of the file to use for storing the game.
Returns
The game was saved successfully.
Todo:
Report error saving file.

Definition at line 364 of file fileio.cpp.

References autoBudget, autoBulldoze, autoGoto, cityTax, cityTime, comHist, crimeHist, enableSound, firePercent, HALF_SWAP_LONGS, HISTORY_LENGTH, indHist, map, MISC_HISTORY_LENGTH, miscHist, moneyHist, policePercent, pollutionHist, resHist, roadPercent, save_short(), totalFunds, WORLD_H, and WORLD_W.

Referenced by saveCity(), and saveCityAs().

◆ scenarioDisaster()

void Micropolis::scenarioDisaster ( )
private

◆ scoreDoer()

void Micropolis::scoreDoer ( )

Update the score after being requested.

Definition at line 515 of file evaluate.cpp.

References doScoreCard(), and evalChanged.

Referenced by simUpdate().

◆ seedRandom()

void Micropolis::seedRandom ( int  seed)

Set seed of the random number generator.

Parameters
seedNew seed.

Definition at line 177 of file random.cpp.

Referenced by generateMap(), and randomlySeedRandom().

◆ sendMessage()

void Micropolis::sendMessage ( short  messageIndex,
short  x = NOWHERE,
short  y = NOWHERE,
bool  picture = false,
bool  important = false 
)

Send the user a message of an event that happens at a particular position in the city.

Parameters
messageIndexMessage number of the message to display.
xX coordinate of the position of the event.
yY coordinate of the position of the event.
pictureFlag that is true if a picture should be shown.
importantFlag that is true if the message is important.

Definition at line 390 of file message.cpp.

References callback.

Referenced by checkGrowth(), doBudgetNow(), doCopterSprite(), doExplosionSprite(), doMeltdown(), doPowerScan(), doScenarioScore(), explodeSprite(), fireBomb(), makeEarthquake(), makeFire(), makeFlood(), makeMonsterAt(), makeTornado(), sendMessages(), setFire(), toolDown(), and updateDate().

◆ sendMessages()

◆ setAutoBudget()

void Micropolis::setAutoBudget ( bool  value)

Set the auto-budget to the given value.

Parameters
valueNew value for the auto-budget setting.

Definition at line 328 of file utilities.cpp.

References autoBudget, and mustUpdateOptions.

Referenced by doBudgetNow(), loadFile(), and simInit().

◆ setAutoBulldoze()

void Micropolis::setAutoBulldoze ( bool  value)

Set the autoBulldoze flag to the given value, and set the mustUpdateOptions flag to update the user interface.

Parameters
valueThe value to set autoBulldoze to.

Definition at line 342 of file utilities.cpp.

References autoBulldoze, and mustUpdateOptions.

Referenced by loadFile(), and simInit().

◆ setAutoGoto()

void Micropolis::setAutoGoto ( bool  value)

Set the autoGoto flag to the given value, and set the mustUpdateOptions flag to update the user interface.

Parameters
valueThe value to set autoGoto to.

Definition at line 356 of file utilities.cpp.

References autoGoto, and mustUpdateOptions.

Referenced by loadFile(), and simInit().

◆ setCallback()

void Micropolis::setCallback ( Callback callback,
emscripten::val  callbackVal 
)

Definition at line 118 of file micropolis.cpp.

◆ setCityName()

void Micropolis::setCityName ( const std::string &  name)

Definition at line 250 of file utilities.cpp.

◆ setCityTax()

void Micropolis::setCityTax ( short  tax)

Definition at line 345 of file budget.cpp.

◆ setCleanCityName()

void Micropolis::setCleanCityName ( const std::string &  name)

Set the name of the city.

Parameters
nameNew name of the city.

Definition at line 272 of file utilities.cpp.

References callback, and cityName.

Referenced by loadScenario().

◆ setCommonInits()

void Micropolis::setCommonInits ( )
private

Definition at line 552 of file simulate.cpp.

◆ setCrimeRate()

void Micropolis::setCrimeRate ( int  x,
int  y,
int  rate 
)

Set a value in the crime rate map.

Parameters
xX coordinate of the position to get, 0 to WORLD_W_2.
yY coordinate of the position to get, 0 to WORLD_H_2.
ratethe value to set.
Note
Off-map positions are ignored.
Todo:
Use world coordinates instead (use crimeRateMap.worldSet() instead).

Definition at line 1417 of file micropolis.cpp.

References crimeRateMap, and Map< DATA, BLKSIZE >::set().

◆ setDemand()

void Micropolis::setDemand ( float  r,
float  c,
float  i 
)

Definition at line 242 of file update.cpp.

◆ setDoAnimation()

void Micropolis::setDoAnimation ( bool  value)

Set the doAnimation flag to the given value, and set the mustUpdateOptions flag to update the user interface.

Parameters
valueThe value to set doAnimation to.

Definition at line 384 of file utilities.cpp.

References doAnimation, and mustUpdateOptions.

◆ setDoMessages()

void Micropolis::setDoMessages ( bool  value)

Set the doMessages flag to the given value, and set the mustUpdateOptions flag to update the user interface.

Parameters
valueThe value to set doMessages to.

Definition at line 398 of file utilities.cpp.

References doMessages, and mustUpdateOptions.

◆ setDoNotices()

void Micropolis::setDoNotices ( bool  value)

Set the doNotices flag to the given value, and set the mustUpdateOptions flag to update the user interface.

Parameters
valueThe value to set doNotices to.

Definition at line 412 of file utilities.cpp.

References doNotices, and mustUpdateOptions.

◆ setEnableDisasters()

void Micropolis::setEnableDisasters ( bool  value)

set the enableDisasters flag, and set the flag to update the user interface.

Parameters
valueNew setting for enableDisasters

Definition at line 317 of file utilities.cpp.

References enableDisasters, and mustUpdateOptions.

Referenced by simInit().

◆ setEnableSound()

void Micropolis::setEnableSound ( bool  value)

Set the enableSound flag to the given value, and set the mustUpdateOptions flag to update the user interface.

Parameters
valueThe value to set enableSound to.

Definition at line 370 of file utilities.cpp.

References enableSound, and mustUpdateOptions.

Referenced by loadFile(), and simInit().

◆ setFire()

void Micropolis::setFire ( )

Start a fire at a random place, random disaster or scenario

Definition at line 285 of file disasters.cpp.

References getRandom(), LASTZONE, LOMASK, map, MESSAGE_FIRE_REPORTED, randomFire(), sendMessage(), WORLD_H, WORLD_W, and ZONEBIT.

Referenced by doDisasters().

◆ setFireCoverage()

void Micropolis::setFireCoverage ( int  x,
int  y,
int  coverage 
)

Set a value in the fire coverage map.

Parameters
xX coordinate of the position to get, 0 to WORLD_W_8.
yY coordinate of the position to get, 0 to WORLD_H_8.
coveragethe value to set.
Note
Off-map positions are ignored.
Todo:
Use world coordinates instead (use fireStationEffectMap.worldSet() instead).

Definition at line 1497 of file micropolis.cpp.

References fireStationEffectMap, and Map< DATA, BLKSIZE >::set().

◆ setFunds()

void Micropolis::setFunds ( int  dollars)

Set player funds to dollars.

Modify the player funds, and warn the front-end about the new amount of money.

Parameters
dollarsNew value for the player funds.

Definition at line 1048 of file micropolis.cpp.

References totalFunds, and updateFunds().

Referenced by loadFile(), loadScenario(), setGameLevelFunds(), simInit(), and spend().

◆ setGameLevel()

void Micropolis::setGameLevel ( GameLevel  level)

Set/change the game level.

Parameters
levelNew game level.

Definition at line 235 of file utilities.cpp.

References gameLevel, LEVEL_FIRST, LEVEL_LAST, and updateGameLevel().

Referenced by loadScenario(), setGameLevelFunds(), and simLoadInit().

◆ setGameLevelFunds()

void Micropolis::setGameLevelFunds ( GameLevel  level)

Set the game level and initial funds.

Parameters
levelNew game level.

Definition at line 208 of file utilities.cpp.

References LEVEL_EASY, LEVEL_HARD, LEVEL_MEDIUM, setFunds(), and setGameLevel().

Referenced by simInit().

◆ setHistory()

void Micropolis::setHistory ( int  historyType,
int  historyScale,
int  historyIndex,
short  historyValue 
)

Store a value into the history tables.

Parameters
historyTypeType of history information.
See also
HistoryType
Parameters
historyScaleScale of history data.
See also
HistoryScale
Parameters
historyIndexIndex in the data to obtain
historyValueIndex in the value to store

Definition at line 348 of file graph.cpp.

References comHist, crimeHist, HISTORY_COUNT, HISTORY_SCALE_COUNT, HISTORY_SCALE_LONG, HISTORY_SCALE_SHORT, HISTORY_TYPE_COM, HISTORY_TYPE_COUNT, HISTORY_TYPE_CRIME, HISTORY_TYPE_IND, HISTORY_TYPE_MONEY, HISTORY_TYPE_POLLUTION, HISTORY_TYPE_RES, indHist, moneyHist, NOT_REACHED, pollutionHist, and resHist.

◆ setLandValue()

void Micropolis::setLandValue ( int  x,
int  y,
int  value 
)

Set a value in the land value map.

Parameters
xX coordinate of the position to get, 0 to WORLD_W_2.
yY coordinate of the position to get, 0 to WORLD_H_2.
valuethe value to set.
Note
Off-map positions are ignored.
Todo:
Use world coordinates instead (use landValueMap.worldSet() instead).

Definition at line 1457 of file micropolis.cpp.

References landValueMap, and Map< DATA, BLKSIZE >::set().

◆ setPasses()

void Micropolis::setPasses ( int  passes)

Definition at line 197 of file utilities.cpp.

◆ setPoliceCoverage()

void Micropolis::setPoliceCoverage ( int  x,
int  y,
int  coverage 
)

Set a value in the police coverage map.

Parameters
xX coordinate of the position to get, 0 to WORLD_W_8.
yY coordinate of the position to get, 0 to WORLD_H_8.
coveragethe value to set.
Note
Off-map positions are ignored.
Todo:
Use world coordinates instead (use policeStationEffectMap.worldSet() instead).

Definition at line 1536 of file micropolis.cpp.

References policeStationEffectMap, and Map< DATA, BLKSIZE >::set().

◆ setPollutionDensity()

void Micropolis::setPollutionDensity ( int  x,
int  y,
int  density 
)

Set a value in the pollition density map.

Parameters
xX coordinate of the position to get, 0 to WORLD_W_2.
yY coordinate of the position to get, 0 to WORLD_H_2.
densitythe value to set.
Note
Off-map positions are ignored.
Todo:
Use world coordinates instead (use pollutionDensityMap.worldSet() instead).

Definition at line 1377 of file micropolis.cpp.

References pollutionDensityMap, and Map< DATA, BLKSIZE >::set().

◆ setPopulationDensity()

void Micropolis::setPopulationDensity ( int  x,
int  y,
int  density 
)

Set a value in the population density map.

Parameters
xX coordinate of the position to get, 0 to WORLD_W_2.
yY coordinate of the position to get, 0 to WORLD_H_2.
densitythe value to set.
Note
Off-map positions are ignored.
Todo:
Use world coordinates instead (use populationDensityMap.worldSet() instead).

Definition at line 1257 of file micropolis.cpp.

References populationDensityMap, and Map< DATA, BLKSIZE >::set().

◆ setPowerGrid()

void Micropolis::setPowerGrid ( int  x,
int  y,
int  power 
)

Set a value in the power grid map.

Parameters
xX coordinate of the position to get, 0 to WORLD_W.
yY coordinate of the position to get, 0 to WORLD_H.
powerthe value to set.
Note
Off-map positions are ignored.
Todo:
Use world coordinates instead (use powerGridMap.worldSet() instead).

Definition at line 1217 of file micropolis.cpp.

References powerGridMap, and Map< DATA, BLKSIZE >::worldSet().

◆ setRateOfGrowth()

void Micropolis::setRateOfGrowth ( int  x,
int  y,
int  rate 
)

Set a value in the rate of growth map.

Parameters
xX coordinate of the position to get, 0 to WORLD_W_8.
yY coordinate of the position to get, 0 to WORLD_H_8.
ratethe value to set.
Note
Off-map positions are ignored.
Todo:
Use world coordinates instead (use rateOfGrowthMap.worldSet() instead).

Definition at line 1297 of file micropolis.cpp.

References rateOfGrowthMap, and Map< DATA, BLKSIZE >::set().

◆ setSmoke()

void Micropolis::setSmoke ( const Position pos,
bool  zonePower 
)
private
Todo:
Why div 8? Industry is 9 tiles long!!
Todo:
Why do we assign the same map position twice?
Todo:
Todo:
Add SMOKEBASE into aniTabA and aniTabB tables?
Todo:
Why do we assign the same map position twice?

Definition at line 237 of file zone.cpp.

References IND1, IZB, LOMASK, map, Position::posX, Position::posY, and testBounds().

Referenced by doIndustrial().

◆ setSpeed()

void Micropolis::setSpeed ( short  speed)

Definition at line 176 of file utilities.cpp.

◆ setTile()

void Micropolis::setTile ( int  x,
int  y,
int  tile 
)

Set a tile into the map.

Parameters
xX coordinate of the position to get, 0 to WORLD_W.
yY coordinate of the position to get, 0 to WORLD_H.
tilethe tile value to set.
Note
Off-map positions are ignored.

Definition at line 1174 of file micropolis.cpp.

References map, and testBounds().

◆ setTrafficDensity()

void Micropolis::setTrafficDensity ( int  x,
int  y,
int  density 
)

Set a value in the traffic density map.

Parameters
xX coordinate of the position to get, 0 to WORLD_W_2.
yY coordinate of the position to get, 0 to WORLD_H_2.
densitythe value to set.
Note
Off-map positions are ignored.
Todo:
Use world coordinates instead (use trafficDensityMap.worldSet() instead).

Definition at line 1337 of file micropolis.cpp.

References Map< DATA, BLKSIZE >::set(), and trafficDensityMap.

◆ setValves()

void Micropolis::setValves ( )
private
Todo:
Break the tax table out into configurable parameters.
Todo:
Make configurable parameters.
Todo:
Break the interesting values out into public member variables so the user interface can display them.

Definition at line 564 of file simulate.cpp.

References cityClass, cityScore, cityTax, clamp(), comCap, comHist, comPop, crimeAverage, gameLevel, indCap, indHist, indPop, landValueAverage, LENGTH_OF, LEVEL_COUNT, LEVEL_FIRST, LEVEL_LAST, max(), min(), miscHist, pollutionAverage, resCap, resHist, resPop, totalPop, and totalPopLast.

Referenced by doSimInit().

◆ setYear()

void Micropolis::setYear ( int  year)

Definition at line 280 of file utilities.cpp.

◆ setZonePower()

bool Micropolis::setZonePower ( const Position pos)
private

Copy the value of powerGridMap at position pos to the map.

Parameters
posPosition to copy.
Returns
Does the tile have power?

Definition at line 433 of file zone.cpp.

References LOMASK, map, NUCLEAR, Position::posX, Position::posY, powerGridMap, POWERPLANT, PWRBIT, and Map< DATA, BLKSIZE >::worldGet().

Referenced by doNilPower(), doZone(), and zonePlop().

◆ showBudgetWindowAndStartWaiting()

void Micropolis::showBudgetWindowAndStartWaiting ( )

Definition at line 339 of file budget.cpp.

◆ showValves()

void Micropolis::showValves ( )

Definition at line 186 of file update.cpp.

◆ simFrame()

void Micropolis::simFrame ( )
private

Definition at line 108 of file simulate.cpp.

◆ simHeat()

void Micropolis::simHeat ( )
private

????

Todo:

Why is Micropolis::cellSrc not allocated together with all the other variables?

What is the purpose of this function?

KILL the define.

Definition at line 776 of file micropolis.cpp.

References heatFlow, heatRule, heatWrap, map, newPtr(), NOT_REACHED, WORLD_H, and WORLD_W.

◆ simInit()

◆ simLoadInit()

◆ simLoop()

void Micropolis::simLoop ( bool  doSim)
private

Definition at line 982 of file micropolis.cpp.

◆ simRandom()

int Micropolis::simRandom ( )

Draw a random number (internal function).

Todo:
Use Wolfram's fast cellular automata pseudo random number generator.
Returns
Unsigned 16 bit random number.

Definition at line 98 of file random.cpp.

Referenced by getRandom16().

◆ simTick()

void Micropolis::simTick ( )

Move simulaton forward.

Todo:
What is the purpose of this function? (also in relation with Micropolis::simUpdate()).

Definition at line 1014 of file micropolis.cpp.

References simPass, simPasses, and simUpdate().

◆ simulate()

void Micropolis::simulate ( )
private

Definition at line 132 of file simulate.cpp.

◆ simulateRobots()

void Micropolis::simulateRobots ( )

Definition at line 1025 of file micropolis.cpp.

◆ simUpdate()

void Micropolis::simUpdate ( )

Update ????

Todo:
What is the purpose of this function? (also in relation with Micropolis::simTick()).

Definition at line 754 of file micropolis.cpp.

References blinkFlag, graphDoer(), heatSteps, scoreDoer(), tickCount(), tilesAnimated, and updateBudget().

Referenced by generateSomeCity(), and simTick().

◆ smoothRiver()

void Micropolis::smoothRiver ( )
private

Definition at line 361 of file generate.cpp.

◆ smoothTerrain()

void Micropolis::smoothTerrain ( )

Definition at line 464 of file scan.cpp.

◆ smoothTrees()

void Micropolis::smoothTrees ( )
private

Definition at line 416 of file generate.cpp.

◆ smoothTreesAt() [1/2]

void Micropolis::smoothTreesAt ( int  x,
int  y,
bool  preserve 
)
private

Temporary function to prevent breaking a lot of code.

Definition at line 429 of file generate.cpp.

References ToolEffects::modifyWorld(), and smoothTreesAt().

Referenced by putDownForest(), and smoothTreesAt().

◆ smoothTreesAt() [2/2]

void Micropolis::smoothTreesAt ( int  x,
int  y,
bool  preserve,
ToolEffects effects 
)
private

Smooth trees at a position.

Definition at line 441 of file generate.cpp.

References ToolEffects::getMapValue(), ToolEffects::setMapValue(), and testBounds().

◆ smoothWater()

void Micropolis::smoothWater ( )
private

Definition at line 670 of file generate.cpp.

◆ spend()

void Micropolis::spend ( int  dollars)

Deduct dollars from the player funds.

Parameters
dollarsAmount of money spent.

Definition at line 1035 of file micropolis.cpp.

References setFunds(), and totalFunds.

Referenced by doBudgetNow(), and ToolEffects::modifyWorld().

◆ spriteNotInBounds()

bool Micropolis::spriteNotInBounds ( SimSprite sprite)

Check whether a sprite is still entirely on-map.

Parameters
spriteSprite to check.
Returns
Sprite is at least partly off-map.

Definition at line 459 of file sprite.cpp.

References WORLD_H, SimSprite::x, SimSprite::xHot, SimSprite::y, and SimSprite::yHot.

Referenced by doAirplaneSprite(), doShipSprite(), and doTornadoSprite().

◆ startFire()

void Micropolis::startFire ( int  x,
int  y 
)

Start a fire at a single tile.

Parameters
xX coordinate in map coordinate.
yY coordinate in map coordinate.

Definition at line 1805 of file sprite.cpp.

References BURNBIT, DIRT, LOMASK, map, randomFire(), testBounds(), and ZONEBIT.

Referenced by doExplosionSprite().

◆ startFireInZone()

void Micropolis::startFireInZone ( int  Xloc,
int  Yloc,
int  ch 
)

Start a fire in a zone.

Parameters
XlocX coordinate in map coordinate.
YlocY coordinate in map coordinate.
chMap character at (Xloc, Yloc).

Definition at line 1764 of file sprite.cpp.

References BULLBIT, clamp(), LOMASK, map, PORTBASE, rateOfGrowthMap, testBounds(), Map< DATA, BLKSIZE >::worldGet(), and Map< DATA, BLKSIZE >::worldSet().

Referenced by destroyMapTile().

◆ take10Census()

void Micropolis::take10Census ( )
private

Take monthly snaphsot of all relevant data for the historic graphs. Also update variables that control building new churches and hospitals.

Todo:

Rename to takeMonthlyCensus (or takeMonthlySnaphshot?).

A lot of this max stuff is also done in graph.cpp

Definition at line 730 of file simulate.cpp.

References changeCensus(), churchPop, clamp(), comHist, comHist10Max, comPop, crimeAverage, crimeHist, faith, graph10Max, hospitalPop, indHist, indHist10Max, indPop, max(), min(), moneyHist, needChurch, needHospital, pollutionAverage, pollutionHist, resHist, resHist10Max, and resPop.

◆ take120Census()

void Micropolis::take120Census ( )
private

Definition at line 807 of file simulate.cpp.

◆ tally()

bool Micropolis::tally ( short  tileValue)
private

Can the tile be auto-bulldozed?.

Parameters
tileValueValue of the tile.
Returns
True if the tile can be auto-bulldozed, else false.

Definition at line 535 of file tool.cpp.

Referenced by canDriveOn(), prepareBuildingSite(), and putDownNetwork().

◆ testBounds()

static bool Micropolis::testBounds ( int  wx,
int  wy 
)
inlinestatic

◆ testForConductive()

bool Micropolis::testForConductive ( const Position pos,
Direction2  testDir 
)
private

Check at position pos for a power-less conducting tile in the direction testDir.

Parameters
posPosition to start from.
testDirDirection to investigate.
Returns
Unpowered tile has been found in the indicated direction.
Todo:
Re-use something like Micropolis::getFromMap(), and fold this function into its caller.

Definition at line 104 of file power.cpp.

References CONDBIT, map, Position::move(), Position::posX, Position::posY, powerGridMap, and Map< DATA, BLKSIZE >::worldGet().

Referenced by doPowerScan().

◆ tickCount()

Quad Micropolis::tickCount ( )

Get number of ticks.

Todo:
Figure out what a 'tick' is.
Bug:
Unix version looks wrong, time.tv_usec should be divided to get seconds or time.tc_sec should be multiplied.

Definition at line 1061 of file micropolis.cpp.

Referenced by simUpdate().

◆ toolDown()

void Micropolis::toolDown ( EditingTool  tool,
short  tileX,
short  tileY 
)
Todo:
: Multi player: This sound should only be heard by the user who called this function.
Todo:
: Multi player: This sound should only be heard by the user who called this function.

Definition at line 1509 of file tool.cpp.

References doTool(), invalidateMaps(), makeSound(), MESSAGE_BULLDOZE_AREA_FIRST, MESSAGE_NOT_ENOUGH_FUNDS, NOWHERE, sendMessage(), simPass, TOOLRESULT_NEED_BULLDOZE, and TOOLRESULT_NO_MONEY.

◆ toolDrag()

void Micropolis::toolDrag ( EditingTool  tool,
short  fromX,
short  fromY,
short  toX,
short  toY 
)

Drag a tool from (fromX, fromY) to (toX, toY).

Parameters
toolTool being dragged.
fromXHorizontal coordinate of the starting position.
fromYVertical coordinate of the starting position.
toXHorizontal coordinate of the ending position.
toYVertical coordinate of the ending position.

Definition at line 1538 of file tool.cpp.

References absoluteValue(), doTool(), gToolSize, invalidateMaps(), min(), and simPass.

◆ treeSplash()

void Micropolis::treeSplash ( short  xloc,
short  yloc 
)

Splash a bunch of trees down near (xloc, yloc).

Amount of trees is controlled by Micropolis::terrainTreeLevel.

Parameters
xlocHorizontal position of starting point for splashing trees.
ylocVertical position of starting point for splashing trees.
Note
Trees are not smoothed.
Bug:
Function generates trees even if Micropolis::terrainTreeLevel is 0.

Definition at line 310 of file generate.cpp.

References DIR2_NORTH, DIRT, getRandom(), LOMASK, map, Position::move(), Position::posX, Position::posY, terrainTreeLevel, and Position::testBounds().

Referenced by doTrees().

◆ tryDrive()

bool Micropolis::tryDrive ( const Position startPos,
ZoneType  destZone 
)
private

Try to drive to a destination.

Parameters
startPosStarting position.
destZoneZonetype to drive to.
Returns
Was drive succesful?
Postcondition
Position stack (curMapStackXY) is filled with some intermediate positions of the drive.
Bug:
The stack is popped, but position (and dirLast) is not updated.

Definition at line 309 of file traffic.cpp.

References curMapStackPointer, DIR2_INVALID, driveDone(), MAX_TRAFFIC_DISTANCE, Position::move(), pushPos(), rotate180(), and tryGo().

Referenced by makeTraffic(), and makeTrafficAt().

◆ tryGo()

Direction2 Micropolis::tryGo ( const Position pos,
Direction2  dirLast 
)
private

Try to drive one tile in a random direction.

Parameters
posCurrent position.
dirLastForbidden direction for movement (to prevent reversing).
Returns
Direction of movement, DIR2_INVALID is returned if not moved.

Definition at line 356 of file traffic.cpp.

References DIR2_INVALID, DIR2_NORTH, DIRT, getRandom16(), getTileFromMap(), roadTest(), and rotate90().

Referenced by tryDrive().

◆ tryOther()

bool Micropolis::tryOther ( int  Tpoo,
int  Told,
int  Tnew 
)

???

Todo:

Figure out what this function is doing.

Remove local magic constants and document the code.

Definition at line 431 of file sprite.cpp.

Referenced by doShipSprite().

◆ turnTo()

short Micropolis::turnTo ( int  p,
int  d 
)

Turn.

Parameters
pPresent direction (1..8).
dDestination direction (1..8).
Returns
New direction.
Todo:
Remove local magic constants and document the code.

Definition at line 396 of file sprite.cpp.

Referenced by doAirplaneSprite(), doCopterSprite(), and doShipSprite().

◆ updateBudget()

void Micropolis::updateBudget ( )

The scripting language should pull these raw values out and format them, instead of the callback pushing them out.

Definition at line 327 of file budget.cpp.

References callback, and mustDrawBudget.

Referenced by simUpdate().

◆ updateDate()

void Micropolis::updateDate ( )
Bug:
Message is wrong.

Definition at line 159 of file update.cpp.

References callback, cityMonth, cityTime, cityYear, MESSAGE_NOT_ENOUGH_POWER, NOWHERE, sendMessage(), and startingYear.

◆ updateEvaluation()

void Micropolis::updateEvaluation ( )

Definition at line 110 of file update.cpp.

◆ updateFundEffects()

void Micropolis::updateFundEffects ( )

Update effects of (possibly reduced) funding

It updates effects with respect to roads, police, and fire.

Note
This function should probably not be used when totalPop is clear (ie with an empty) city. See also bugs of collectTax()
Bug:
I think this should be called after loading a city, or any time anything it depends on changes.

Definition at line 912 of file simulate.cpp.

References fireEffect, fireFund, fireSpend, MAX_FIRE_STATION_EFFECT, MAX_POLICE_STATION_EFFECT, MAX_ROAD_EFFECT, mustDrawBudget, policeEffect, policeFund, policeSpend, roadEffect, roadFund, and roadSpend.

◆ updateFunds()

void Micropolis::updateFunds ( )

Set a flag that the funds display is out of date.

Definition at line 127 of file update.cpp.

Referenced by generateSomeCity(), loadScenario(), ToolEffects::modifyWorld(), and setFunds().

◆ updateGameLevel()

void Micropolis::updateGameLevel ( )

Report to the front-end that a new game level has been set.

Definition at line 244 of file utilities.cpp.

References callback, and gameLevel.

Referenced by setGameLevel().

◆ updateGraphs()

void Micropolis::updateGraphs ( )

Definition at line 104 of file update.cpp.

◆ updateHeads()

void Micropolis::updateHeads ( )

Definition at line 116 of file update.cpp.

◆ updateMaps()

void Micropolis::updateMaps ( )

Definition at line 97 of file update.cpp.

◆ updateOptions()

void Micropolis::updateOptions ( )

Definition at line 248 of file update.cpp.

◆ updateUserInterface()

void Micropolis::updateUserInterface ( )
Todo:
Keeping track of pending updates should be moved to the interface (the simulator generates events, the interface forwards them to the GUI when possible/allowed.
Todo:
Send all pending update messages to the user interface.

Definition at line 261 of file update.cpp.

◆ voteProblems()

void Micropolis::voteProblems ( const short  problemTable[PROBNUM])
private

Vote on the problems of the city.

Parameters
problemTableStorage of how bad each problem is.
Postcondition
problemVotes contains the vote counts

Definition at line 288 of file evaluate.cpp.

References getRandom(), and problemVotes.

Referenced by doProblems().

◆ vulnerable()

bool Micropolis::vulnerable ( int  tem)
private

Is tile vulnerable for an earthquake?

Parameters
temTile data
Returns
Function returns true if tile is vulnerable, and false if not

Definition at line 330 of file disasters.cpp.

References LASTZONE, LOMASK, and ZONEBIT.

Referenced by makeEarthquake().

◆ waterTool()

ToolResult Micropolis::waterTool ( short  x,
short  y,
ToolEffects effects 
)
private

Definition at line 1305 of file tool.cpp.

◆ wireTool()

ToolResult Micropolis::wireTool ( short  x,
short  y,
ToolEffects effects 
)
private

Build a wire at a tile.

Parameters
xHorizontal position of the tile to wire.
yVertical position of the tile to wire.
effectsStorage of effects of wiring the tile.
Returns
Tool result.

Definition at line 1172 of file tool.cpp.

References ToolEffects::addFrontendMessage(), CONNECT_TILE_WIRE, connectTile(), testBounds(), TOOLRESULT_FAILED, and TOOLRESULT_OK.

Referenced by doTool().

◆ zonePlop()

bool Micropolis::zonePlop ( const Position pos,
int  base 
)
private

Put down a 3x3 zone around the center tile at pos..

Parameters
baseTile number of the top-left tile.
See also
Tiles
Returns
Build was a success.
Bug:
This function allows partial on-map construction. Is that intentional? No!

Definition at line 366 of file zone.cpp.

References BULLBIT, LOMASK, map, Position::posX, Position::posY, setZonePower(), testBounds(), and ZONEBIT.

Referenced by comPlop(), doComOut(), doHospitalChurch(), doIndOut(), indPlop(), makeHospital(), and resPlop().

Member Data Documentation

◆ absDist

int Micropolis::absDist
private

Definition at line 2243 of file micropolis.h.

◆ airportPop

short Micropolis::airportPop

Airport population.

Definition at line 1056 of file micropolis.h.

Referenced by doSpecialZone(), getAssessedValue(), init(), and sendMessages().

◆ autoBudget

bool Micropolis::autoBudget

Enable auto budget

When enabled, the program will perform budgetting of the city

Definition at line 2338 of file micropolis.h.

Referenced by doBudgetNow(), init(), saveFile(), and setAutoBudget().

◆ autoBulldoze

bool Micropolis::autoBulldoze

Enable auto-bulldoze

When enabled, the game will silently clear tiles when the user builds something on non-clear and bulldozable tiles

Definition at line 2331 of file micropolis.h.

Referenced by connectTile(), init(), prepareBuildingSite(), saveFile(), and setAutoBulldoze().

◆ autoGoto

bool Micropolis::autoGoto

Enable auto goto

When enabled and an important event happens, the map display will jump to the location of the event

Definition at line 1969 of file micropolis.h.

Referenced by init(), saveFile(), and setAutoGoto().

◆ blinkFlag

short Micropolis::blinkFlag
Todo:
Variable is not used, can we remove it?

Definition at line 2363 of file micropolis.h.

Referenced by init(), simInit(), and simUpdate().

◆ callback

◆ callbackData

void* Micropolis::callbackData

Hook for scripting language to store scripted callback function. (i.e. a callable Python object.)

Definition at line 2371 of file micropolis.h.

◆ callbackVal

emscripten::val Micropolis::callbackVal

Definition at line 2365 of file micropolis.h.

◆ cashFlow

short Micropolis::cashFlow

Definition at line 2105 of file micropolis.h.

◆ categoryLast

short Micropolis::categoryLast

City class of last city class check.

See also
CheckGrowth

Definition at line 1961 of file micropolis.h.

Referenced by checkGrowth(), and init().

◆ cellDst

short* Micropolis::cellDst
private

Definition at line 1944 of file micropolis.h.

◆ cellSrc

short* Micropolis::cellSrc
private

Definition at line 1942 of file micropolis.h.

◆ censusChanged

bool Micropolis::censusChanged

Census changed flag.

Need to redraw census dependent stuff.

Definition at line 1159 of file micropolis.h.

Referenced by changeCensus(), doSimInit(), graphDoer(), and init().

◆ churchPop

short Micropolis::churchPop

Number of churches.

Definition at line 1024 of file micropolis.h.

Referenced by doHospitalChurch(), init(), and take10Census().

◆ cityAssessedValue

Quad Micropolis::cityAssessedValue

City assessed value.

Depends on roadTotal, railTotal, policeStationPop, fireStationPop, hospitalPop, stadiumPop, seaportPop, airportPop, coalPowerPop, and nuclearPowerPop, and their respective values.

Definition at line 1594 of file micropolis.h.

Referenced by evalInit(), getAssessedValue(), and init().

◆ cityCenterX

short Micropolis::cityCenterX

X coordinate of city center.

Definition at line 2052 of file micropolis.h.

Referenced by getCityCenterDistance(), init(), makeEarthquake(), and populationDensityScan().

◆ cityCenterY

short Micropolis::cityCenterY

Y coordinate of city center.

Definition at line 2053 of file micropolis.h.

Referenced by getCityCenterDistance(), init(), makeEarthquake(), and populationDensityScan().

◆ cityClass

CityClass Micropolis::cityClass

City class, affected by city population.

Definition at line 1596 of file micropolis.h.

Referenced by doPopNum(), doScenarioScore(), evalInit(), init(), setValves(), and simLoadInit().

◆ cityFileName

std::string Micropolis::cityFileName

Filename of the last loaded city.

Definition at line 1913 of file micropolis.h.

Referenced by generateSomeCity(), init(), loadCity(), loadScenario(), saveCity(), and saveCityAs().

◆ cityMonth

Quad Micropolis::cityMonth

City month, 4 time units per month.

Todo:
Remove, can be computed from Micropolis::cityTime.

Definition at line 1099 of file micropolis.h.

Referenced by init(), and updateDate().

◆ cityMonthLast

Quad Micropolis::cityMonthLast

Definition at line 2652 of file micropolis.h.

◆ cityName

std::string Micropolis::cityName

Name of the city.

Name of the city.

Definition at line 1918 of file micropolis.h.

Referenced by init(), saveCityAs(), and setCleanCityName().

◆ cityPop

Quad Micropolis::cityPop

City population.

Depends of ResPop, ComPop and IndPop.

Definition at line 1577 of file micropolis.h.

Referenced by doPopNum(), evalInit(), getScore(), init(), and initWillStuff().

◆ cityPopDelta

Quad Micropolis::cityPopDelta

Change in the city population.

Depends on last cityPop.

Definition at line 1584 of file micropolis.h.

Referenced by doPopNum(), evalInit(), getScore(), and init().

◆ cityPopLast

Quad Micropolis::cityPopLast

Population of last city class check.

See also
CheckGrowth

Definition at line 1960 of file micropolis.h.

Referenced by checkGrowth(), and init().

◆ cityScore

short Micropolis::cityScore

City score.

Affected by average of problems, residential cap, commercial cap, industrial cap, road effect, police effect, fire effect, residential valve, commercial valve, industrial valve, city population, delta city population, fires, tax rate, and unpowered zones.

Definition at line 1607 of file micropolis.h.

Referenced by doScenarioScore(), doVotes(), evalInit(), getScore(), init(), initWillStuff(), setValves(), and simLoadInit().

◆ cityScoreDelta

short Micropolis::cityScoreDelta

Change in the city score.

Depends on city score.

Definition at line 1614 of file micropolis.h.

Referenced by evalInit(), getScore(), and init().

◆ cityTax

short Micropolis::cityTax

City tax rate.

Definition at line 1226 of file micropolis.h.

Referenced by collectTax(), doProblems(), getScore(), init(), loadFile(), saveFile(), sendMessages(), and setValves().

◆ cityTaxAverage

short Micropolis::cityTaxAverage

Definition at line 2120 of file micropolis.h.

◆ cityTime

Quad Micropolis::cityTime

City time unit counter, increnented once every 16 runs through the simulator (at fast speed). A time unit is 7.6 days. 4 units per month, 48 units per year, relative to startingYear

Four units per month, so one unit is about a week (7.6 days).

Definition at line 1093 of file micropolis.h.

Referenced by checkGrowth(), currentYear(), doHospitalChurch(), doSpecialZone(), generateSomeCity(), init(), loadFile(), loadScenario(), saveFile(), sendMessages(), simInit(), simLoadInit(), and updateDate().

◆ cityTimeLast

Quad Micropolis::cityTimeLast

Definition at line 2648 of file micropolis.h.

◆ cityYear

Quad Micropolis::cityYear

City year, (Micropolis::cityTime / 48) + Micropolis::startingYear.

Todo:
Remove, can be computed from Micropolis::cityTime.

Definition at line 1105 of file micropolis.h.

Referenced by init(), and updateDate().

◆ cityYearLast

Quad Micropolis::cityYearLast

Definition at line 2650 of file micropolis.h.

◆ cityYes

short Micropolis::cityYes

Yes votes.

Percentage of people who think the mayor is doing a good job.

Definition at line 1554 of file micropolis.h.

Referenced by cityEvaluation(), doVotes(), evalInit(), and init().

◆ coalPowerPop

short Micropolis::coalPowerPop

Coal power plant population.

Definition at line 1041 of file micropolis.h.

Referenced by doPowerScan(), doSpecialZone(), getAssessedValue(), init(), and sendMessages().

◆ comCap

bool Micropolis::comCap

Block commercial growth.

Definition at line 2102 of file micropolis.h.

Referenced by getScore(), init(), sendMessages(), setValves(), and simLoadInit().

◆ comHist

short* Micropolis::comHist

◆ comHist10Max

short Micropolis::comHist10Max

10 year commercial history maximum value.

Definition at line 1137 of file micropolis.h.

Referenced by init(), initGraphMax(), and take10Census().

◆ comHist120Max

short Micropolis::comHist120Max

120 year commercial history maximum value.

Definition at line 1142 of file micropolis.h.

Referenced by init(), and initGraphMax().

◆ comLast

Quad Micropolis::comLast

Definition at line 2658 of file micropolis.h.

◆ comPop

short Micropolis::comPop

Commercial zone population.

Depends on level of zone development.

Definition at line 990 of file micropolis.h.

Referenced by doCommercial(), getPopulation(), getUnemployment(), init(), sendMessages(), setValves(), simLoadInit(), and take10Census().

◆ comRateMap

MapShort8 Micropolis::comRateMap

Commercial rate map.

Depends on distance to city center. Affects commercial zone evaluation.

Definition at line 1332 of file micropolis.h.

Referenced by computeComRateMap(), evalCom(), init(), and initWillStuff().

◆ comValve

short Micropolis::comValve

Definition at line 2135 of file micropolis.h.

◆ comZonePop

short Micropolis::comZonePop

Number of commercial zones.

Definition at line 1015 of file micropolis.h.

Referenced by doCommercial(), init(), and sendMessages().

◆ crimeAverage

short Micropolis::crimeAverage

Average crime.

Affected by land value, population density, police station distance.

Definition at line 1064 of file micropolis.h.

Referenced by crimeScan(), doProblems(), doScenarioScore(), init(), sendMessages(), setValves(), simLoadInit(), and take10Census().

◆ crimeHist

short* Micropolis::crimeHist

◆ crimeMaxX

short Micropolis::crimeMaxX

X coordinate of most criminal area. Not used.

Definition at line 2058 of file micropolis.h.

Referenced by crimeScan(), and init().

◆ crimeMaxY

short Micropolis::crimeMaxY

Y coordinate of most criminal area. Not used.

Definition at line 2059 of file micropolis.h.

Referenced by crimeScan(), and init().

◆ crimeRamp

short Micropolis::crimeRamp

Definition at line 2097 of file micropolis.h.

◆ crimeRateMap

MapByte2 Micropolis::crimeRateMap

◆ curMapStackPointer

short Micropolis::curMapStackPointer
private

Position stack top pointer, points to top position.

Definition at line 2610 of file micropolis.h.

Referenced by addToTrafficDensityMap(), init(), makeTraffic(), pullPos(), pushPos(), and tryDrive().

◆ curMapStackXY

Position Micropolis::curMapStackXY[MAX_TRAFFIC_DISTANCE+1]
private

Position stack.

Definition at line 2611 of file micropolis.h.

Referenced by init(), pullPos(), and pushPos().

◆ disasterEvent

Scenario Micropolis::disasterEvent

The disaster for which a count-down is running.

Definition at line 2109 of file micropolis.h.

Referenced by doDisasters(), init(), initWillStuff(), scenarioDisaster(), and simLoadInit().

◆ disasterWait

short Micropolis::disasterWait

Count-down timer for the disaster.

Definition at line 2110 of file micropolis.h.

Referenced by init(), scenarioDisaster(), and simLoadInit().

◆ doAnimation

bool Micropolis::doAnimation

Enable animation.

Todo:
Currently always true. Should connect it to a frontend option.

Definition at line 1888 of file micropolis.h.

Referenced by destroyMapTile(), init(), putRubble(), and setDoAnimation().

◆ doInitialEval

bool Micropolis::doInitialEval

Need to perform initial city evaluation.

Definition at line 2128 of file micropolis.h.

Referenced by doSimInit(), generateSomeCity(), init(), loadFile(), and loadScenario().

◆ doMessages

bool Micropolis::doMessages
Todo:
Not currently used, should hook it up.

Definition at line 1890 of file micropolis.h.

Referenced by init(), and setDoMessages().

◆ donDither

Quad Micropolis::donDither

Integer with bits 0..2 that control smoothing.

Definition at line 2064 of file micropolis.h.

Referenced by init().

◆ doNotices

bool Micropolis::doNotices
Todo:
Not currently used, should hook it up.

Definition at line 1892 of file micropolis.h.

Referenced by init(), and setDoNotices().

◆ enableDisasters

bool Micropolis::enableDisasters

Enable disasters.

Definition at line 2354 of file micropolis.h.

Referenced by doAirplaneSprite(), doBusSprite(), doDisasters(), doSpecialZone(), init(), and setEnableDisasters().

◆ enableSound

bool Micropolis::enableSound

Enable sound.

Definition at line 2352 of file micropolis.h.

Referenced by init(), makeSound(), saveFile(), and setEnableSound().

◆ evalChanged

bool Micropolis::evalChanged

The evaluation window should be shown to the user.

Definition at line 2358 of file micropolis.h.

Referenced by changeEval(), init(), and scoreDoer().

◆ externalMarket

float Micropolis::externalMarket

Definition at line 2107 of file micropolis.h.

◆ faith

short Micropolis::faith

Faith bias.

Definition at line 1025 of file micropolis.h.

Referenced by init(), and take10Census().

◆ fireEffect

Quad Micropolis::fireEffect

Ratio of fire spending over fire funding, times MAX_FIRE_EFFECT.

Definition at line 1213 of file micropolis.h.

Referenced by collectTax(), doSpecialZone(), getScore(), init(), initWillStuff(), sendMessages(), simLoadInit(), and updateFundEffects().

◆ fireFund

Quad Micropolis::fireFund

Requested funds for fire stations.

Depends on fire station population.

Definition at line 1198 of file micropolis.h.

Referenced by collectTax(), doBudgetNow(), init(), initWillStuff(), and updateFundEffects().

◆ firePercent

float Micropolis::firePercent

Percentage of requested fire station costs to funding level.

Value between 0 and MAX_FIRESTATION_EFFECT. Affected by road funds slider and budgetary constraints.

Definition at line 1446 of file micropolis.h.

Referenced by doBudgetNow(), init(), loadFile(), and saveFile().

◆ firePop

short Micropolis::firePop

Number of fires.

Definition at line 976 of file micropolis.h.

Referenced by getFireSeverity(), and init().

◆ fireSpend

Quad Micropolis::fireSpend

Spending on fire stations.

Definition at line 1177 of file micropolis.h.

Referenced by doBudgetNow(), init(), and updateFundEffects().

◆ fireStationEffectMap

MapShort8 Micropolis::fireStationEffectMap

Copy of fire station map to display.

Definition at line 1308 of file micropolis.h.

Referenced by doFire(), fireAnalysis(), getFireCoverage(), getFireCoverageMapBuffer(), init(), initWillStuff(), and setFireCoverage().

◆ fireStationMap

MapShort8 Micropolis::fireStationMap

Fire station map.

Effectivity of fire control in this area.

Affected by fire stations, powered, fire funding ratio, road access. Affects how long fires burn.

See also
fireEffect

Definition at line 1303 of file micropolis.h.

Referenced by doSpecialZone(), fireAnalysis(), init(), and initWillStuff().

◆ fireStationPop

short Micropolis::fireStationPop

Fire station population.

Definition at line 1036 of file micropolis.h.

Referenced by collectTax(), doSpecialZone(), getAssessedValue(), init(), and sendMessages().

◆ fireValue

Quad Micropolis::fireValue

Amount of fire station funding granted.

Definition at line 1461 of file micropolis.h.

Referenced by doBudgetNow(), and init().

◆ floodCount

short Micropolis::floodCount

Size of flooding disaster.

Definition at line 1515 of file micropolis.h.

Referenced by doDisasters(), doFlood(), init(), and makeFlood().

◆ freeSprites

SimSprite* Micropolis::freeSprites
private

Pool of free SimSprite objects.

Definition at line 2239 of file micropolis.h.

Referenced by destroySprite(), init(), and newSprite().

◆ gameLevel

GameLevel Micropolis::gameLevel

Difficulty level of the game (0..2)

Definition at line 2342 of file micropolis.h.

Referenced by collectTax(), doDisasters(), doSpecialZone(), init(), setGameLevel(), setValves(), simLoadInit(), and updateGameLevel().

◆ generatedCitySeed

int Micropolis::generatedCitySeed

The seed of the most recently generated city.

Definition at line 1743 of file micropolis.h.

Referenced by generateMap().

◆ globalSprites

SimSprite* Micropolis::globalSprites[SPRITE_COUNT]
private

Definition at line 2241 of file micropolis.h.

◆ graph10Max

short Micropolis::graph10Max
Todo:
Write-only variable. Can it be removed?

Definition at line 1808 of file micropolis.h.

Referenced by init(), initGraphMax(), and take10Census().

◆ graph120Max

short Micropolis::graph120Max
Todo:
Write-only variable. Can it be removed?

Definition at line 1813 of file micropolis.h.

Referenced by init(), and initGraphMax().

◆ heatFlow

int Micropolis::heatFlow

Heat flow.

Definition at line 1928 of file micropolis.h.

Referenced by init(), and simHeat().

◆ heatRule

int Micropolis::heatRule

Heat rule.

Definition at line 1933 of file micropolis.h.

Referenced by init(), and simHeat().

◆ heatSteps

int Micropolis::heatSteps

Heat steps.

Definition at line 1923 of file micropolis.h.

Referenced by init(), and simUpdate().

◆ heatWrap

int Micropolis::heatWrap

Heat wrap.

Definition at line 1938 of file micropolis.h.

Referenced by init(), and simHeat().

◆ historyInitialized

bool Micropolis::historyInitialized
Todo:
Nobody uses this variable. Can it be removed?

Definition at line 1803 of file micropolis.h.

Referenced by initGraphs().

◆ hospitalPop

short Micropolis::hospitalPop

Number of hospitals.

Definition at line 1023 of file micropolis.h.

Referenced by doHospitalChurch(), getAssessedValue(), init(), and take10Census().

◆ indCap

bool Micropolis::indCap

Block industrial growth.

Definition at line 2103 of file micropolis.h.

Referenced by getScore(), init(), sendMessages(), setValves(), and simLoadInit().

◆ indHist

short* Micropolis::indHist

◆ indHist10Max

short Micropolis::indHist10Max

10 year industrial history maximum value.

Definition at line 1147 of file micropolis.h.

Referenced by init(), initGraphMax(), and take10Census().

◆ indHist120Max

short Micropolis::indHist120Max

120 year industrial history maximum value.

Definition at line 1152 of file micropolis.h.

Referenced by init(), and initGraphMax().

◆ indLast

Quad Micropolis::indLast

Definition at line 2660 of file micropolis.h.

◆ indPop

short Micropolis::indPop

Industrial zone population.

Depends on level of zone development.

Definition at line 997 of file micropolis.h.

Referenced by doIndustrial(), getPopulation(), getUnemployment(), init(), sendMessages(), setValves(), simLoadInit(), and take10Census().

◆ indValve

short Micropolis::indValve

Definition at line 2136 of file micropolis.h.

◆ indZonePop

short Micropolis::indZonePop

Number of industrial zones.

Definition at line 1016 of file micropolis.h.

Referenced by doIndustrial(), init(), and sendMessages().

◆ initSimLoad

short Micropolis::initSimLoad

Definition at line 2344 of file micropolis.h.

◆ landValueAverage

short Micropolis::landValueAverage

Land value average.

Affected by distance from city center, development density (terrainMem), pollution, and crime.

Definition at line 1081 of file micropolis.h.

Referenced by collectTax(), doProblems(), init(), setValves(), and simLoadInit().

◆ landValueMap

◆ map

◆ mapBase

unsigned short* Micropolis::mapBase
private

Memory for map array.

Definition at line 1398 of file micropolis.h.

Referenced by destroyMapArrays(), getMapBuffer(), initMapArrays(), and loadFileData().

◆ mapSerial

int Micropolis::mapSerial

The invalidateMaps method increases the map serial number every time the maps changes.

Definition at line 2130 of file micropolis.h.

Referenced by init(), and invalidateMaps().

◆ messageNumber

short Micropolis::messageNumber

Definition at line 2356 of file micropolis.h.

◆ messageTimeLast

Quad Micropolis::messageTimeLast

Definition at line 2340 of file micropolis.h.

◆ miscHist

short* Micropolis::miscHist

Memory used to save miscelaneous game values in save file.

Definition at line 1373 of file micropolis.h.

Referenced by destroyMapArrays(), initMapArrays(), loadFile(), loadFileData(), saveFile(), setValves(), and simLoadInit().

◆ moneyHist

short* Micropolis::moneyHist

◆ mop

unsigned short* Micropolis::mop[WORLD_W]

Definition at line 1122 of file micropolis.h.

◆ mopBase

unsigned short* Micropolis::mopBase
private

Definition at line 1399 of file micropolis.h.

◆ mustDrawBudget

int Micropolis::mustDrawBudget

Flag set when budget window needs to be updated.

Definition at line 1466 of file micropolis.h.

Referenced by doBudgetNow(), init(), updateBudget(), and updateFundEffects().

◆ mustUpdateFunds

bool Micropolis::mustUpdateFunds

Definition at line 2644 of file micropolis.h.

◆ mustUpdateOptions

bool Micropolis::mustUpdateOptions

◆ needChurch

short Micropolis::needChurch
private

Need church?

0 if no, 1 if yes, -1 if too many.

Definition at line 1392 of file micropolis.h.

Referenced by doHospitalChurch(), init(), makeHospital(), and take10Census().

◆ needHospital

short Micropolis::needHospital
private

Need hospital?

0 if no, 1 if yes, -1 if too many.

Definition at line 1385 of file micropolis.h.

Referenced by doHospitalChurch(), init(), makeHospital(), and take10Census().

◆ newMap

short Micropolis::newMap
Todo:
Write-only variable, can be removed?

Definition at line 2047 of file micropolis.h.

Referenced by doSimInit(), and init().

◆ newMapFlags

short Micropolis::newMapFlags[MAP_TYPE_COUNT]
Todo:
Write-only variable, can be removed?

Definition at line 2050 of file micropolis.h.

Referenced by crimeScan(), fireAnalysis(), init(), and populationDensityScan().

◆ newPower

bool Micropolis::newPower

Definition at line 2118 of file micropolis.h.

◆ nextRandom

UQuad Micropolis::nextRandom

Definition at line 2025 of file micropolis.h.

◆ nuclearPowerPop

short Micropolis::nuclearPowerPop

Nuclear power plant population.

Definition at line 1046 of file micropolis.h.

Referenced by doPowerScan(), doSpecialZone(), getAssessedValue(), init(), and sendMessages().

◆ phaseCycle

short Micropolis::phaseCycle

Definition at line 2124 of file micropolis.h.

◆ policeEffect

Quad Micropolis::policeEffect

Ratio of police spending over police funding, times MAX_POLICE_EFFECT.

Definition at line 1208 of file micropolis.h.

Referenced by collectTax(), doSpecialZone(), getScore(), init(), initWillStuff(), sendMessages(), simLoadInit(), and updateFundEffects().

◆ policeFund

Quad Micropolis::policeFund

Requested funds for police stations.

Depends on police station population.

Definition at line 1191 of file micropolis.h.

Referenced by collectTax(), doBudgetNow(), init(), initWillStuff(), and updateFundEffects().

◆ policePercent

float Micropolis::policePercent

Percentage of requested police station costs to funding level.

Value between 0 and MAX_POLICESTATION_EFFECT. Affected by road funds slider and budgetary constraints.

Definition at line 1438 of file micropolis.h.

Referenced by doBudgetNow(), init(), loadFile(), and saveFile().

◆ policeSpend

Quad Micropolis::policeSpend

Spending on police stations.

Definition at line 1172 of file micropolis.h.

Referenced by doBudgetNow(), init(), and updateFundEffects().

◆ policeStationEffectMap

MapShort8 Micropolis::policeStationEffectMap

Copy of police station map to display.

Definition at line 1324 of file micropolis.h.

Referenced by crimeScan(), getPoliceCoverage(), getPoliceCoverageMapBuffer(), init(), initWillStuff(), and setPoliceCoverage().

◆ policeStationMap

MapShort8 Micropolis::policeStationMap

Police station map.

Effectivity of police in fighting crime.

Affected by police stations, powered, police funding ratio, road access. Affects crime rate.

See also
policeEffect

Definition at line 1319 of file micropolis.h.

Referenced by crimeScan(), doSpecialZone(), init(), and initWillStuff().

◆ policeStationPop

short Micropolis::policeStationPop

Police station population.

Definition at line 1031 of file micropolis.h.

Referenced by collectTax(), doSpecialZone(), getAssessedValue(), init(), and sendMessages().

◆ policeValue

Quad Micropolis::policeValue

Amount of police funding granted.

Definition at line 1456 of file micropolis.h.

Referenced by doBudgetNow(), and init().

◆ pollutionAverage

short Micropolis::pollutionAverage

Average pollution.

Affected by PollutionMem, which is effected by traffic, fire, radioactivity, industrial zones, seaports, airports, power plants.

Definition at line 1073 of file micropolis.h.

Referenced by doDisasters(), doProblems(), init(), sendMessages(), setValves(), simLoadInit(), and take10Census().

◆ pollutionDensityMap

◆ pollutionHist

short* Micropolis::pollutionHist

◆ pollutionMaxX

short Micropolis::pollutionMaxX

X coordinate of most polluted area.

Definition at line 2055 of file micropolis.h.

Referenced by init(), initSprite(), and makeMonster().

◆ pollutionMaxY

short Micropolis::pollutionMaxY

Y coordinate of most polluted area.

Definition at line 2056 of file micropolis.h.

Referenced by init(), initSprite(), and makeMonster().

◆ pollutionRamp

short Micropolis::pollutionRamp

Definition at line 2099 of file micropolis.h.

◆ populationDensityMap

◆ poweredZoneCount

short Micropolis::poweredZoneCount

Number of powered tiles in all zone.

Definition at line 2115 of file micropolis.h.

Referenced by doZone(), getScore(), init(), and sendMessages().

◆ powerGridMap

MapByte1 Micropolis::powerGridMap

◆ powerStackPointer

int Micropolis::powerStackPointer
private

Stack counter, points to top-most item.

Definition at line 2002 of file micropolis.h.

Referenced by doPowerScan(), init(), pullPowerStack(), and pushPowerStack().

◆ powerStackXY

Position Micropolis::powerStackXY[POWER_STACK_SIZE]
private

Stack of X/Y positions for traversing setting the power grid.

Definition at line 2005 of file micropolis.h.

Referenced by init(), pullPowerStack(), and pushPowerStack().

◆ problemOrder

short Micropolis::problemOrder[CVP_PROBLEM_COMPLAINTS]

Order of taken problems.

Contains index of MicropolisEngine::problemVotes of taken problems, in decreasing order.

Note
Value CVP_NUMPROBLEMS means that the entry is not used

Definition at line 1570 of file micropolis.h.

Referenced by countProblems(), doProblems(), evalInit(), getProblemNumber(), getProblemVotes(), and init().

◆ problemVotes

short Micropolis::problemVotes[PROBNUM]

Problem votes.

The number of votes for each problem.

See also
CityVotingProblems

Definition at line 1562 of file micropolis.h.

Referenced by doProblems(), evalInit(), getProblemVotes(), init(), and voteProblems().

◆ railTotal

short Micropolis::railTotal

Total number of rails.

No penalty for bridges or high traffic density.

Definition at line 971 of file micropolis.h.

Referenced by collectTax(), doRail(), getAssessedValue(), init(), and sendMessages().

◆ rateOfGrowthMap

MapShort8 Micropolis::rateOfGrowthMap

Rate of growth map.

Affected by DecROGMem, incROG called by zones. Decreased by fire explosions from sprites, fire spreading. Doesn't seem to actually feed back into the simulation. Output only.

Definition at line 1292 of file micropolis.h.

Referenced by decRateOfGrowthMap(), fireZone(), getDensity(), getRateOfGrowth(), getRateOfGrowthMapBuffer(), incRateOfGrowth(), init(), initWillStuff(), setRateOfGrowth(), and startFireInZone().

◆ resCap

bool Micropolis::resCap

Block residential growth.

Definition at line 2101 of file micropolis.h.

Referenced by getScore(), init(), sendMessages(), setValves(), and simLoadInit().

◆ resHist

short* Micropolis::resHist

◆ resHist10Max

short Micropolis::resHist10Max

10 year residential history maximum value.

Definition at line 1127 of file micropolis.h.

Referenced by init(), initGraphMax(), and take10Census().

◆ resHist120Max

short Micropolis::resHist120Max

120 year residential history maximum value.

Definition at line 1132 of file micropolis.h.

Referenced by init(), and initGraphMax().

◆ resLast

Quad Micropolis::resLast

Definition at line 2656 of file micropolis.h.

◆ resPop

short Micropolis::resPop

Number of people in the residential zones.

Depends on level of zone development.

Definition at line 983 of file micropolis.h.

Referenced by doResidential(), getPopulation(), getUnemployment(), init(), sendMessages(), setValves(), simLoadInit(), and take10Census().

◆ resValve

short Micropolis::resValve

Definition at line 2134 of file micropolis.h.

◆ resZonePop

short Micropolis::resZonePop

Number of residential zones.

Definition at line 1014 of file micropolis.h.

Referenced by doResidential(), init(), and sendMessages().

◆ roadEffect

Quad Micropolis::roadEffect

Ratio of road spending over road funding, times MAX_ROAD_EFFECT.

Definition at line 1203 of file micropolis.h.

Referenced by collectTax(), doRail(), doRoad(), getScore(), init(), initWillStuff(), sendMessages(), simLoadInit(), and updateFundEffects().

◆ roadFund

Quad Micropolis::roadFund

Requested funds for roads.

Depends on number of roads, rails, and game level.

Definition at line 1184 of file micropolis.h.

Referenced by collectTax(), doBudgetNow(), init(), initWillStuff(), and updateFundEffects().

◆ roadPercent

float Micropolis::roadPercent

Percentage of requested road and rail costs to funding level.

Value between 0 and MAX_ROAD_EFFECT. Affected by road funds slider and budgetary constraints.

Definition at line 1430 of file micropolis.h.

Referenced by doBudgetNow(), init(), loadFile(), and saveFile().

◆ roadSpend

Quad Micropolis::roadSpend

Spending on roads.

Definition at line 1167 of file micropolis.h.

Referenced by doBudgetNow(), init(), and updateFundEffects().

◆ roadTotal

short Micropolis::roadTotal

Number of road tiles in the game.

Bridges count as 4 tiles, and high density traffic counts as 2 tiles.

Definition at line 964 of file micropolis.h.

Referenced by collectTax(), doRoad(), getAssessedValue(), init(), and sendMessages().

◆ roadValue

Quad Micropolis::roadValue

Amount of road funding granted.

Definition at line 1451 of file micropolis.h.

Referenced by doBudgetNow(), and init().

◆ scenario

Scenario Micropolis::scenario

Scenario being played.

Definition at line 2346 of file micropolis.h.

Referenced by doShipSprite(), doStartScenario(), generateSomeCity(), init(), loadFile(), loadScenario(), sendMessages(), simInit(), and simLoadInit().

◆ scoreType

Scenario Micropolis::scoreType

The type of score table to use.

Definition at line 2112 of file micropolis.h.

Referenced by init(), sendMessages(), and simLoadInit().

◆ scoreWait

short Micropolis::scoreWait

Time to wait before computing the score.

Definition at line 2113 of file micropolis.h.

Referenced by init(), sendMessages(), and simLoadInit().

◆ seaportPop

short Micropolis::seaportPop

Seaport population.

Definition at line 1051 of file micropolis.h.

Referenced by doSpecialZone(), getAssessedValue(), init(), and sendMessages().

◆ simCycle

short Micropolis::simCycle

Definition at line 2122 of file micropolis.h.

◆ simLoops

int Micropolis::simLoops

Definition at line 1862 of file micropolis.h.

◆ simPass

int Micropolis::simPass

The count of the current pass through the simulator loop.

Definition at line 1872 of file micropolis.h.

Referenced by init(), simInit(), simTick(), toolDown(), and toolDrag().

◆ simPasses

int Micropolis::simPasses

The number of passes through the simulator loop to take each tick.

Definition at line 1867 of file micropolis.h.

Referenced by init(), simInit(), and simTick().

◆ simPaused

bool Micropolis::simPaused

Simulation is paused

Todo:
Variable has reversed logic, maybe use sim_running instead?

Definition at line 1878 of file micropolis.h.

Referenced by init(), pause(), resume(), and simInit().

◆ simPausedSpeed

int Micropolis::simPausedSpeed

Definition at line 1880 of file micropolis.h.

◆ simSpeed

short Micropolis::simSpeed

Definition at line 2348 of file micropolis.h.

◆ simSpeedMeta

short Micropolis::simSpeedMeta

Definition at line 2350 of file micropolis.h.

◆ speedCycle

short Micropolis::speedCycle

Definition at line 2126 of file micropolis.h.

◆ spriteCycle

short Micropolis::spriteCycle
private

Definition at line 2245 of file micropolis.h.

◆ spriteList

SimSprite* Micropolis::spriteList

◆ stadiumPop

short Micropolis::stadiumPop

Number of stadiums.

Definition at line 1026 of file micropolis.h.

Referenced by doSpecialZone(), getAssessedValue(), init(), and sendMessages().

◆ startingYear

short Micropolis::startingYear

City starting year.

Definition at line 1110 of file micropolis.h.

Referenced by currentYear(), init(), simInit(), and updateDate().

◆ taxFlag

bool Micropolis::taxFlag

Tax port flag.

Apparently never used. CollectTax checks it.

Todo:

Apparently taxFlag is never set to true in MicropolisEngine or the TCL code.

Don should check old Mac code to see if it's ever set.

Variable is always 0. Decide whether to keep it, and if yes, create means to modify its value

Definition at line 1239 of file micropolis.h.

Referenced by collectTax(), init(), and initWillStuff().

◆ taxFund

Quad Micropolis::taxFund

Funds from taxes.

Depends on total population, average land value, city tax, and game level.

Definition at line 1221 of file micropolis.h.

Referenced by collectTax(), doBudgetNow(), and init().

◆ tempMap1

MapByte2 Micropolis::tempMap1

Temporary map 1.

Used to smooth population density, pollution.

Definition at line 1264 of file micropolis.h.

Referenced by destroyMapArrays(), and populationDensityScan().

◆ tempMap2

MapByte2 Micropolis::tempMap2

Temporary map 2.

Used to smooth population density, pollution.

Definition at line 1271 of file micropolis.h.

Referenced by destroyMapArrays(), and populationDensityScan().

◆ tempMap3

MapByte4 Micropolis::tempMap3

Temporary map 3.

Used to smooth development density, for terrainDensityMap.

Definition at line 1278 of file micropolis.h.

Referenced by destroyMapArrays().

◆ terrainCreateIsland

int Micropolis::terrainCreateIsland

Controls how often to create an island. -1 => 10% chance of island, 0 => never create island, 1 => always create island

Definition at line 1738 of file micropolis.h.

Referenced by generateMap(), and init().

◆ terrainCurveLevel

int Micropolis::terrainCurveLevel

Controls the level of river curviness. -1 => default curve level, 0 => never create rivers, >0 => create curvier rivers

Definition at line 1732 of file micropolis.h.

Referenced by doBRiver(), doSRiver(), generateMap(), and init().

◆ terrainDensityMap

MapByte4 Micropolis::terrainDensityMap

Terrain development density map.

Used to calculate land value.

Definition at line 1257 of file micropolis.h.

Referenced by destroyMapArrays(), init(), and initWillStuff().

◆ terrainLakeLevel

int Micropolis::terrainLakeLevel

Controls the level of lake creation. -1 => create default number of lakes, 0 => never create lakes, >0 => create more lakes

Definition at line 1726 of file micropolis.h.

Referenced by generateMap(), init(), and makeLakes().

◆ terrainTreeLevel

int Micropolis::terrainTreeLevel

Controls the level of tree creation. -1 => create default number of trees, 0 => never create trees, >0 => create more trees

Definition at line 1720 of file micropolis.h.

Referenced by doTrees(), generateMap(), init(), and treeSplash().

◆ tilesAnimated

bool Micropolis::tilesAnimated
Todo:
Not currently used, should hook it up.

Definition at line 1882 of file micropolis.h.

Referenced by init(), and simUpdate().

◆ totalFunds

Quad Micropolis::totalFunds

Funds of the player.

Definition at line 2323 of file micropolis.h.

Referenced by doBudgetNow(), init(), ToolEffects::modifyIfEnoughFunding(), saveFile(), setFunds(), and spend().

◆ totalFundsLast

Quad Micropolis::totalFundsLast

Definition at line 2654 of file micropolis.h.

◆ totalPop

short Micropolis::totalPop

Total population.

Includes residential pop / 8 plus industrial pop plus commercial pop.

Definition at line 1005 of file micropolis.h.

Referenced by cityEvaluation(), collectTax(), doSimInit(), generateTrain(), init(), sendMessages(), and setValves().

◆ totalPopLast

short Micropolis::totalPopLast

Last total population.

Not used?

Definition at line 1012 of file micropolis.h.

Referenced by init(), and setValves().

◆ totalZonePop

short Micropolis::totalZonePop

Total zone population.

Definition at line 1021 of file micropolis.h.

Referenced by init(), and sendMessages().

◆ trafficAverage

short Micropolis::trafficAverage

Average traffic.

Depends on average traffic density of tiles with non-zero land value.

Definition at line 1621 of file micropolis.h.

Referenced by doScenarioScore(), getTrafficAverage(), init(), and sendMessages().

◆ trafficDensityMap

◆ trafMaxX

short Micropolis::trafMaxX
private

X coordinate of a position with heavy traffic.

Definition at line 2613 of file micropolis.h.

Referenced by addToTrafficDensityMap(), and init().

◆ trafMaxY

short Micropolis::trafMaxY
private

Y coordinate of a position with heavy traffic.

Definition at line 2614 of file micropolis.h.

Referenced by addToTrafficDensityMap(), and init().

◆ unpoweredZoneCount

short Micropolis::unpoweredZoneCount

Number of unpowered tiles in all zones.

Definition at line 2116 of file micropolis.h.

Referenced by doZone(), getScore(), init(), and sendMessages().

◆ userData

void* Micropolis::userData

Hook for scripting language to store context (i.e. peer object). (i.e. Python SWIG wrapper of this Micropolis object.)

Definition at line 2377 of file micropolis.h.

◆ valveFlag

bool Micropolis::valveFlag

Definition at line 2095 of file micropolis.h.


The documentation for this class was generated from the following files: