/// <summary> /// Free / Clear all Map Arrays /// </summary> private void destoryMapArrays() { InitMapArrays(); for (int x = 0; x < Constants.WorldWidth; ++x) { for (int y = 0; y < Constants.WorldHeight; ++y) { Map[x, y] = (ushort)MapTileCharacters.DIRT; } } PopulationDensityMap.Clear(); TrafficDensityMap.Clear(); PollutionDensityMap.Clear(); LandValueMap.Clear(); CrimeRateMap.Clear(); TerrainDensityMap.Clear(); RateOfGrowthMap.Clear(); PowerGridMap.Clear(); FireStationMap.Clear(); FireStationEffectMap.Clear(); PoliceStationMap.Clear(); PoliceStationEffectMap.Clear(); ComRateMap.Clear(); TempMap1.Clear(); TempMap2.Clear(); TempMap3.Clear(); }
/// <summary> /// Reset many game state variables /// </summary> public void InitWillStuff() { RandomlySeedRandom(); InitGraphMax(); DestroyAllSprites(); RoadEffect = Constants.MaxRoadEffect; PoliceEffect = Constants.MaxPoliceStationEffect; FireEffect = Constants.MaxFireStationEffect; CityScore = 500; CityPopulation = -1; CityTimeLast = -1; CityYearLast = -1; CityMonthLast = -1; TotalFundsLast = -1; ResLast = ComLast = IndLast = -999999; RoadFund = 0; PoliceFund = 0; FireFund = 0; ValveFlag = true; DisasterEvent = Scenario.None; TaxFlag = false; PopulationDensityMap.Clear(); TrafficDensityMap.Clear(); PollutionDensityMap.Clear(); LandValueMap.Clear(); CrimeRateMap.Clear(); TerrainDensityMap.Clear(); RateOfGrowthMap.Clear(); ComRateMap.Clear(); PoliceStationMap.Clear(); PoliceStationEffectMap.Clear(); FireStationMap.Clear(); FireStationEffectMap.Clear(); DoNewGame(); DoUpdateHeads(); }
/// <summary> /// Initialize simulator variables to a sane default. /// </summary> private void init() { // short roadTotal; RoadTotal = 0; // short railTotal; RailTotal = 0; // short firePop; FirePop = 0; // short resPop; ResPop = 0; // short comPop; ComPop = 0; // short indPop; IndPop = 0; // short totalPop; TotalPop = 0; // short totalPopLast; TotalPopLast = 0; // short resZonePop; ResZonePop = 0; // short comZonePop; ComZonePop = 0; // short indZonePop; IndZonePop = 0; // short totalZonePop; TotalZonePop = 0; // short hospitalPop; HospitalPop = 0; // short churchPop; ChurchPop = 0; // short faith; Faith = 0; // short stadiumPop; StadiumPop = 0; // short policeStationPop; PoliceStationPop = 0; // short fireStationPop; FireStationPop = 0; // short coalPowerPop; CoalPowerPop = 0; // short nuclearPowerPop; NuclearPowerPop = 0; // short seaportPop; SeaportPop = 0; // short airportPop; AirportPop = 0; // short needHospital; NeedHospital = 0; // short needChurch; NeedChurch = 0; // short crimeAverage; CrimeAverage = 0; // short pollutionAverage; PollutionAverage = 0; // short landValueAverage; LandValueAverage = 0; // Quad cityTime; CityTime = 0; // Quad cityMonth; CityMonth = 0; // Quad cityYear; CityYear = 0; // short startingYear; StartingYear = 0; Map = new ushort[Constants.WorldWidth, Constants.WorldHeight]; // short resHist10Max; ResHist10Max = 0; // short resHist120Max; ResHist120Max = 0; // short comHist10Max; ComHist10Max = 0; // short comHist120Max; ComHist120Max = 0; // short indHist10Max; IndHist10Max = 0; // short indHist120Max; IndHist120Max = 0; CensusChanged = false; // Quad roadSpend; RoadSpend = 0; // Quad policeSpend; PoliceSpend = 0; // Quad fireSpend; FireSpend = 0; // Quad roadFund; RoadFund = 0; // Quad policeFund; PoliceFund = 0; // Quad fireFund; FireFund = 0; RoadEffect = 0; PoliceEffect = 0; FireEffect = 0; // Quad taxFund; TaxFund = 0; // short cityTax; CityTax = 0; // bool taxFlag; TaxFlag = false; PopulationDensityMap.Clear(); TrafficDensityMap.Clear(); PollutionDensityMap.Clear(); LandValueMap.Clear(); CrimeRateMap.Clear(); PowerGridMap.Clear(); TerrainDensityMap.Clear(); RateOfGrowthMap.Clear(); FireStationMap.Clear(); FireStationEffectMap.Clear(); PoliceStationMap.Clear(); PoliceStationEffectMap.Clear(); ComRateMap.Clear(); // short *resHist; ResHist = new short[Constants.HistoryLength]; // short *comHist; ComHist = new short[Constants.HistoryLength]; // short *indHist; IndHist = new short[Constants.HistoryLength]; // short *moneyHist; MoneyHist = new short[Constants.HistoryLength]; // short *pollutionHist; PollutionHist = new short[Constants.HistoryLength]; // short *crimeHist; CrimeHist = new short[Constants.HistoryLength]; // short *miscHist; MiscHist = new short[Constants.HistoryLength]; // float roadPercent; RoadPercentage = (float)0.0; // float policePercent; PolicePercentage = (float)0.0; // float firePercent; FirePercentage = (float)0.0; // Quad roadValue; RoadValue = 0; // Quad policeValue; PoliceValue = 0; // Quad fireValue; FireValue = 0; // int mustDrawBudget; MustDrawBudget = 0; // short floodCount; FloodCount = 0; // short cityYes; CityYes = 0; // short problemVotes[PROBNUM]; /* these are the votes for each */ ProblemVotes = new int[(int)CityVotingProblems.NumberOfProblems]; ProblemOrder = new int[(int)CityVotingProblems.CountOfProblemsToComplainAbout]; // Quad cityPop; CityPopulation = 0; // Quad cityPopDelta; CityPopDelta = 0; // Quad cityAssessedValue; CityAssessedValue = 0; CityClassification = CityClassification.Village; // short cityScore; CityScore = 0; // short cityScoreDelta; CityScoreDelta = 0; // short trafficAverage; TrafficAverage = 0; // int TreeLevel; /* level for tree creation */ TerrainTreeLevel = -1; // int LakeLevel; /* level for lake creation */ TerrainLakeLevel = -1; // int CurveLevel; /* level for river curviness */ TerrainCurveLevel = -1; // int CreateIsland; /* -1 => 10%, 0 => never, 1 => always */ TerrainCreateIsland = -1; Graph10Max = 0; Graph120Max = 0; // int simLoops; SimLoops = 0; // int simPasses; SimPasses = 0; // int simPass; SimPass = 0; SimPaused = false; // Simulation is running // int simPausedSpeed; SimPausedSpeed = 3; // int heatSteps; HeatSteps = 0; // int heatFlow; HeatFlow = -7; // std::string cityFileName; CityFileName = ""; // std::string cityName; CityName = ""; // bool tilesAnimated; TilesAnimated = false; // bool doAnimaton; DoAnimation = true; // bool doMessages; DoMessages = true; // bool doNotices; DoNotices = true; // Quad cityPopLast; CityPopulationLast = 0; // short categoryLast; CategoryLast = 0; AutoGoTo = false; powerStackPointer = 0; // Position powerStackXY[POWER_STACK_SIZE]; for (int i = 0; i < Constants.PowerStackSize; i++) { powerStackXY[i] = new Position(); } // UQuad nextRandom; nextRandom = 1; // char *HomeDir; homeDir = ""; // char *ResourceDir; resourceDir = ""; // Resource *resources; Resources = null; // StringTable *stringTables; StringTables = null; //////////////////////////////////////////////////////////////////////// // scan.cpp // short newMap; NewMap = 0; // short newMapFlags[MAP_TYPE_COUNT]; NewMapFlags = new short[(int)MapType.Count]; // short cityCenterX; CityCenterX = 0; // short cityCenterY; CityCenterY = 0; // short pollutionMaxX; PollutionMaxX = 0; // short pollutionMaxY; PollutionMaxY = 0; // short crimeMaxX; CrimeMaxX = 0; // short crimeMaxY; CrimeMaxY = 0; // Quad donDither; DonDither = 0; ValveFlag = false; // short crimeRamp; CrimeRamp = 0; // short pollutionRamp; PollutionRamp = 0; ResCap = false; // Do not block residential growth ComCap = false; // Do not block commercial growth IndCap = false; // Do not block industrial growth // short cashFlow; CashFlow = 0; // float externalMarket; ExternalMarket = (float)4.0; DisasterEvent = Scenario.None; // short disasterWait; DisasterWait = 0; ScoreType = Scenario.None; // short scoreWait; scoreWait = 0; // short poweredZoneCount; PoweredZoneCount = 0; // short unpoweredZoneCount; UnpoweredZoneCount = 0; NewPower = false; // short cityTaxAverage; CityTaxAverage = 0; // short simCycle; SimCycle = 0; // short phaseCycle; PhaseCycle = 0; // short speedCycle; SpeedCycle = 0; // bool doInitialEval DoInitialEval = false; // int mapSerial; MapSerial = 1; // short resValve; ResValve = 0; // short comValve; ComValve = 0; // short indValve; IndValve = 0; //SimSprite *spriteList; SpriteList = null; // SimSprite *freeSprites; freeSprites = null; // SimSprite *globalSprites[SPRITE_COUNT]; globalSprites = new SimSprite[(int)SpriteType.Count]; // int absDist; absDist = 0; // short spriteCycle; spriteCycle = 0; // Quad totalFunds; TotalFunds = 0; AutoBulldoze = true; AutoBudget = true; GameLevel = Levels.Easy; // short initSimLoad; InitSimLoad = 0; Scenario = Scenario.None; // short simSpeed; SimSpeed = 0; // short simSpeedMeta; SimSpeedMeta = 0; EnableSound = false; EnableDisasters = true; EvalChanged = false; // short blinkFlag; BlinkFlag = 0; // short curMapStackPointer; curMapStackPointer = 0; // Position curMapStackXY[MAX_TRAFFIC_DISTANCE+1]; for (int i = 0; i < Constants.MaxTrafficDistance + 1; i++) { curMapStackXY[i] = new Position(); } // short trafMaxX, trafMaxY; trafMaxX = 0; trafMaxY = 0; MustUpdateFunds = false; MustUpdateOptions = false; // Quad cityTimeLast; CityTimeLast = 0; // Quad cityYearLast; CityYearLast = 0; // Quad cityMonthLast; CityMonthLast = 0; // Quad totalFundsLast; TotalFundsLast = 0; // Quad resLast; ResLast = 0; // Quad comLast; ComLast = 0; // Quad indLast; IndLast = 0; SimInit(); }