89 std::string Micropolis::makeDollarDecimalStr(
const std::string &numStr)
95 short dollarIndex = 0;
99 numOfDigits = numStr.length();
101 std::string dollarStr;
104 if (numOfDigits == 1) {
105 dollarStr += numStr[0];
107 }
else if (numOfDigits == 2) {
108 dollarStr += numStr[0];
109 dollarStr += numStr[1];
111 }
else if (numOfDigits == 3) {
112 dollarStr += numStr[0];
113 dollarStr += numStr[1];
114 dollarStr += numStr[2];
117 leftMostSet = numOfDigits % 3;
119 if (leftMostSet == 0) {
123 numOfCommas = (numOfDigits - 1) / 3;
126 numOfChars = numOfDigits + numOfCommas + 1;
128 for (x = 1; x <= leftMostSet; x++) {
129 dollarStr += numStr[numIndex++];
132 for (x = 1; x <= numOfCommas; x++) {
134 dollarStr += numStr[numIndex++];
135 dollarStr += numStr[numIndex++];
136 dollarStr += numStr[numIndex++];
151 simPausedSpeed = simSpeedMeta;
168 setSpeed(simPausedSpeed);
176 void Micropolis::setSpeed(
short speed)
180 }
else if (speed > 3) {
184 simSpeedMeta = speed;
187 simPausedSpeed = simSpeedMeta;
193 callback->updateSpeed(
this, callbackVal, speed);
197 void Micropolis::setPasses(
int passes)
201 callback->updatePasses(
this, callbackVal, passes);
250 void Micropolis::setCityName(
const std::string &name)
252 std::string cleanName;
255 int n = name.length();
256 for (i = 0; i < n; i++) {
261 cleanName.push_back(ch);
280 void Micropolis::setYear(
int year)
308 callback->newGame(
this, callbackVal);
425 float *resDemandResult,
426 float *comDemandResult,
427 float *indDemandResult)
429 *resDemandResult = (float)resValve / (
float)RES_VALVE_RANGE;
430 *comDemandResult = (float)comValve / (
float)COM_VALVE_RANGE;
431 *indDemandResult = (float)indValve / (
float)IND_VALVE_RANGE;
void setGameLevelFunds(GameLevel level)
void setDoAnimation(bool value)
void setDoNotices(bool value)
GameLevel gameLevel
Difficulty level of the game (0..2)
void getDemands(float *resDemandResult, float *comDemandResult, float *indDemandResult)
void setAutoGoto(bool value)
bool enableDisasters
Enable disasters.
std::string cityName
Name of the city.
void setFunds(int dollars)
void setAutoBulldoze(bool value)
void setEnableSound(bool value)
bool mustUpdateOptions
Options displayed at user need updating.
void setEnableDisasters(bool value)
bool enableSound
Enable sound.
void setGameLevel(GameLevel level)
void setCleanCityName(const std::string &name)
void setDoMessages(bool value)
void setAutoBudget(bool value)
Header file for Micropolis game engine.
@ LEVEL_FIRST
First game level value.
@ LEVEL_MEDIUM
Intermediate game level.
@ LEVEL_EASY
Simple game level.
@ LEVEL_HARD
Difficult game level.
@ LEVEL_LAST
Last game level value.