Micropolis
Micropolis Class Reference

#include <micropolis.h>

Public Member Functions

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

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]
 
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 ()
 
void init ()
 

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
 
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. More...
 
int heatSteps
 
int heatFlow
 
int heatRule
 
int heatWrap
 
Quad cityPopLast
 Population of last city class check. More...
 
short categoryLast
 City class of last city class check. More...
 
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 ()
 
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
 
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.
 
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]
 
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
 
short resValve
 
short comValve
 
short indValve
 
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 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 ()
 
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 ()
 
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 923 of file micropolis.h.

Constructor & Destructor Documentation

◆ Micropolis()

Micropolis::Micropolis ( )

Simulator constructor.

Definition at line 88 of file micropolis.cpp.

References init().

◆ ~Micropolis()

Micropolis::~Micropolis ( )

Simulator destructor.

Definition at line 112 of file micropolis.cpp.

Member Function Documentation

◆ addToTrafficDensityMap()

void Micropolis::addToTrafficDensityMap ( )
private

Update the trafficDensityMap from the positions at the curMapStackXY stack.

Definition at line 165 of file traffic.cpp.

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

Referenced by makeTraffic(), and makeTrafficAt().

◆ 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.

◆ 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 457 of file zone.cpp.

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

◆ bulldozerTool()

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(), checkBigZone(), checkSize(), gCostOf, ToolEffects::getMapValue(), LOMASK, 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 LOMASK, map, and testBounds().

◆ 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 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.

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(), and doTornadoSprite().

◆ 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 totalPop.

◆ 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 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 1662 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:
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 852 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 881 of file zone.cpp.

Referenced by doComIn(), and doComOut().

◆ computeComRateMap()

void Micropolis::computeComRateMap ( )
private

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 autoBulldoze, BULLBIT, CONNECT_TILE_RAILROAD, CONNECT_TILE_ROAD, CONNECT_TILE_WIRE, ToolEffects::getMapValue(), LOMASK, neutralizeRoad(), testBounds(), TOOLRESULT_FAILED, and TOOLRESULT_OK.

Referenced by 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 369 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

◆ 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 LOMASK, map, and testBounds().

Referenced by 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 538 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 494 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 548 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 603 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 593 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 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 1645 of file simulate.cpp.

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

◆ 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 1139 of file simulate.cpp.

◆ 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, policeFund, policePercent, policeSpend, policeValue, roadFund, roadPercent, roadSpend, roadValue, taxFund, and totalFunds.

Referenced by doBudget(), and doBudgetFromMenu().

◆ doBusSprite()

void Micropolis::doBusSprite ( SimSprite sprite)

Move bus sprite.

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

Definition at line 1342 of file sprite.cpp.

References SimSprite::frame, trafficDensityMap, WORLD_H_2, Map< DATA, BLKSIZE >::worldGet(), SimSprite::x, SimSprite::xHot, SimSprite::y, and SimSprite::yHot.

Referenced by moveObjects().

◆ 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 821 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 763 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.

◆ 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 844 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 1159 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 1294 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, floodCount, getRandom16(), LOMASK, map, Position::posX, Position::posY, and testBounds().

◆ 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 407 of file zone.cpp.

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

◆ 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 145 of file zone.cpp.

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

◆ 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 965 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 979 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 915 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.

◆ 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 1682 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 SimSprite::destX, SimSprite::destY, SimSprite::frame, getChar(), getDir(), getRandom(), getRandom16(), makeSound(), 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 321 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().

◆ 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.

◆ doRadTile()

void Micropolis::doRadTile ( const Position pos)
private

Handle decay of radio-active tile

Parameters
posPosition of the radio-active tile.

Definition at line 1054 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 1019 of file simulate.cpp.

References CONDBIT, generateTrain(), getRandom16(), LOMASK, map, MAX_ROAD_EFFECT, Position::posX, Position::posY, railTotal, 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 546 of file zone.cpp.

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

◆ 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 612 of file zone.cpp.

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

◆ 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 653 of file zone.cpp.

References incRateOfGrowth(), map, Position::posX, Position::posY, and resPlop().

◆ 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

Handle road tile.

Parameters
posPosition of the road.

Definition at line 1066 of file simulate.cpp.

◆ 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 583 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.

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.

◆ doSimInit()

void Micropolis::doSimInit ( )
private

Initialize simulation.

Todo:
Create constants for initSimLoad.

Definition at line 286 of file simulate.cpp.

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

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

◆ doSpecialZone()

void Micropolis::doSpecialZone ( const Position pos,
bool  powerOn 
)
private

◆ 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 1133 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 1124 of file micropolis.cpp.

References callback, and scenario.

Referenced by simLoadInit().

◆ doTool()

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

Apply a tool.

Parameters
toolTool to use.
tileXHorizontal position in the city map.
tileYVertical position in the city map.
Returns
Tool result.

Definition at line 1397 of file tool.cpp.

Referenced by toolDown(), and toolDrag().

◆ 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(), 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().

◆ 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().

◆ 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

Handle zone.

Parameters
posPosition of the zone.

Definition at line 91 of file zone.cpp.

References LOMASK, map, PORTBASE, Position::posX, Position::posY, poweredZoneCount, setZonePower(), and unpoweredZoneCount.

◆ 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 COALSMOKE1, 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 1624 of file simulate.cpp.

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

◆ 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.

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 895 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 1027 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, and cityYes.

◆ evalLot()

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

Evaluate suitability of the position for placing a new house.

Returns
Suitability.

Definition at line 512 of file zone.cpp.

References LOMASK, and map.

Referenced by buildHouse().

◆ evalRes()

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

Evaluate residential zone.

Definition at line 734 of file zone.cpp.

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

◆ 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 ( )
private

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 1357 of file simulate.cpp.

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

Referenced by doFire().

◆ 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 ToolEffects::getMapTile(), and neutralizeRoad().

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.

◆ 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.

◆ freePtr()

void Micropolis::freePtr ( void *  data)

Release claimed memory.

Parameters
dataPointer to previously claimed memory.

Definition at line 1113 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(), map, and WORLD_W.

◆ 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.

◆ 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 1264 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.

◆ 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 
)
private

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 864 of file zone.cpp.

Referenced by doCommercial().

◆ 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 1448 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 1474 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().

◆ 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().

◆ 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 1528 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 1554 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().

◆ 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 999 of file zone.cpp.

References INDCLR, and IZB.

Referenced by doIndustrial().

◆ 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 321 of file zone.cpp.

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

Referenced by doCommercial().

◆ 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 1488 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 1514 of file micropolis.cpp.

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

◆ 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 1234 of file micropolis.cpp.

References mapBase.

◆ 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 1567 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 1593 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 1408 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 1434 of file micropolis.cpp.

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

◆ getPollutionValue()

int Micropolis::getPollutionValue ( int  loc)
private

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.

◆ 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 
)
private

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.

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 1288 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 1314 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 1248 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 1274 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()

short Micropolis::getRandom ( short  range)

Draw a random number in a given range.

Parameters
rangeUpper bound of the range (inclusive).
Returns
Random number between 0 and range (inclusive).
Bug:
Increment may cause range overflow.

Definition at line 110 of file random.cpp.

References getRandom16().

Referenced by doAirplaneSprite(), doAirport(), doBRiver(), doCommercial(), doDisasters(), doFire(), doIndustrial(), doMakeSound(), doMeltdown(), doMonsterSprite(), doRivers(), doSpecialZone(), doSRiver(), doTornadoSprite(), doTrees(), doVotes(), fireBomb(), generateBus(), generateMap(), generateTrain(), getERandom(), initSprite(), makeEarthquake(), makeFire(), makeFlood(), makeLakes(), makeMonster(), makeSingleLake(), makeTornado(), makeTraffic(), putDownPark(), setFire(), and treeSplash().

◆ getRandom16()

int Micropolis::getRandom16 ( )

◆ getRandom16Signed()

int Micropolis::getRandom16Signed ( )

Get signed 16 bit random number.

Definition at line 137 of file random.cpp.

References getRandom16().

Referenced by doCommercial(), and doIndustrial().

◆ 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 1328 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 1354 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 709 of file zone.cpp.

◆ 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.

◆ 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 doCopterSprite(), 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 1202 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().

◆ 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 1368 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 1394 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.

◆ 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 349 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(), 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 1015 of file zone.cpp.

References IND1, and zonePlop().

Referenced by doIndIn(), and doIndOut().

◆ init()

◆ initGame()

void Micropolis::initGame ( )

Initialize the game. This is called from the scripting language.

Todo:
we seem to have several of these functions.

Definition at line 1144 of file micropolis.cpp.

References heatSteps, simPass, simPasses, and simPaused.

◆ 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 simInit().

◆ 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 1168 of file micropolis.cpp.

References callback, and mapSerial.

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

◆ landTool()

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

Definition at line 1328 of file tool.cpp.

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

◆ 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 BULLBIT, ToolEffects::getMapValue(), HBRIDGE, LOMASK, neutralizeRoad(), TOOLRESULT_FAILED, and VBRIDGE.

◆ 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 DIRT, ToolEffects::getMapTile(), neutralizeRoad(), and ToolEffects::setMapValue().

◆ 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 DIRT, ToolEffects::getMapTile(), and ToolEffects::setMapValue().

◆ 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 DIRT, ToolEffects::getMapTile(), neutralizeRoad(), and ToolEffects::setMapValue().

◆ 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 508 of file fileio.cpp.

References cityFileName, didLoadCity(), didntLoadCity(), 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 251 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(), map, MISC_HISTORY_LENGTH, miscHist, moneyHist, pollutionHist, resHist, WORLD_H, and WORLD_W.

Referenced by loadFile(), and loadScenario().

◆ loadScenario()

void Micropolis::loadScenario ( Scenario  s)

◆ 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 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 getRandom(), LOMASK, map, 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 290 of file zone.cpp.

References needHospital, and zonePlop().

◆ 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 SimSprite::destX, SimSprite::destY, getRandom(), getSprite(), 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.

◆ 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 ISLAND_RADIUS, map, 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.

◆ 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 1185 of file micropolis.cpp.

References callback, and enableSound.

Referenced by doCopterSprite(), doEarthquake(), doExplosionSprite(), doMakeSound(), doMonsterSprite(), 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 Position::posX, and Position::posY.

Referenced by doCommercial(), and doIndustrial().

◆ 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().

◆ 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.

◆ 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 1103 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.

◆ 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.

Referenced by doBRiver(), 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.

Referenced by doSRiver(), and makeSingleLake().

◆ 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, 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.

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::setMapValue().

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(), and TOOLRESULT_FAILED.

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(), DIRT, gCostOf, ToolEffects::getMapTile(), and tally().

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 BULLBIT, BURNBIT, and getRandom().

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::getMapTile().

◆ 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().

◆ 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 DIRT, doAnimation, ToolEffects::getMapTile(), RADTILE, and testBounds().

◆ 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.

◆ 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.

◆ randomFire()

MapValue Micropolis::randomFire ( )
inlineprivate

Generate a random animated Tiles::FIRE tile

Definition at line 2139 of file micropolis.h.

Referenced by doFire(), doMeltdown(), makeEarthquake(), makeFire(), 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 2145 of file micropolis.h.

Referenced by doFire(), and makeEarthquake().

◆ 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 1404 of file simulate.cpp.

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

Referenced by 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 722 of file zone.cpp.

Referenced by 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.

◆ 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 559 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 616 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 337 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(), doCopterSprite(), doExplosionSprite(), doMeltdown(), doPowerScan(), doScenarioScore(), explodeSprite(), fireBomb(), makeEarthquake(), makeFire(), makeMonsterAt(), makeTornado(), sendMessages(), 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 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().

◆ 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().

◆ 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 1462 of file micropolis.cpp.

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

◆ 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(), LOMASK, map, 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 1542 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 1077 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 1502 of file micropolis.cpp.

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

◆ 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 1581 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 1422 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 1302 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 1262 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 1342 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:
Add #SMOKEBASE into aniTabA and aniTabB tables?
Todo:
Why do we assign the same map position twice?

Definition at line 235 of file zone.cpp.

References IND1.

Referenced by doIndustrial().

◆ 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 1219 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 1382 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 560 of file simulate.cpp.

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

Referenced by doSimInit().

◆ 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 431 of file zone.cpp.

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

Referenced by doNilPower(), and doZone().

◆ 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 806 of file micropolis.cpp.

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

◆ simInit()

◆ simLoadInit()

◆ 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 1043 of file micropolis.cpp.

References simPass, simPasses, and simUpdate().

◆ simUpdate()

void Micropolis::simUpdate ( )

Update ????

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

Definition at line 783 of file micropolis.cpp.

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

Referenced by generateSomeCity(), and simTick().

◆ 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().

◆ 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(), and testBounds().

◆ spend()

void Micropolis::spend ( int  dollars)

Deduct dollars from the player funds.

Parameters
dollarsAmount of money spent.

Definition at line 1064 of file micropolis.cpp.

References setFunds(), and totalFunds.

Referenced by 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(), 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 clamp(), LOMASK, PORTBASE, rateOfGrowthMap, Map< DATA, BLKSIZE >::worldGet(), and Map< DATA, BLKSIZE >::worldSet().

◆ 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 726 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.

◆ 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 prepareBuildingSite(), and putDownNetwork().

◆ testBounds()

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

Check that the given coordinate is within world bounds

Parameters
wxWorld x coordinate
wyWorld y coordinate
Returns
Boolean indicating (wx, wy) is inside the world bounds

Definition at line 2378 of file micropolis.h.

References WORLD_H.

Referenced by buildHouse(), bulldozerTool(), canDriveOn(), connectTile(), destroyMapTile(), doBRiver(), doFire(), doFlood(), doMeltdown(), doSRiver(), findPerimeterRoad(), findPerimeterTelecom(), forestTool(), getChar(), getTile(), landTool(), makeExplosion(), networkTool(), parkTool(), putOnMap(), putRubble(), queryTool(), railroadTool(), repairZone(), roadTool(), setTile(), smoothTreesAt(), startFire(), wireTool(), and zonePlop().

◆ 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 1090 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.

◆ 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(), and doCopterSprite().

◆ 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.

◆ 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 908 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().

◆ 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.

◆ 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().

◆ 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.

◆ 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 364 of file zone.cpp.

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

Referenced by doComOut(), doIndOut(), indPlop(), and makeHospital().

Member Data Documentation

◆ airportPop

short Micropolis::airportPop

Airport population.

Definition at line 1055 of file micropolis.h.

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

◆ autoBudget

bool Micropolis::autoBudget

Enable auto budget

When enabled, the program will perform budgetting of the city

Definition at line 2330 of file micropolis.h.

Referenced by doBudgetNow(), 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 2323 of file micropolis.h.

Referenced by connectTile(), 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 1960 of file micropolis.h.

Referenced by saveFile(), and setAutoGoto().

◆ blinkFlag

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

Definition at line 2355 of file micropolis.h.

Referenced by 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 2363 of file micropolis.h.

◆ categoryLast

short Micropolis::categoryLast

City class of last city class check.

See also
CheckGrowth

Definition at line 1952 of file micropolis.h.

Referenced by checkGrowth().

◆ censusChanged

bool Micropolis::censusChanged

Census changed flag.

Need to redraw census dependent stuff.

Definition at line 1157 of file micropolis.h.

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

◆ 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 1591 of file micropolis.h.

Referenced by evalInit(), and getAssessedValue().

◆ cityMonth

Quad Micropolis::cityMonth

City month, 4 time units per month.

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

Definition at line 1098 of file micropolis.h.

Referenced by init(), and updateDate().

◆ cityName

std::string Micropolis::cityName

Name of the city.

Name of the city.

Definition at line 1909 of file micropolis.h.

Referenced by saveCityAs(), and setCleanCityName().

◆ cityPop

Quad Micropolis::cityPop

City population.

Depends of ResPop, ComPop and IndPop.

Definition at line 1574 of file micropolis.h.

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

◆ cityPopDelta

Quad Micropolis::cityPopDelta

Change in the city population.

Depends on last cityPop.

Definition at line 1581 of file micropolis.h.

Referenced by doPopNum(), and evalInit().

◆ cityPopLast

Quad Micropolis::cityPopLast

Population of last city class check.

See also
CheckGrowth

Definition at line 1951 of file micropolis.h.

Referenced by checkGrowth().

◆ 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 1604 of file micropolis.h.

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

◆ cityScoreDelta

short Micropolis::cityScoreDelta

Change in the city score.

Depends on city score.

Definition at line 1611 of file micropolis.h.

Referenced by evalInit().

◆ cityTax

short Micropolis::cityTax

City tax rate.

Definition at line 1224 of file micropolis.h.

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

◆ 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 1092 of file micropolis.h.

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

◆ cityYear

Quad Micropolis::cityYear

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

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

Definition at line 1104 of file micropolis.h.

Referenced by init(), and updateDate().

◆ cityYes

short Micropolis::cityYes

Yes votes.

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

Definition at line 1551 of file micropolis.h.

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

◆ coalPowerPop

short Micropolis::coalPowerPop

Coal power plant population.

Definition at line 1040 of file micropolis.h.

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

◆ comHist

short* Micropolis::comHist

◆ comHist10Max

short Micropolis::comHist10Max

10 year commercial history maximum value.

Definition at line 1135 of file micropolis.h.

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

◆ comHist120Max

short Micropolis::comHist120Max

120 year commercial history maximum value.

Definition at line 1140 of file micropolis.h.

Referenced by init(), and initGraphMax().

◆ comPop

short Micropolis::comPop

Commercial zone population.

Depends on level of zone development.

Definition at line 989 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 1330 of file micropolis.h.

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

◆ crimeAverage

short Micropolis::crimeAverage

Average crime.

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

Definition at line 1063 of file micropolis.h.

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

◆ crimeHist

short* Micropolis::crimeHist

◆ curMapStackPointer

short Micropolis::curMapStackPointer
private

Position stack top pointer, points to top position.

Definition at line 2602 of file micropolis.h.

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

◆ doAnimation

bool Micropolis::doAnimation

Enable animation.

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

Definition at line 1887 of file micropolis.h.

Referenced by putRubble(), and setDoAnimation().

◆ doMessages

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

Definition at line 1889 of file micropolis.h.

Referenced by setDoMessages().

◆ donDither

Quad Micropolis::donDither
private

Integer with bits 0..2 that control smoothing.

Definition at line 2056 of file micropolis.h.

◆ doNotices

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

Definition at line 1891 of file micropolis.h.

Referenced by setDoNotices().

◆ fireEffect

Quad Micropolis::fireEffect

Ratio of fire spending over fire funding, times #MAX_FIRE_EFFECT.

Definition at line 1211 of file micropolis.h.

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

◆ fireFund

Quad Micropolis::fireFund

Requested funds for fire stations.

Depends on fire station population.

Definition at line 1196 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 1443 of file micropolis.h.

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

◆ firePop

short Micropolis::firePop

Number of fires.

Definition at line 975 of file micropolis.h.

Referenced by getFireSeverity(), and init().

◆ fireSpend

Quad Micropolis::fireSpend

Spending on fire stations.

Definition at line 1175 of file micropolis.h.

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

◆ fireStationEffectMap

MapShort8 Micropolis::fireStationEffectMap

Copy of fire station map to display.

Definition at line 1306 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 1301 of file micropolis.h.

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

◆ fireStationPop

short Micropolis::fireStationPop

Fire station population.

Definition at line 1035 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 1458 of file micropolis.h.

Referenced by doBudgetNow(), and init().

◆ floodCount

short Micropolis::floodCount

Size of flooding disaster.

Definition at line 1512 of file micropolis.h.

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

◆ generatedCitySeed

int Micropolis::generatedCitySeed

The seed of the most recently generated city.

Definition at line 1741 of file micropolis.h.

Referenced by generateMap().

◆ graph10Max

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

Definition at line 1807 of file micropolis.h.

Referenced by initGraphMax(), and take10Census().

◆ graph120Max

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

Definition at line 1812 of file micropolis.h.

Referenced by initGraphMax().

◆ heatFlow

int Micropolis::heatFlow

Heat flow.

Definition at line 1919 of file micropolis.h.

Referenced by simHeat().

◆ heatRule

int Micropolis::heatRule

Heat rule.

Definition at line 1924 of file micropolis.h.

Referenced by simHeat().

◆ heatSteps

int Micropolis::heatSteps

Heat steps.

Definition at line 1914 of file micropolis.h.

Referenced by initGame(), and simUpdate().

◆ heatWrap

int Micropolis::heatWrap

Heat wrap.

Definition at line 1929 of file micropolis.h.

Referenced by simHeat().

◆ historyInitialized

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

Definition at line 1802 of file micropolis.h.

Referenced by initGraphs().

◆ indHist

short* Micropolis::indHist

◆ indHist10Max

short Micropolis::indHist10Max

10 year industrial history maximum value.

Definition at line 1145 of file micropolis.h.

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

◆ indHist120Max

short Micropolis::indHist120Max

120 year industrial history maximum value.

Definition at line 1150 of file micropolis.h.

Referenced by init(), and initGraphMax().

◆ indPop

short Micropolis::indPop

Industrial zone population.

Depends on level of zone development.

Definition at line 996 of file micropolis.h.

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

◆ landValueAverage

short Micropolis::landValueAverage

Land value average.

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

Definition at line 1080 of file micropolis.h.

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

◆ map

◆ mapBase

unsigned short* Micropolis::mapBase
private

Memory for map array.

Definition at line 1396 of file micropolis.h.

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

◆ miscHist

short* Micropolis::miscHist

Memory used to save miscelaneous game values in save file.

Definition at line 1371 of file micropolis.h.

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

◆ moneyHist

short* Micropolis::moneyHist

◆ mustDrawBudget

int Micropolis::mustDrawBudget

Flag set when budget window needs to be updated.

Definition at line 1463 of file micropolis.h.

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

◆ needChurch

short Micropolis::needChurch
private

Need church?

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

Definition at line 1390 of file micropolis.h.

Referenced by init(), and take10Census().

◆ needHospital

short Micropolis::needHospital
private

Need hospital?

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

Definition at line 1383 of file micropolis.h.

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

◆ newMap

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

Definition at line 2039 of file micropolis.h.

Referenced by doSimInit().

◆ newMapFlags

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

Definition at line 2042 of file micropolis.h.

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

◆ nuclearPowerPop

short Micropolis::nuclearPowerPop

Nuclear power plant population.

Definition at line 1045 of file micropolis.h.

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

◆ policeEffect

Quad Micropolis::policeEffect

Ratio of police spending over police funding, times #MAX_POLICE_EFFECT.

Definition at line 1206 of file micropolis.h.

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

◆ policeFund

Quad Micropolis::policeFund

Requested funds for police stations.

Depends on police station population.

Definition at line 1189 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 1435 of file micropolis.h.

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

◆ policeSpend

Quad Micropolis::policeSpend

Spending on police stations.

Definition at line 1170 of file micropolis.h.

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

◆ policeStationEffectMap

MapShort8 Micropolis::policeStationEffectMap

Copy of police station map to display.

Definition at line 1322 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 1317 of file micropolis.h.

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

◆ policeStationPop

short Micropolis::policeStationPop

Police station population.

Definition at line 1030 of file micropolis.h.

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

◆ policeValue

Quad Micropolis::policeValue

Amount of police funding granted.

Definition at line 1453 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 1072 of file micropolis.h.

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

◆ pollutionHist

short* Micropolis::pollutionHist

◆ powerGridMap

MapByte1 Micropolis::powerGridMap

◆ powerStackXY

Position Micropolis::powerStackXY[POWER_STACK_SIZE]
private

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

Definition at line 1996 of file micropolis.h.

Referenced by 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 1567 of file micropolis.h.

Referenced by countProblems(), getProblemNumber(), and getProblemVotes().

◆ problemVotes

short Micropolis::problemVotes[PROBNUM]

Problem votes.

The number of votes for each problem.

See also
CityVotingProblems

Definition at line 1559 of file micropolis.h.

Referenced by getProblemVotes(), and init().

◆ railTotal

short Micropolis::railTotal

Total number of rails.

No penalty for bridges or high traffic density.

Definition at line 970 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 1290 of file micropolis.h.

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

◆ resHist

short* Micropolis::resHist

◆ resHist10Max

short Micropolis::resHist10Max

10 year residential history maximum value.

Definition at line 1125 of file micropolis.h.

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

◆ resHist120Max

short Micropolis::resHist120Max

120 year residential history maximum value.

Definition at line 1130 of file micropolis.h.

Referenced by init(), and initGraphMax().

◆ resPop

short Micropolis::resPop

Number of people in the residential zones.

Depends on level of zone development.

Definition at line 982 of file micropolis.h.

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

◆ roadEffect

Quad Micropolis::roadEffect

Ratio of road spending over road funding, times MAX_ROAD_EFFECT.

Definition at line 1201 of file micropolis.h.

Referenced by collectTax(), doRail(), 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 1182 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 1427 of file micropolis.h.

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

◆ roadSpend

Quad Micropolis::roadSpend

Spending on roads.

Definition at line 1165 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 963 of file micropolis.h.

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

◆ roadValue

Quad Micropolis::roadValue

Amount of road funding granted.

Definition at line 1448 of file micropolis.h.

Referenced by doBudgetNow(), and init().

◆ seaportPop

short Micropolis::seaportPop

Seaport population.

Definition at line 1050 of file micropolis.h.

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

◆ simPass

int Micropolis::simPass

The count of the current pass through the simulator loop.

Definition at line 1871 of file micropolis.h.

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

◆ simPasses

int Micropolis::simPasses

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

Definition at line 1866 of file micropolis.h.

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

◆ simPaused

bool Micropolis::simPaused

Simulation is paused

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

Definition at line 1877 of file micropolis.h.

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

◆ startingYear

short Micropolis::startingYear

City starting year.

Definition at line 1109 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 1237 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 1219 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 1262 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 1269 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 1276 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 1735 of file micropolis.h.

Referenced by generateMap().

◆ 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 1729 of file micropolis.h.

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

◆ terrainDensityMap

MapByte4 Micropolis::terrainDensityMap

Terrain development density map.

Used to calculate land value.

Definition at line 1255 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 1723 of file micropolis.h.

Referenced by generateMap(), 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 1717 of file micropolis.h.

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

◆ tilesAnimated

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

Definition at line 1881 of file micropolis.h.

Referenced by simUpdate().

◆ totalPop

short Micropolis::totalPop

Total population.

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

Definition at line 1004 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 1011 of file micropolis.h.

Referenced by init(), and setValves().

◆ totalZonePop

short Micropolis::totalZonePop

Total zone population.

Definition at line 1020 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 1618 of file micropolis.h.

Referenced by doScenarioScore(), getTrafficAverage(), 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 2369 of file micropolis.h.


The documentation for this class was generated from the following files: