Micropolis
|
#include <micropolis.h>
Public Member Functions | |
Micropolis () | |
~Micropolis () | |
void | setCallback (Callback *callback, emscripten::val callbackVal) |
Private Member Functions | |
void | destroy () |
void | init () |
Historic graphs. | |
short * | resHist |
short * | comHist |
short * | indHist |
short * | moneyHist |
short * | pollutionHist |
short * | crimeHist |
short * | miscHist |
float | roadPercent |
float | policePercent |
float | firePercent |
Quad | roadValue |
Quad | policeValue |
Quad | fireValue |
int | mustDrawBudget |
short | floodCount |
short | cityYes |
short | problemVotes [PROBNUM] |
short | problemOrder [CVP_PROBLEM_COMPLAINTS] |
Quad | cityPop |
Quad | cityPopDelta |
Quad | cityAssessedValue |
CityClass | cityClass |
City class, affected by city population. | |
short | cityScore |
short | cityScoreDelta |
short | trafficAverage |
short | needHospital |
short | needChurch |
unsigned short * | mapBase |
void | animateTiles () |
void | initFundingLevel () |
void | doBudget () |
void | doBudgetFromMenu () |
void | doBudgetNow (bool fromMenu) |
void | updateBudget () |
void | showBudgetWindowAndStartWaiting () |
void | setCityTax (short tax) |
void | makeMeltdown () |
void | makeFireBombs () |
void | makeEarthquake () |
void | makeFire () |
void | makeFlood () |
void | setFire () |
void | fireBomb () |
void | cityEvaluation () |
void | evalInit () |
void | doScoreCard () |
void | changeEval () |
void | scoreDoer () |
int | countProblems () |
int | getProblemNumber (int i) |
int | getProblemVotes (int i) |
bool | loadFileData (const std::string &filename) |
bool | loadFile (const std::string &filename) |
bool | saveFile (const std::string &filename) |
void | loadScenario (Scenario s) |
void | didLoadScenario (int s, const std::string name, const std::string fname) |
bool | loadCity (const std::string &filename) |
void | didLoadCity (const std::string &filename) |
void | didntLoadCity (const std::string &msg) |
void | saveCity () |
void | doSaveCityAs (const std::string &filename) |
void | didSaveCity (const std::string &filename) |
void | didntSaveCity (const std::string &msg) |
void | saveCityAs (const std::string &filename) |
void | initMapArrays () |
void | destroyMapArrays () |
ToolResult | connectTile (short x, short y, ConnectTileCommand cmd, ToolEffects *effects) |
ToolResult | layDoze (int x, int y, ToolEffects *effects) |
ToolResult | layRoad (int x, int y, ToolEffects *effects) |
ToolResult | layRail (int x, int y, ToolEffects *effects) |
ToolResult | layWire (int x, int y, ToolEffects *effects) |
void | fixZone (int x, int y, ToolEffects *effects) |
void | fixSingle (int x, int y, ToolEffects *effects) |
void | doDisasters () |
void | scenarioDisaster () |
bool | vulnerable (int tem) |
void | doFlood (const Position &pos) |
void | getAssessedValue () |
void | doPopNum () |
Quad | getPopulation () |
CityClass | getCityClass (Quad cityPop) |
void | doProblems (short problemTable[PROBNUM]) |
void | voteProblems (const short problemTable[PROBNUM]) |
short | getTrafficAverage () |
short | getUnemployment () |
short | getFireSeverity () |
void | getScore (const short problemTable[PROBNUM]) |
void | doVotes () |
static int | getNextAnimatedTile (int index) |
Terrain generator. | |
features available incrementally as city building tools. The user should be able to place water and trees, and it should dynamically smooth the edges. The user interface could restrict the user to only drawing terrain before any zones were built, but it would be best if the terrain editing tools worked properly when there were zones built (by automatically bulldozing zones whose underlying terrain it's modifying). | |
int | terrainTreeLevel |
int | terrainLakeLevel |
int | terrainCurveLevel |
int | terrainCreateIsland |
int | generatedCitySeed |
bool | historyInitialized |
short | graph10Max |
short | graph120Max |
int | simLoops |
int | simPasses |
int | simPass |
bool | simPaused |
int | simPausedSpeed |
bool | tilesAnimated |
bool | doAnimation |
bool | doMessages |
bool | doNotices |
std::string | cityFileName |
Filename of the last loaded city. | |
std::string | cityName |
Name of the city. More... | |
int | heatSteps |
int | heatFlow |
int | heatRule |
int | heatWrap |
Quad | cityPopLast |
Population of last city class check. More... | |
short | categoryLast |
City class of last city class check. More... | |
bool | autoGoto |
short * | cellSrc |
short * | cellDst |
void | generateSomeRandomCity () |
void | clearMap () |
void | clearUnnatural () |
void | makeIsland () |
void | treeSplash (short xloc, short yloc) |
void | makeSingleLake (const Position &pos) |
void | plopBRiver (const Position &pos) |
void | plopSRiver (const Position &pos) |
void | generateSomeCity (int seed) |
void | generateMap (int seed) |
void | drawMonth (short *hist, unsigned char *s, float scale) |
void | changeCensus () |
void | graphDoer () |
void | initGraphs () |
void | initGraphMax () |
void | getHistoryRange (int historyType, int historyScale, short *minValResult, short *maxValResult) |
short | getHistory (int historyType, int historyScale, int historyIndex) |
void | setHistory (int historyType, int historyScale, int historyIndex, short historyValue) |
std::string | getMicropolisVersion () |
void | simUpdate () |
void | simTick () |
void | simulateRobots () |
void | sendMessages () |
void | checkGrowth () |
void | doScenarioScore (Scenario type) |
void | sendMessage (short Mnum, short x=NOWHERE, short y=NOWHERE, bool picture=false, bool important=false) |
void | doMakeSound (int mesgNum, int x, int y) |
void | doAutoGoto (short x, short y, const std::string &message) |
void | doLoseGame () |
void | doWinGame () |
void | makeNakedIsland () |
void | doTrees () |
bool | isTree (MapValue cell) |
void | smoothTrees () |
void | smoothTreesAt (int x, int y, bool preserve) |
void | smoothTreesAt (int x, int y, bool preserve, ToolEffects *effects) |
void | makeLakes () |
void | doRivers (const Position &terrainPos) |
Direction2 | doBRiver (const Position &riverPos, Direction2 riverDir, Direction2 terrainDir) |
Direction2 | doSRiver (const Position &riverPos, Direction2 riverDir, Direction2 terrainDir) |
void | smoothRiver () |
void | smoothWater () |
void | putOnMap (MapValue mChar, short xLoc, short yLoc) |
void | initWillStuff () |
void | resetMapState () |
void | resetEditorState () |
void | simInit () |
void | simHeat () |
void | simLoop (bool doSim) |
Power stack | |
Stack used to find powered tiles by tracking conductive tiles. | |
UQuad | nextRandom |
bool | valveFlag |
short | crimeRamp |
short | pollutionRamp |
bool | resCap |
Block residential growth. | |
bool | comCap |
Block commercial growth. | |
bool | indCap |
Block industrial growth. | |
short | cashFlow |
float | externalMarket |
Scenario | disasterEvent |
The disaster for which a count-down is running. | |
short | disasterWait |
Count-down timer for the disaster. | |
Scenario | scoreType |
The type of score table to use. | |
short | scoreWait |
Time to wait before computing the score. | |
short | poweredZoneCount |
Number of powered tiles in all zone. | |
short | unpoweredZoneCount |
Number of unpowered tiles in all zones. | |
bool | newPower |
short | cityTaxAverage |
short | simCycle |
short | phaseCycle |
short | speedCycle |
bool | doInitialEval |
Need to perform initial city evaluation. | |
int | mapSerial |
The invalidateMaps method increases the map serial number every time the maps changes. | |
SimSprite * | spriteList |
List of active sprites. | |
Quad | totalFunds |
Funds of the player. | |
bool | autoBulldoze |
bool | autoBudget |
Quad | messageTimeLast |
GameLevel | gameLevel |
Difficulty level of the game (0..2) | |
short | initSimLoad |
Scenario | scenario |
Scenario being played. | |
short | simSpeed |
short | simSpeedMeta |
bool | enableSound |
Enable sound. | |
bool | enableDisasters |
Enable disasters. | |
short | messageNumber |
bool | evalChanged |
The evaluation window should be shown to the user. | |
short | blinkFlag |
emscripten::val | callbackVal |
void * | callbackData |
void * | userData |
bool | mustUpdateFunds |
bool | mustUpdateOptions |
Options displayed at user need updating. | |
Quad | cityTimeLast |
Quad | cityYearLast |
Quad | cityMonthLast |
Quad | totalFundsLast |
Quad | resLast |
Quad | comLast |
Quad | indLast |
int | powerStackPointer |
Stack counter, points to top-most item. | |
Position | powerStackXY [POWER_STACK_SIZE] |
short | newMap |
short | newMapFlags [MAP_TYPE_COUNT] |
short | cityCenterX |
X coordinate of city center. | |
short | cityCenterY |
Y coordinate of city center. | |
short | pollutionMaxX |
X coordinate of most polluted area. | |
short | pollutionMaxY |
Y coordinate of most polluted area. | |
short | crimeMaxX |
X coordinate of most criminal area. Not used. | |
short | crimeMaxY |
Y coordinate of most criminal area. Not used. | |
Quad | donDither |
short | resValve |
short | comValve |
short | indValve |
SimSprite * | freeSprites |
Pool of free SimSprite objects. | |
SimSprite * | globalSprites [SPRITE_COUNT] |
int | absDist |
short | spriteCycle |
short | curMapStackPointer |
Position | curMapStackXY [MAX_TRAFFIC_DISTANCE+1] |
Position stack. | |
short | trafMaxX |
X coordinate of a position with heavy traffic. | |
short | trafMaxY |
Y coordinate of a position with heavy traffic. | |
int | simRandom () |
short | getRandom (short range) |
int | getRandom16 () |
int | getRandom16Signed () |
short | getERandom (short limit) |
void | randomlySeedRandom () |
void | seedRandom (int seed) |
void | updateFundEffects () |
SimSprite * | newSprite (const std::string &name, int type, int x, int y) |
void | initSprite (SimSprite *sprite, int x, int y) |
void | destroyAllSprites () |
void | destroySprite (SimSprite *sprite) |
SimSprite * | getSprite (int type) |
SimSprite * | makeSprite (int type, int x, int y) |
short | getChar (int x, int y) |
short | turnTo (int p, int d) |
bool | tryOther (int Tpoo, int Told, int Tnew) |
bool | spriteNotInBounds (SimSprite *sprite) |
short | getDir (int orgX, int orgY, int desX, int desY) |
int | getDistance (int x1, int y1, int x2, int y2) |
bool | checkSpriteCollision (SimSprite *s1, SimSprite *s2) |
void | moveObjects () |
void | doTrainSprite (SimSprite *sprite) |
void | doCopterSprite (SimSprite *sprite) |
void | doAirplaneSprite (SimSprite *sprite) |
void | doShipSprite (SimSprite *sprite) |
void | doMonsterSprite (SimSprite *sprite) |
void | doTornadoSprite (SimSprite *sprite) |
void | doExplosionSprite (SimSprite *sprite) |
void | doBusSprite (SimSprite *sprite) |
int | canDriveOn (int x, int y) |
void | explodeSprite (SimSprite *sprite) |
bool | checkWet (int x) |
void | destroyMapTile (int ox, int oy) |
void | startFireInZone (int Xloc, int Yloc, int ch) |
void | startFire (int x, int y) |
void | generateTrain (int x, int y) |
void | generateBus (int x, int y) |
void | generateShip () |
void | makeShipHere (int x, int y) |
void | makeMonster () |
void | makeMonsterAt (int x, int y) |
void | generateCopter (const Position &pos) |
void | generatePlane (const Position &pos) |
void | makeTornado () |
void | makeExplosion (int x, int y) |
void | makeExplosionAt (int x, int y) |
void | spend (int dollars) |
void | setFunds (int dollars) |
Quad | tickCount () |
Ptr | newPtr (int size) |
void | freePtr (void *data) |
void | doStartScenario (int scenario) |
void | doStartGame () |
void | initGame () |
void | doEarthquake (int strength) |
void | invalidateMaps () |
void | makeSound (const std::string &channel, const std::string &sound, int x=-1, int y=-1) |
int | getTile (int x, int y) |
void | setTile (int x, int y, int tile) |
void * | getMapBuffer () |
int | getPowerGrid (int x, int y) |
void | setPowerGrid (int x, int y, int power) |
void * | getPowerGridMapBuffer () |
int | getPopulationDensity (int x, int y) |
void | setPopulationDensity (int x, int y, int density) |
void * | getPopulationDensityMapBuffer () |
int | getRateOfGrowth (int x, int y) |
void | setRateOfGrowth (int x, int y, int rate) |
void * | getRateOfGrowthMapBuffer () |
int | getTrafficDensity (int x, int y) |
void | setTrafficDensity (int x, int y, int density) |
void * | getTrafficDensityMapBuffer () |
int | getPollutionDensity (int x, int y) |
void | setPollutionDensity (int x, int y, int density) |
void * | getPollutionDensityMapBuffer () |
int | getCrimeRate (int x, int y) |
void | setCrimeRate (int x, int y, int rate) |
void * | getCrimeRateMapBuffer () |
int | getLandValue (int x, int y) |
void | setLandValue (int x, int y, int value) |
void * | getLandValueMapBuffer () |
int | getFireCoverage (int x, int y) |
void | setFireCoverage (int x, int y, int coverage) |
void * | getFireCoverageMapBuffer () |
int | getPoliceCoverage (int x, int y) |
void | setPoliceCoverage (int x, int y, int coverage) |
void * | getPoliceCoverageMapBuffer () |
ToolResult | doTool (EditingTool tool, short tileX, short tileY) |
void | toolDown (EditingTool tool, short tileX, short tileY) |
void | toolDrag (EditingTool tool, short fromX, short fromY, short toX, short toY) |
void | didTool (std::string name, short x, short y) |
short | makeTrafficAt (int x, int y, ZoneType dest) |
short | makeTraffic (int x, int y, ZoneType dest) |
void | doUpdateHeads () |
void | updateMaps () |
void | updateGraphs () |
void | updateEvaluation () |
void | updateHeads () |
void | updateFunds () |
void | reallyUpdateFunds () |
void | doTimeStuff () |
void | updateDate () |
void | showValves () |
void | drawValve () |
void | setDemand (float r, float c, float i) |
void | updateOptions () |
void | updateUserInterface () |
void | pause () |
void | resume () |
void | setSpeed (short speed) |
void | setPasses (int passes) |
void | setGameLevelFunds (GameLevel level) |
void | setGameLevel (GameLevel level) |
void | updateGameLevel () |
void | setCityName (const std::string &name) |
void | setCleanCityName (const std::string &name) |
void | setYear (int year) |
int | currentYear () |
void | doNewGame () |
void | setEnableDisasters (bool value) |
void | setAutoBudget (bool value) |
void | setAutoBulldoze (bool value) |
void | setAutoGoto (bool value) |
void | setEnableSound (bool value) |
void | setDoAnimation (bool value) |
void | setDoMessages (bool value) |
void | setDoNotices (bool value) |
void | getDemands (float *resDemandResult, float *comDemandResult, float *indDemandResult) |
void | doPowerScan () |
bool | testForConductive (const Position &pos, Direction2 testDir) |
void | pushPowerStack (const Position &pos) |
Position | pullPowerStack () |
void | fireAnalysis () |
void | populationDensityScan () |
int | getPopulationDensity (const Position &pos, MapTile tile) |
void | pollutionTerrainLandValueScan () |
int | getPollutionValue (int loc) |
int | getCityCenterDistance (int x, int y) |
void | crimeScan () |
void | smoothTerrain () |
void | doSmooth1 () |
void | doSmooth2 () |
void | computeComRateMap () |
MapValue | randomFire () |
MapValue | randomRubble () |
void | simFrame () |
void | simulate () |
void | doSimInit () |
void | doNilPower () |
void | decTrafficMap () |
void | decRateOfGrowthMap () |
void | initSimMemory () |
void | simLoadInit () |
void | setCommonInits () |
void | setValves () |
void | clearCensus () |
void | take10Census () |
void | take120Census () |
void | collectTax () |
void | mapScan (int x1, int x2) |
void | doRail (const Position &pos) |
void | doRadTile (const Position &pos) |
void | doRoad (const Position &pos) |
bool | doBridge (const Position &pos, MapTile tile) |
int | getBoatDistance (const Position &pos) |
void | doFire (const Position &pos) |
void | fireZone (const Position &pos, MapValue ch) |
void | repairZone (const Position &pos, MapTile zCent, short zSize) |
void | doSpecialZone (const Position &pos, bool PwrOn) |
void | drawStadium (const Position ¢er, MapTile z) |
void | doAirport (const Position &pos) |
void | coalSmoke (const Position &pos) |
void | doMeltdown (const Position &pos) |
ToolResult | queryTool (short x, short y) |
ToolResult | bulldozerTool (short x, short y) |
ToolResult | bulldozerTool (short x, short y, ToolEffects *effects) |
ToolResult | roadTool (short x, short y, ToolEffects *effects) |
ToolResult | railroadTool (short x, short y, ToolEffects *effects) |
ToolResult | wireTool (short x, short y, ToolEffects *effects) |
ToolResult | parkTool (short x, short y, ToolEffects *effects) |
ToolResult | buildBuildingTool (short x, short y, const BuildingProperties *bprops, ToolEffects *effects) |
ToolResult | networkTool (short x, short y, ToolEffects *effects) |
ToolResult | waterTool (short x, short y, ToolEffects *effects) |
ToolResult | landTool (short x, short y, ToolEffects *effects) |
ToolResult | forestTool (short x, short y, ToolEffects *effects) |
ToolResult | putDownPark (short mapH, short mapV, ToolEffects *effects) |
ToolResult | putDownNetwork (short mapH, short mapV, ToolEffects *effects) |
ToolResult | putDownWater (short mapH, short mapV, ToolEffects *effects) |
ToolResult | putDownLand (short mapH, short mapV, ToolEffects *effects) |
ToolResult | putDownForest (short mapH, short mapV, ToolEffects *effects) |
void | doZoneStatus (short mapH, short mapV) |
void | doShowZoneStatus (int tileCategoryIndex, int populationDensityIndex, int landValueIndex, int crimeRateIndex, int pollutionIndex, int growthRateIndex, int x, int y) |
void | putBuilding (int leftX, int topY, int sizeX, int sizeY, MapTile baseTile, bool aniFlag, ToolEffects *effects) |
ToolResult | prepareBuildingSite (int leftX, int topY, int sizeX, int sizeY, ToolEffects *effects) |
ToolResult | buildBuilding (int mapH, int mapV, const BuildingProperties *bprops, ToolEffects *effects) |
int | getDensity (short catNo, short mapH, short mapV) |
bool | tally (short tileValue) |
short | checkSize (short tileValue) |
void | checkBorder (short xMap, short yMap, int sizeX, int sizeY, ToolEffects *effects) |
void | putRubble (int x, int y, int size, ToolEffects *effects) |
short | makeTraffic (const Position &startPos, ZoneType dest) |
void | addToTrafficDensityMap () |
void | pushPos (const Position &pos) |
Position | pullPos () |
bool | findPerimeterRoad (Position *pos) |
bool | findPerimeterTelecom (const Position &pos) |
bool | tryDrive (const Position &startPos, ZoneType destZone) |
Direction2 | tryGo (const Position &pos, Direction2 dirLast) |
MapTile | getTileFromMap (const Position &pos, Direction2 dir, MapTile defaultTile) |
bool | driveDone (const Position &pos, ZoneType destZone) |
bool | roadTest (MapValue tile) |
std::string | makeDollarDecimalStr (const std::string &numStr) |
void | doZone (const Position &pos) |
void | doHospitalChurch (const Position &pos) |
void | setSmoke (const Position &pos, bool zonePower) |
void | makeHospital (const Position &pos) |
short | getLandPollutionValue (const Position &pos) |
void | incRateOfGrowth (const Position &pos, int amount) |
bool | zonePlop (const Position &pos, int base) |
short | doFreePop (const Position &pos) |
bool | setZonePower (const Position &pos) |
void | buildHouse (const Position &pos, int value) |
short | evalLot (int x, int y) |
void | doResidential (const Position &pos, bool zonePower) |
void | doResIn (const Position &pos, int pop, int value) |
void | doResOut (const Position &pos, int pop, int value) |
short | getResZonePop (MapTile mapTile) |
void | resPlop (const Position &pos, int Den, int Value) |
short | evalRes (const Position &pos, int traf) |
void | doCommercial (const Position &pos, bool zonePower) |
void | doComIn (const Position &pos, int pop, int value) |
void | doComOut (const Position &pos, int pop, int value) |
short | getComZonePop (MapTile tile) |
void | comPlop (const Position &pos, int Den, int Value) |
short | evalCom (const Position &pos, int traf) |
void | doIndustrial (const Position &pos, bool zonePower) |
void | doIndIn (const Position &pos, int pop, int value) |
void | doIndOut (const Position &pos, int pop, int value) |
short | getIndZonePop (MapTile tile) |
void | indPlop (const Position &pos, int den, int value) |
short | evalInd (int traf) |
static bool | testBounds (int wx, int wy) |
Main simulator class
Modify Micropolis::roadPercent, Micropolis::policePercent, and Micropolis::firePercent to hold real percentage from 0
to 100
instead of a floating point fraction
Micropolis::crimeMaxX and Micropolis::crimeMaxY seem unused.
Definition at line 923 of file micropolis.h.
Micropolis::Micropolis | ( | ) |
Micropolis::~Micropolis | ( | ) |
Simulator destructor.
Definition at line 112 of file micropolis.cpp.
|
private |
Update the trafficDensityMap from the positions at the curMapStackXY stack.
Definition at line 165 of file traffic.cpp.
References curMapStackPointer, LOMASK, map, Position::posX, Position::posY, pullPos(), and Position::testBounds().
Referenced by makeTraffic(), and makeTrafficAt().
|
private |
Build a building.
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. |
Give putBuilding a BuildingProperties pointer instead.
Move cost into building properties?
Definition at line 711 of file tool.cpp.
References ToolEffects::addCost(), BuildingProperties::baseTile, BuildingProperties::buildingIsAnimated, checkBorder(), gCostOf, prepareBuildingSite(), putBuilding(), BuildingProperties::sizeX, BuildingProperties::sizeY, BuildingProperties::tool, and TOOLRESULT_OK.
Referenced by buildBuildingTool().
|
private |
Build a building.
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. |
Definition at line 1225 of file tool.cpp.
References ToolEffects::addFrontendMessage(), buildBuilding(), BuildingProperties::toolName, and TOOLRESULT_OK.
|
private |
Try to build a house at the zone at pos.
pos | Center tile of the zone. |
value | Value to build (land value?) |
Definition at line 457 of file zone.cpp.
References evalLot(), getRandom16(), map, Position::posX, Position::posY, and testBounds().
|
private |
Apply bulldozer tool.
x | X coordinate of the position of the query. |
y | Y coordinate of the position of the query. |
Tool does not return TOOLRESULT_NO_MONEY.
Sometimes we can delete parts of a residential zone, but not always. Decide what rule we should have, and fix accordingly.
Definition at line 1010 of file tool.cpp.
References ToolEffects::addCost(), checkBigZone(), checkSize(), gCostOf, ToolEffects::getMapValue(), LOMASK, testBounds(), TOOLRESULT_FAILED, TOOLRESULT_OK, and ZONEBIT.
int Micropolis::canDriveOn | ( | int | x, |
int | y | ||
) |
Can one drive at the specified tile?
x | X coordinate at map. |
y | Y coordinate at map. |
Definition at line 1626 of file sprite.cpp.
References LOMASK, map, and testBounds().
void Micropolis::changeCensus | ( | ) |
Set flag that graph data has been changed and graphs should be updated.
Definition at line 122 of file graph.cpp.
References censusChanged.
Referenced by loadFile(), and take10Census().
void Micropolis::changeEval | ( | ) |
Request that new score is displayed to the user.
Definition at line 507 of file evaluate.cpp.
References evalChanged.
Referenced by simInit().
|
private |
Check and connect a new zone around the border.
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 575 of file tool.cpp.
References CONNECT_TILE_FIX, and connectTile().
Referenced by buildBuilding().
void Micropolis::checkGrowth | ( | ) |
Detect a change in city class, and produce a message if the player has reached the next class.
Definition at line 250 of file message.cpp.
References categoryLast, CC_CAPITAL, CC_CITY, CC_MEGALOPOLIS, CC_METROPOLIS, CC_TOWN, CC_VILLAGE, cityPopLast, cityTime, getCityClass(), getPopulation(), MESSAGE_REACHED_CAPITAL, MESSAGE_REACHED_CITY, MESSAGE_REACHED_MEGALOPOLIS, MESSAGE_REACHED_METROPOLIS, MESSAGE_REACHED_TOWN, NOT_REACHED, NOWHERE, and sendMessage().
Referenced by sendMessages().
|
private |
Return the size of the zone that the tile belongs to.
tileValue | Value of the tile in the zone. |
0
. Definition at line 548 of file tool.cpp.
Referenced by bulldozerTool().
Check whether two sprites collide with each other.
s1 | First sprite. |
s2 | Second sprite. |
Definition at line 537 of file sprite.cpp.
References SimSprite::frame, getDistance(), SimSprite::x, SimSprite::xHot, SimSprite::y, and SimSprite::yHot.
Referenced by doAirplaneSprite(), and doTornadoSprite().
void Micropolis::cityEvaluation | ( | ) |
Evaluate city
Definition at line 110 of file evaluate.cpp.
References totalPop.
void Micropolis::clearMap | ( | ) |
Clear the whole world to DIRT tiles
Definition at line 175 of file generate.cpp.
References DIRT, map, WORLD_H, and WORLD_W.
Referenced by generateMap(), and simInit().
void Micropolis::clearUnnatural | ( | ) |
Clear everything from all land
Definition at line 188 of file generate.cpp.
|
private |
Draw coal smoke tiles around given position (of a coal power plant).
pos | Center tile of the coal power plant |
Definition at line 1662 of file simulate.cpp.
References ANIMBIT, BURNBIT, COALSMOKE1, COALSMOKE2, COALSMOKE3, COALSMOKE4, CONDBIT, map, Position::posX, Position::posY, and PWRBIT.
Referenced by doSpecialZone().
|
private |
Collect taxes
Function seems to be doing different things depending on Micropolis::totalPop value. With an non-empty city it does fund calculations. For an empty city, it immediately sets effects of funding, which seems inconsistent at least, and may be wrong
If Micropolis::taxFlag is set, no variable is touched which seems non-robust at least
Definition at line 852 of file simulate.cpp.
References cityTax, doBudget(), fireEffect, fireFund, fireStationPop, gameLevel, landValueAverage, LENGTH_OF, LEVEL_COUNT, MAX_FIRE_STATION_EFFECT, MAX_POLICE_STATION_EFFECT, MAX_ROAD_EFFECT, policeEffect, policeFund, policeStationPop, railTotal, roadEffect, roadFund, roadTotal, taxFlag, taxFund, and totalPop.
|
private |
Build a commercial zone.
pos | Position of the commercial zone. |
Den | Density |
Value | Land value corrected for pollution. |
Definition at line 881 of file zone.cpp.
Referenced by doComIn(), and doComOut().
|
private |
Compute distance to city center for the entire map.
Definition at line 585 of file scan.cpp.
References comRateMap, getCityCenterDistance(), Map< DATA, BLKSIZE >::MAP_H, Map< DATA, BLKSIZE >::MAP_W, and Map< DATA, BLKSIZE >::set().
Referenced by populationDensityScan().
|
private |
Perform the command, and fix wire/road/rail/zone connections around it. Store modification in the effects object.
x | X world position to perform the command. |
y | Y world position to perform the command. |
cmd | Command to perform. |
effects | Modification collecting object. |
Definition at line 133 of file connect.cpp.
References autoBulldoze, BULLBIT, CONNECT_TILE_RAILROAD, CONNECT_TILE_ROAD, CONNECT_TILE_WIRE, ToolEffects::getMapValue(), LOMASK, neutralizeRoad(), testBounds(), TOOLRESULT_FAILED, and TOOLRESULT_OK.
Referenced by checkBorder(), railroadTool(), roadTool(), and wireTool().
int Micropolis::countProblems | ( | ) |
Return number of problem in the city.
Definition at line 528 of file evaluate.cpp.
References CVP_NUMPROBLEMS, CVP_PROBLEM_COMPLAINTS, and problemOrder.
|
private |
Smooth police station map and compute crime rate
Definition at line 413 of file scan.cpp.
References clamp(), crimeAverage, crimeMaxX, crimeMaxY, crimeRateMap, getRandom16(), landValueMap, Map< DATA, BLKSIZE >::MAP_BLOCKSIZE, MAP_TYPE_CRIME, MAP_TYPE_DYNAMIC, MAP_TYPE_POLICE_RADIUS, min(), newMapFlags, policeStationEffectMap, policeStationMap, populationDensityMap, smoothStationMap(), WORLD_H, WORLD_W, Map< DATA, BLKSIZE >::worldGet(), and Map< DATA, BLKSIZE >::worldSet().
Referenced by doSimInit().
int Micropolis::currentYear | ( | ) |
Get the current year.
Definition at line 297 of file utilities.cpp.
References cityTime, and startingYear.
|
private |
Decrease rate of grow.
Definition at line 369 of file simulate.cpp.
References clamp(), Map< DATA, BLKSIZE >::get(), Map< DATA, BLKSIZE >::MAP_H, Map< DATA, BLKSIZE >::MAP_W, rateOfGrowthMap, and Map< DATA, BLKSIZE >::set().
|
private |
Decrease traffic memory
Definition at line 337 of file simulate.cpp.
References Map< DATA, BLKSIZE >::MAP_BLOCKSIZE, trafficDensityMap, WORLD_H, WORLD_W, Map< DATA, BLKSIZE >::worldGet(), and Map< DATA, BLKSIZE >::worldSet().
void Micropolis::destroyAllSprites | ( | ) |
Destroy all sprites by de-activating them all (setting their SimSprite::frame to 0).
Definition at line 298 of file sprite.cpp.
References SimSprite::frame, SimSprite::next, and spriteList.
Referenced by initWillStuff().
|
private |
Free all map arrays
Definition at line 113 of file allocate.cpp.
References Map< DATA, BLKSIZE >::clear(), comHist, crimeHist, crimeRateMap, freePtr(), indHist, landValueMap, map, mapBase, miscHist, moneyHist, pollutionDensityMap, pollutionHist, populationDensityMap, resHist, tempMap1, tempMap2, tempMap3, terrainDensityMap, trafficDensityMap, and WORLD_W.
void Micropolis::destroyMapTile | ( | int | ox, |
int | oy | ||
) |
Destroy a map tile.
ox | X coordinate in pixels. |
oy | Y coordinate in pixels. |
Definition at line 1714 of file sprite.cpp.
References LOMASK, map, and testBounds().
Referenced by doTornadoSprite().
void Micropolis::destroySprite | ( | SimSprite * | sprite | ) |
Destroy the sprite by taking it out of the active list.
sprite | Sprite to destroy. |
Definition at line 313 of file sprite.cpp.
References freeSprites, SimSprite::next, spriteList, and SimSprite::type.
Referenced by moveObjects().
void Micropolis::didLoadCity | ( | const std::string & | filename | ) |
Report to the frontend that the game was successfully loaded.
Definition at line 538 of file fileio.cpp.
References callback.
Referenced by loadCity().
void Micropolis::didLoadScenario | ( | int | s, |
const std::string | name, | ||
const std::string | fname | ||
) |
Report to the front-end that the scenario was loaded.
Definition at line 494 of file fileio.cpp.
References callback.
Referenced by loadScenario().
void Micropolis::didntLoadCity | ( | const std::string & | filename | ) |
Report to the frontend that the game failed to load.
msg | File that attempted to load |
Definition at line 548 of file fileio.cpp.
References callback.
Referenced by loadCity().
void Micropolis::didntSaveCity | ( | const std::string & | filename | ) |
Report to the frontend that the city could not be saved.
filename | Name of the file used |
Definition at line 603 of file fileio.cpp.
References callback.
Referenced by saveCity(), and saveCityAs().
void Micropolis::didSaveCity | ( | const std::string & | filename | ) |
Report to the frontend that the city was saved successfully.
filename | Name of the file used |
Definition at line 593 of file fileio.cpp.
References callback.
Referenced by saveCity(), and saveCityAs().
void Micropolis::didTool | ( | std::string | name, |
short | x, | ||
short | y | ||
) |
Report to the front-end that a tool was used.
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 947 of file tool.cpp.
References callback.
Referenced by queryTool(), and FrontendMessageDidTool::sendMessage().
void Micropolis::doAirplaneSprite | ( | SimSprite * | sprite | ) |
Move airplane sprite.
sprite | Airplane sprite. |
Remove local magic constants and document the code.
absDist gets updated by Micropolis::getDir(), which is not always called before reading it (or worse, we just turned towards the old destination).
Definition at line 800 of file sprite.cpp.
References checkSpriteCollision(), SimSprite::destX, SimSprite::destY, enableDisasters, explodeSprite(), SimSprite::frame, getDir(), getRandom(), SimSprite::next, SPRITE_AIRPLANE, SPRITE_HELICOPTER, spriteList, spriteNotInBounds(), turnTo(), SimSprite::type, WORLD_H, WORLD_W, SimSprite::x, and SimSprite::y.
Referenced by moveObjects().
|
private |
Generate a airplane or helicopter every now and then.
pos | Position of the airport to start from. |
Definition at line 1645 of file simulate.cpp.
References generateCopter(), generatePlane(), and getRandom().
void Micropolis::doAutoGoto | ( | short | x, |
short | y, | ||
const std::string & | message | ||
) |
Tell the front-end that it should perform an auto-goto
x | X position at the map |
y | Y position at the map |
message | Message |
Definition at line 457 of file message.cpp.
References callback.
Handle a bridge.
pos | Position of the bridge. |
tile | Tile value of the bridge. |
What does this function return?
Discover the structure of all the magic constants.
Definition at line 1139 of file simulate.cpp.
|
private |
Make a big river.
pos | Start position of making a river. |
riverDir | Global direction of the river. |
terrainDir | Local direction of the terrain. |
Definition at line 512 of file generate.cpp.
References getRandom(), Position::move(), plopBRiver(), Position::posX, Position::posY, rotate45(), terrainCurveLevel, and testBounds().
Referenced by doRivers().
void Micropolis::doBudget | ( | ) |
Game decided to show the budget window
Definition at line 97 of file budget.cpp.
References doBudgetNow().
Referenced by collectTax().
void Micropolis::doBudgetFromMenu | ( | ) |
void Micropolis::doBudgetNow | ( | bool | fromMenu | ) |
Handle budget window.
fromMenu | User requested the budget window. |
Definition at line 116 of file budget.cpp.
References autoBudget, fireFund, firePercent, fireSpend, fireValue, policeFund, policePercent, policeSpend, policeValue, roadFund, roadPercent, roadSpend, roadValue, taxFund, and totalFunds.
Referenced by doBudget(), and doBudgetFromMenu().
void Micropolis::doBusSprite | ( | SimSprite * | sprite | ) |
Move bus sprite.
sprite | Bus sprite. |
Definition at line 1342 of file sprite.cpp.
References SimSprite::frame, trafficDensityMap, WORLD_H_2, Map< DATA, BLKSIZE >::worldGet(), SimSprite::x, SimSprite::xHot, SimSprite::y, and SimSprite::yHot.
Referenced by moveObjects().
|
private |
Handle immigration of commercial zone.
pos | Position of the commercial zone. |
pop | Population ? |
value | Land value corrected for pollution. |
Definition at line 821 of file zone.cpp.
References comPlop(), incRateOfGrowth(), landValueMap, Position::posX, Position::posY, and Map< DATA, BLKSIZE >::worldGet().
Referenced by doCommercial().
|
private |
Handle commercial zone.
pos | Position of the commercial zone. |
zonePwrFlg | Does the zone have power? |
Definition at line 763 of file zone.cpp.
References comPop, comZonePop, doComIn(), doComOut(), evalCom(), getComZonePop(), getLandPollutionValue(), getRandom(), getRandom16(), getRandom16Signed(), LOMASK, makeTraffic(), map, Position::posX, Position::posY, and ZT_INDUSTRIAL.
|
private |
Handle emigration of commercial zone.
pos | Position of the commercial zone. |
pop | Population ? |
value | Land value corrected for pollution. |
Definition at line 844 of file zone.cpp.
References comPlop(), incRateOfGrowth(), and zonePlop().
Referenced by doCommercial().
void Micropolis::doCopterSprite | ( | SimSprite * | sprite | ) |
Move helicopter sprite.
sprite | Helicopter sprite. |
Definition at line 695 of file sprite.cpp.
References SimSprite::destX, SimSprite::destY, SimSprite::frame, getDir(), getRandom16(), getSprite(), makeSound(), MESSAGE_HEAVY_TRAFFIC, sendMessage(), SPRITE_MONSTER, SPRITE_TORNADO, trafficDensityMap, turnTo(), WORLD_H, Map< DATA, BLKSIZE >::worldGet(), SimSprite::x, and SimSprite::y.
Referenced by moveObjects().
|
private |
Let disasters happen.
DisChance
table). Definition at line 92 of file disasters.cpp.
References disasterEvent, enableDisasters, floodCount, gameLevel, getRandom(), LENGTH_OF, LEVEL_COUNT, LEVEL_EASY, LEVEL_LAST, makeEarthquake(), makeFlood(), makeMonster(), makeTornado(), pollutionAverage, SC_NONE, scenarioDisaster(), and setFire().
void Micropolis::doEarthquake | ( | int | strength | ) |
Tell the front-end to show an earthquake to the user (shaking the map for some time).
Definition at line 1159 of file micropolis.cpp.
References callback, and makeSound().
Referenced by makeEarthquake().
void Micropolis::doExplosionSprite | ( | SimSprite * | sprite | ) |
'Move' fire sprite.
sprite | Fire sprite. |
Definition at line 1306 of file sprite.cpp.
References SimSprite::frame, makeSound(), MESSAGE_EXPLOSION_REPORTED, sendMessage(), startFire(), SimSprite::x, and SimSprite::y.
Referenced by moveObjects().
|
private |
Handle tile being on fire.
pos | Position of the fire. |
Needs a notion of iterative neighbour tiles computing.
Use a getFromMap()-like function here.
Extract constants of fire station effectiveness from here.
Definition at line 1294 of file simulate.cpp.
References BURNBIT, fireStationEffectMap, fireZone(), getRandom(), getRandom16(), IZB, LOMASK, makeExplosionAt(), map, Position::posX, Position::posY, randomFire(), randomRubble(), testBounds(), Map< DATA, BLKSIZE >::worldGet(), and ZONEBIT.
|
private |
Flood around the given position.
pos | Position around which to flood further. |
Definition at line 385 of file disasters.cpp.
References BURNBIT, DIRT, floodCount, getRandom16(), LOMASK, map, Position::posX, Position::posY, and testBounds().
|
private |
Count the number of single tile houses in a residential zone.
pos | Position of the residential zone. |
Definition at line 407 of file zone.cpp.
References LOMASK, map, Position::posX, Position::posY, and WORLD_H.
|
private |
Handle repairing or removing of hospitals and churches.
pos | Position of the hospital or church. |
Definition at line 145 of file zone.cpp.
References LOMASK, map, Position::posX, and Position::posY.
|
private |
Handle immigration of industrial zone.
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 965 of file zone.cpp.
References incRateOfGrowth(), and indPlop().
Referenced by doIndustrial().
|
private |
Handle industrial zone emigration.
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 979 of file zone.cpp.
References incRateOfGrowth(), INDBASE, indPlop(), and zonePlop().
Referenced by doIndustrial().
|
private |
Handle industrial zone.
pos | Position of the industrial zone. |
zonePwrFlg | Does the zone have power? |
Definition at line 915 of file zone.cpp.
References doIndIn(), doIndOut(), evalInd(), getIndZonePop(), getRandom(), getRandom16(), getRandom16Signed(), indPop, indZonePop, LOMASK, makeTraffic(), map, Position::posX, Position::posY, setSmoke(), and ZT_RESIDENTIAL.
void Micropolis::doLoseGame | ( | ) |
Tell the front-end that the player has lost the game
Definition at line 464 of file message.cpp.
References callback.
Referenced by doScenarioScore().
void Micropolis::doMakeSound | ( | int | mesgNum, |
int | x, | ||
int | y | ||
) |
Make a sound for message mesgNum if appropriate.
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 402 of file message.cpp.
References getRandom(), makeSound(), MESSAGE_EARTHQUAKE, MESSAGE_FIRE_REPORTED, MESSAGE_FIREBOMBING, MESSAGE_HELICOPTER_CRASHED, MESSAGE_HIGH_CRIME, MESSAGE_MONSTER_SIGHTED, MESSAGE_NUCLEAR_MELTDOWN, MESSAGE_PLANE_CRASHED, MESSAGE_RIOTS_REPORTED, MESSAGE_SHIP_CRASHED, MESSAGE_TORNADO_SIGHTED, MESSAGE_TRAFFIC_JAMS, and MESSAGE_TRAIN_CRASHED.
|
private |
Perform a nuclear melt-down disaster
pos | Position of the nuclear power plant that melts. |
Definition at line 1682 of file simulate.cpp.
References BURNBIT, DIRT, getRandom(), makeExplosion(), map, MESSAGE_NUCLEAR_MELTDOWN, Position::posX, Position::posY, RADTILE, randomFire(), sendMessage(), testBounds(), and ZONEBIT.
Referenced by doSpecialZone(), and makeMeltdown().
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
sprite | Monster sprite. |
Definition at line 1007 of file sprite.cpp.
References SimSprite::destX, SimSprite::destY, SimSprite::frame, getChar(), getDir(), getRandom(), getRandom16(), makeSound(), SimSprite::x, SimSprite::xHot, SimSprite::y, and SimSprite::yHot.
Referenced by moveObjects().
void Micropolis::doNewGame | ( | ) |
Notify the user interface to start a new game.
Definition at line 306 of file utilities.cpp.
References callback.
Referenced by initWillStuff().
|
private |
Copy bits from powerGridMap to the PWRBIT in the map for all zones in the world.
Definition at line 321 of file simulate.cpp.
References map, setZonePower(), WORLD_H, WORLD_W, and ZONEBIT.
Referenced by simLoadInit().
|
private |
Compute city population and city classification.
Definition at line 182 of file evaluate.cpp.
References cityClass, cityPop, cityPopDelta, getCityClass(), and getPopulation().
|
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 125 of file power.cpp.
References Map< DATA, BLKSIZE >::clear(), 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(), testForConductive(), and Map< DATA, BLKSIZE >::worldSet().
Referenced by doSimInit().
|
private |
Evaluate problems of the city, take votes, and decide which are the most important ones.
problemTable | Storage of how bad each problem is. |
Definition at line 241 of file evaluate.cpp.
|
private |
Handle decay of radio-active tile
pos | Position of the radio-active tile. |
Definition at line 1054 of file simulate.cpp.
References DIRT, getRandom16(), map, Position::posX, and Position::posY.
|
private |
Handle rail track. Generate a train, and handle road deteriorating effects.
pos | Position of the rail. |
Definition at line 1019 of file simulate.cpp.
References CONDBIT, generateTrain(), getRandom16(), LOMASK, map, MAX_ROAD_EFFECT, Position::posX, Position::posY, railTotal, and roadEffect.
|
private |
Handle residential zone.
pos | Center tile of the residential zone. |
zonePwrFlg | Does the zone have power? |
Definition at line 546 of file zone.cpp.
References LOMASK, map, Position::posX, Position::posY, and resZonePop.
|
private |
Perform residential immigration into the current residential tile.
pos | Position of the tile. |
pop | Population ? |
value | Land value corrected for pollution. |
Definition at line 612 of file zone.cpp.
References LOMASK, map, pollutionDensityMap, Position::posX, Position::posY, and Map< DATA, BLKSIZE >::worldGet().
|
private |
Perform residential emigration from the current residential tile.
pos | Position of the tile. |
pop | Population ? |
value | Land value corrected for pollution. |
Definition at line 653 of file zone.cpp.
References incRateOfGrowth(), map, Position::posX, Position::posY, and resPlop().
|
private |
Construct rivers.
terrainPos | Coordinate to start making a river. |
Definition at line 489 of file generate.cpp.
References DIR2_NORTH, doBRiver(), doSRiver(), getRandom(), and rotate180().
Referenced by generateMap().
|
private |
void Micropolis::doSaveCityAs | ( | const std::string & | filename | ) |
Report to the frontend that the city is being saved.
filename | Name of the file used |
Definition at line 583 of file fileio.cpp.
References callback.
Referenced by saveCity().
void Micropolis::doScenarioScore | ( | Scenario | type | ) |
Compute score for each scenario
type | Scenario used |
SC_NONE
Definition at line 313 of file message.cpp.
References CC_METROPOLIS, cityClass, cityScore, crimeAverage, doLoseGame(), MESSAGE_SCENARIO_LOST, MESSAGE_SCENARIO_WON, NOT_REACHED, NOWHERE, SC_BERN, SC_BOSTON, SC_DETROIT, SC_DULLSVILLE, SC_HAMBURG, SC_RIO, SC_SAN_FRANCISCO, SC_TOKYO, sendMessage(), and trafficAverage.
Referenced by sendMessages().
void Micropolis::doScoreCard | ( | ) |
Push new score to the user
Definition at line 479 of file evaluate.cpp.
References callback.
Referenced by scoreDoer().
void Micropolis::doShipSprite | ( | SimSprite * | sprite | ) |
Move ship sprite.
sprite | Ship sprite. |
Definition at line 867 of file sprite.cpp.
Referenced by moveObjects().
|
private |
Tell front-end to report on status of a tile.
tileCategoryIndex | Category of the tile text index. |
populationDensityIndex | Population density text index. |
landValueIndex | Land value text index. |
crimeRateIndex | Crime rate text index. |
pollutionIndex | Pollution text index. |
growthRateIndex | Grow rate text index. |
x | X coordinate of the tile. |
y | Y coordinate of the tile. |
Definition at line 903 of file tool.cpp.
References callback.
|
private |
Initialize simulation.
Definition at line 286 of file simulate.cpp.
References censusChanged, crimeScan(), doInitialEval, doPowerScan(), fireAnalysis(), newMap, populationDensityScan(), setValves(), simLoadInit(), totalPop, and WORLD_W.
Referenced by generateSomeCity(), loadFile(), and loadScenario().
|
private |
Update special zones.
pos | Position of the zone. |
powerOn | Zone is powered. |
Definition at line 1445 of file simulate.cpp.
References cityTime, coalPowerPop, coalSmoke(), doMeltdown(), enableDisasters, findPerimeterRoad(), fireEffect, FIRESTATION, fireStationMap, fireStationPop, gameLevel, getRandom(), LENGTH_OF, LEVEL_COUNT, LOMASK, map, NUCLEAR, nuclearPowerPop, Position::posX, Position::posY, POWERPLANT, pushPowerStack(), repairZone(), Map< DATA, BLKSIZE >::worldGet(), and Map< DATA, BLKSIZE >::worldSet().
|
private |
Make a small river.
pos | Start position of making a river. |
riverDir | Global direction of the river. |
terrainDir | Local direction of the terrain. |
Definition at line 552 of file generate.cpp.
References getRandom(), Position::move(), plopSRiver(), Position::posX, Position::posY, rotate45(), terrainCurveLevel, and testBounds().
Referenced by doRivers().
void Micropolis::doStartGame | ( | ) |
Tell the front-end a game is started.
Definition at line 1133 of file micropolis.cpp.
References callback.
Referenced by simLoadInit().
void Micropolis::doStartScenario | ( | int | scenario | ) |
Tell the front-end a scenario is started.
scenario | The scenario being started. |
Definition at line 1124 of file micropolis.cpp.
References callback, and scenario.
Referenced by simLoadInit().
ToolResult Micropolis::doTool | ( | EditingTool | tool, |
short | tileX, | ||
short | tileY | ||
) |
Apply a tool.
tool | Tool to use. |
tileX | Horizontal position in the city map. |
tileY | Vertical position in the city map. |
Definition at line 1397 of file tool.cpp.
Referenced by toolDown(), and toolDrag().
void Micropolis::doTornadoSprite | ( | SimSprite * | sprite | ) |
Move tornado.
sprite | Tornado sprite to move. |
Definition at line 1239 of file sprite.cpp.
References checkSpriteCollision(), destroyMapTile(), explodeSprite(), SimSprite::frame, getRandom(), SimSprite::next, SPRITE_AIRPLANE, SPRITE_HELICOPTER, SPRITE_SHIP, SPRITE_TRAIN, spriteList, spriteNotInBounds(), SimSprite::type, SimSprite::x, and SimSprite::y.
Referenced by moveObjects().
void Micropolis::doTrainSprite | ( | SimSprite * | sprite | ) |
Move train sprite.
sprite | Train sprite. |
Definition at line 623 of file sprite.cpp.
References SimSprite::frame, getChar(), getRandom16(), SimSprite::x, and SimSprite::y.
Referenced by moveObjects().
|
private |
Splash trees around the world.
Definition at line 340 of file generate.cpp.
References getRandom(), terrainTreeLevel, treeSplash(), WORLD_H, and WORLD_W.
Referenced by generateMap(), and makeIsland().
|
private |
Vote whether the mayor is doing a good job
Definition at line 464 of file evaluate.cpp.
References cityScore, cityYes, and getRandom().
void Micropolis::doWinGame | ( | ) |
Tell the front-end that the player has won the game
Definition at line 471 of file message.cpp.
References callback.
|
private |
Handle zone.
pos | Position of the zone. |
Definition at line 91 of file zone.cpp.
References LOMASK, map, PORTBASE, Position::posX, Position::posY, poweredZoneCount, setZonePower(), and unpoweredZoneCount.
|
private |
Report about the status of a tile.
mapH | X coordinate of the tile. |
mapV | Y coordinate of the tile. |
Definition at line 838 of file tool.cpp.
References COALSMOKE1, LOMASK, and map.
Referenced by queryTool().
void Micropolis::drawMonth | ( | short * | hist, |
unsigned char * | s, | ||
float | scale | ||
) |
Draw a stadium (either full or empty).
center | Center tile position of the stadium. |
z | Base tile value. |
Definition at line 1624 of file simulate.cpp.
References map, Position::posX, and Position::posY.
Has the journey arrived at its destination?
pos | Current position. |
destZone | Zonetype to drive to. |
Definition at line 453 of file traffic.cpp.
Referenced by tryDrive().
|
private |
Compute evaluation of a commercial zone.
traf | Result if traffic attempt. |
Definition at line 895 of file zone.cpp.
References comRateMap, Position::posX, Position::posY, and Map< DATA, BLKSIZE >::worldGet().
Referenced by doCommercial().
|
private |
Compute evaluation of an industrial zone.
traf | Result if traffic attempt. |
Definition at line 1027 of file zone.cpp.
Referenced by doIndustrial().
void Micropolis::evalInit | ( | ) |
Initialize evaluation variables
Definition at line 136 of file evaluate.cpp.
References CC_VILLAGE, cityAssessedValue, cityClass, cityPop, cityPopDelta, cityScore, cityScoreDelta, and cityYes.
|
private |
Evaluate suitability of the position for placing a new house.
Definition at line 512 of file zone.cpp.
Referenced by buildHouse().
|
private |
Evaluate residential zone.
Definition at line 734 of file zone.cpp.
References landValueMap, min(), pollutionDensityMap, Position::posX, Position::posY, and Map< DATA, BLKSIZE >::worldGet().
void Micropolis::explodeSprite | ( | SimSprite * | sprite | ) |
Handle explosion of sprite (mostly due to collision?).
sprite | that should explode. |
Definition at line 1654 of file sprite.cpp.
References SimSprite::frame, makeExplosionAt(), makeSound(), MESSAGE_HELICOPTER_CRASHED, MESSAGE_PLANE_CRASHED, MESSAGE_SHIP_CRASHED, MESSAGE_TRAIN_CRASHED, sendMessage(), SPRITE_AIRPLANE, SPRITE_BUS, SPRITE_HELICOPTER, SPRITE_SHIP, SPRITE_TRAIN, SimSprite::type, SimSprite::x, SimSprite::xHot, SimSprite::y, and SimSprite::yHot.
Referenced by doAirplaneSprite(), and doTornadoSprite().
|
private |
Find a connection to a road at the perimeter.
pos | Starting position. Gets updated when a perimeter has been found. |
Definition at line 239 of file traffic.cpp.
References map, Position::posX, Position::posY, roadTest(), and testBounds().
Referenced by doSpecialZone(), and makeTraffic().
|
private |
Find a telecom connection at the perimeter.
pos | Position to start searching. |
Definition at line 274 of file traffic.cpp.
References LOMASK, map, Position::posX, and testBounds().
Referenced by makeTraffic().
|
private |
Make firerate map from firestation map.
Definition at line 120 of file scan.cpp.
References fireStationEffectMap, fireStationMap, MAP_TYPE_DYNAMIC, MAP_TYPE_FIRE_RADIUS, newMapFlags, and smoothStationMap().
Referenced by doSimInit().
void Micropolis::fireBomb | ( | ) |
Let a fire bomb explode at a random location
Definition at line 233 of file disasters.cpp.
References getRandom(), makeExplosion(), MESSAGE_FIREBOMBING, sendMessage(), WORLD_H, and WORLD_W.
Referenced by makeFireBombs().
Handle a zone on fire.
Decreases rate of growth of the zone, and makes remaining tiles bulldozable.
pos | Position of the zone on fire. |
ch | Character of the zone. |
Definition at line 1357 of file simulate.cpp.
References clamp(), LOMASK, PORTBASE, Position::posX, Position::posY, rateOfGrowthMap, Map< DATA, BLKSIZE >::worldGet(), and Map< DATA, BLKSIZE >::worldSet().
Referenced by doFire().
|
private |
Modify road, rails, and wire connections at a given tile.
x | X map coordinate. |
y | Y map coordinate. |
effects | Modification collecting object. |
Definition at line 593 of file connect.cpp.
References ToolEffects::getMapTile(), and neutralizeRoad().
Referenced by fixZone().
|
private |
Update connections (rails, and wire connections) to a zone.
x | X map coordinate |
y | Y map coordinate. |
effects | Modification collecting object. |
Definition at line 565 of file connect.cpp.
References fixSingle(), WORLD_H, and WORLD_W.
|
private |
Definition at line 1351 of file tool.cpp.
References ToolEffects::addFrontendMessage(), DIRT, ToolEffects::getMapValue(), LOMASK, putDownForest(), testBounds(), TOOLRESULT_FAILED, and TOOLRESULT_OK.
void Micropolis::freePtr | ( | void * | data | ) |
Release claimed memory.
data | Pointer to previously claimed memory. |
Definition at line 1113 of file micropolis.cpp.
Referenced by destroyMapArrays().
void Micropolis::generateBus | ( | int | x, |
int | y | ||
) |
Try to start a new bus sprite at the given map tile.
x | X coordinate in map coordinate. |
y | Y coordinate in map coordinate. |
Definition at line 1849 of file sprite.cpp.
References getRandom(), getSprite(), makeSprite(), and SPRITE_BUS.
void Micropolis::generateCopter | ( | const Position & | pos | ) |
Ensure a helicopter sprite exists.
If it does not exist, create one at the given coordinates.
pos | Start position in map coordinates. |
Definition at line 1969 of file sprite.cpp.
References getSprite(), makeSprite(), Position::posX, Position::posY, and SPRITE_HELICOPTER.
Referenced by doAirport().
void Micropolis::generateMap | ( | int | seed | ) |
Generate a map.
seed | Initialization seed for the random generator. |
Definition at line 129 of file generate.cpp.
References clearMap(), doRivers(), doTrees(), generatedCitySeed, getRandom(), makeIsland(), makeLakes(), makeNakedIsland(), seedRandom(), terrainCreateIsland, terrainCurveLevel, terrainLakeLevel, terrainTreeLevel, WORLD_H, and WORLD_W.
Referenced by generateSomeCity().
void Micropolis::generatePlane | ( | const Position & | pos | ) |
Ensure an airplane sprite exists.
If it does not exist, create one at the given coordinates.
pos | Start position in map coordinates. |
Definition at line 1985 of file sprite.cpp.
References getSprite(), makeSprite(), Position::posX, Position::posY, and SPRITE_AIRPLANE.
Referenced by doAirport().
void Micropolis::generateShip | ( | ) |
Try to construct a new ship sprite
Definition at line 1858 of file sprite.cpp.
References getRandom16(), map, and WORLD_W.
void Micropolis::generateSomeCity | ( | int | seed | ) |
Generate a map for a city.
seed | Random number generator initializing seed |
Definition at line 102 of file generate.cpp.
References callback, cityFileName, cityTime, doInitialEval, doSimInit(), generateMap(), initWillStuff(), invalidateMaps(), resetEditorState(), resetMapState(), SC_NONE, scenario, simUpdate(), and updateFunds().
Referenced by generateSomeRandomCity().
void Micropolis::generateSomeRandomCity | ( | ) |
Create a new map for a city.
Definition at line 92 of file generate.cpp.
References generateSomeCity(), and getRandom16().
void Micropolis::generateTrain | ( | int | x, |
int | y | ||
) |
Try to start a new train sprite at the given map tile.
x | X coordinate in map coordinate. |
y | Y coordinate in map coordinate. |
Definition at line 1836 of file sprite.cpp.
References getRandom(), getSprite(), makeSprite(), SPRITE_TRAIN, and totalPop.
Referenced by doRail().
|
private |
Assess value of the city.
Definition at line 159 of file evaluate.cpp.
References airportPop, cityAssessedValue, coalPowerPop, fireStationPop, hospitalPop, nuclearPowerPop, policeStationPop, railTotal, roadTotal, seaportPop, and stadiumPop.
|
private |
Compute distance to nearest boat from a given bridge.
pos | Position of bridge. |
Definition at line 1264 of file simulate.cpp.
References absoluteValue(), SimSprite::frame, min(), SimSprite::next, Position::posX, Position::posY, SPRITE_SHIP, spriteList, SimSprite::type, SimSprite::x, SimSprite::xHot, SimSprite::y, and SimSprite::yHot.
short Micropolis::getChar | ( | int | x, |
int | y | ||
) |
Get character from the map.
x | X coordinate in pixels. |
y | Y coordinate in pixels. |
-1
if off-map. Definition at line 375 of file sprite.cpp.
References LOMASK, map, and testBounds().
Referenced by doMonsterSprite(), and doTrainSprite().
|
private |
Compute Manhattan distance between given world position and center of the city.
x | X world coordinate of given position. |
y | Y world coordinate of given position. |
dx+dy
) between both positions. Definition at line 392 of file scan.cpp.
References cityCenterX, cityCenterY, and min().
Referenced by computeComRateMap().
|
private |
Classify the city based on its population.
cityPopulation | Number of people in the city. |
Definition at line 210 of file evaluate.cpp.
References CC_CAPITAL, CC_CITY, CC_MEGALOPOLIS, CC_METROPOLIS, CC_TOWN, and CC_VILLAGE.
Referenced by checkGrowth(), and doPopNum().
|
private |
Get commercial zone population number.
tile | Tile of the commercial zone. |
Definition at line 864 of file zone.cpp.
Referenced by doCommercial().
int Micropolis::getCrimeRate | ( | int | x, |
int | y | ||
) |
Get a value from the crime rate map.
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. |
Definition at line 1448 of file micropolis.cpp.
References crimeRateMap, and Map< DATA, BLKSIZE >::get().
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.
Definition at line 1474 of file micropolis.cpp.
References crimeRateMap, and Map< DATA, BLKSIZE >::getBase().
void Micropolis::getDemands | ( | float * | resDemandResult, |
float * | comDemandResult, | ||
float * | indDemandResult | ||
) |
Return the residential, commercial and industrial development demands, as floating point numbers from -1 (lowest demand) to 1 (highest demand).
Definition at line 424 of file utilities.cpp.
|
private |
Get string index for a status report on tile mapH, mapV on a given status category.
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. |
Definition at line 788 of file tool.cpp.
References crimeRateMap, landValueMap, pollutionDensityMap, populationDensityMap, rateOfGrowthMap, STR202_CRIME_NONE, STR202_GROWRATE_DECLINING, STR202_GROWRATE_FASTGROWTH, STR202_GROWRATE_SLOWGROWTH, STR202_GROWRATE_STABLE, STR202_LANDVALUE_HIGH_CLASS, STR202_LANDVALUE_LOWER_CLASS, STR202_LANDVALUE_MIDDLE_CLASS, STR202_LANDVALUE_SLUM, STR202_POLLUTION_NONE, STR202_POPULATIONDENSITY_LOW, and Map< DATA, BLKSIZE >::worldGet().
short Micropolis::getDir | ( | int | orgX, |
int | orgY, | ||
int | desX, | ||
int | desY | ||
) |
Get direction (0..8?) to get from starting point to destination point.
orgX | X coordinate starting point. |
orgY | Y coordinate starting point. |
desX | X coordinate destination point. |
desY | Y coordinate destination point. |
Definition at line 477 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.
x1 | X coordinate first point. |
y1 | Y coordinate first point. |
x2 | X coordinate second point. |
y2 | Y coordinate second point. |
Definition at line 525 of file sprite.cpp.
References absoluteValue().
Referenced by checkSpriteCollision().
short Micropolis::getERandom | ( | short | limit | ) |
Get a random number within a given range, with a preference to smaller values.
limit | Upper bound of the range (inclusive). |
0
and limit (inclusive). Definition at line 155 of file random.cpp.
References getRandom(), and min().
int Micropolis::getFireCoverage | ( | int | x, |
int | y | ||
) |
Get a value from the fire coverage map.
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. |
Definition at line 1528 of file micropolis.cpp.
References fireStationEffectMap, and Map< DATA, BLKSIZE >::get().
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.
Definition at line 1554 of file micropolis.cpp.
References fireStationEffectMap, and Map< DATA, BLKSIZE >::getBase().
|
private |
Compute severity of fire
Definition at line 361 of file evaluate.cpp.
short Micropolis::getHistory | ( | int | historyType, |
int | historyScale, | ||
int | historyIndex | ||
) |
Get a value from the history tables.
historyType | Type of history information. |
historyScale | Scale of history data. |
historyIndex | Index in the data to obtain |
Definition at line 288 of file graph.cpp.
References comHist, crimeHist, HISTORY_COUNT, HISTORY_SCALE_COUNT, HISTORY_SCALE_LONG, HISTORY_SCALE_SHORT, HISTORY_TYPE_COM, HISTORY_TYPE_COUNT, HISTORY_TYPE_CRIME, HISTORY_TYPE_IND, HISTORY_TYPE_MONEY, HISTORY_TYPE_POLLUTION, HISTORY_TYPE_RES, indHist, moneyHist, NOT_REACHED, pollutionHist, and resHist.
void Micropolis::getHistoryRange | ( | int | historyType, |
int | historyScale, | ||
short * | minValResult, | ||
short * | maxValResult | ||
) |
Get the minimal and maximal values of a historic graph.
historyType | Type of history information. |
historyScale | Scale of history data. |
minValResult | Pointer to variable to write minimal value to. |
maxValResult | Pointer to variable to write maximal value to. |
Definition at line 218 of file graph.cpp.
References comHist, crimeHist, HISTORY_COUNT, HISTORY_SCALE_COUNT, HISTORY_SCALE_LONG, HISTORY_SCALE_SHORT, HISTORY_TYPE_COM, HISTORY_TYPE_COUNT, HISTORY_TYPE_CRIME, HISTORY_TYPE_IND, HISTORY_TYPE_MONEY, HISTORY_TYPE_POLLUTION, HISTORY_TYPE_RES, indHist, max(), min(), moneyHist, NOT_REACHED, pollutionHist, and resHist.
|
private |
Get the population value for the given industrial tile.
tile | Center tile value of the industrial zone. |
Definition at line 999 of file zone.cpp.
Referenced by doIndustrial().
|
private |
Compute land value at pos, taking pollution into account.
pos | Position of interest. |
0
=> low value, 3
=> high value) Definition at line 321 of file zone.cpp.
References landValueMap, pollutionDensityMap, Position::posX, Position::posY, and Map< DATA, BLKSIZE >::worldGet().
Referenced by doCommercial().
int Micropolis::getLandValue | ( | int | x, |
int | y | ||
) |
Get a value from the land value map.
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. |
Definition at line 1488 of file micropolis.cpp.
References Map< DATA, BLKSIZE >::get(), and 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.
Definition at line 1514 of file micropolis.cpp.
References Map< DATA, BLKSIZE >::getBase(), and landValueMap.
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.
Definition at line 1234 of file micropolis.cpp.
References mapBase.
int Micropolis::getPoliceCoverage | ( | int | x, |
int | y | ||
) |
Get a value from the police coverage map.
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. |
Definition at line 1567 of file micropolis.cpp.
References Map< DATA, BLKSIZE >::get(), and policeStationEffectMap.
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.
Definition at line 1593 of file micropolis.cpp.
References Map< DATA, BLKSIZE >::getBase(), and policeStationEffectMap.
int Micropolis::getPollutionDensity | ( | int | x, |
int | y | ||
) |
Get a value from the pollution density map.
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. |
Definition at line 1408 of file micropolis.cpp.
References Map< DATA, BLKSIZE >::get(), and 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.
Definition at line 1434 of file micropolis.cpp.
References Map< DATA, BLKSIZE >::getBase(), and pollutionDensityMap.
|
private |
|
private |
Compute city population.
Definition at line 197 of file evaluate.cpp.
References comPop, indPop, and resPop.
Referenced by checkGrowth(), and doPopNum().
Get population of a zone.
pos | Position of the zone to count. |
tile | Tile of the zone. |
Definition at line 198 of file scan.cpp.
Referenced by populationDensityScan().
int Micropolis::getPopulationDensity | ( | int | x, |
int | y | ||
) |
Get a value from the population density map.
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. |
Definition at line 1288 of file micropolis.cpp.
References Map< DATA, BLKSIZE >::get(), and 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.
Definition at line 1314 of file micropolis.cpp.
References Map< DATA, BLKSIZE >::getBase(), and populationDensityMap.
int Micropolis::getPowerGrid | ( | int | x, |
int | y | ||
) |
Get a value from the power grid map.
x | X coordinate of the position to get, 0 to WORLD_W. |
y | Y coordinate of the position to get, 0 to WORLD_H. |
Definition at line 1248 of file micropolis.cpp.
References powerGridMap, and Map< DATA, BLKSIZE >::worldGet().
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.
Definition at line 1274 of file micropolis.cpp.
References Map< DATA, BLKSIZE >::getBase(), and powerGridMap.
int Micropolis::getProblemNumber | ( | int | i | ) |
Return the index of the i-th worst problem.
i | Number of the problem. |
-1
if such a problem does not exist. Definition at line 545 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.
i | Number of the problem. |
-1
if such a problem does not exist. Definition at line 562 of file evaluate.cpp.
References CVP_NUMPROBLEMS, CVP_PROBLEM_COMPLAINTS, problemOrder, and problemVotes.
short Micropolis::getRandom | ( | short | range | ) |
Draw a random number in a given range.
range | Upper bound of the range (inclusive). |
0
and range (inclusive). Definition at line 110 of file random.cpp.
References getRandom16().
Referenced by doAirplaneSprite(), doAirport(), doBRiver(), doCommercial(), doDisasters(), doFire(), doIndustrial(), doMakeSound(), doMeltdown(), doMonsterSprite(), doRivers(), doSpecialZone(), doSRiver(), doTornadoSprite(), doTrees(), doVotes(), fireBomb(), generateBus(), generateMap(), generateTrain(), getERandom(), initSprite(), makeEarthquake(), makeFire(), makeFlood(), makeLakes(), makeMonster(), makeSingleLake(), makeTornado(), makeTraffic(), putDownPark(), setFire(), and treeSplash().
int Micropolis::getRandom16 | ( | ) |
Get random 16 bit number.
Definition at line 130 of file random.cpp.
References simRandom().
Referenced by buildHouse(), crimeScan(), doCommercial(), doCopterSprite(), doFire(), doFlood(), doIndustrial(), doMonsterSprite(), doRadTile(), doRail(), doTrainSprite(), generateShip(), generateSomeRandomCity(), getRandom(), getRandom16Signed(), makeFireBombs(), and tryGo().
int Micropolis::getRandom16Signed | ( | ) |
Get signed 16 bit random number.
Definition at line 137 of file random.cpp.
References getRandom16().
Referenced by doCommercial(), and doIndustrial().
int Micropolis::getRateOfGrowth | ( | int | x, |
int | y | ||
) |
Get a value from the rate of growth map.
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. |
Definition at line 1328 of file micropolis.cpp.
References Map< DATA, BLKSIZE >::get(), and rateOfGrowthMap.
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.
Definition at line 1354 of file micropolis.cpp.
References Map< DATA, BLKSIZE >::getBase(), and rateOfGrowthMap.
|
private |
|
private |
Compute total score
problemTable | Storage of how bad each problem is. |
Definition at line 371 of file evaluate.cpp.
SimSprite * Micropolis::getSprite | ( | int | type | ) |
Return the sprite of the give type, if available.
type | Type of the sprite. |
NULL
. Definition at line 338 of file sprite.cpp.
References SimSprite::frame.
Referenced by doCopterSprite(), generateBus(), generateCopter(), generatePlane(), generateTrain(), makeMonster(), and makeTornado().
int Micropolis::getTile | ( | int | x, |
int | y | ||
) |
Get a tile from the map.
x | X coordinate of the position to get, 0 to WORLD_W. |
y | Y coordinate of the position to get, 0 to WORLD_H. |
Definition at line 1202 of file micropolis.cpp.
References DIRT, map, and testBounds().
|
private |
Get neighbouring tile from the map.
pos | Current position. |
dir | Direction of neighbouring tile, only horizontal and vertical directions are supported. |
defaultTile | Tile to return if off-map. |
DIRT
is returned. Definition at line 407 of file traffic.cpp.
References DIR2_EAST, DIR2_NORTH, DIR2_SOUTH, DIR2_WEST, LOMASK, map, Position::posX, Position::posY, WORLD_H, and WORLD_W.
Referenced by tryGo().
|
private |
Compute average traffic in the city.
Definition at line 315 of file evaluate.cpp.
References landValueMap, Map< DATA, BLKSIZE >::MAP_BLOCKSIZE, trafficAverage, trafficDensityMap, WORLD_H, WORLD_W, and Map< DATA, BLKSIZE >::worldGet().
int Micropolis::getTrafficDensity | ( | int | x, |
int | y | ||
) |
Get a value from the traffic density map.
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. |
Definition at line 1368 of file micropolis.cpp.
References Map< DATA, BLKSIZE >::get(), and 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.
Definition at line 1394 of file micropolis.cpp.
References Map< DATA, BLKSIZE >::getBase(), and trafficDensityMap.
|
private |
void Micropolis::graphDoer | ( | ) |
If graph data has been changed, update all graphs. If graphs have been changed, tell the user front-end about it.
Definition at line 132 of file graph.cpp.
References callback, and censusChanged.
Referenced by simUpdate().
|
private |
Update the rate of growth at position pos by amount.
pos | Position to modify. |
amount | Amount of change (can both be positive and negative). |
Definition at line 349 of file zone.cpp.
References clamp(), Position::posX, Position::posY, rateOfGrowthMap, Map< DATA, BLKSIZE >::worldGet(), and Map< DATA, BLKSIZE >::worldSet().
Referenced by doComIn(), doComOut(), doIndIn(), doIndOut(), and doResOut().
|
private |
Place an industrial zone around center tile pos.
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 1015 of file zone.cpp.
References IND1, and zonePlop().
Referenced by doIndIn(), and doIndOut().
|
private |
Initialize simulator variables to a sane default.
Definition at line 130 of file micropolis.cpp.
References airportPop, censusChanged, churchPop, cityMonth, cityTax, cityTime, cityYear, cityYes, Map< DATA, BLKSIZE >::clear(), coalPowerPop, comHist, comHist10Max, comHist120Max, comPop, comRateMap, comZonePop, crimeAverage, crimeHist, crimeRateMap, faith, fireEffect, fireFund, firePercent, firePop, fireSpend, fireStationEffectMap, fireStationMap, fireStationPop, fireValue, floodCount, hospitalPop, indHist, indHist10Max, indHist120Max, indPop, indZonePop, landValueAverage, landValueMap, map, mapBase, miscHist, moneyHist, mustDrawBudget, needChurch, needHospital, nuclearPowerPop, policeEffect, policeFund, policePercent, policeSpend, policeStationEffectMap, policeStationMap, policeStationPop, policeValue, pollutionAverage, pollutionDensityMap, pollutionHist, populationDensityMap, powerGridMap, problemVotes, railTotal, rateOfGrowthMap, resHist, resHist10Max, resHist120Max, resPop, resZonePop, roadEffect, roadFund, roadPercent, roadSpend, roadTotal, roadValue, seaportPop, stadiumPop, startingYear, taxFlag, taxFund, terrainDensityMap, totalPop, totalPopLast, totalZonePop, trafficDensityMap, and WORLD_W.
Referenced by Micropolis().
void Micropolis::initGame | ( | ) |
void Micropolis::initGraphMax | ( | ) |
Compute various max ranges of graphs
Definition at line 151 of file graph.cpp.
References comHist, comHist10Max, comHist120Max, graph10Max, graph120Max, indHist, indHist10Max, indHist120Max, max(), resHist, resHist10Max, and resHist120Max.
Referenced by initWillStuff().
void Micropolis::initGraphs | ( | ) |
Initialize graphs
Definition at line 142 of file graph.cpp.
References historyInitialized.
Referenced by simInit().
|
private |
Allocate and initialize arrays for the maps
Definition at line 88 of file allocate.cpp.
References comHist, crimeHist, HISTORY_LENGTH, indHist, map, mapBase, MISC_HISTORY_LENGTH, miscHist, moneyHist, newPtr(), pollutionHist, resHist, WORLD_H, and WORLD_W.
Referenced by simInit().
void Micropolis::initSprite | ( | SimSprite * | sprite, |
int | x, | ||
int | y | ||
) |
Re-initialize an existing sprite.
sprite | Sprite to re-use. |
x | New x coordinate of the sprite (in pixels?). |
y | New y coordinate of the sprite (in pixels?). |
Definition at line 136 of file sprite.cpp.
References SimSprite::destX, SimSprite::destY, SimSprite::frame, getRandom(), pollutionMaxX, pollutionMaxY, SPRITE_AIRPLANE, SPRITE_BUS, SPRITE_EXPLOSION, SPRITE_HELICOPTER, SPRITE_MONSTER, SPRITE_SHIP, SPRITE_TORNADO, SPRITE_TRAIN, SimSprite::type, WORLD_H, WORLD_W, SimSprite::x, SimSprite::xHot, SimSprite::y, and SimSprite::yHot.
Referenced by makeSprite(), and newSprite().
|
private |
Reset many game state variables
Definition at line 85 of file initialize.cpp.
References cityPop, cityScore, Map< DATA, BLKSIZE >::clear(), comRateMap, crimeRateMap, destroyAllSprites(), disasterEvent, doNewGame(), fireEffect, fireFund, fireStationEffectMap, fireStationMap, initGraphMax(), landValueMap, MAX_FIRE_STATION_EFFECT, MAX_POLICE_STATION_EFFECT, MAX_ROAD_EFFECT, policeEffect, policeFund, policeStationEffectMap, policeStationMap, pollutionDensityMap, populationDensityMap, randomlySeedRandom(), rateOfGrowthMap, roadEffect, roadFund, SC_NONE, taxFlag, terrainDensityMap, and trafficDensityMap.
Referenced by generateSomeCity(), loadFile(), loadScenario(), and simInit().
void Micropolis::invalidateMaps | ( | ) |
Tell the front-end that the maps are not valid any more
Definition at line 1168 of file micropolis.cpp.
References callback, and mapSerial.
Referenced by generateSomeCity(), loadFile(), loadScenario(), toolDown(), and toolDrag().
|
private |
Definition at line 1328 of file tool.cpp.
References ToolEffects::addFrontendMessage(), putDownLand(), testBounds(), TOOLRESULT_FAILED, and TOOLRESULT_OK.
|
private |
Builldoze a tile (make it a #RIVER or DIRT).
x | X map coordinate. |
y | Y map coordinate. |
effects | Modification collecting object. |
Definition at line 222 of file connect.cpp.
References BULLBIT, ToolEffects::getMapValue(), HBRIDGE, LOMASK, neutralizeRoad(), TOOLRESULT_FAILED, and VBRIDGE.
|
private |
Lay a rail, and update connections (rail, road, and wire) around it.
x | X map coordinate. |
y | Y map coordinate. |
effects | Modification collecting object. |
Definition at line 364 of file connect.cpp.
References DIRT, ToolEffects::getMapTile(), neutralizeRoad(), and ToolEffects::setMapValue().
|
private |
Lay a road, and update road around it.
x | X map coordinate. |
y | Y map coordinate. |
effects | Modification collecting object. |
Definition at line 271 of file connect.cpp.
References DIRT, ToolEffects::getMapTile(), and ToolEffects::setMapValue().
|
private |
Lay a wire, and update connections (rail, road, and wire) around it.
x | X map coordinate. |
y | Y map coordinate. |
effects | Modification collecting object. |
Definition at line 460 of file connect.cpp.
References DIRT, ToolEffects::getMapTile(), neutralizeRoad(), and ToolEffects::setMapValue().
bool Micropolis::loadCity | ( | const std::string & | filename | ) |
Try to load a new game from disk.
filename | Name of the file to load. |
In what state is the game left when loading fails?
String normalization code is duplicated in Micropolis::saveCityAs(). Extract to a sub-function.
lastDot<lastSlash
(ie with "x.y/bla"
) Definition at line 508 of file fileio.cpp.
References cityFileName, didLoadCity(), didntLoadCity(), and loadFile().
bool Micropolis::loadFile | ( | const std::string & | filename | ) |
Load a file, and initialize the game variables.
filename | Name of the file to load. |
Definition at line 251 of file fileio.cpp.
References changeCensus(), cityTax, cityTime, doInitialEval, doSimInit(), firePercent, HALF_SWAP_LONGS, initWillStuff(), invalidateMaps(), loadFileData(), max(), miscHist, mustUpdateOptions, policePercent, roadPercent, SC_NONE, scenario, setAutoBudget(), setAutoBulldoze(), setAutoGoto(), setEnableSound(), and setFunds().
Referenced by loadCity().
bool Micropolis::loadFileData | ( | const std::string & | filename | ) |
Load a city file from a given filename and (optionally) directory.
filename | Name of the file to load. |
dir | If not NULL , name of the directory containing the file. |
Definition at line 213 of file fileio.cpp.
References comHist, crimeHist, HISTORY_LENGTH, indHist, load_short(), map, MISC_HISTORY_LENGTH, miscHist, moneyHist, pollutionHist, resHist, WORLD_H, and WORLD_W.
Referenced by loadFile(), and loadScenario().
void Micropolis::loadScenario | ( | Scenario | s | ) |
Load a scenario.
s | Scenario to load. |
SC_NONE
. Definition at line 401 of file fileio.cpp.
References cityFileName, cityTime, didLoadScenario(), doInitialEval, doSimInit(), initWillStuff(), invalidateMaps(), LEVEL_EASY, loadFileData(), NOT_REACHED, SC_BERN, SC_BOSTON, SC_DETROIT, SC_DULLSVILLE, SC_HAMBURG, SC_RIO, SC_SAN_FRANCISCO, SC_TOKYO, scenario, setCleanCityName(), setFunds(), setGameLevel(), and updateFunds().
void Micropolis::makeEarthquake | ( | ) |
Change random tiles to fire or dirt as result of the earthquake
Definition at line 257 of file disasters.cpp.
References cityCenterX, cityCenterY, doEarthquake(), getRandom(), map, MESSAGE_EARTHQUAKE, randomFire(), randomRubble(), sendMessage(), vulnerable(), WORLD_H, and WORLD_W.
Referenced by doDisasters(), and scenarioDisaster().
void Micropolis::makeExplosion | ( | int | x, |
int | y | ||
) |
Construct an explosion sprite.
x | X coordinate of the explosion (in map coordinates). |
y | Y coordinate of the explosion (in map coordinates). |
Definition at line 2020 of file sprite.cpp.
References makeExplosionAt(), and testBounds().
Referenced by doMeltdown(), and fireBomb().
void Micropolis::makeExplosionAt | ( | int | x, |
int | y | ||
) |
Construct an explosion sprite.
x | X coordinate of the explosion (in pixels). |
y | Y coordinate of the explosion (in pixels). |
Definition at line 2033 of file sprite.cpp.
References newSprite(), and SPRITE_EXPLOSION.
Referenced by doFire(), explodeSprite(), and makeExplosion().
void Micropolis::makeFire | ( | ) |
Start a fire at a random place, requested by user
Definition at line 304 of file disasters.cpp.
References BURNBIT, getRandom(), LASTZONE, LOMASK, map, MESSAGE_FIRE_REPORTED, randomFire(), sendMessage(), WORLD_H, WORLD_W, and ZONEBIT.
void Micropolis::makeFireBombs | ( | ) |
Throw several bombs onto the city.
Definition at line 243 of file disasters.cpp.
References fireBomb(), and getRandom16().
Referenced by scenarioDisaster().
void Micropolis::makeFlood | ( | ) |
Flood many tiles
Definition at line 346 of file disasters.cpp.
References getRandom(), LOMASK, map, WORLD_H, and WORLD_W.
Referenced by doDisasters(), and scenarioDisaster().
|
private |
If needed, add a new hospital or a new church.
pos | Center position of the new hospital or church. |
Definition at line 290 of file zone.cpp.
References needHospital, and zonePlop().
void Micropolis::makeIsland | ( | ) |
Construct a new world as an island
Definition at line 248 of file generate.cpp.
References doTrees(), and makeNakedIsland().
Referenced by generateMap().
|
private |
Make a number of lakes, depending on the Micropolis::terrainLakeLevel.
Definition at line 259 of file generate.cpp.
References getRandom(), makeSingleLake(), terrainLakeLevel, WORLD_H, and WORLD_W.
Referenced by generateMap().
void Micropolis::makeMeltdown | ( | ) |
Make a nuclear power plant melt
Definition at line 217 of file disasters.cpp.
References doMeltdown(), LOMASK, map, NUCLEAR, WORLD_H, and WORLD_W.
Referenced by scenarioDisaster().
void Micropolis::makeMonster | ( | ) |
Start a new monster sprite.
Definition at line 1917 of file sprite.cpp.
References SimSprite::destX, SimSprite::destY, getRandom(), getSprite(), map, pollutionMaxX, pollutionMaxY, SPRITE_MONSTER, WORLD_H, and WORLD_W.
Referenced by doDisasters(), and scenarioDisaster().
void Micropolis::makeMonsterAt | ( | int | x, |
int | y | ||
) |
Start a new monster sprite at the given map tile.
x | X coordinate in map coordinate. |
y | Y coordinate in map coordinate. |
Definition at line 1956 of file sprite.cpp.
References makeSprite(), MESSAGE_MONSTER_SIGHTED, sendMessage(), and SPRITE_MONSTER.
|
private |
Construct a plain island as world, surrounded by 5 tiles of river.
Definition at line 204 of file generate.cpp.
References ISLAND_RADIUS, map, WORLD_H, and WORLD_W.
Referenced by generateMap(), and makeIsland().
void Micropolis::makeShipHere | ( | int | x, |
int | y | ||
) |
Start a new ship sprite at the given map tile.
x | X coordinate in map coordinate. |
y | Y coordinate in map coordinate. |
Definition at line 1905 of file sprite.cpp.
References makeSprite(), and SPRITE_SHIP.
void Micropolis::makeSingleLake | ( | const Position & | pos | ) |
Make a random lake at pos.
pos | Rough position of the lake. |
Definition at line 283 of file generate.cpp.
References getRandom(), plopBRiver(), and plopSRiver().
Referenced by makeLakes().
void Micropolis::makeSound | ( | const std::string & | channel, |
const std::string & | sound, | ||
int | x = -1 , |
||
int | y = -1 |
||
) |
Instruct the front-end to make a sound.
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 1185 of file micropolis.cpp.
References callback, and enableSound.
Referenced by doCopterSprite(), doEarthquake(), doExplosionSprite(), doMakeSound(), doMonsterSprite(), explodeSprite(), FrontendMessageMakeSound::sendMessage(), and toolDown().
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.
type | Sprite type of the new sprite. |
x | X coordinate of the new sprite. |
y | Y coordinate of the new sprite. |
Definition at line 355 of file sprite.cpp.
References initSprite(), and newSprite().
Referenced by generateBus(), generateCopter(), generatePlane(), generateTrain(), makeMonsterAt(), makeShipHere(), and makeTornado().
void Micropolis::makeTornado | ( | ) |
Ensure a tornado sprite exists.
Definition at line 1996 of file sprite.cpp.
References getRandom(), getSprite(), makeSprite(), MESSAGE_TORNADO_SIGHTED, sendMessage(), SPRITE_TORNADO, WORLD_H, and WORLD_W.
Referenced by doDisasters().
Find a connection over a road from startPos to a specified zone type.
startPos | Start position of the attempt. |
dest | Zone type to go to. |
1
if connection found, 0
if not found, -1
if no connection to road found. Definition at line 134 of file traffic.cpp.
References addToTrafficDensityMap(), curMapStackPointer, findPerimeterRoad(), findPerimeterTelecom(), getRandom(), and tryDrive().
short Micropolis::makeTraffic | ( | int | x, |
int | y, | ||
ZoneType | dest | ||
) |
Find a connection over a road from position x y to a specified zone type.
x | Start x position of the attempt |
y | Start y position of the attempt |
dest | Zone type to go to. |
1
if connection found, 0
if not found, -1
if no connection to road found. Definition at line 118 of file traffic.cpp.
References Position::posX, and Position::posY.
Referenced by doCommercial(), and doIndustrial().
short Micropolis::makeTrafficAt | ( | int | x, |
int | y, | ||
ZoneType | dest | ||
) |
Makes traffic starting from the road tile at \x, \y.
x | Start x position of the attempt |
y | Start y position of the attempt |
dest | Zone type to go to. |
1
if connection found, 0
if not found, -1
if no connection to road found. Definition at line 95 of file traffic.cpp.
References addToTrafficDensityMap(), Position::posX, Position::posY, and tryDrive().
void Micropolis::moveObjects | ( | ) |
Move all sprites.
Sprites with SimSprite::frame == 0 are removed.
It uses SimSprite::name[0] == '\0' as condition which seems stupid.
Micropolis::destroySprite modifies the Micropolis::spriteList while we loop over it.
Definition at line 553 of file sprite.cpp.
References destroySprite(), doAirplaneSprite(), doBusSprite(), doCopterSprite(), doExplosionSprite(), doMonsterSprite(), doShipSprite(), doTornadoSprite(), doTrainSprite(), SimSprite::frame, SimSprite::name, SimSprite::next, SPRITE_AIRPLANE, SPRITE_BUS, SPRITE_EXPLOSION, SPRITE_HELICOPTER, SPRITE_MONSTER, SPRITE_SHIP, SPRITE_TORNADO, SPRITE_TRAIN, spriteList, and SimSprite::type.
|
private |
Put down a network.
Definition at line 1286 of file tool.cpp.
References ToolEffects::addFrontendMessage(), putDownNetwork(), testBounds(), TOOLRESULT_FAILED, and TOOLRESULT_OK.
Ptr Micropolis::newPtr | ( | int | size | ) |
Claim size bytes of memory.
size | Number of bytes to claim. |
Definition at line 1103 of file micropolis.cpp.
Referenced by initMapArrays(), newSprite(), and simHeat().
SimSprite * Micropolis::newSprite | ( | const std::string & | name, |
int | type, | ||
int | x, | ||
int | y | ||
) |
Create and initialize a sprite.
name | Name of the sprite (always "" ). |
type | Type pf the sprite. |
x | X coordinate of the sprite (in pixels). |
y | Y coordinate of the sprite (in pixels). |
Definition at line 104 of file sprite.cpp.
References freeSprites, initSprite(), SimSprite::name, newPtr(), SimSprite::next, spriteList, and SimSprite::type.
Referenced by makeExplosionAt(), and makeSprite().
|
private |
Build a park.
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. |
Definition at line 1198 of file tool.cpp.
References ToolEffects::addFrontendMessage(), putDownPark(), testBounds(), TOOLRESULT_FAILED, and TOOLRESULT_OK.
void Micropolis::pause | ( | ) |
void Micropolis::plopBRiver | ( | const Position & | pos | ) |
Put down a big river diamond-like shape.
pos | Base coordinate of the blob (top-left position). |
Definition at line 623 of file generate.cpp.
Referenced by doBRiver(), and makeSingleLake().
void Micropolis::plopSRiver | ( | const Position & | pos | ) |
Put down a small river diamond-like shape.
pos | Base coordinate of the blob (top-left position). |
Definition at line 650 of file generate.cpp.
Referenced by doSRiver(), and makeSingleLake().
|
private |
Definition at line 136 of file scan.cpp.
References cityCenterX, cityCenterY, Map< DATA, BLKSIZE >::clear(), computeComRateMap(), Map< DATA, BLKSIZE >::getBase(), getPopulationDensity(), LOMASK, map, Map< DATA, BLKSIZE >::MAP_H, MAP_TYPE_DYNAMIC, MAP_TYPE_POPULATION_DENSITY, MAP_TYPE_RATE_OF_GROWTH, Map< DATA, BLKSIZE >::MAP_W, min(), newMapFlags, populationDensityMap, tempMap1, tempMap2, WORLD_H, WORLD_W, Map< DATA, BLKSIZE >::worldSet(), and ZONEBIT.
Referenced by doSimInit().
|
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.
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. |
Definition at line 657 of file tool.cpp.
References ToolEffects::addCost(), autoBulldoze, DIRT, gCostOf, ToolEffects::getMapTile(), ToolEffects::setMapValue(), tally(), TOOLRESULT_FAILED, TOOLRESULT_NEED_BULLDOZE, WORLD_H, and WORLD_W.
Referenced by buildBuilding().
|
private |
Pull top-most position from the position stack.
Definition at line 223 of file traffic.cpp.
References curMapStackPointer, and curMapStackXY.
Referenced by addToTrafficDensityMap().
|
private |
Pull a position from the power stack.
Definition at line 187 of file power.cpp.
References powerStackPointer, and powerStackXY.
Referenced by doPowerScan().
|
private |
Push a position onto the position stack.
pos | Position to push. |
Definition at line 210 of file traffic.cpp.
References curMapStackPointer, curMapStackXY, and MAX_TRAFFIC_DISTANCE.
Referenced by tryDrive().
|
private |
Push position pos onto the power stack if there is room.
pos | Position to push. |
Definition at line 173 of file power.cpp.
References POWER_STACK_SIZE, powerStackPointer, and powerStackXY.
Referenced by doPowerScan(), and doSpecialZone().
|
private |
Put down a building, starting at (leftX, topY) with size (sizeX, sizeY).
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. |
Definition at line 617 of file tool.cpp.
Referenced by buildBuilding().
|
private |
Put down a forest tile.
mapH | X coordinate of the tile. |
mapV | Y coordinate of the tile. |
Definition at line 366 of file tool.cpp.
References ToolEffects::setMapValue().
Referenced by forestTool().
|
private |
Put down a land tile.
mapH | X coordinate of the tile. |
mapV | Y coordinate of the tile. |
Auto-bulldoze deducts always 1.
Auto-bulldoze costs should be pulled from a table/constant.
Definition at line 333 of file tool.cpp.
References ToolEffects::addCost(), DIRT, gCostOf, ToolEffects::getMapTile(), ToolEffects::setMapValue(), and TOOLRESULT_FAILED.
Referenced by landTool().
|
private |
Put down a communication network.
mapH | X coordinate of the tile. |
mapV | Y coordinate of the tile. |
effects | Storage of effects of putting down the park. |
Definition at line 282 of file tool.cpp.
References ToolEffects::addCost(), DIRT, gCostOf, ToolEffects::getMapTile(), and tally().
Referenced by networkTool().
|
private |
Put a park down at the give tile.
mapH | X coordinate of the tile. |
mapV | Y coordinate of the tile. |
effects | Storage of effects of putting down the park. |
Definition at line 252 of file tool.cpp.
References BULLBIT, BURNBIT, and getRandom().
Referenced by parkTool().
|
private |
Put down a water tile.
mapH | X coordinate of the tile. |
mapV | Y coordinate of the tile. |
Definition at line 310 of file tool.cpp.
References ToolEffects::getMapTile().
|
private |
Put mChar onto the map at position xLoc, yLoc if possible.
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 593 of file generate.cpp.
References DIRT, LOMASK, map, and testBounds().
|
private |
Make a size by size tiles square of rubble
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 923 of file tool.cpp.
References DIRT, doAnimation, ToolEffects::getMapTile(), RADTILE, and testBounds().
|
private |
Do query tool.
x | X coordinate of the position of the query. |
y | Y coordinate of the position of the query. |
Definition at line 972 of file tool.cpp.
References didTool(), doZoneStatus(), testBounds(), TOOLRESULT_FAILED, and TOOLRESULT_OK.
|
private |
Build a rail track at a tile.
x | Horizontal position of the tile. |
y | Vertical position of the tile. |
effects | Storage of effects of laying the rail. |
Definition at line 1146 of file tool.cpp.
References ToolEffects::addFrontendMessage(), CONNECT_TILE_RAILROAD, connectTile(), testBounds(), TOOLRESULT_FAILED, and TOOLRESULT_OK.
|
inlineprivate |
Generate a random animated Tiles::FIRE tile
Definition at line 2139 of file micropolis.h.
Referenced by doFire(), doMeltdown(), makeEarthquake(), makeFire(), and startFire().
void Micropolis::randomlySeedRandom | ( | ) |
Initialize the random number generator with a 'random' seed.
Definition at line 165 of file random.cpp.
References seedRandom().
Referenced by initWillStuff().
|
inlineprivate |
Generate a random Tiles::RUBBLE tile
Definition at line 2145 of file micropolis.h.
Referenced by doFire(), and makeEarthquake().
Repair a zone at pos.
pos | Center-tile position of the zone. |
zCent | Value of the center tile. |
zSize | Size of the zone (in both directions). |
Definition at line 1404 of file simulate.cpp.
References ANIMBIT, LOMASK, map, Position::posX, Position::posY, testBounds(), and ZONEBIT.
Referenced by doSpecialZone().
|
private |
Reset all tools in the simulator editor.
Definition at line 141 of file initialize.cpp.
Referenced by generateSomeCity(), and simInit().
|
private |
Reset all maps in the simulator.
Definition at line 131 of file initialize.cpp.
Referenced by generateSomeCity(), and simInit().
|
private |
Put down a residential zone.
pos | Center tile of the residential zone. |
den | Population density (0..3) |
value | Land value - pollution (0..3), higher is better. |
Definition at line 722 of file zone.cpp.
Referenced by doResOut().
void Micropolis::resume | ( | ) |
|
private |
Can the given tile be used as road?
mv | Value from the map. |
Definition at line 503 of file traffic.cpp.
References LOMASK.
Referenced by findPerimeterRoad(), and tryGo().
|
private |
Build a road at a tile.
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. |
Definition at line 1120 of file tool.cpp.
References ToolEffects::addFrontendMessage(), CONNECT_TILE_ROAD, connectTile(), testBounds(), TOOLRESULT_FAILED, and TOOLRESULT_OK.
void Micropolis::saveCity | ( | ) |
Try to save the game.
Definition at line 559 of file fileio.cpp.
References cityFileName, didntSaveCity(), didSaveCity(), doSaveCityAs(), and saveFile().
void Micropolis::saveCityAs | ( | const std::string & | filename | ) |
Save the city under a new name (?)
filename | Name of the file to use for storing the game. |
lastDot<lastSlash
(ie with "x.y/bla"
) Definition at line 616 of file fileio.cpp.
References cityFileName, cityName, didntSaveCity(), didSaveCity(), and saveFile().
bool Micropolis::saveFile | ( | const std::string & | filename | ) |
Save a game to disk.
filename | Name of the file to use for storing the game. |
Definition at line 337 of file fileio.cpp.
References autoBudget, autoBulldoze, autoGoto, cityTax, cityTime, comHist, crimeHist, enableSound, firePercent, HALF_SWAP_LONGS, HISTORY_LENGTH, indHist, map, MISC_HISTORY_LENGTH, miscHist, moneyHist, policePercent, pollutionHist, resHist, roadPercent, save_short(), totalFunds, WORLD_H, and WORLD_W.
Referenced by saveCity(), and saveCityAs().
|
private |
Let disasters of the scenario happen
Definition at line 158 of file disasters.cpp.
References disasterEvent, disasterWait, makeEarthquake(), makeFireBombs(), makeFlood(), makeMeltdown(), makeMonster(), NOT_REACHED, SC_BERN, SC_BOSTON, SC_DETROIT, SC_DULLSVILLE, SC_HAMBURG, SC_NONE, SC_RIO, SC_SAN_FRANCISCO, and SC_TOKYO.
Referenced by doDisasters().
void Micropolis::scoreDoer | ( | ) |
Update the score after being requested.
Definition at line 515 of file evaluate.cpp.
References doScoreCard(), and evalChanged.
Referenced by simUpdate().
void Micropolis::seedRandom | ( | int | seed | ) |
Set seed of the random number generator.
seed | New seed. |
Definition at line 177 of file random.cpp.
Referenced by generateMap(), and randomlySeedRandom().
void Micropolis::sendMessage | ( | short | messageIndex, |
short | x = NOWHERE , |
||
short | y = NOWHERE , |
||
bool | picture = false , |
||
bool | important = false |
||
) |
Send the user a message of an event that happens at a particular position in the city.
messageIndex | 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 390 of file message.cpp.
References callback.
Referenced by checkGrowth(), doCopterSprite(), doExplosionSprite(), doMeltdown(), doPowerScan(), doScenarioScore(), explodeSprite(), fireBomb(), makeEarthquake(), makeFire(), makeMonsterAt(), makeTornado(), sendMessages(), toolDown(), and updateDate().
void Micropolis::sendMessages | ( | ) |
Check progress of the user, and send him messages about it.
Definition at line 87 of file message.cpp.
References airportPop, checkGrowth(), cityTax, cityTime, coalPowerPop, comCap, comPop, comZonePop, crimeAverage, doScenarioScore(), fireEffect, fireStationPop, indCap, indPop, indZonePop, MAX_FIRE_STATION_EFFECT, MAX_POLICE_STATION_EFFECT, MAX_ROAD_EFFECT, MESSAGE_BLACKOUTS_REPORTED, MESSAGE_FIRE_STATION_NEEDS_FUNDING, MESSAGE_HIGH_CRIME, MESSAGE_HIGH_POLLUTION, MESSAGE_NEED_AIRPORT, MESSAGE_NEED_ELECTRICITY, MESSAGE_NEED_FIRE_STATION, MESSAGE_NEED_MORE_COMMERCIAL, MESSAGE_NEED_MORE_INDUSTRIAL, MESSAGE_NEED_MORE_RAILS, MESSAGE_NEED_MORE_RESIDENTIAL, MESSAGE_NEED_MORE_ROADS, MESSAGE_NEED_POLICE_STATION, MESSAGE_NEED_SEAPORT, MESSAGE_NEED_STADIUM, MESSAGE_POLICE_NEEDS_FUNDING, MESSAGE_ROAD_NEEDS_FUNDING, MESSAGE_TAX_TOO_HIGH, MESSAGE_TRAFFIC_JAMS, nuclearPowerPop, policeEffect, policeStationPop, pollutionAverage, poweredZoneCount, railTotal, resCap, resPop, resZonePop, roadEffect, roadTotal, SC_NONE, scenario, scoreType, scoreWait, seaportPop, sendMessage(), stadiumPop, totalPop, totalZonePop, trafficAverage, and unpoweredZoneCount.
void Micropolis::setAutoBudget | ( | bool | value | ) |
Set the auto-budget to the given value.
value | New value for the auto-budget setting. |
Definition at line 328 of file utilities.cpp.
References autoBudget, and mustUpdateOptions.
Referenced by 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.
value | The value to set autoBulldoze to. |
Definition at line 342 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.
value | The value to set autoGoto to. |
Definition at line 356 of file utilities.cpp.
References autoGoto, and mustUpdateOptions.
Referenced by loadFile(), and simInit().
void Micropolis::setCleanCityName | ( | const std::string & | name | ) |
Set the name of the city.
name | New name of the city. |
Definition at line 272 of file utilities.cpp.
References callback, and cityName.
Referenced by loadScenario().
void Micropolis::setCrimeRate | ( | int | x, |
int | y, | ||
int | rate | ||
) |
Set a value in the crime rate map.
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. |
Definition at line 1462 of file micropolis.cpp.
References crimeRateMap, and Map< DATA, BLKSIZE >::set().
void Micropolis::setDoAnimation | ( | bool | value | ) |
Set the doAnimation flag to the given value, and set the mustUpdateOptions flag to update the user interface.
value | The value to set doAnimation to. |
Definition at line 384 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.
value | The value to set doMessages to. |
Definition at line 398 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.
value | The value to set doNotices to. |
Definition at line 412 of file utilities.cpp.
References doNotices, and mustUpdateOptions.
void Micropolis::setEnableDisasters | ( | bool | value | ) |
set the enableDisasters flag, and set the flag to update the user interface.
value | New setting for enableDisasters |
Definition at line 317 of file utilities.cpp.
References enableDisasters, and mustUpdateOptions.
Referenced by simInit().
void Micropolis::setEnableSound | ( | bool | value | ) |
Set the enableSound flag to the given value, and set the mustUpdateOptions flag to update the user interface.
value | The value to set enableSound to. |
Definition at line 370 of file utilities.cpp.
References enableSound, and mustUpdateOptions.
Referenced by loadFile(), and simInit().
void Micropolis::setFire | ( | ) |
Start a fire at a random place, random disaster or scenario
Definition at line 285 of file disasters.cpp.
References getRandom(), LOMASK, map, WORLD_H, WORLD_W, and ZONEBIT.
Referenced by doDisasters().
void Micropolis::setFireCoverage | ( | int | x, |
int | y, | ||
int | coverage | ||
) |
Set a value in the fire coverage map.
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. |
Definition at line 1542 of file micropolis.cpp.
References fireStationEffectMap, and Map< DATA, BLKSIZE >::set().
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.
dollars | New value for the player funds. |
Definition at line 1077 of file micropolis.cpp.
References totalFunds, and updateFunds().
Referenced by loadFile(), loadScenario(), setGameLevelFunds(), simInit(), and spend().
void Micropolis::setGameLevel | ( | GameLevel | level | ) |
Set/change the game level.
level | New game level. |
Definition at line 235 of file utilities.cpp.
References gameLevel, LEVEL_FIRST, LEVEL_LAST, and updateGameLevel().
Referenced by loadScenario(), setGameLevelFunds(), and simLoadInit().
void Micropolis::setGameLevelFunds | ( | GameLevel | level | ) |
Set the game level and initial funds.
level | New game level. |
Definition at line 208 of file utilities.cpp.
References LEVEL_EASY, LEVEL_HARD, LEVEL_MEDIUM, setFunds(), and setGameLevel().
Referenced by simInit().
void Micropolis::setHistory | ( | int | historyType, |
int | historyScale, | ||
int | historyIndex, | ||
short | historyValue | ||
) |
Store a value into the history tables.
historyType | Type of history information. |
historyScale | Scale of history data. |
historyIndex | Index in the data to obtain |
historyValue | Index in the value to store |
Definition at line 348 of file graph.cpp.
References comHist, crimeHist, HISTORY_COUNT, HISTORY_SCALE_COUNT, HISTORY_SCALE_LONG, HISTORY_SCALE_SHORT, HISTORY_TYPE_COM, HISTORY_TYPE_COUNT, HISTORY_TYPE_CRIME, HISTORY_TYPE_IND, HISTORY_TYPE_MONEY, HISTORY_TYPE_POLLUTION, HISTORY_TYPE_RES, indHist, moneyHist, NOT_REACHED, pollutionHist, and resHist.
void Micropolis::setLandValue | ( | int | x, |
int | y, | ||
int | value | ||
) |
Set a value in the land value map.
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. |
Definition at line 1502 of file micropolis.cpp.
References landValueMap, and Map< DATA, BLKSIZE >::set().
void Micropolis::setPoliceCoverage | ( | int | x, |
int | y, | ||
int | coverage | ||
) |
Set a value in the police coverage map.
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. |
Definition at line 1581 of file micropolis.cpp.
References policeStationEffectMap, and Map< DATA, BLKSIZE >::set().
void Micropolis::setPollutionDensity | ( | int | x, |
int | y, | ||
int | density | ||
) |
Set a value in the pollition density map.
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. |
Definition at line 1422 of file micropolis.cpp.
References pollutionDensityMap, and Map< DATA, BLKSIZE >::set().
void Micropolis::setPopulationDensity | ( | int | x, |
int | y, | ||
int | density | ||
) |
Set a value in the population density map.
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. |
Definition at line 1302 of file micropolis.cpp.
References populationDensityMap, and Map< DATA, BLKSIZE >::set().
void Micropolis::setPowerGrid | ( | int | x, |
int | y, | ||
int | power | ||
) |
Set a value in the power grid map.
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. |
Definition at line 1262 of file micropolis.cpp.
References powerGridMap, and Map< DATA, BLKSIZE >::worldSet().
void Micropolis::setRateOfGrowth | ( | int | x, |
int | y, | ||
int | rate | ||
) |
Set a value in the rate of growth map.
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. |
Definition at line 1342 of file micropolis.cpp.
References rateOfGrowthMap, and Map< DATA, BLKSIZE >::set().
|
private |
void Micropolis::setTile | ( | int | x, |
int | y, | ||
int | tile | ||
) |
Set a tile into the map.
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. |
Definition at line 1219 of file micropolis.cpp.
References map, and testBounds().
void Micropolis::setTrafficDensity | ( | int | x, |
int | y, | ||
int | density | ||
) |
Set a value in the traffic density map.
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. |
Definition at line 1382 of file micropolis.cpp.
References Map< DATA, BLKSIZE >::set(), and trafficDensityMap.
|
private |
Definition at line 560 of file simulate.cpp.
References cityClass, cityScore, cityTax, clamp(), comHist, comPop, crimeAverage, gameLevel, indHist, indPop, landValueAverage, LENGTH_OF, LEVEL_COUNT, LEVEL_FIRST, LEVEL_LAST, max(), min(), miscHist, pollutionAverage, resHist, resPop, totalPop, and totalPopLast.
Referenced by doSimInit().
|
private |
Copy the value of powerGridMap at position pos to the map.
pos | Position to copy. |
Definition at line 431 of file zone.cpp.
References LOMASK, map, NUCLEAR, Position::posX, Position::posY, powerGridMap, POWERPLANT, PWRBIT, and Map< DATA, BLKSIZE >::worldGet().
Referenced by doNilPower(), and doZone().
|
private |
|
private |
Initialize for a simulation
Definition at line 743 of file micropolis.cpp.
References blinkFlag, changeEval(), cityTime, clearMap(), initGraphs(), initMapArrays(), initWillStuff(), LEVEL_EASY, mustUpdateOptions, resetEditorState(), resetMapState(), SC_NONE, scenario, setAutoBudget(), setAutoBulldoze(), setAutoGoto(), setEnableDisasters(), setEnableSound(), setFunds(), setGameLevelFunds(), simPass, simPasses, simPaused, and startingYear.
|
private |
Definition at line 436 of file simulate.cpp.
References CC_MEGALOPOLIS, CC_VILLAGE, cityClass, cityScore, cityTime, comCap, comPop, crimeAverage, disasterEvent, disasterWait, doNilPower(), doStartGame(), doStartScenario(), Map< DATA, BLKSIZE >::fill(), fireEffect, gameLevel, indCap, indPop, landValueAverage, LENGTH_OF, LEVEL_FIRST, LEVEL_LAST, MAX_FIRE_STATION_EFFECT, MAX_POLICE_STATION_EFFECT, MAX_ROAD_EFFECT, miscHist, policeEffect, pollutionAverage, powerGridMap, resCap, resPop, roadEffect, SC_COUNT, SC_NONE, scenario, scoreType, scoreWait, and setGameLevel().
Referenced by doSimInit().
int Micropolis::simRandom | ( | ) |
Draw a random number (internal function).
Definition at line 98 of file random.cpp.
Referenced by getRandom16().
void Micropolis::simTick | ( | ) |
Move simulaton forward.
Definition at line 1043 of file micropolis.cpp.
References simPass, simPasses, and simUpdate().
void Micropolis::simUpdate | ( | ) |
Update ????
Definition at line 783 of file micropolis.cpp.
References blinkFlag, graphDoer(), heatSteps, scoreDoer(), tickCount(), tilesAnimated, and updateBudget().
Referenced by generateSomeCity(), and simTick().
|
private |
Temporary function to prevent breaking a lot of code.
Definition at line 429 of file generate.cpp.
References ToolEffects::modifyWorld().
|
private |
Smooth trees at a position.
Definition at line 441 of file generate.cpp.
References ToolEffects::getMapValue(), and testBounds().
void Micropolis::spend | ( | int | dollars | ) |
Deduct dollars from the player funds.
dollars | Amount of money spent. |
Definition at line 1064 of file micropolis.cpp.
References setFunds(), and totalFunds.
Referenced by ToolEffects::modifyWorld().
bool Micropolis::spriteNotInBounds | ( | SimSprite * | sprite | ) |
Check whether a sprite is still entirely on-map.
sprite | Sprite to check. |
Definition at line 459 of file sprite.cpp.
References WORLD_H, SimSprite::x, SimSprite::xHot, SimSprite::y, and SimSprite::yHot.
Referenced by doAirplaneSprite(), and doTornadoSprite().
void Micropolis::startFire | ( | int | x, |
int | y | ||
) |
Start a fire at a single tile.
x | X coordinate in map coordinate. |
y | Y coordinate in map coordinate. |
Definition at line 1805 of file sprite.cpp.
References BURNBIT, DIRT, LOMASK, map, randomFire(), testBounds(), and ZONEBIT.
Referenced by doExplosionSprite().
void Micropolis::startFireInZone | ( | int | Xloc, |
int | Yloc, | ||
int | ch | ||
) |
Start a fire in a zone.
Xloc | X coordinate in map coordinate. |
Yloc | Y coordinate in map coordinate. |
ch | Map character at (Xloc, Yloc). |
Definition at line 1764 of file sprite.cpp.
References clamp(), LOMASK, PORTBASE, rateOfGrowthMap, Map< DATA, BLKSIZE >::worldGet(), and Map< DATA, BLKSIZE >::worldSet().
|
private |
Take monthly snaphsot of all relevant data for the historic graphs. Also update variables that control building new churches and hospitals.
Rename to takeMonthlyCensus (or takeMonthlySnaphshot?).
A lot of this max stuff is also done in graph.cpp
Definition at line 726 of file simulate.cpp.
References changeCensus(), churchPop, clamp(), comHist, comHist10Max, comPop, crimeAverage, crimeHist, faith, graph10Max, hospitalPop, indHist, indHist10Max, indPop, max(), min(), moneyHist, needChurch, needHospital, pollutionAverage, pollutionHist, resHist, resHist10Max, and resPop.
|
private |
Can the tile be auto-bulldozed?.
tileValue | Value of the tile. |
True
if the tile can be auto-bulldozed, else false
. Definition at line 535 of file tool.cpp.
Referenced by prepareBuildingSite(), and putDownNetwork().
|
inlinestatic |
Check that the given coordinate is within world bounds
wx | World x coordinate |
wy | World y coordinate |
Definition at line 2378 of file micropolis.h.
References WORLD_H.
Referenced by buildHouse(), bulldozerTool(), canDriveOn(), connectTile(), destroyMapTile(), doBRiver(), doFire(), doFlood(), doMeltdown(), doSRiver(), findPerimeterRoad(), findPerimeterTelecom(), forestTool(), getChar(), getTile(), landTool(), makeExplosion(), networkTool(), parkTool(), putOnMap(), putRubble(), queryTool(), railroadTool(), repairZone(), roadTool(), setTile(), smoothTreesAt(), startFire(), wireTool(), and zonePlop().
|
private |
Check at position pos for a power-less conducting tile in the direction testDir.
pos | Position to start from. |
testDir | Direction to investigate. |
Definition at line 104 of file power.cpp.
References CONDBIT, map, Position::move(), Position::posX, Position::posY, powerGridMap, and Map< DATA, BLKSIZE >::worldGet().
Referenced by doPowerScan().
Quad Micropolis::tickCount | ( | ) |
Get number of ticks.
time.tv_usec
should be divided to get seconds or time.tc_sec
should be multiplied. Definition at line 1090 of file micropolis.cpp.
Referenced by simUpdate().
void Micropolis::toolDown | ( | EditingTool | tool, |
short | tileX, | ||
short | tileY | ||
) |
Definition at line 1509 of file tool.cpp.
References doTool(), invalidateMaps(), makeSound(), MESSAGE_BULLDOZE_AREA_FIRST, MESSAGE_NOT_ENOUGH_FUNDS, NOWHERE, sendMessage(), simPass, TOOLRESULT_NEED_BULLDOZE, and TOOLRESULT_NO_MONEY.
void Micropolis::toolDrag | ( | EditingTool | tool, |
short | fromX, | ||
short | fromY, | ||
short | toX, | ||
short | toY | ||
) |
Drag a tool from (fromX, fromY) to (toX, toY).
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 1538 of file tool.cpp.
References absoluteValue(), doTool(), gToolSize, invalidateMaps(), min(), and simPass.
void Micropolis::treeSplash | ( | short | xloc, |
short | yloc | ||
) |
Splash a bunch of trees down near (xloc, yloc).
Amount of trees is controlled by Micropolis::terrainTreeLevel.
xloc | Horizontal position of starting point for splashing trees. |
yloc | Vertical position of starting point for splashing trees. |
Definition at line 310 of file generate.cpp.
References DIR2_NORTH, DIRT, getRandom(), LOMASK, map, Position::move(), Position::posX, Position::posY, terrainTreeLevel, and Position::testBounds().
Referenced by doTrees().
Try to drive to a destination.
startPos | Starting position. |
destZone | Zonetype to drive to. |
Definition at line 309 of file traffic.cpp.
References curMapStackPointer, DIR2_INVALID, driveDone(), MAX_TRAFFIC_DISTANCE, Position::move(), pushPos(), rotate180(), and tryGo().
Referenced by makeTraffic(), and makeTrafficAt().
|
private |
Try to drive one tile in a random direction.
pos | Current position. |
dirLast | Forbidden direction for movement (to prevent reversing). |
DIR2_INVALID
is returned if not moved. Definition at line 356 of file traffic.cpp.
References DIR2_INVALID, DIR2_NORTH, DIRT, getRandom16(), getTileFromMap(), roadTest(), and rotate90().
Referenced by tryDrive().
bool Micropolis::tryOther | ( | int | Tpoo, |
int | Told, | ||
int | Tnew | ||
) |
???
Figure out what this function is doing.
Remove local magic constants and document the code.
Definition at line 431 of file sprite.cpp.
short Micropolis::turnTo | ( | int | p, |
int | d | ||
) |
Turn.
p | Present direction (1..8). |
d | Destination direction (1..8). |
Definition at line 396 of file sprite.cpp.
Referenced by doAirplaneSprite(), and doCopterSprite().
void Micropolis::updateBudget | ( | ) |
The scripting language should pull these raw values out and format them, instead of the callback pushing them out.
Definition at line 327 of file budget.cpp.
References callback, and mustDrawBudget.
Referenced by simUpdate().
void Micropolis::updateDate | ( | ) |
Definition at line 159 of file update.cpp.
References callback, cityMonth, cityTime, cityYear, MESSAGE_NOT_ENOUGH_POWER, NOWHERE, sendMessage(), and startingYear.
void Micropolis::updateFundEffects | ( | ) |
Update effects of (possibly reduced) funding
It updates effects with respect to roads, police, and fire.
Definition at line 908 of file simulate.cpp.
References fireEffect, fireFund, fireSpend, MAX_FIRE_STATION_EFFECT, MAX_POLICE_STATION_EFFECT, MAX_ROAD_EFFECT, mustDrawBudget, policeEffect, policeFund, policeSpend, roadEffect, roadFund, and roadSpend.
void Micropolis::updateFunds | ( | ) |
Set a flag that the funds display is out of date.
Definition at line 127 of file update.cpp.
Referenced by generateSomeCity(), loadScenario(), ToolEffects::modifyWorld(), and setFunds().
void Micropolis::updateGameLevel | ( | ) |
Report to the front-end that a new game level has been set.
Definition at line 244 of file utilities.cpp.
References callback, and gameLevel.
Referenced by setGameLevel().
void Micropolis::updateUserInterface | ( | ) |
Definition at line 261 of file update.cpp.
|
private |
Vote on the problems of the city.
problemTable | Storage of how bad each problem is. |
Definition at line 288 of file evaluate.cpp.
|
private |
Is tile vulnerable for an earthquake?
tem | Tile data |
true
if tile is vulnerable, and false
if not Definition at line 330 of file disasters.cpp.
References LASTZONE, LOMASK, and ZONEBIT.
Referenced by makeEarthquake().
|
private |
Build a wire at a tile.
x | Horizontal position of the tile to wire. |
y | Vertical position of the tile to wire. |
effects | Storage of effects of wiring the tile. |
Definition at line 1172 of file tool.cpp.
References ToolEffects::addFrontendMessage(), CONNECT_TILE_WIRE, connectTile(), testBounds(), TOOLRESULT_FAILED, and TOOLRESULT_OK.
|
private |
Put down a 3x3 zone around the center tile at pos..
base | Tile number of the top-left tile. |
Definition at line 364 of file zone.cpp.
References LOMASK, map, Position::posX, Position::posY, and testBounds().
Referenced by doComOut(), doIndOut(), indPlop(), and makeHospital().
short Micropolis::airportPop |
Airport population.
Definition at line 1055 of file micropolis.h.
Referenced by getAssessedValue(), init(), and sendMessages().
bool Micropolis::autoBudget |
Enable auto budget
When enabled, the program will perform budgetting of the city
Definition at line 2330 of file micropolis.h.
Referenced by doBudgetNow(), saveFile(), and setAutoBudget().
bool Micropolis::autoBulldoze |
Enable auto-bulldoze
When enabled, the game will silently clear tiles when the user builds something on non-clear and bulldozable tiles
Definition at line 2323 of file micropolis.h.
Referenced by connectTile(), prepareBuildingSite(), saveFile(), and setAutoBulldoze().
bool Micropolis::autoGoto |
Enable auto goto
When enabled and an important event happens, the map display will jump to the location of the event
Definition at line 1960 of file micropolis.h.
Referenced by saveFile(), and setAutoGoto().
short Micropolis::blinkFlag |
Definition at line 2355 of file micropolis.h.
Referenced by simInit(), and simUpdate().
Callback* Micropolis::callback |
Callback interface.
Definition at line 954 of file micropolis.h.
Referenced by didLoadCity(), didLoadScenario(), didntLoadCity(), didntSaveCity(), didSaveCity(), didTool(), doAutoGoto(), doEarthquake(), doLoseGame(), doNewGame(), doSaveCityAs(), doScoreCard(), doShowZoneStatus(), doStartGame(), doStartScenario(), doWinGame(), generateSomeCity(), graphDoer(), invalidateMaps(), makeSound(), pause(), resume(), sendMessage(), setCleanCityName(), updateBudget(), updateDate(), and updateGameLevel().
void* Micropolis::callbackData |
Hook for scripting language to store scripted callback function. (i.e. a callable Python object.)
Definition at line 2363 of file micropolis.h.
short Micropolis::categoryLast |
City class of last city class check.
Definition at line 1952 of file micropolis.h.
Referenced by checkGrowth().
bool Micropolis::censusChanged |
Census changed flag.
Need to redraw census dependent stuff.
Definition at line 1157 of file micropolis.h.
Referenced by changeCensus(), doSimInit(), graphDoer(), and init().
Quad Micropolis::cityAssessedValue |
City assessed value.
Depends on roadTotal, railTotal, policeStationPop, fireStationPop, hospitalPop, stadiumPop, seaportPop, airportPop, coalPowerPop, and nuclearPowerPop, and their respective values.
Definition at line 1591 of file micropolis.h.
Referenced by evalInit(), and getAssessedValue().
Quad Micropolis::cityMonth |
City month, 4 time units per month.
Definition at line 1098 of file micropolis.h.
Referenced by init(), and updateDate().
std::string Micropolis::cityName |
Name of the city.
Name of the city.
Definition at line 1909 of file micropolis.h.
Referenced by saveCityAs(), and setCleanCityName().
Quad Micropolis::cityPop |
City population.
Depends of ResPop, ComPop and IndPop.
Definition at line 1574 of file micropolis.h.
Referenced by doPopNum(), evalInit(), and initWillStuff().
Quad Micropolis::cityPopDelta |
Change in the city population.
Depends on last cityPop.
Definition at line 1581 of file micropolis.h.
Referenced by doPopNum(), and evalInit().
Quad Micropolis::cityPopLast |
Population of last city class check.
Definition at line 1951 of file micropolis.h.
Referenced by checkGrowth().
short Micropolis::cityScore |
City score.
Affected by average of problems, residential cap, commercial cap, industrial cap, road effect, police effect, fire effect, residential valve, commercial valve, industrial valve, city population, delta city population, fires, tax rate, and unpowered zones.
Definition at line 1604 of file micropolis.h.
Referenced by doScenarioScore(), doVotes(), evalInit(), initWillStuff(), setValves(), and simLoadInit().
short Micropolis::cityScoreDelta |
Change in the city score.
Depends on city score.
Definition at line 1611 of file micropolis.h.
Referenced by evalInit().
short Micropolis::cityTax |
City tax rate.
Definition at line 1224 of file micropolis.h.
Referenced by collectTax(), init(), loadFile(), saveFile(), sendMessages(), and setValves().
Quad Micropolis::cityTime |
City time unit counter, increnented once every 16 runs through the simulator (at fast speed). A time unit is 7.6 days. 4 units per month, 48 units per year, relative to startingYear
Four units per month, so one unit is about a week (7.6 days).
Definition at line 1092 of file micropolis.h.
Referenced by checkGrowth(), currentYear(), doSpecialZone(), generateSomeCity(), init(), loadFile(), loadScenario(), saveFile(), sendMessages(), simInit(), simLoadInit(), and updateDate().
Quad Micropolis::cityYear |
City year, (Micropolis::cityTime / 48) + Micropolis::startingYear.
Definition at line 1104 of file micropolis.h.
Referenced by init(), and updateDate().
short Micropolis::cityYes |
Yes votes.
Percentage of people who think the mayor is doing a good job.
Definition at line 1551 of file micropolis.h.
Referenced by doVotes(), evalInit(), and init().
short Micropolis::coalPowerPop |
Coal power plant population.
Definition at line 1040 of file micropolis.h.
Referenced by doPowerScan(), doSpecialZone(), getAssessedValue(), init(), and sendMessages().
short* Micropolis::comHist |
Commercial population history.
Definition at line 1346 of file micropolis.h.
Referenced by destroyMapArrays(), getHistory(), getHistoryRange(), init(), initGraphMax(), initMapArrays(), loadFileData(), saveFile(), setHistory(), setValves(), and take10Census().
short Micropolis::comHist10Max |
10 year commercial history maximum value.
Definition at line 1135 of file micropolis.h.
Referenced by init(), initGraphMax(), and take10Census().
short Micropolis::comHist120Max |
120 year commercial history maximum value.
Definition at line 1140 of file micropolis.h.
Referenced by init(), and initGraphMax().
short Micropolis::comPop |
Commercial zone population.
Depends on level of zone development.
Definition at line 989 of file micropolis.h.
Referenced by doCommercial(), getPopulation(), getUnemployment(), init(), sendMessages(), setValves(), simLoadInit(), and take10Census().
MapShort8 Micropolis::comRateMap |
Commercial rate map.
Depends on distance to city center. Affects commercial zone evaluation.
Definition at line 1330 of file micropolis.h.
Referenced by computeComRateMap(), evalCom(), init(), and initWillStuff().
short Micropolis::crimeAverage |
Average crime.
Affected by land value, population density, police station distance.
Definition at line 1063 of file micropolis.h.
Referenced by crimeScan(), doScenarioScore(), init(), sendMessages(), setValves(), simLoadInit(), and take10Census().
short* Micropolis::crimeHist |
Crime history.
Definition at line 1366 of file micropolis.h.
Referenced by destroyMapArrays(), getHistory(), getHistoryRange(), init(), initMapArrays(), loadFileData(), saveFile(), setHistory(), and take10Census().
|
private |
Position stack top pointer, points to top position.
Definition at line 2602 of file micropolis.h.
Referenced by addToTrafficDensityMap(), makeTraffic(), pullPos(), pushPos(), and tryDrive().
bool Micropolis::doAnimation |
Enable animation.
true
. Should connect it to a frontend option. Definition at line 1887 of file micropolis.h.
Referenced by putRubble(), and setDoAnimation().
bool Micropolis::doMessages |
Definition at line 1889 of file micropolis.h.
Referenced by setDoMessages().
|
private |
Integer with bits 0..2 that control smoothing.
Definition at line 2056 of file micropolis.h.
bool Micropolis::doNotices |
Definition at line 1891 of file micropolis.h.
Referenced by setDoNotices().
Quad Micropolis::fireEffect |
Ratio of fire spending over fire funding, times #MAX_FIRE_EFFECT.
Definition at line 1211 of file micropolis.h.
Referenced by collectTax(), doSpecialZone(), init(), initWillStuff(), sendMessages(), simLoadInit(), and updateFundEffects().
Quad Micropolis::fireFund |
Requested funds for fire stations.
Depends on fire station population.
Definition at line 1196 of file micropolis.h.
Referenced by collectTax(), doBudgetNow(), init(), initWillStuff(), and updateFundEffects().
float Micropolis::firePercent |
Percentage of requested fire station costs to funding level.
Value between 0
and ::MAX_FIRESTATION_EFFECT. Affected by road funds slider and budgetary constraints.
Definition at line 1443 of file micropolis.h.
Referenced by doBudgetNow(), init(), loadFile(), and saveFile().
short Micropolis::firePop |
Number of fires.
Definition at line 975 of file micropolis.h.
Referenced by getFireSeverity(), and init().
Quad Micropolis::fireSpend |
Spending on fire stations.
Definition at line 1175 of file micropolis.h.
Referenced by doBudgetNow(), init(), and updateFundEffects().
MapShort8 Micropolis::fireStationEffectMap |
Copy of fire station map to display.
Definition at line 1306 of file micropolis.h.
Referenced by doFire(), fireAnalysis(), getFireCoverage(), getFireCoverageMapBuffer(), init(), initWillStuff(), and setFireCoverage().
MapShort8 Micropolis::fireStationMap |
Fire station map.
Effectivity of fire control in this area.
Affected by fire stations, powered, fire funding ratio, road access. Affects how long fires burn.
Definition at line 1301 of file micropolis.h.
Referenced by doSpecialZone(), fireAnalysis(), init(), and initWillStuff().
short Micropolis::fireStationPop |
Fire station population.
Definition at line 1035 of file micropolis.h.
Referenced by collectTax(), doSpecialZone(), getAssessedValue(), init(), and sendMessages().
Quad Micropolis::fireValue |
Amount of fire station funding granted.
Definition at line 1458 of file micropolis.h.
Referenced by doBudgetNow(), and init().
short Micropolis::floodCount |
Size of flooding disaster.
Definition at line 1512 of file micropolis.h.
Referenced by doDisasters(), doFlood(), and init().
int Micropolis::generatedCitySeed |
The seed of the most recently generated city.
Definition at line 1741 of file micropolis.h.
Referenced by generateMap().
short Micropolis::graph10Max |
Definition at line 1807 of file micropolis.h.
Referenced by initGraphMax(), and take10Census().
short Micropolis::graph120Max |
Definition at line 1812 of file micropolis.h.
Referenced by initGraphMax().
int Micropolis::heatFlow |
int Micropolis::heatRule |
int Micropolis::heatSteps |
Heat steps.
Definition at line 1914 of file micropolis.h.
Referenced by initGame(), and simUpdate().
int Micropolis::heatWrap |
bool Micropolis::historyInitialized |
Definition at line 1802 of file micropolis.h.
Referenced by initGraphs().
short* Micropolis::indHist |
Industrial population history.
Definition at line 1351 of file micropolis.h.
Referenced by destroyMapArrays(), getHistory(), getHistoryRange(), init(), initGraphMax(), initMapArrays(), loadFileData(), saveFile(), setHistory(), setValves(), and take10Census().
short Micropolis::indHist10Max |
10 year industrial history maximum value.
Definition at line 1145 of file micropolis.h.
Referenced by init(), initGraphMax(), and take10Census().
short Micropolis::indHist120Max |
120 year industrial history maximum value.
Definition at line 1150 of file micropolis.h.
Referenced by init(), and initGraphMax().
short Micropolis::indPop |
Industrial zone population.
Depends on level of zone development.
Definition at line 996 of file micropolis.h.
Referenced by doIndustrial(), getPopulation(), getUnemployment(), init(), sendMessages(), setValves(), simLoadInit(), and take10Census().
short Micropolis::landValueAverage |
Land value average.
Affected by distance from city center, development density (terrainMem), pollution, and crime.
Definition at line 1080 of file micropolis.h.
Referenced by collectTax(), init(), setValves(), and simLoadInit().
unsigned short* Micropolis::map[WORLD_W] |
Two-dimensional array of map tiles.
Map[0 <= x < 120][0 <= y < 100]
Definition at line 1120 of file micropolis.h.
Referenced by addToTrafficDensityMap(), buildHouse(), canDriveOn(), clearMap(), clearUnnatural(), coalSmoke(), destroyMapArrays(), destroyMapTile(), doCommercial(), doFire(), doFlood(), doFreePop(), doHospitalChurch(), doIndustrial(), doMeltdown(), doNilPower(), doRadTile(), doRail(), doResidential(), doResIn(), doResOut(), doSpecialZone(), doZone(), doZoneStatus(), drawStadium(), evalLot(), findPerimeterRoad(), findPerimeterTelecom(), generateShip(), getChar(), ToolEffects::getMapValue(), getTile(), getTileFromMap(), init(), initMapArrays(), loadFileData(), makeEarthquake(), makeFire(), makeFlood(), makeMeltdown(), makeMonster(), makeNakedIsland(), ToolEffects::modifyWorld(), populationDensityScan(), putOnMap(), repairZone(), saveFile(), setFire(), setTile(), setZonePower(), simHeat(), startFire(), testForConductive(), treeSplash(), and zonePlop().
|
private |
Memory for map array.
Definition at line 1396 of file micropolis.h.
Referenced by destroyMapArrays(), getMapBuffer(), init(), and initMapArrays().
short* Micropolis::miscHist |
Memory used to save miscelaneous game values in save file.
Definition at line 1371 of file micropolis.h.
Referenced by destroyMapArrays(), init(), initMapArrays(), loadFile(), loadFileData(), saveFile(), setValves(), and simLoadInit().
short* Micropolis::moneyHist |
Money history.
Definition at line 1356 of file micropolis.h.
Referenced by destroyMapArrays(), getHistory(), getHistoryRange(), init(), initMapArrays(), loadFileData(), saveFile(), setHistory(), and take10Census().
int Micropolis::mustDrawBudget |
Flag set when budget window needs to be updated.
Definition at line 1463 of file micropolis.h.
Referenced by init(), updateBudget(), and updateFundEffects().
|
private |
Need church?
0 if no, 1 if yes, -1 if too many.
Definition at line 1390 of file micropolis.h.
Referenced by init(), and take10Census().
|
private |
Need hospital?
0 if no, 1 if yes, -1 if too many.
Definition at line 1383 of file micropolis.h.
Referenced by init(), makeHospital(), and take10Census().
|
private |
Definition at line 2039 of file micropolis.h.
Referenced by doSimInit().
|
private |
Definition at line 2042 of file micropolis.h.
Referenced by crimeScan(), fireAnalysis(), and populationDensityScan().
short Micropolis::nuclearPowerPop |
Nuclear power plant population.
Definition at line 1045 of file micropolis.h.
Referenced by doPowerScan(), doSpecialZone(), getAssessedValue(), init(), and sendMessages().
Quad Micropolis::policeEffect |
Ratio of police spending over police funding, times #MAX_POLICE_EFFECT.
Definition at line 1206 of file micropolis.h.
Referenced by collectTax(), init(), initWillStuff(), sendMessages(), simLoadInit(), and updateFundEffects().
Quad Micropolis::policeFund |
Requested funds for police stations.
Depends on police station population.
Definition at line 1189 of file micropolis.h.
Referenced by collectTax(), doBudgetNow(), init(), initWillStuff(), and updateFundEffects().
float Micropolis::policePercent |
Percentage of requested police station costs to funding level.
Value between 0
and ::MAX_POLICESTATION_EFFECT. Affected by road funds slider and budgetary constraints.
Definition at line 1435 of file micropolis.h.
Referenced by doBudgetNow(), init(), loadFile(), and saveFile().
Quad Micropolis::policeSpend |
Spending on police stations.
Definition at line 1170 of file micropolis.h.
Referenced by doBudgetNow(), init(), and updateFundEffects().
MapShort8 Micropolis::policeStationEffectMap |
Copy of police station map to display.
Definition at line 1322 of file micropolis.h.
Referenced by crimeScan(), getPoliceCoverage(), getPoliceCoverageMapBuffer(), init(), initWillStuff(), and setPoliceCoverage().
MapShort8 Micropolis::policeStationMap |
Police station map.
Effectivity of police in fighting crime.
Affected by police stations, powered, police funding ratio, road access. Affects crime rate.
Definition at line 1317 of file micropolis.h.
Referenced by crimeScan(), init(), and initWillStuff().
short Micropolis::policeStationPop |
Police station population.
Definition at line 1030 of file micropolis.h.
Referenced by collectTax(), getAssessedValue(), init(), and sendMessages().
Quad Micropolis::policeValue |
Amount of police funding granted.
Definition at line 1453 of file micropolis.h.
Referenced by doBudgetNow(), and init().
short Micropolis::pollutionAverage |
Average pollution.
Affected by PollutionMem, which is effected by traffic, fire, radioactivity, industrial zones, seaports, airports, power plants.
Definition at line 1072 of file micropolis.h.
Referenced by doDisasters(), init(), sendMessages(), setValves(), simLoadInit(), and take10Census().
short* Micropolis::pollutionHist |
Pollution history.
Definition at line 1361 of file micropolis.h.
Referenced by destroyMapArrays(), getHistory(), getHistoryRange(), init(), initMapArrays(), loadFileData(), saveFile(), setHistory(), and take10Census().
MapByte1 Micropolis::powerGridMap |
Power grid map.
Definition at line 1281 of file micropolis.h.
Referenced by doPowerScan(), getPowerGrid(), getPowerGridMapBuffer(), init(), setPowerGrid(), setZonePower(), simLoadInit(), and testForConductive().
|
private |
Stack of X/Y positions for traversing setting the power grid.
Definition at line 1996 of file micropolis.h.
Referenced by pullPowerStack(), and pushPowerStack().
short Micropolis::problemOrder[CVP_PROBLEM_COMPLAINTS] |
Order of taken problems.
Contains index of MicropolisEngine::problemVotes of taken problems, in decreasing order.
Definition at line 1567 of file micropolis.h.
Referenced by countProblems(), getProblemNumber(), and getProblemVotes().
short Micropolis::problemVotes[PROBNUM] |
Problem votes.
The number of votes for each problem.
Definition at line 1559 of file micropolis.h.
Referenced by getProblemVotes(), and init().
short Micropolis::railTotal |
Total number of rails.
No penalty for bridges or high traffic density.
Definition at line 970 of file micropolis.h.
Referenced by collectTax(), doRail(), getAssessedValue(), init(), and sendMessages().
MapShort8 Micropolis::rateOfGrowthMap |
Rate of growth map.
Affected by DecROGMem, incROG called by zones. Decreased by fire explosions from sprites, fire spreading. Doesn't seem to actually feed back into the simulation. Output only.
Definition at line 1290 of file micropolis.h.
Referenced by decRateOfGrowthMap(), fireZone(), getDensity(), getRateOfGrowth(), getRateOfGrowthMapBuffer(), incRateOfGrowth(), init(), initWillStuff(), setRateOfGrowth(), and startFireInZone().
short* Micropolis::resHist |
Residential population history.
Definition at line 1341 of file micropolis.h.
Referenced by destroyMapArrays(), getHistory(), getHistoryRange(), init(), initGraphMax(), initMapArrays(), loadFileData(), saveFile(), setHistory(), setValves(), and take10Census().
short Micropolis::resHist10Max |
10 year residential history maximum value.
Definition at line 1125 of file micropolis.h.
Referenced by init(), initGraphMax(), and take10Census().
short Micropolis::resHist120Max |
120 year residential history maximum value.
Definition at line 1130 of file micropolis.h.
Referenced by init(), and initGraphMax().
short Micropolis::resPop |
Number of people in the residential zones.
Depends on level of zone development.
Definition at line 982 of file micropolis.h.
Referenced by getPopulation(), getUnemployment(), init(), sendMessages(), setValves(), simLoadInit(), and take10Census().
Quad Micropolis::roadEffect |
Ratio of road spending over road funding, times MAX_ROAD_EFFECT.
Definition at line 1201 of file micropolis.h.
Referenced by collectTax(), doRail(), init(), initWillStuff(), sendMessages(), simLoadInit(), and updateFundEffects().
Quad Micropolis::roadFund |
Requested funds for roads.
Depends on number of roads, rails, and game level.
Definition at line 1182 of file micropolis.h.
Referenced by collectTax(), doBudgetNow(), init(), initWillStuff(), and updateFundEffects().
float Micropolis::roadPercent |
Percentage of requested road and rail costs to funding level.
Value between 0
and MAX_ROAD_EFFECT. Affected by road funds slider and budgetary constraints.
Definition at line 1427 of file micropolis.h.
Referenced by doBudgetNow(), init(), loadFile(), and saveFile().
Quad Micropolis::roadSpend |
Spending on roads.
Definition at line 1165 of file micropolis.h.
Referenced by doBudgetNow(), init(), and updateFundEffects().
short Micropolis::roadTotal |
Number of road tiles in the game.
Bridges count as 4 tiles, and high density traffic counts as 2 tiles.
Definition at line 963 of file micropolis.h.
Referenced by collectTax(), getAssessedValue(), init(), and sendMessages().
Quad Micropolis::roadValue |
Amount of road funding granted.
Definition at line 1448 of file micropolis.h.
Referenced by doBudgetNow(), and init().
short Micropolis::seaportPop |
Seaport population.
Definition at line 1050 of file micropolis.h.
Referenced by getAssessedValue(), init(), and sendMessages().
int Micropolis::simPass |
The count of the current pass through the simulator loop.
Definition at line 1871 of file micropolis.h.
Referenced by initGame(), simInit(), simTick(), toolDown(), and toolDrag().
int Micropolis::simPasses |
The number of passes through the simulator loop to take each tick.
Definition at line 1866 of file micropolis.h.
Referenced by initGame(), simInit(), and simTick().
bool Micropolis::simPaused |
Simulation is paused
Definition at line 1877 of file micropolis.h.
Referenced by initGame(), pause(), resume(), and simInit().
short Micropolis::startingYear |
City starting year.
Definition at line 1109 of file micropolis.h.
Referenced by currentYear(), init(), simInit(), and updateDate().
bool Micropolis::taxFlag |
Tax port flag.
Apparently never used. CollectTax checks it.
Apparently taxFlag is never set to true in MicropolisEngine or the TCL code.
Don should check old Mac code to see if it's ever set.
Variable is always 0
. Decide whether to keep it, and if yes, create means to modify its value
Definition at line 1237 of file micropolis.h.
Referenced by collectTax(), init(), and initWillStuff().
Quad Micropolis::taxFund |
Funds from taxes.
Depends on total population, average land value, city tax, and game level.
Definition at line 1219 of file micropolis.h.
Referenced by collectTax(), doBudgetNow(), and init().
MapByte2 Micropolis::tempMap1 |
Temporary map 1.
Used to smooth population density, pollution.
Definition at line 1262 of file micropolis.h.
Referenced by destroyMapArrays(), and populationDensityScan().
MapByte2 Micropolis::tempMap2 |
Temporary map 2.
Used to smooth population density, pollution.
Definition at line 1269 of file micropolis.h.
Referenced by destroyMapArrays(), and populationDensityScan().
MapByte4 Micropolis::tempMap3 |
Temporary map 3.
Used to smooth development density, for terrainDensityMap.
Definition at line 1276 of file micropolis.h.
Referenced by destroyMapArrays().
int Micropolis::terrainCreateIsland |
Controls how often to create an island. -1 => 10% chance of island, 0 => never create island, 1 => always create island
Definition at line 1735 of file micropolis.h.
Referenced by generateMap().
int Micropolis::terrainCurveLevel |
Controls the level of river curviness. -1 => default curve level, 0 => never create rivers, >0 => create curvier rivers
Definition at line 1729 of file micropolis.h.
Referenced by doBRiver(), doSRiver(), and generateMap().
MapByte4 Micropolis::terrainDensityMap |
Terrain development density map.
Used to calculate land value.
Definition at line 1255 of file micropolis.h.
Referenced by destroyMapArrays(), init(), and initWillStuff().
int Micropolis::terrainLakeLevel |
Controls the level of lake creation. -1 => create default number of lakes, 0 => never create lakes, >0 => create more lakes
Definition at line 1723 of file micropolis.h.
Referenced by generateMap(), and makeLakes().
int Micropolis::terrainTreeLevel |
Controls the level of tree creation. -1 => create default number of trees, 0 => never create trees, >0 => create more trees
Definition at line 1717 of file micropolis.h.
Referenced by doTrees(), generateMap(), and treeSplash().
bool Micropolis::tilesAnimated |
Definition at line 1881 of file micropolis.h.
Referenced by simUpdate().
short Micropolis::totalPop |
Total population.
Includes residential pop / 8 plus industrial pop plus commercial pop.
Definition at line 1004 of file micropolis.h.
Referenced by cityEvaluation(), collectTax(), doSimInit(), generateTrain(), init(), sendMessages(), and setValves().
short Micropolis::totalPopLast |
Last total population.
Not used?
Definition at line 1011 of file micropolis.h.
Referenced by init(), and setValves().
short Micropolis::totalZonePop |
Total zone population.
Definition at line 1020 of file micropolis.h.
Referenced by init(), and sendMessages().
short Micropolis::trafficAverage |
Average traffic.
Depends on average traffic density of tiles with non-zero land value.
Definition at line 1618 of file micropolis.h.
Referenced by doScenarioScore(), getTrafficAverage(), and sendMessages().
void* Micropolis::userData |
Hook for scripting language to store context (i.e. peer object). (i.e. Python SWIG wrapper of this Micropolis object.)
Definition at line 2369 of file micropolis.h.