Micropolis Class Reference

#include <micropolis.h>

List of all members.

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
void generateMap ()
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 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)

Power stack

Stack used to find powered tiles by tracking conductive tiles.

int powerStackPointer
 Stack counter, points to top-most item.
Position powerStackXY [POWER_STACK_SIZE]
void doPowerScan ()
bool testForConductive (const Position &pos, Direction2 testDir)
void pushPowerStack (const Position &pos)
Position pullPowerStack ()

Public Member Functions

 Micropolis ()
 ~Micropolis ()
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 loadFileDir (const char *filename, const char *dir)
bool loadFile (const char *filename)
bool saveFile (const char *filename)
void loadScenario (Scenario s)
void didLoadScenario ()
bool loadCity (const char *filename)
void didLoadCity ()
void didntLoadCity (const char *msg)
void saveCity ()
void doSaveCityAs ()
void didSaveCity ()
void didntSaveCity (const char *msg)
void saveCityAs (const char *filename)
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)
const char * getMicropolisVersion ()
void simUpdate ()
void simTick ()
void simRobots ()
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, char *msg)
void doLoseGame ()
void doWinGame ()
ResourcegetResource (const char *name, Quad id)
void getIndString (char *str, int id, short num)
void updateFundEffects ()
SimSpritenewSprite (const char *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 doPlayNewCity ()
void doReallyStartGame ()
void doStartLoad ()
void doStartScenario (int scenario)
void initGame ()
void callback (const char *name, const char *params,...)
void doEarthquake (int strength)
void invalidateMaps ()
void makeSound (const char *channel, const char *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 (const char *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)

Static Public Member Functions

static int getNextAnimatedTile (int index)
static bool testBounds (int wx, int wy)

Public Attributes

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
unsigned short * map [WORLD_W]
short resHist10Max
short resHist120Max
short comHist10Max
short comHist120Max
short indHist10Max
short indHist120Max
bool censusChanged
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
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.
Quad cityPopLast
 Population of last city class check.
short categoryLast
 City class of last city class check.
bool autoGoto
std::string homeDir
std::string resourceDir
Resourceresources
 Linked list of loaded resources.
StringTablestringTables
 Linked list of loaded string tables.
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
CallbackFunction callbackHook
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
Dates


Quad cityTime
Quad cityMonth
Quad cityYear
short startingYear
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
Historic graphs.


short * resHist
short * comHist
short * indHist
short * moneyHist
short * pollutionHist
short * crimeHist
short * miscHist

Private Member Functions

void init ()
void destroy ()
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 ()
void initWillStuff ()
void resetMapState ()
void resetEditorState ()
void environmentInit ()
void simInit ()
void simHeat ()
void simLoop (bool doSim)
int simRandom ()
short getRandom (short range)
int getRandom16 ()
int getRandom16Signed ()
short getERandom (short limit)
void randomlySeedRandom ()
void seedRandom (int seed)
void fireAnalysis ()
void populationDensityScan ()
int getPopulationDensity (const Position &pos, MapTile tile)
void pollutionTerrainLandValueScan ()
int getPollutionValue (int loc)
int getCityCenterDistance (int x, int y)
void crimeScan ()
void smoothTerrain ()
void doSmooth1 ()
void doSmooth2 ()
void computeComRateMap ()
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 (char *str, char *s0, char *s1, char *s2, char *s3, char *s4, 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 getDensityStr (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)
void makeDollarDecimalStr (char *numStr, char *dollarStr)
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)

Private Attributes

short needHospital
short needChurch
unsigned short * mapBase
int heatSteps
int heatFlow
int heatRule
int heatWrap
short * cellSrc
short * cellDst
UQuad nextRandom
short newMap
short newMapFlags [MAP_TYPE_COUNT]
short cityCenterX
 X coordinate of city center.
short cityCenterY
 Y coordinate of city center.
short pollutionMaxX
 X coordinate of most polluted area.
short pollutionMaxY
 Y coordinate of most polluted area.
short crimeMaxX
 X coordinate of most criminal area. Not used.
short crimeMaxY
 Y coordinate of most criminal area. Not used.
Quad donDither
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.


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
Todo:
Micropolis::crimeMaxX and Micropolis::crimeMaxY seem unused.

Definition at line 1025 of file micropolis.h.


Constructor & Destructor Documentation

Micropolis::Micropolis (  ) 

Simulator constructor.

Definition at line 78 of file micropolis.cpp.

References init().

Micropolis::~Micropolis (  ) 

Simulator destructor.

Definition at line 101 of file micropolis.cpp.


Member Function Documentation

void Micropolis::init (  )  [private]

Initialize simulator variables to a sane default.

Definition at line 108 of file micropolis.cpp.

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

Referenced by Micropolis().

void Micropolis::initMapArrays (  )  [private]

Allocate and initialize arrays for the maps

Definition at line 75 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().

void Micropolis::destroyMapArrays (  )  [private]

void Micropolis::doBudget (  ) 

Game decided to show the budget window

Definition at line 88 of file budget.cpp.

References doBudgetNow().

Referenced by collectTax().

void Micropolis::doBudgetFromMenu (  ) 

User queried the budget window

Definition at line 95 of file budget.cpp.

References doBudgetNow().

void Micropolis::doBudgetNow ( bool  fromMenu  ) 

Handle budget window.

Parameters:
fromMenu User 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 107 of file budget.cpp.

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

Referenced by doBudget(), and doBudgetFromMenu().

void Micropolis::updateBudget (  ) 

Todo:
The scripting language should pull these raw values out and format them, instead of the simulator core formatting them and pushing them out.

Definition at line 318 of file budget.cpp.

References callback(), and mustDrawBudget.

Referenced by simUpdate().

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:
x X world position to perform the command.
y Y world position to perform the command.
cmd Command to perform.
effects Modification collecting object.
Returns:
Tool result.

Definition at line 122 of file connect.cpp.

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

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

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

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

Parameters:
x X map coordinate.
y Y map coordinate.
effects Modification collecting object.
Returns:
Tool result.

Definition at line 211 of file connect.cpp.

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

Referenced by connectTile().

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

Lay a road, and update road around it.

Parameters:
x X map coordinate.
y Y map coordinate.
effects Modification collecting object.
Returns:
Tool result.

Definition at line 260 of file connect.cpp.

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

Referenced by connectTile().

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

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

Parameters:
x X map coordinate.
y Y map coordinate.
effects Modification collecting object.
Returns:
Tool result.

Definition at line 353 of file connect.cpp.

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

Referenced by connectTile().

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

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

Parameters:
x X map coordinate.
y Y map coordinate.
effects Modification collecting object.
Returns:
Tool result.

Definition at line 449 of file connect.cpp.

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

Referenced by connectTile().

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

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

Parameters:
x X map coordinate
y Y map coordinate.
effects Modification collecting object.

Definition at line 554 of file connect.cpp.

References fixSingle(), WORLD_H, and WORLD_W.

Referenced by connectTile().

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

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

Parameters:
x X map coordinate.
y Y map coordinate.
effects Modification collecting object.

Definition at line 582 of file connect.cpp.

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

Referenced by fixZone().

void Micropolis::makeMeltdown (  ) 

Make a nuclear power plant melt

Todo:
Randomize which nuke plant melts down.

Definition at line 207 of file disasters.cpp.

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

Referenced by scenarioDisaster().

void Micropolis::makeFireBombs (  ) 

Throw several bombs onto the city.

Definition at line 233 of file disasters.cpp.

References fireBomb(), and getRandom16().

Referenced by scenarioDisaster().

void Micropolis::makeEarthquake (  ) 

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

Definition at line 247 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().

void Micropolis::makeFire (  ) 

Start a fire at a random place, requested by user

Definition at line 294 of file disasters.cpp.

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

void Micropolis::makeFlood (  ) 

Flood many tiles

Todo:
Use Direction and some form of XYPosition class here

Definition at line 336 of file disasters.cpp.

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

Referenced by doDisasters(), and scenarioDisaster().

void Micropolis::setFire (  ) 

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

Definition at line 275 of file disasters.cpp.

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

Referenced by doDisasters().

void Micropolis::fireBomb (  ) 

Let a fire bomb explode at a random location

Definition at line 223 of file disasters.cpp.

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

Referenced by makeFireBombs().

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

void Micropolis::scenarioDisaster (  )  [private]

bool Micropolis::vulnerable ( int  tem  )  [private]

Is tile vulnerable for an earthquake?

Parameters:
tem Tile data
Returns:
Function returns true if tile is vulnerable, and false if not

Definition at line 320 of file disasters.cpp.

References LASTZONE, LOMASK, and ZONEBIT.

Referenced by makeEarthquake().

void Micropolis::doFlood ( const Position pos  )  [private]

Flood around the given position.

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

Definition at line 375 of file disasters.cpp.

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

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 100 of file evaluate.cpp.

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

void Micropolis::evalInit (  ) 

Initialize evaluation variables

Definition at line 126 of file evaluate.cpp.

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

Referenced by cityEvaluation().

void Micropolis::doScoreCard (  ) 

Push new score to the user

Definition at line 469 of file evaluate.cpp.

References callback().

Referenced by scoreDoer().

void Micropolis::changeEval (  ) 

Request that new score is displayed to the user.

Definition at line 497 of file evaluate.cpp.

References evalChanged.

Referenced by cityEvaluation(), and simInit().

void Micropolis::scoreDoer (  ) 

Update the score after being requested.

Definition at line 505 of file evaluate.cpp.

References doScoreCard(), and evalChanged.

Referenced by simUpdate().

int Micropolis::countProblems (  ) 

Return number of problem in the city.

Returns:
Number of problems.

Definition at line 518 of file evaluate.cpp.

References CVP_NUMPROBLEMS, CVP_PROBLEM_COMPLAINTS, and problemOrder.

int Micropolis::getProblemNumber ( int  i  ) 

Return the index of the i-th worst problem.

Parameters:
i Number 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 535 of file evaluate.cpp.

References CVP_NUMPROBLEMS, CVP_PROBLEM_COMPLAINTS, and problemOrder.

int Micropolis::getProblemVotes ( int  i  ) 

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

Parameters:
i Number 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 552 of file evaluate.cpp.

References CVP_NUMPROBLEMS, CVP_PROBLEM_COMPLAINTS, problemOrder, and problemVotes.

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 149 of file evaluate.cpp.

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

Referenced by cityEvaluation().

void Micropolis::doPopNum (  )  [private]

Compute city population and city classification.

See also:
cityPop cityClass.

Definition at line 172 of file evaluate.cpp.

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

Referenced by cityEvaluation().

Quad Micropolis::getPopulation (  )  [private]

Compute city population.

Definition at line 187 of file evaluate.cpp.

References comPop, indPop, and resPop.

Referenced by checkGrowth(), and doPopNum().

CityClass Micropolis::getCityClass ( Quad  cityPopulation  )  [private]

Classify the city based on its population.

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

Definition at line 200 of file evaluate.cpp.

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

Referenced by checkGrowth(), and doPopNum().

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

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

Parameters:
problemTable Storage 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 231 of file evaluate.cpp.

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

Referenced by cityEvaluation().

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

Vote on the problems of the city.

Parameters:
problemTable Storage of how bad each problem is.
Postcondition:
problemVotes contains the vote counts

Definition at line 278 of file evaluate.cpp.

References getRandom(), and problemVotes.

Referenced by doProblems().

short Micropolis::getTrafficAverage (  )  [private]

Compute average traffic in the city.

Returns:
Value representing how large the traffic problem is.

Definition at line 305 of file evaluate.cpp.

References landValueMap, trafficAverage, trafficDensityMap, WORLD_H, and WORLD_W.

Referenced by doProblems().

short Micropolis::getUnemployment (  )  [private]

Compute severity of unemployment

Returns:
Value representing the severity of unemployment problems

Definition at line 331 of file evaluate.cpp.

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

Referenced by doProblems().

short Micropolis::getFireSeverity (  )  [private]

Compute severity of fire

Returns:
Value representing the severity of fire problems

Definition at line 351 of file evaluate.cpp.

References firePop, and min().

Referenced by doProblems(), and getScore().

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

Compute total score

Parameters:
problemTable Storage of how bad each problem is.

Todo:
Should this expression depend on CVP_NUMPROBLEMS?

Definition at line 361 of file evaluate.cpp.

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

Referenced by cityEvaluation().

void Micropolis::doVotes (  )  [private]

Vote whether the mayor is doing a good job

Postcondition:
cityYes contains the number of 'yes' votes

Definition at line 454 of file evaluate.cpp.

References cityScore, cityYes, and getRandom().

Referenced by cityEvaluation().

bool Micropolis::loadFileDir ( const char *  filename,
const char *  dir 
)

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

Parameters:
filename Name of the file to load.
dir If not NULL, name of the directory containing the file.
Returns:
Load was succesfull.

Definition at line 203 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().

bool Micropolis::loadFile ( const char *  filename  ) 

Load a file, and initialize the game variables.

Parameters:
filename Name of the file to load.
Returns:
Load was succesfull.

Definition at line 254 of file fileio.cpp.

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

Referenced by loadCity().

bool Micropolis::saveFile ( const char *  filename  ) 

Save a game to disk.

Parameters:
filename Name of the file to use for storing the game.
Returns:
The game was saved successfully.

Todo:
Report error saving file.

Definition at line 340 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().

void Micropolis::loadScenario ( Scenario  s  ) 

void Micropolis::didLoadScenario (  ) 

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

Definition at line 499 of file fileio.cpp.

References callback().

Referenced by loadScenario().

bool Micropolis::loadCity ( const char *  filename  ) 

Try to load a new game from disk.

Parameters:
filename Name of the file to load.
Returns:
Game was loaded successfully.
Todo:
In what state is the game left when loading fails?
Todo:
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 513 of file fileio.cpp.

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

void Micropolis::didLoadCity (  ) 

Report to the frontend that the game was successfully loaded.

Definition at line 543 of file fileio.cpp.

References callback().

Referenced by loadCity().

void Micropolis::didntLoadCity ( const char *  msg  ) 

Report to the frontend that the game failed to load.

Parameters:
msg File that attempted to load

Definition at line 553 of file fileio.cpp.

References callback().

Referenced by loadCity().

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

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

void Micropolis::doSaveCityAs (  ) 

Report to the frontend that the city is being saved.

Definition at line 585 of file fileio.cpp.

References callback().

Referenced by saveCity().

void Micropolis::didSaveCity (  ) 

Report to the frontend that the city was saved successfully.

Definition at line 592 of file fileio.cpp.

References callback().

Referenced by saveCity(), and saveCityAs().

void Micropolis::didntSaveCity ( const char *  msg  ) 

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

Parameters:
msg Name of the file used

Definition at line 602 of file fileio.cpp.

References callback().

Referenced by saveCity(), and saveCityAs().

void Micropolis::saveCityAs ( const char *  filename  ) 

Save the city under a new name (?)

Parameters:
filename Name 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 615 of file fileio.cpp.

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

void Micropolis::generateMap (  ) 

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 82 of file generate.cpp.

References generateSomeCity(), and getRandom16().

Referenced by generateSomeCity().

void Micropolis::clearMap (  ) 

Clear the whole world to DIRT tiles

Definition at line 163 of file generate.cpp.

References DIRT, map, WORLD_H, and WORLD_W.

Referenced by generateMap(), and simInit().

void Micropolis::clearUnnatural (  ) 

Clear everything from all land

Definition at line 176 of file generate.cpp.

References DIRT, map, WORLD_H, and WORLD_W.

void Micropolis::makeIsland (  ) 

Construct a new world as an island

Definition at line 236 of file generate.cpp.

References doTrees(), and makeNakedIsland().

Referenced by generateMap().

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:
xloc Horizontal position of starting point for splashing trees.
yloc Vertical 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 298 of file generate.cpp.

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

Referenced by doTrees().

void Micropolis::makeSingleLake ( const Position pos  ) 

Make a random lake at pos.

Parameters:
pos Rough position of the lake.

Definition at line 271 of file generate.cpp.

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

Referenced by makeLakes().

void Micropolis::plopBRiver ( const Position pos  ) 

Put down a big river diamond-like shape.

Parameters:
pos Base coordinate of the blob (top-left position).

Definition at line 611 of file generate.cpp.

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

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

void Micropolis::plopSRiver ( const Position pos  ) 

Put down a small river diamond-like shape.

Parameters:
pos Base coordinate of the blob (top-left position).

Definition at line 638 of file generate.cpp.

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

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

void Micropolis::generateSomeCity ( int  seed  ) 

Generate a map for a city.

Parameters:
seed Random number generator initializing seed

Definition at line 92 of file generate.cpp.

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

Referenced by generateMap().

void Micropolis::generateMap ( int  seed  )  [private]

Generate a map.

Parameters:
seed Initialization seed for the random generator.

Definition at line 119 of file generate.cpp.

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

void Micropolis::makeNakedIsland (  )  [private]

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

Definition at line 192 of file generate.cpp.

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

Referenced by generateMap(), and makeIsland().

void Micropolis::doTrees (  )  [private]

Splash trees around the world.

Definition at line 328 of file generate.cpp.

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

Referenced by generateMap(), and makeIsland().

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

Temporary function to prevent breaking a lot of code.

Definition at line 417 of file generate.cpp.

References ToolEffects::modifyWorld().

Referenced by putDownForest().

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

Smooth trees at a position.

Definition at line 429 of file generate.cpp.

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

void Micropolis::makeLakes (  )  [private]

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

Definition at line 247 of file generate.cpp.

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

Referenced by generateMap().

void Micropolis::doRivers ( const Position terrainPos  )  [private]

Construct rivers.

Parameters:
terrainPos Coordinate to start making a river.

Definition at line 477 of file generate.cpp.

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

Referenced by generateMap().

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

Make a big river.

Parameters:
pos Start position of making a river.
riverDir Global direction of the river.
terrainDir Local direction of the terrain.
Returns:
Last used local terrain direction.

Definition at line 500 of file generate.cpp.

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

Referenced by doRivers().

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

Make a small river.

Parameters:
pos Start position of making a river.
riverDir Global direction of the river.
terrainDir Local direction of the terrain.
Returns:
Last used local terrain direction.

Definition at line 540 of file generate.cpp.

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

Referenced by doRivers().

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

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

Parameters:
mChar Map value to put ont the map.
xLoc Horizontal position at the map to put mChar.
yLoc Vertical position at the map to put mChar.

Definition at line 581 of file generate.cpp.

References DIRT, map, and testBounds().

Referenced by plopBRiver(), and plopSRiver().

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

Copy history data to new array, scaling as needed.

Parameters:
hist Source history data.
s Destination byte array.
scale Scale factor.
Todo:
Figure out why we copy data.

Definition at line 96 of file graph.cpp.

References clamp().

void Micropolis::changeCensus (  ) 

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

Todo:
Rename function.

Definition at line 111 of file graph.cpp.

References censusChanged.

Referenced by loadFile(), and take10Census().

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 121 of file graph.cpp.

References callback(), and censusChanged.

Referenced by simUpdate().

void Micropolis::initGraphs (  ) 

Initialize graphs

Definition at line 131 of file graph.cpp.

References historyInitialized.

Referenced by simInit().

void Micropolis::initGraphMax (  ) 

Compute various max ranges of graphs

Definition at line 140 of file graph.cpp.

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

Referenced by initWillStuff().

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

Get the minimal and maximal values of a historic graph.

Parameters:
historyType Type of history information.
See also:
HistoryType
Parameters:
historyScale Scale of history data.
See also:
HistoryScale
Parameters:
minValResult Pointer to variable to write minimal value to.
maxValResult Pointer to variable to write maximal value to.

Definition at line 207 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.

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

Get a value from the history tables.

Parameters:
historyType Type of history information.
See also:
HistoryType
Parameters:
historyScale Scale of history data.
See also:
HistoryScale
Parameters:
historyIndex Index in the data to obtain
Returns:
Historic data value of the requested graph

Definition at line 277 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.

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

Store a value into the history tables.

Parameters:
historyType Type of history information.
See also:
HistoryType
Parameters:
historyScale Scale of history data.
See also:
HistoryScale
Parameters:
historyIndex Index in the data to obtain
historyValue Index in the value to store

Definition at line 337 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.

void Micropolis::initWillStuff (  )  [private]

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 122 of file initialize.cpp.

Referenced by generateSomeCity(), and simInit().

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 132 of file initialize.cpp.

Referenced by generateSomeCity(), and simInit().

const char * Micropolis::getMicropolisVersion (  ) 

Get version of Micropolis program.

Todo:
Use this function or eliminate it.
Returns:
Textual version.

Definition at line 80 of file main.cpp.

References MICROPOLIS_VERSION.

void Micropolis::simUpdate (  ) 

Update ????

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

Definition at line 175 of file main.cpp.

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

Referenced by generateSomeCity(), and simTick().

void Micropolis::simTick (  ) 

Move simulaton forward.

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

Definition at line 435 of file main.cpp.

References simPass, simPasses, and simUpdate().

void Micropolis::environmentInit (  )  [private]

Locate resource directory.

Definition at line 110 of file main.cpp.

References homeDir, resourceDir, and testDirectory().

void Micropolis::simInit (  )  [private]

void Micropolis::simHeat (  )  [private]

????

Todo:
Why is Micropolis::cellSrc not allocated together with all the other variables?
Todo:
What is the purpose of this function?
Todo:
KILL the define.

Definition at line 198 of file main.cpp.

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

void Micropolis::sendMessages (  ) 

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

void Micropolis::doScenarioScore ( Scenario  type  ) 

Compute score for each scenario

Parameters:
type Scenario used
Note:
Parameter type may not be SC_NONE

Definition at line 303 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().

void Micropolis::sendMessage ( short  mesgNum,
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:
mesgNum Message number of the message to display.
x X coordinate of the position of the event.
y Y coordinate of the position of the event.
picture Flag that is true if a picture should be shown.
important Flag that is true if the message is important.

Definition at line 380 of file message.cpp.

References callback().

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

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

Make a sound for message mesgNum if appropriate.

Parameters:
mesgNum Message number displayed.
x Horizontal coordinate in the city of the sound.
y Vertical coordinate in the city of the sound.

Definition at line 397 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.

void Micropolis::doAutoGoto ( short  x,
short  y,
char *  msg 
)

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

Parameters:
x X position at the map
y Y position at the map
msg Message
Todo:
msg parameter is not used!

Definition at line 453 of file message.cpp.

References callback().

void Micropolis::doLoseGame (  ) 

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

Definition at line 460 of file message.cpp.

References callback().

Referenced by doScenarioScore().

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 467 of file message.cpp.

References callback().

void Micropolis::doPowerScan (  )  [private]

Scan the map for powered tiles, and copy them to the Micropolis::powerGridMap array. Also warns the user about using too much power ('buy another power plant').

Definition at line 115 of file power.cpp.

References COAL_POWER_STRENGTH, coalPowerPop, DIR2_BEGIN, DIR2_END, DIR2_INVALID, increment90(), MESSAGE_NOT_ENOUGH_POWER, Position::move(), NUCLEAR_POWER_STRENGTH, nuclearPowerPop, Position::posX, Position::posY, powerGridMap, powerStackPointer, pullPowerStack(), pushPowerStack(), sendMessage(), and testForConductive().

Referenced by doSimInit().

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

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

Parameters:
pos Position to start from.
testDir Direction 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 94 of file power.cpp.

References CONDBIT, map, Position::move(), Position::posX, Position::posY, and powerGridMap.

Referenced by doPowerScan().

void Micropolis::pushPowerStack ( const Position pos  )  [private]

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

Parameters:
pos Position to push.

Definition at line 163 of file power.cpp.

References POWER_STACK_SIZE, powerStackPointer, and powerStackXY.

Referenced by doPowerScan(), and doSpecialZone().

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 177 of file power.cpp.

References powerStackPointer, and powerStackXY.

Referenced by doPowerScan().

int Micropolis::simRandom (  )  [private]

Bug:
Code seems to assume that sizeof(short)==2 and sizeof(int)==4 However, this depends on the compiler. We should introduce typedefs for them, and check correctness of our assumptions w.r.t. size of them (eg in Micropolis::randomlySeedRandom() or in Micropolis::Micropolis()).
Bug:
Code stores unsigned 16 bit numbers in short which is a signed type.
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 88 of file random.cpp.

Referenced by getRandom16().

short Micropolis::getRandom ( short  range  )  [private]

int Micropolis::getRandom16 (  )  [private]

int Micropolis::getRandom16Signed (  )  [private]

Get signed 16 bit random number.

Definition at line 127 of file random.cpp.

References getRandom16().

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

short Micropolis::getERandom ( short  limit  )  [private]

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

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

Definition at line 145 of file random.cpp.

References getRandom(), and min().

Referenced by makeNakedIsland().

void Micropolis::randomlySeedRandom (  )  [private]

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

Definition at line 155 of file random.cpp.

References seedRandom().

Referenced by initWillStuff().

void Micropolis::seedRandom ( int  seed  )  [private]

Set seed of the random number generator.

Parameters:
seed New seed.

Definition at line 171 of file random.cpp.

Referenced by generateMap(), and randomlySeedRandom().

Resource * Micropolis::getResource ( const char *  name,
Quad  id 
)

Find the resource with the given name and identification.

Parameters:
name Name of the resource (a 4 character string)
id Identification of the resource.
Returns:
Pointer to the resource.
Bug:
Function is not safely handling strings.
Bug:
File handling is not safe across platforms (text-mode may modify data).
Todo:
What is the point of a Quad id when we cast it to an int ?

Bug:
Not safe!

Bug:
Not safe (overflow, non-printable chars)

Definition at line 85 of file resource.cpp.

References Resource::buf, Resource::id, Resource::name, newPtr(), Resource::next, resourceDir, resources, and Resource::size.

Referenced by getIndString().

void Micropolis::getIndString ( char *  str,
int  id,
short  num 
)

Get the text of a message.

Parameters:
str Destination of the text (usually 256 characters long).
id Identification of the resource.
num Number of the string in the resource.
Bug:
Make the function safe (should never overwrite data outside str, handle case where last line of file is not terminated with new-line)
Bug:
Out of range num seems not correctly handled (strcpy(str,"Oops") is overwritten at least. Maybe use an assert() instead?).
Todo:
Why do we copy the text? Can we not return its address instead?

Definition at line 179 of file resource.cpp.

References Resource::buf, getResource(), StringTable::id, StringTable::lines, newPtr(), StringTable::next, Resource::size, StringTable::strings, and stringTables.

Referenced by doZoneStatus().

void Micropolis::fireAnalysis (  )  [private]

Make firerate map from firestation map.

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

Definition at line 110 of file scan.cpp.

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

Referenced by doSimInit().

void Micropolis::populationDensityScan (  )  [private]

Todo:
The tempMap1 has MAP_BLOCKSIZE > 1, so we may be able to optimize the first x, y loop.

Definition at line 126 of file scan.cpp.

References cityCenterX, cityCenterY, computeComRateMap(), getPopulationDensity(), LOMASK, map, MAP_TYPE_DYNAMIC, MAP_TYPE_POPULATION_DENSITY, MAP_TYPE_RATE_OF_GROWTH, min(), newMapFlags, populationDensityMap, tempMap1, tempMap2, WORLD_H, WORLD_W, and ZONEBIT.

Referenced by doSimInit().

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

Get population of a zone.

Parameters:
pos Position of the zone to count.
tile Tile of the zone.
Returns:
Population of the zone.

Definition at line 188 of file scan.cpp.

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

Referenced by populationDensityScan().

int Micropolis::getPollutionValue ( int  loc  )  [private]

Return pollution of a tile value

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

Definition at line 331 of file scan.cpp.

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

int Micropolis::getCityCenterDistance ( int  x,
int  y 
) [private]

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

Parameters:
x X world coordinate of given position.
y Y 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 382 of file scan.cpp.

References cityCenterX, cityCenterY, and min().

Referenced by computeComRateMap().

void Micropolis::crimeScan (  )  [private]

void Micropolis::computeComRateMap (  )  [private]

Compute distance to city center for the entire map.

See also:
comRateMap

Definition at line 575 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().

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

MapValue Micropolis::randomFire (  )  [inline, private]

Generate a random animated MapTileCharacters::FIRE tile

Definition at line 2319 of file micropolis.h.

References ANIMBIT, and getRandom16().

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

MapValue Micropolis::randomRubble (  )  [inline, private]

Generate a random MapTileCharacters::RUBBLE tile

Definition at line 2325 of file micropolis.h.

References BULLBIT, and getRandom16().

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

void Micropolis::doSimInit (  )  [private]

Initialize simulation.

Todo:
Create constants for initSimLoad.

Definition at line 276 of file simulate.cpp.

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

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

void Micropolis::doNilPower (  )  [private]

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

Definition at line 311 of file simulate.cpp.

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

Referenced by simLoadInit().

void Micropolis::decTrafficMap (  )  [private]

Decrease traffic memory

Definition at line 327 of file simulate.cpp.

References trafficDensityMap, WORLD_H, and WORLD_W.

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

void Micropolis::simLoadInit (  )  [private]

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

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

Referenced by doSimInit().

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?).
Todo:
A lot of this max stuff is also done in graph.cpp

Definition at line 712 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.

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
Bug:
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 838 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.

void Micropolis::doRail ( const Position pos  )  [private]

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

Parameters:
pos Position of the rail.

Definition at line 1005 of file simulate.cpp.

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

void Micropolis::doRadTile ( const Position pos  )  [private]

Handle decay of radio-active tile

Parameters:
pos Position of the radio-active tile.

Definition at line 1040 of file simulate.cpp.

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

void Micropolis::doRoad ( const Position pos  )  [private]

Handle road tile.

Parameters:
pos Position of the road.

Definition at line 1052 of file simulate.cpp.

References ALLBITS, ANIMBIT, BURNBIT, doBridge(), getRandom16(), HTRFBASE, LTRFBASE, map, MAX_ROAD_EFFECT, Position::posX, Position::posY, randomRubble(), roadEffect, roadTotal, and trafficDensityMap.

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

Handle a bridge.

Parameters:
pos Position of the bridge.
tile Tile value of the bridge.
Returns:
???
Todo:
What does this function return?
Todo:
Discover the structure of all the magic constants.

Definition at line 1125 of file simulate.cpp.

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

Referenced by doRoad().

int Micropolis::getBoatDistance ( const Position pos  )  [private]

Compute distance to nearest boat from a given bridge.

Parameters:
pos Position of bridge.
Returns:
Distance to nearest boat.

Definition at line 1250 of file simulate.cpp.

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

Referenced by doBridge().

void Micropolis::doFire ( const Position pos  )  [private]

Handle tile being on fire.

Parameters:
pos Position of the fire.
Todo:
Needs a notion of iterative neighbour tiles computing.
Todo:
Use a getFromMap()-like function here.
Todo:
Extract constants of fire station effectiveness from here.

Definition at line 1280 of file simulate.cpp.

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

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:
pos Position of the zone on fire.
ch Character of the zone.

Definition at line 1343 of file simulate.cpp.

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

Referenced by doFire(), and doFlood().

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

Repair a zone at pos.

Parameters:
pos Center-tile position of the zone.
zCent Value of the center tile.
zSize Size of the zone (in both directions).

Definition at line 1390 of file simulate.cpp.

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

Referenced by doHospitalChurch(), and doSpecialZone().

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

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

Draw a stadium (either full or empty).

Parameters:
center Center tile position of the stadium.
z Base tile value.
Todo:
Merge with zonePlop()-like function.

Definition at line 1610 of file simulate.cpp.

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

Referenced by doSpecialZone().

void Micropolis::doAirport ( const Position pos  )  [private]

Generate a airplane or helicopter every now and then.

Parameters:
pos Position of the airport to start from.

Definition at line 1631 of file simulate.cpp.

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

Referenced by doSpecialZone().

void Micropolis::coalSmoke ( const Position pos  )  [private]

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

Parameters:
pos Center tile of the coal power plant

Definition at line 1648 of file simulate.cpp.

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

Referenced by doSpecialZone().

void Micropolis::doMeltdown ( const Position pos  )  [private]

Perform a nuclear melt-down disaster

Parameters:
pos Position of the nuclear power plant that melts.

Definition at line 1668 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().

SimSprite * Micropolis::newSprite ( const char *  name,
int  type,
int  x,
int  y 
)

Create and initialize a sprite.

Parameters:
name Name of the sprite (always "").
type Type pf the sprite.
See also:
SpriteType.
Parameters:
x X coordinate of the sprite (in pixels).
y Y coordinate of the sprite (in pixels).
Returns:
New sprite object.

Definition at line 93 of file sprite.cpp.

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

Referenced by makeExplosionAt(), and makeSprite().

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

void Micropolis::destroyAllSprites (  ) 

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

Definition at line 288 of file sprite.cpp.

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

Referenced by initWillStuff().

void Micropolis::destroySprite ( SimSprite sprite  ) 

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

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

Definition at line 303 of file sprite.cpp.

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

Referenced by moveObjects().

SimSprite * Micropolis::getSprite ( int  type  ) 

Return the sprite of the give type, if available.

Parameters:
type Type of the sprite.
Returns:
Pointer to the active sprite if avaiable, else NULL.

Definition at line 333 of file sprite.cpp.

References SimSprite::frame.

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

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:
type Sprite type of the new sprite.
x X coordinate of the new sprite.
y Y coordinate of the new sprite.

Definition at line 350 of file sprite.cpp.

References initSprite(), and newSprite().

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

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

Get character from the map.

Parameters:
x X coordinate in pixels.
y Y coordinate in pixels.
Returns:
Map character if on-map, or -1 if off-map.

Definition at line 370 of file sprite.cpp.

References LOMASK, map, and testBounds().

Referenced by doMonsterSprite(), and doTrainSprite().

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

Turn.

Parameters:
p Present direction (1..8).
d Destination direction (1..8).
Returns:
New direction.
Todo:
Remove local magic constants and document the code.

Definition at line 391 of file sprite.cpp.

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

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

???

Todo:
Figure out what this function is doing.
Todo:
Remove local magic constants and document the code.

Definition at line 426 of file sprite.cpp.

Referenced by doShipSprite().

bool Micropolis::spriteNotInBounds ( SimSprite sprite  ) 

Check whether a sprite is still entirely on-map.

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

Definition at line 454 of file sprite.cpp.

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

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

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

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

Parameters:
orgX X coordinate starting point.
orgY Y coordinate starting point.
desX X coordinate destination point.
desY Y 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 472 of file sprite.cpp.

References absoluteValue().

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

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

Compute Manhattan distance between two points.

Parameters:
x1 X coordinate first point.
y1 Y coordinate first point.
x2 X coordinate second point.
y2 Y coordinate second point.
Returns:
Manhattan distance between both points.

Definition at line 520 of file sprite.cpp.

References absoluteValue().

Referenced by checkSpriteCollision().

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

Check whether two sprites collide with each other.

Parameters:
s1 First sprite.
s2 Second sprite.
Returns:
Sprites are colliding.

Definition at line 532 of file sprite.cpp.

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

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

void Micropolis::moveObjects (  ) 

void Micropolis::doTrainSprite ( SimSprite sprite  ) 

Move train sprite.

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

Definition at line 618 of file sprite.cpp.

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

Referenced by moveObjects().

void Micropolis::doCopterSprite ( SimSprite sprite  ) 

Move helicopter sprite.

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

Definition at line 690 of file sprite.cpp.

References SimSprite::control, SimSprite::count, SimSprite::destX, SimSprite::destY, SimSprite::frame, getDir(), getRandom16(), getSprite(), makeSound(), MESSAGE_HEAVY_TRAFFIC, SimSprite::origX, SimSprite::origY, sendMessage(), SimSprite::soundCount, SPRITE_MONSTER, SPRITE_TORNADO, trafficDensityMap, turnTo(), WORLD_H, SimSprite::x, and SimSprite::y.

Referenced by moveObjects().

void Micropolis::doAirplaneSprite ( SimSprite sprite  ) 

Move airplane sprite.

Parameters:
sprite Airplane sprite.
Todo:
Remove local magic constants and document the code.
Todo:
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 795 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().

void Micropolis::doShipSprite ( SimSprite sprite  ) 

Move ship sprite.

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

Definition at line 862 of file sprite.cpp.

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

Referenced by moveObjects().

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:
sprite Monster sprite.
Todo:
Remove local magic constants and document the code.

Definition at line 1002 of file sprite.cpp.

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

Referenced by moveObjects().

void Micropolis::doTornadoSprite ( SimSprite sprite  ) 

Move tornado.

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

Definition at line 1234 of file sprite.cpp.

References checkSpriteCollision(), SimSprite::count, destroyMapTile(), explodeSprite(), SimSprite::flag, 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().

void Micropolis::doExplosionSprite ( SimSprite sprite  ) 

'Move' fire sprite.

Parameters:
sprite Fire sprite.

Definition at line 1301 of file sprite.cpp.

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

Referenced by moveObjects().

void Micropolis::doBusSprite ( SimSprite sprite  ) 

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

Can one drive at the specified tile?

Parameters:
x X coordinate at map.
y Y coordinate at map.
Returns:
0 if not, 1 if you can, -1 otherwise

Definition at line 1621 of file sprite.cpp.

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

Referenced by doBusSprite().

void Micropolis::explodeSprite ( SimSprite sprite  ) 

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

Destroy a map tile.

Parameters:
ox X coordinate in pixels.
oy Y coordinate in pixels.

Definition at line 1709 of file sprite.cpp.

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

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

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

Start a fire in a zone.

Parameters:
Xloc X coordinate in map coordinate.
Yloc Y coordinate in map coordinate.
ch Map character at (Xloc, Yloc).

Definition at line 1759 of file sprite.cpp.

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

Referenced by destroyMapTile().

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

Start a fire at a single tile.

Parameters:
x X coordinate in map coordinate.
y Y coordinate in map coordinate.

Definition at line 1800 of file sprite.cpp.

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

Referenced by doExplosionSprite().

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

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

Parameters:
x X coordinate in map coordinate.
y Y coordinate in map coordinate.

Definition at line 1831 of file sprite.cpp.

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

Referenced by doRail().

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

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

Parameters:
x X coordinate in map coordinate.
y Y coordinate in map coordinate.

Definition at line 1844 of file sprite.cpp.

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

void Micropolis::generateShip (  ) 

Try to construct a new ship sprite

Definition at line 1853 of file sprite.cpp.

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

Referenced by doSpecialZone().

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

Start a new ship sprite at the given map tile.

Parameters:
x X coordinate in map coordinate.
y Y coordinate in map coordinate.

Definition at line 1900 of file sprite.cpp.

References makeSprite(), and SPRITE_SHIP.

Referenced by generateShip().

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 1912 of file sprite.cpp.

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

Referenced by doDisasters(), and scenarioDisaster().

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

Start a new monster sprite at the given map tile.

Parameters:
x X coordinate in map coordinate.
y Y coordinate in map coordinate.

Definition at line 1951 of file sprite.cpp.

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

Referenced by makeMonster().

void Micropolis::generateCopter ( const Position pos  ) 

Ensure a helicopter sprite exists.

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

Parameters:
pos Start position in map coordinates.

Definition at line 1964 of file sprite.cpp.

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

Referenced by doAirport().

void Micropolis::generatePlane ( const Position pos  ) 

Ensure an airplane sprite exists.

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

Parameters:
pos Start position in map coordinates.

Definition at line 1980 of file sprite.cpp.

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

Referenced by doAirport().

void Micropolis::makeTornado (  ) 

Ensure a tornado sprite exists.

Definition at line 1991 of file sprite.cpp.

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

Referenced by doDisasters().

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

Construct an explosion sprite.

Parameters:
x X coordinate of the explosion (in map coordinates).
y Y coordinate of the explosion (in map coordinates).

Definition at line 2015 of file sprite.cpp.

References makeExplosionAt(), and testBounds().

Referenced by doMeltdown(), and fireBomb().

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

Construct an explosion sprite.

Parameters:
x X coordinate of the explosion (in pixels).
y Y coordinate of the explosion (in pixels).

Definition at line 2028 of file sprite.cpp.

References newSprite(), and SPRITE_EXPLOSION.

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

static bool Micropolis::testBounds ( int  wx,
int  wy 
) [inline, static]

void Micropolis::spend ( int  dollars  ) 

Deduct dollars from the player funds.

Parameters:
dollars Amount of money spent.

Definition at line 143 of file stubs.cpp.

References setFunds(), and totalFunds.

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

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:
dollars New value for the player funds.

Definition at line 156 of file stubs.cpp.

References totalFunds, and updateFunds().

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

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 169 of file stubs.cpp.

Referenced by simUpdate().

Ptr Micropolis::newPtr ( int  size  ) 

Claim size bytes of memory.

Parameters:
size Number of bytes to claim.
Returns:
Pointer to the claimed memory.

Definition at line 186 of file stubs.cpp.

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

void Micropolis::freePtr ( void *  data  ) 

Release claimed memory.

Parameters:
data Pointer to previously claimed memory.

Definition at line 196 of file stubs.cpp.

Referenced by destroyMapArrays(), and destroySprite().

void Micropolis::doPlayNewCity (  ) 

Bug:
Function is never called.

Definition at line 203 of file stubs.cpp.

References callback().

void Micropolis::doReallyStartGame (  ) 

Bug:
Function is never called.

Definition at line 210 of file stubs.cpp.

References callback().

void Micropolis::doStartLoad (  ) 

Bug:
Function is never called.

Definition at line 217 of file stubs.cpp.

References callback().

void Micropolis::doStartScenario ( int  scenario  ) 

Tell the front-end a scenario is started.

Parameters:
scenario The scenario being started.
See also:
Scenario.
Bug:
Function is never called.

Definition at line 229 of file stubs.cpp.

References callback().

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 240 of file stubs.cpp.

References simPass, simPasses, and simPaused.

void Micropolis::callback ( const char *  name,
const char *  params,
  ... 
)

Scripting language independent callback mechanism.

This allows Micropolis to send callback messages with a variable number of typed parameters back to the scripting language, while maintining independence from the particular scripting language (or user interface runtime).

The name is the name of a message to send. The params is a string that specifies the number and types of the following vararg parameters. There is one character in the param string per vararg parameter. The following parameter types are currently supported:

  • i: integer
  • f: float
  • s: string

See PythonCallbackHook defined in swig/micropolis-swig-python.i for an example of a callback function.

Parameters:
name Name of the callback.
params Parameters of the callback.

Definition at line 275 of file stubs.cpp.

References callbackData, and callbackHook.

Referenced by didLoadCity(), didLoadScenario(), didntLoadCity(), didntSaveCity(), didSaveCity(), didTool(), doAutoGoto(), doEarthquake(), doHospitalChurch(), doLoseGame(), doNewGame(), doPlayNewCity(), doReallyStartGame(), doSaveCityAs(), doScoreCard(), doShowZoneStatus(), doStartLoad(), doStartScenario(), doWinGame(), generateSomeCity(), graphDoer(), invalidateMaps(), makeSound(), pause(), resume(), sendMessage(), setCleanCityName(), updateBudget(), updateDate(), and updateGameLevel().

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 294 of file stubs.cpp.

References callback(), and makeSound().

Referenced by makeEarthquake().

void Micropolis::invalidateMaps (  ) 

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

Definition at line 303 of file stubs.cpp.

References callback(), and mapSerial.

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

void Micropolis::makeSound ( const char *  channel,
const char *  sound,
int  x = -1,
int  y = -1 
)

Instruct the front-end to make a sound.

Parameters:
channel Name 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.
sound Name of the sound.
x Tile X position of sound, 0 to WORLD_W, or -1 for everywhere.
y Tile Y position of sound, 0 to WORLD_H, or -1 for everywhere.

Definition at line 320 of file stubs.cpp.

References callback(), and enableSound.

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

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

Get a tile from the map.

Parameters:
x X coordinate of the position to get, 0 to WORLD_W.
y Y 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 336 of file stubs.cpp.

References DIRT, map, and testBounds().

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

Set a tile into the map.

Parameters:
x X coordinate of the position to get, 0 to WORLD_W.
y Y coordinate of the position to get, 0 to WORLD_H.
tile the tile value to set.
Note:
Off-map positions are ignored.

Definition at line 353 of file stubs.cpp.

References map, and testBounds().

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 368 of file stubs.cpp.

References mapBase.

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

Get a value from the power grid map.

Parameters:
x X coordinate of the position to get, 0 to WORLD_W.
y Y 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 382 of file stubs.cpp.

References powerGridMap.

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

Set a value in the power grid map.

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

Definition at line 396 of file stubs.cpp.

References powerGridMap.

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 408 of file stubs.cpp.

References powerGridMap.

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

Get a value from the population density map.

Parameters:
x X coordinate of the position to get, 0 to WORLD_W_2.
y Y 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 422 of file stubs.cpp.

References populationDensityMap.

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

Set a value in the population density map.

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

Definition at line 436 of file stubs.cpp.

References populationDensityMap.

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 448 of file stubs.cpp.

References populationDensityMap.

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

Get a value from the rate of growth map.

Parameters:
x X coordinate of the position to get, 0 to WORLD_W_8.
y Y 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 462 of file stubs.cpp.

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

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

Set a value in the rate of growth map.

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

Definition at line 476 of file stubs.cpp.

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

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 488 of file stubs.cpp.

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

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

Get a value from the traffic density map.

Parameters:
x X coordinate of the position to get, 0 to WORLD_W_2.
y Y 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 502 of file stubs.cpp.

References trafficDensityMap.

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

Set a value in the traffic density map.

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

Definition at line 516 of file stubs.cpp.

References trafficDensityMap.

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 528 of file stubs.cpp.

References trafficDensityMap.

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

Get a value from the pollution density map.

Parameters:
x X coordinate of the position to get, 0 to WORLD_W_2.
y Y 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 542 of file stubs.cpp.

References pollutionDensityMap.

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

Set a value in the pollition density map.

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

Definition at line 556 of file stubs.cpp.

References pollutionDensityMap.

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 568 of file stubs.cpp.

References pollutionDensityMap.

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

Get a value from the crime rate map.

Parameters:
x X coordinate of the position to get, 0 to WORLD_W_2.
y Y 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 582 of file stubs.cpp.

References crimeRateMap.

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

Set a value in the crime rate map.

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

Definition at line 596 of file stubs.cpp.

References crimeRateMap.

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 608 of file stubs.cpp.

References crimeRateMap.

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

Get a value from the land value map.

Parameters:
x X coordinate of the position to get, 0 to WORLD_W_2.
y Y 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 622 of file stubs.cpp.

References landValueMap.

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

Set a value in the land value map.

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

Definition at line 636 of file stubs.cpp.

References landValueMap.

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 648 of file stubs.cpp.

References landValueMap.

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

Get a value from the fire coverage map.

Parameters:
x X coordinate of the position to get, 0 to WORLD_W_8.
y Y 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 662 of file stubs.cpp.

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

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

Set a value in the fire coverage map.

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

Definition at line 676 of file stubs.cpp.

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

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 688 of file stubs.cpp.

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

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

Get a value from the police coverage map.

Parameters:
x X coordinate of the position to get, 0 to WORLD_W_8.
y Y 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 701 of file stubs.cpp.

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

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

Set a value in the police coverage map.

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

Definition at line 715 of file stubs.cpp.

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

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 727 of file stubs.cpp.

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

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

Apply a tool.

Parameters:
tool Tool to use.
tileX Horizontal position in the city map.
tileY Vertical position in the city map.
Returns:
Tool result.

Definition at line 1369 of file tool.cpp.

References buildBuildingTool(), forestTool(), landTool(), ToolEffects::modifyIfEnoughFunding(), networkTool(), parkTool(), queryTool(), railroadTool(), roadTool(), TOOLRESULT_FAILED, TOOLRESULT_NO_MONEY, TOOLRESULT_OK, and wireTool().

Referenced by toolDown(), and toolDrag().

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

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

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

Parameters:
tool Tool being dragged.
fromX Horizontal coordinate of the starting position.
fromY Vertical coordinate of the starting position.
toX Horizontal coordinate of the ending position.
toY Vertical coordinate of the ending position.

Definition at line 1510 of file tool.cpp.

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

void Micropolis::didTool ( const char *  name,
short  x,
short  y 
)

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

Parameters:
name,: Name of the tool.
x X coordinate of where the tool was applied.
y Y coordinate of where the tool was applied.

Definition at line 928 of file tool.cpp.

References callback().

Referenced by bulldozerTool(), and queryTool().

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

Do query tool.

Parameters:
x X coordinate of the position of the query.
y Y coordinate of the position of the query.
Returns:
Tool result.

Definition at line 944 of file tool.cpp.

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

Referenced by doTool().

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

Apply bulldozer tool.

Parameters:
x X coordinate of the position of the query.
y Y coordinate of the position of the query.
Returns:
Tool result.
Todo:
Code is too complex/long.
Bug:
Tool does not return TOOLRESULT_NO_MONEY.
Bug:
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 982 of file tool.cpp.

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

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

Build a road at a tile.

Parameters:
x Horizontal position of the tile to lay road.
y Vertical position of the tile to lay road.
effects Storage of effects of laying raod at the tile.
Returns:
Tool result.
Todo:
Merge roadTool, railroadTool, wireTool, and parkTool functions.

Definition at line 1092 of file tool.cpp.

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

Referenced by doTool().

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

Build a rail track at a tile.

Parameters:
x Horizontal position of the tile.
y Vertical position of the tile.
effects Storage of effects of laying the rail.
Returns:
Tool result.

Definition at line 1118 of file tool.cpp.

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

Referenced by doTool().

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

Build a wire at a tile.

Parameters:
x Horizontal position of the tile to wire.
y Vertical position of the tile to wire.
effects Storage of effects of wiring the tile.
Returns:
Tool result.

Definition at line 1144 of file tool.cpp.

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

Referenced by doTool().

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

Build a park.

Parameters:
x Horizontal position of 'center tile' of the park.
y Vertical position of 'center tile' of the park.
effects Storage of effects of putting down the park.
Returns:
Tool result.

Definition at line 1170 of file tool.cpp.

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

Referenced by doTool().

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

Build a building.

Parameters:
x Horizontal position of center tile of the new building.
y Vertical position of center tile of the new building.
buildingProps Building properties of the building being constructed.
effects Storage of effects of putting down the building.
Returns:
Tool result.

Definition at line 1197 of file tool.cpp.

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

Referenced by doTool().

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

Put down a network.

Todo:
Is this ever used?

Definition at line 1258 of file tool.cpp.

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

Referenced by doTool().

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 1300 of file tool.cpp.

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

Referenced by doTool().

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 1323 of file tool.cpp.

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

Referenced by doTool().

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

Put a park down at the give tile.

Parameters:
mapH X coordinate of the tile.
mapV Y coordinate of the tile.
effects Storage of effects of putting down the park.
Returns:
Tool result.
Todo:
Add auto-bulldoze? (seems to be missing).

Definition at line 244 of file tool.cpp.

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

Referenced by parkTool().

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

Put down a communication network.

Parameters:
mapH X coordinate of the tile.
mapV Y coordinate of the tile.
Returns:
Tool result.
Parameters:
effects Storage of effects of putting down the park.
Todo:
Auto-bulldoze costs should be pulled from a table/constant.

Definition at line 274 of file tool.cpp.

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

Referenced by networkTool().

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

Put down a water tile.

Parameters:
mapH X coordinate of the tile.
mapV Y coordinate of the tile.
Returns:
Tool result.

Definition at line 302 of file tool.cpp.

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

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

Put down a land tile.

Parameters:
mapH X coordinate of the tile.
mapV Y coordinate of the tile.
Returns:
Tool result.
Todo:
Auto-bulldoze deducts always 1.
Todo:
Auto-bulldoze costs should be pulled from a table/constant.

Definition at line 325 of file tool.cpp.

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

Referenced by landTool().

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

Put down a forest tile.

Parameters:
mapH X coordinate of the tile.
mapV Y coordinate of the tile.
Returns:
Tool result.
Todo:
Auto-bulldoze deducts always 1.

Definition at line 358 of file tool.cpp.

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

Referenced by forestTool().

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

Report about the status of a tile.

Parameters:
mapH X coordinate of the tile.
mapV Y coordinate of the tile.
Bug:
Program breaks for status on 'dirt'

Definition at line 830 of file tool.cpp.

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

Referenced by queryTool().

void Micropolis::doShowZoneStatus ( char *  str,
char *  s0,
char *  s1,
char *  s2,
char *  s3,
char *  s4,
int  x,
int  y 
) [private]

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

Parameters:
str Category of the tile.
s0 Population density text.
s1 Land value text.
s2 Crime rate text.
s3 Pollution text.
s4 Grow rate text.
x X coordinate of the tile.
y Y coordinate of the tile.

Definition at line 889 of file tool.cpp.

References callback().

Referenced by doZoneStatus().

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:
leftX Position of left column of tiles of the building.
topY Position of top row of tiles of the building.
sizeX Horizontal size of the building.
sizeY Vertical size of the building.
baseTile Tile value to use at the top-left position. Tiles are laid in column major mode.
aniFlag Set animation flag at relative position (1, 2)
effects Storage 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 609 of file tool.cpp.

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

Referenced by buildBuilding().

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:
leftX Position of left column of tiles of the building.
topY Position of top row of tiles of the building.
sizeX Horizontal size of the building.
sizeY Vertical size of the building.
effects Storage of effects of preparing the site.
Returns:
: Result of preparation.

Definition at line 649 of file tool.cpp.

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

Referenced by buildBuilding().

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

Build a building.

Parameters:
mapH Horizontal position of the 'center' tile in the world.
mapV Vertical position of the 'center' tile in the world.
buildingProps Building properties of the building being constructed.
effects Storage of effects of putting down the building.
Returns:
Tool result.
Todo:
Give putBuilding a BuildingProperties pointer instead.
Todo:
Move cost into building properties?

Definition at line 703 of file tool.cpp.

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

Referenced by buildBuildingTool().

int Micropolis::getDensityStr ( short  catNo,
short  mapH,
short  mapV 
) [private]

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

Parameters:
catNo Category number: 0: population density 1: land value. 2: crime rate. 3: pollution. 4: growth rate.
mapH X coordinate of the tile.
mapV Y coordinate of the tile.
Returns:
Index into stri.202 file.

Definition at line 780 of file tool.cpp.

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

Referenced by doZoneStatus().

bool Micropolis::tally ( short  tileValue  )  [private]

Can the tile be auto-bulldozed?.

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

Definition at line 527 of file tool.cpp.

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

short Micropolis::checkSize ( short  tileValue  )  [private]

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

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

Definition at line 540 of file tool.cpp.

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

Referenced by bulldozerTool().

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

Check and connect a new zone around the border.

Parameters:
xMap X coordinate of top-left tile.
yMap Y coordinate of top-left tile.
sizeX Horizontal size of the new zone.
sizeY Vertical size of the new zone.
effects Storage of the effects.

Definition at line 567 of file tool.cpp.

References CONNECT_TILE_FIX, and connectTile().

Referenced by buildBuilding().

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

Make a size by size tiles square of rubble

Parameters:
x Horizontal position of the left-most tile
y Vertical position of the left-most tile
size Size of the rubble square

Definition at line 904 of file tool.cpp.

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

Referenced by bulldozerTool().

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

Makes traffic starting from the road tile at , .

Parameters:
x Start x position of the attempt
y Start y position of the attempt
dest Zone type to go to.
Returns:
1 if connection found, 0 if not found, -1 if no connection to road found.

Definition at line 83 of file traffic.cpp.

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

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:
x Start x position of the attempt
y Start y position of the attempt
dest Zone type to go to.
Returns:
1 if connection found, 0 if not found, -1 if no connection to road found.

Definition at line 106 of file traffic.cpp.

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

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

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

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

Parameters:
startPos Start position of the attempt.
dest Zone type to go to.
Returns:
1 if connection found, 0 if not found, -1 if no connection to road found.

Definition at line 122 of file traffic.cpp.

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

void Micropolis::addToTrafficDensityMap (  )  [private]

void Micropolis::pushPos ( const Position pos  )  [private]

Push a position onto the position stack.

Parameters:
pos Position to push.
Precondition:
Stack may not be full.

Definition at line 198 of file traffic.cpp.

References curMapStackPointer, curMapStackXY, and MAX_TRAFFIC_DISTANCE.

Referenced by tryDrive().

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 211 of file traffic.cpp.

References curMapStackPointer, and curMapStackXY.

Referenced by addToTrafficDensityMap().

bool Micropolis::findPerimeterRoad ( Position pos  )  [private]

Find a connection to a road at the perimeter.

Parameters:
pos Starting 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 227 of file traffic.cpp.

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

Referenced by doSpecialZone(), and makeTraffic().

bool Micropolis::findPerimeterTelecom ( const Position pos  )  [private]

Find a telecom connection at the perimeter.

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

Definition at line 262 of file traffic.cpp.

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

Referenced by makeTraffic().

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

Try to drive to a destination.

Parameters:
startPos Starting position.
destZone Zonetype 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 297 of file traffic.cpp.

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

Referenced by makeTraffic(), and makeTrafficAt().

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

Try to drive one tile in a random direction.

Parameters:
pos Current position.
dirLast Forbidden direction for movement (to prevent reversing).
Returns:
Direction of movement, DIR2_INVALID is returned if not moved.

Definition at line 344 of file traffic.cpp.

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

Referenced by tryDrive().

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

Get neighbouring tile from the map.

Parameters:
pos Current position.
dir Direction of neighbouring tile, only horizontal and vertical directions are supported.
defaultTile Tile 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 395 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().

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

Has the journey arrived at its destination?

Parameters:
pos Current position.
destZone Zonetype to drive to.
Returns:
Destination has been reached.

Definition at line 441 of file traffic.cpp.

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

Referenced by tryDrive().

bool Micropolis::roadTest ( MapValue  mv  )  [private]

Can the given tile be used as road?

Parameters:
mv Value from the map.
Returns:
Indication that you can drive on the given tile

Definition at line 491 of file traffic.cpp.

References LOMASK.

Referenced by findPerimeterRoad(), and tryGo().

void Micropolis::updateFunds (  ) 

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

Definition at line 115 of file update.cpp.

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

void Micropolis::updateDate (  ) 

Bug:
Message is wrong.

Definition at line 147 of file update.cpp.

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

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 249 of file update.cpp.

void Micropolis::pause (  ) 

Pause a simulation

See also:
resume

Definition at line 140 of file utilities.cpp.

References callback(), and simPaused.

void Micropolis::resume (  ) 

Resume simulation after pausing it

See also:
pause

Definition at line 156 of file utilities.cpp.

References callback(), and simPaused.

void Micropolis::setGameLevelFunds ( GameLevel  level  ) 

Set the game level and initial funds.

Parameters:
level New game level.

Definition at line 200 of file utilities.cpp.

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

Referenced by simInit().

void Micropolis::setGameLevel ( GameLevel  level  ) 

Set/change the game level.

Parameters:
level New game level.

Definition at line 227 of file utilities.cpp.

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

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

void Micropolis::updateGameLevel (  ) 

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

Definition at line 236 of file utilities.cpp.

References callback().

Referenced by setGameLevel().

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

Set the name of the city.

Parameters:
name New name of the city.

Definition at line 264 of file utilities.cpp.

References callback(), and cityName.

Referenced by loadScenario().

int Micropolis::currentYear (  ) 

Get the current year.

Returns:
The current game year.

Definition at line 289 of file utilities.cpp.

References cityTime, and startingYear.

void Micropolis::doNewGame (  ) 

Notify the user interface to start a new game.

Definition at line 298 of file utilities.cpp.

References callback().

Referenced by initWillStuff().

void Micropolis::setEnableDisasters ( bool  value  ) 

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

Parameters:
value New setting for enableDisasters

Definition at line 309 of file utilities.cpp.

References enableDisasters, and mustUpdateOptions.

Referenced by simInit().

void Micropolis::setAutoBudget ( bool  value  ) 

Set the auto-budget to the given value.

Parameters:
value New value for the auto-budget setting.

Definition at line 320 of file utilities.cpp.

References autoBudget, and mustUpdateOptions.

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

void Micropolis::setAutoBulldoze ( bool  value  ) 

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

Parameters:
value The value to set autoBulldoze to.

Definition at line 334 of file utilities.cpp.

References autoBulldoze, and mustUpdateOptions.

Referenced by loadFile(), and simInit().

void Micropolis::setAutoGoto ( bool  value  ) 

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

Parameters:
value The value to set autoGoto to.

Definition at line 348 of file utilities.cpp.

References autoGoto, and mustUpdateOptions.

Referenced by loadFile(), and simInit().

void Micropolis::setEnableSound ( bool  value  ) 

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

Parameters:
value The value to set enableSound to.

Definition at line 362 of file utilities.cpp.

References enableSound, and mustUpdateOptions.

Referenced by loadFile(), and simInit().

void Micropolis::setDoAnimation ( bool  value  ) 

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

Parameters:
value The value to set doAnimation to.

Definition at line 376 of file utilities.cpp.

References doAnimation, and mustUpdateOptions.

void Micropolis::setDoMessages ( bool  value  ) 

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

Parameters:
value The value to set doMessages to.

Definition at line 390 of file utilities.cpp.

References doMessages, and mustUpdateOptions.

void Micropolis::setDoNotices ( bool  value  ) 

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

Parameters:
value The value to set doNotices to.

Definition at line 404 of file utilities.cpp.

References doNotices, and mustUpdateOptions.

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 416 of file utilities.cpp.

void Micropolis::doZone ( const Position pos  )  [private]

void Micropolis::doHospitalChurch ( const Position pos  )  [private]

Handle repairing or removing of hospitals and churches.

Parameters:
pos Position of the hospital or church.

Definition at line 133 of file zone.cpp.

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

Referenced by doZone().

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

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

Referenced by doIndustrial().

void Micropolis::makeHospital ( const Position pos  )  [private]

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

Parameters:
pos Center position of the new hospital or church.

Definition at line 278 of file zone.cpp.

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

Referenced by doResidential().

short Micropolis::getLandPollutionValue ( const Position pos  )  [private]

Compute land value at pos, taking pollution into account.

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

Definition at line 309 of file zone.cpp.

References landValueMap, pollutionDensityMap, Position::posX, and Position::posY.

Referenced by doCommercial(), and doResidential().

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

Update the rate of growth at position pos by amount.

Parameters:
pos Position to modify.
amount Amount of change (can both be positive and negative).

Definition at line 337 of file zone.cpp.

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

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

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

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

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

Definition at line 352 of file zone.cpp.

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

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

short Micropolis::doFreePop ( const Position pos  )  [private]

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

Parameters:
pos Position of the residential zone.
Returns:
Number of single tile houses.

Definition at line 395 of file zone.cpp.

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

Referenced by doResidential(), and getPopulationDensity().

bool Micropolis::setZonePower ( const Position pos  )  [private]

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

Parameters:
pos Position to copy.
Returns:
Does the tile have power?

Definition at line 419 of file zone.cpp.

References LOMASK, map, NUCLEAR, Position::posX, Position::posY, powerGridMap, POWERPLANT, and PWRBIT.

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

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

Try to build a house at the zone at pos.

Parameters:
pos Center tile of the zone.
value Value 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 445 of file zone.cpp.

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

Referenced by doResIn().

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

Evaluate suitability of the position for placing a new house.

Returns:
Suitability.

Definition at line 500 of file zone.cpp.

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

Referenced by buildHouse().

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

Handle residential zone.

Parameters:
pos Center tile of the residential zone.
zonePwrFlg Does the zone have power?

Definition at line 534 of file zone.cpp.

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

Referenced by doZone().

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

Perform residential immigration into the current residential tile.

Parameters:
pos Position of the tile.
pop Population ?
value Land value corrected for pollution.

Definition at line 600 of file zone.cpp.

References buildHouse(), incRateOfGrowth(), LOMASK, map, pollutionDensityMap, populationDensityMap, Position::posX, Position::posY, and resPlop().

Referenced by doResidential().

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

Perform residential emigration from the current residential tile.

Parameters:
pos Position of the tile.
pop Population ?
value Land value corrected for pollution.

Definition at line 641 of file zone.cpp.

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

Referenced by doResidential().

short Micropolis::getResZonePop ( MapTile  mapTile  )  [private]

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

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

Definition at line 697 of file zone.cpp.

Referenced by doResidential(), and getPopulationDensity().

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

Put down a residential zone.

Parameters:
pos Center tile of the residential zone.
den Population density (0..3)
value Land value - pollution (0..3), higher is better.

Definition at line 710 of file zone.cpp.

References zonePlop().

Referenced by doResIn(), and doResOut().

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

Evaluate residential zone.

Definition at line 722 of file zone.cpp.

References landValueMap, min(), pollutionDensityMap, Position::posX, and Position::posY.

Referenced by doResidential().

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

Handle commercial zone.

Parameters:
pos Position of the commercial zone.
zonePwrFlg Does the zone have power?
Todo:
Make zonePwrFlg a boolean.

Definition at line 751 of file zone.cpp.

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

Referenced by doZone().

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

Handle immigration of commercial zone.

Parameters:
pos Position of the commercial zone.
pop Population ?
value Land value corrected for pollution.

Definition at line 809 of file zone.cpp.

References comPlop(), incRateOfGrowth(), landValueMap, Position::posX, and Position::posY.

Referenced by doCommercial().

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

Handle emigration of commercial zone.

Parameters:
pos Position of the commercial zone.
pop Population ?
value Land value corrected for pollution.

Definition at line 832 of file zone.cpp.

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

Referenced by doCommercial().

short Micropolis::getComZonePop ( MapTile  tile  )  [private]

Get commercial zone population number.

Parameters:
tile Tile of the commercial zone.
Returns:
Population number of the zone.

Definition at line 852 of file zone.cpp.

Referenced by doCommercial(), and getPopulationDensity().

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

Build a commercial zone.

Parameters:
pos Position of the commercial zone.
Den Density
Value Land value corrected for pollution.

Definition at line 869 of file zone.cpp.

References zonePlop().

Referenced by doComIn(), and doComOut().

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

Compute evaluation of a commercial zone.

Parameters:
traf Result if traffic attempt.
Returns:
Evaluation value of the commercial zone.

Definition at line 883 of file zone.cpp.

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

Referenced by doCommercial().

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

Handle industrial zone.

Parameters:
pos Position of the industrial zone.
zonePwrFlg Does the zone have power?
Todo:
Make zonePwrFlg a boolean.

Definition at line 903 of file zone.cpp.

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

Referenced by doZone().

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

Handle immigration of industrial zone.

Parameters:
pos Position of the center tile of the industrial tile.
pos Population value of the industrial zone.
value Random land value (it seems).

Definition at line 953 of file zone.cpp.

References incRateOfGrowth(), and indPlop().

Referenced by doIndustrial().

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

Handle industrial zone emigration.

Parameters:
pos Position of the center tile of the industrial tile.
pos Population value of the industrial zone.
value Random land value (it seems).

Definition at line 967 of file zone.cpp.

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

Referenced by doIndustrial().

short Micropolis::getIndZonePop ( MapTile  tile  )  [private]

Get the population value for the given industrial tile.

Parameters:
tile Center tile value of the industrial zone.
Returns:
Population value.

Definition at line 987 of file zone.cpp.

References INDCLR, and IZB.

Referenced by doIndustrial(), and getPopulationDensity().

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

Place an industrial zone around center tile pos.

Parameters:
pos Center of the industrial zone.
den Population density of the industrial zone (0, 1, 2, or 3).
value Landvalue of the industrial zone (0 or 1).

Definition at line 1003 of file zone.cpp.

References IND1, and zonePlop().

Referenced by doIndIn(), and doIndOut().

short Micropolis::evalInd ( int  traf  )  [private]

Compute evaluation of an industrial zone.

Parameters:
traf Result if traffic attempt.
Returns:
Evaluation value of the industrial zone.

Definition at line 1015 of file zone.cpp.

Referenced by doIndustrial().


Member Data Documentation

Number of road tiles in the game.

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

Definition at line 1057 of file micropolis.h.

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

Total number of rails.

No penalty for bridges or high traffic density.

Definition at line 1064 of file micropolis.h.

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

Number of fires.

Definition at line 1069 of file micropolis.h.

Referenced by getFireSeverity(), and init().

Number of people in the residential zones.

Depends on level of zone development.

Definition at line 1076 of file micropolis.h.

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

Commercial zone population.

Depends on level of zone development.

Definition at line 1083 of file micropolis.h.

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

Industrial zone population.

Depends on level of zone development.

Definition at line 1090 of file micropolis.h.

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

Total population.

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

Definition at line 1098 of file micropolis.h.

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

Last total population.

Not used?

Definition at line 1105 of file micropolis.h.

Referenced by init(), and setValves().

Total zone population.

Definition at line 1114 of file micropolis.h.

Referenced by init(), and sendMessages().

Police station population.

Definition at line 1124 of file micropolis.h.

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

Fire station population.

Definition at line 1129 of file micropolis.h.

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

Coal power plant population.

Definition at line 1134 of file micropolis.h.

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

Nuclear power plant population.

Definition at line 1139 of file micropolis.h.

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

Seaport population.

Definition at line 1144 of file micropolis.h.

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

Airport population.

Definition at line 1149 of file micropolis.h.

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

Average crime.

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

Definition at line 1157 of file micropolis.h.

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

Average pollution.

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

Definition at line 1166 of file micropolis.h.

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

Land value average.

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

Definition at line 1174 of file micropolis.h.

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

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

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

City month, 4 time units per month.

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

Definition at line 1192 of file micropolis.h.

Referenced by init(), and updateDate().

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

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

Definition at line 1198 of file micropolis.h.

Referenced by init(), and updateDate().

City starting year.

Definition at line 1203 of file micropolis.h.

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

unsigned short* Micropolis::map[WORLD_W]

10 year residential history maximum value.

Definition at line 1219 of file micropolis.h.

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

120 year residential history maximum value.

Definition at line 1224 of file micropolis.h.

Referenced by init(), and initGraphMax().

10 year commercial history maximum value.

Definition at line 1229 of file micropolis.h.

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

120 year commercial history maximum value.

Definition at line 1234 of file micropolis.h.

Referenced by init(), and initGraphMax().

10 year industrial history maximum value.

Definition at line 1239 of file micropolis.h.

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

120 year industrial history maximum value.

Definition at line 1244 of file micropolis.h.

Referenced by init(), and initGraphMax().

Census changed flag.

Need to redraw census dependent stuff.

Definition at line 1251 of file micropolis.h.

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

Spending on roads.

Definition at line 1259 of file micropolis.h.

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

Spending on police stations.

Definition at line 1264 of file micropolis.h.

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

Spending on fire stations.

Definition at line 1269 of file micropolis.h.

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

Requested funds for roads.

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

Definition at line 1276 of file micropolis.h.

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

Requested funds for police stations.

Depends on police station population.

Definition at line 1283 of file micropolis.h.

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

Requested funds for fire stations.

Depends on fire station population.

Definition at line 1290 of file micropolis.h.

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

Ratio of road spending over road funding, times MAX_ROAD_EFFECT.

Definition at line 1295 of file micropolis.h.

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

Ratio of police spending over police funding, times MAX_POLICE_EFFECT.

Definition at line 1300 of file micropolis.h.

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

Ratio of fire spending over fire funding, times MAX_FIRE_EFFECT.

Definition at line 1305 of file micropolis.h.

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

Funds from taxes.

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

Definition at line 1313 of file micropolis.h.

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

City tax rate.

Definition at line 1318 of file micropolis.h.

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

Tax port flag.

Apparently never used. CollectTax checks it.

Todo:
Apparently taxFlag is never set to true in MicropolisEngine or the TCL code.
Todo:
Don should check old Mac code to see if it's ever set.
Todo:
Variable is always 0. Decide whether to keep it, and if yes, create means to modify its value

Definition at line 1331 of file micropolis.h.

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

Terrain development density map.

Used to calculate land value.

Definition at line 1349 of file micropolis.h.

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

Temporary map 1.

Used to smooth population density, pollution.

Definition at line 1356 of file micropolis.h.

Referenced by destroyMapArrays(), and populationDensityScan().

Temporary map 2.

Used to smooth population density, pollution.

Definition at line 1363 of file micropolis.h.

Referenced by destroyMapArrays(), and populationDensityScan().

Temporary map 3.

Used to smooth development density, for terrainDensityMap.

Definition at line 1370 of file micropolis.h.

Referenced by destroyMapArrays().

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

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

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

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

Copy of fire station map to display.

Definition at line 1400 of file micropolis.h.

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

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

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

Copy of police station map to display.

Definition at line 1416 of file micropolis.h.

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

Commercial rate map.

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

Definition at line 1424 of file micropolis.h.

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

Memory used to save miscelaneous game values in save file.

Definition at line 1465 of file micropolis.h.

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

short Micropolis::needHospital [private]

Need hospital?

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

Definition at line 1477 of file micropolis.h.

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

short Micropolis::needChurch [private]

Need church?

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

Definition at line 1484 of file micropolis.h.

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

unsigned short* Micropolis::mapBase [private]

Memory for map array.

Definition at line 1490 of file micropolis.h.

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

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

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

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

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

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

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

Amount of road funding granted.

Definition at line 1542 of file micropolis.h.

Referenced by doBudgetNow(), and init().

Amount of police funding granted.

Definition at line 1547 of file micropolis.h.

Referenced by doBudgetNow(), and init().

Amount of fire station funding granted.

Definition at line 1552 of file micropolis.h.

Referenced by doBudgetNow(), and init().

Flag set when budget window needs to be updated.

Definition at line 1557 of file micropolis.h.

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

Size of flooding disaster.

Definition at line 1606 of file micropolis.h.

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

Yes votes.

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

Definition at line 1645 of file micropolis.h.

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

short Micropolis::problemVotes[PROBNUM]

Problem votes.

The number of votes for each problem.

See also:
CityVotingProblems

Definition at line 1653 of file micropolis.h.

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

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

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

City population.

Depends of ResPop, ComPop and IndPop.

Definition at line 1668 of file micropolis.h.

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

Change in the city population.

Depends on last cityPop.

Definition at line 1675 of file micropolis.h.

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

City assessed value.

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

Definition at line 1685 of file micropolis.h.

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

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

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

Change in the city score.

Depends on city score.

Definition at line 1705 of file micropolis.h.

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

Average traffic.

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

Definition at line 1712 of file micropolis.h.

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

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

Definition at line 1811 of file micropolis.h.

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

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

Definition at line 1817 of file micropolis.h.

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

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

Definition at line 1823 of file micropolis.h.

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

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

Definition at line 1829 of file micropolis.h.

Referenced by generateMap(), and init().

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

Definition at line 1890 of file micropolis.h.

Referenced by initGraphs().

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

Definition at line 1895 of file micropolis.h.

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

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

Definition at line 1900 of file micropolis.h.

Referenced by init(), and initGraphMax().

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

Definition at line 1954 of file micropolis.h.

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

The count of the current pass through the simulator loop.

Definition at line 1959 of file micropolis.h.

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

Simulation is paused

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

Definition at line 1965 of file micropolis.h.

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

Todo:
Not currently used, should hook it up.

Definition at line 1969 of file micropolis.h.

Referenced by init(), and simUpdate().

Enable animation.

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

Definition at line 1975 of file micropolis.h.

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

Todo:
Not currently used, should hook it up.

Definition at line 1977 of file micropolis.h.

Referenced by init(), and setDoMessages().

Todo:
Not currently used, should hook it up.

Definition at line 1979 of file micropolis.h.

Referenced by init(), and setDoNotices().

std::string Micropolis::cityName

Name of the city.

Name of the city.

Todo:
Write-only variable, should it be removed?

Definition at line 1998 of file micropolis.h.

Referenced by init(), and setCleanCityName().

int Micropolis::heatFlow [private]

Todo:
Always -7, should this variable be moved or removed?

Definition at line 2007 of file micropolis.h.

Referenced by init(), and simHeat().

int Micropolis::heatWrap [private]

Todo:
Always 3, should this variable be moved or removed?

Definition at line 2014 of file micropolis.h.

Referenced by init(), and simHeat().

Population of last city class check.

See also:
CheckGrowth

Definition at line 2106 of file micropolis.h.

Referenced by checkGrowth(), and init().

City class of last city class check.

See also:
CheckGrowth

Definition at line 2107 of file micropolis.h.

Referenced by checkGrowth(), and init().

Enable auto goto

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

Definition at line 2115 of file micropolis.h.

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

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

Definition at line 2151 of file micropolis.h.

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

std::string Micropolis::homeDir

Name of the Micropolis top level home directory.

Definition at line 2196 of file micropolis.h.

Referenced by environmentInit(), and init().

Name of the sub-directory where the resources are located.

Definition at line 2199 of file micropolis.h.

Referenced by environmentInit(), getResource(), init(), and loadScenario().

short Micropolis::newMap [private]

Todo:
Write-only variable, can be removed?

Definition at line 2217 of file micropolis.h.

Referenced by doSimInit(), and init().

short Micropolis::newMapFlags[MAP_TYPE_COUNT] [private]

Todo:
Write-only variable, can be removed?

Definition at line 2220 of file micropolis.h.

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

Quad Micropolis::donDither [private]

Integer with bits 0..2 that control smoothing.

Todo:
Variable is always 0. Can we delete the variable?
Todo:
Introduce constants for the bits and/or a bool array.

Definition at line 2236 of file micropolis.h.

Referenced by init().

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

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

Enable auto budget

When enabled, the program will perform budgetting of the city

Definition at line 2510 of file micropolis.h.

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

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

Definition at line 2535 of file micropolis.h.

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

CallbackFunction Micropolis::callbackHook

Hook into scripting language to send callbacks. (i.e. a function that calls back into the Python interpreter.)

Definition at line 2541 of file micropolis.h.

Referenced by callback(), and init().

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

Definition at line 2547 of file micropolis.h.

Referenced by callback(), and init().

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

Definition at line 2553 of file micropolis.h.

Referenced by init().

Position stack top pointer, points to top position.

Definition at line 2787 of file micropolis.h.

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


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

Generated on Wed Feb 2 09:19:22 2011 for Micropolis by  doxygen 1.5.6