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

Method getUnemployment

MicropolisCore/src/MicropolisEngine/src/evaluate.cpp:331–344  ·  view source on GitHub ↗

* Compute severity of unemployment * @return Value representing the severity of unemployment problems */

Source from the content-addressed store, hash-verified

329 * @return Value representing the severity of unemployment problems
330 */
331short Micropolis::getUnemployment()
332{
333 short b = (comPop + indPop) * 8;
334
335 if (b == 0) {
336 return 0;
337 }
338
339 // Ratio total people / working. At least 1.
340 float r = ((float)resPop) / b;
341
342 b = (short)((r - 1) * 255); // (r - 1) is the fraction unemployed people
343 return min(b, (short)255);
344}
345
346
347/**

Callers

nothing calls this directly

Calls 1

minFunction · 0.85

Tested by

no test coverage detected