MCPcopy Create free account
hub / github.com/SimHacker/micropolis / setValves

Method setValves

MicropolisCore/src/MicropolisEngine/src/simulate.cpp:546–670  ·  view source on GitHub ↗

comefrom: simulate doSimInit */

Source from the content-addressed store, hash-verified

544
545/* comefrom: simulate doSimInit */
546void Micropolis::setValves()
547{
548 /// @todo Break the tax table out into configurable parameters.
549 static const short taxTable[21] = {
550 200, 150, 120, 100, 80, 50, 30, 0, -10, -40, -100,
551 -150, -200, -250, -300, -350, -400, -450, -500, -550, -600,
552 };
553 static const float extMarketParamTable[3] = {
554 1.2f, 1.1f, 0.98f,
555 };
556 assert(LEVEL_COUNT == LENGTH_OF(extMarketParamTable));
557
558 /// @todo Make configurable parameters.
559 short resPopDenom = 8;
560 float birthRate = 0.02;
561 float laborBaseMax = 1.3;
562 float internalMarketDenom = 3.7;
563 float projectedIndPopMin = 5.0;
564 float resRatioDefault = 1.3;
565 float resRatioMax = 2;
566 float comRatioMax = 2;
567 float indRatioMax = 2;
568 short taxMax = 20;
569 float taxTableScale = 600;
570
571 /// @todo Break the interesting values out into public member
572 /// variables so the user interface can display them.
573 float employment, migration, births, laborBase, internalMarket;
574 float resRatio, comRatio, indRatio;
575 float normalizedResPop, projectedResPop, projectedComPop, projectedIndPop;
576
577 miscHist[1] = (short)externalMarket;
578 miscHist[2] = resPop;
579 miscHist[3] = comPop;
580 miscHist[4] = indPop;
581 miscHist[5] = resValve;
582 miscHist[6] = comValve;
583 miscHist[7] = indValve;
584 miscHist[10] = crimeRamp;
585 miscHist[11] = pollutionRamp;
586 miscHist[12] = landValueAverage;
587 miscHist[13] = crimeAverage;
588 miscHist[14] = pollutionAverage;
589 miscHist[15] = gameLevel;
590 miscHist[16] = (short)cityClass;
591 miscHist[17] = cityScore;
592
593 normalizedResPop = (float)resPop / (float)resPopDenom;
594 totalPopLast = totalPop;
595 totalPop = (short)(normalizedResPop + comPop + indPop);
596
597 if (resPop > 0) {
598 employment = (comHist[1] + indHist[1]) / normalizedResPop;
599 } else {
600 employment = 1;
601 }
602
603 migration = normalizedResPop * (employment - 1);

Callers

nothing calls this directly

Calls 3

clampFunction · 0.85
maxFunction · 0.85
minFunction · 0.85

Tested by

no test coverage detected