* Compute severity of unemployment * @return Value representing the severity of unemployment problems */
| 329 | * @return Value representing the severity of unemployment problems |
| 330 | */ |
| 331 | short 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 | /** |