* Store a value into the history tables. * @param historyType Type of history information. @see HistoryType * @param historyScale Scale of history data. @see HistoryScale * @param historyIndex Index in the data to obtain * @param historyValue Index in the value to store */
| 335 | * @param historyValue Index in the value to store |
| 336 | */ |
| 337 | void Micropolis::setHistory(int historyType, int historyScale, |
| 338 | int historyIndex, short historyValue) |
| 339 | { |
| 340 | if (historyType < 0 || historyType >= HISTORY_TYPE_COUNT |
| 341 | || historyScale < 0 || historyScale >= HISTORY_SCALE_COUNT |
| 342 | || historyIndex < 0 || historyIndex >= HISTORY_COUNT) { |
| 343 | return; |
| 344 | } |
| 345 | |
| 346 | short *history = NULL; |
| 347 | switch (historyType) { |
| 348 | case HISTORY_TYPE_RES: |
| 349 | history = resHist; |
| 350 | break; |
| 351 | case HISTORY_TYPE_COM: |
| 352 | history = comHist; |
| 353 | break; |
| 354 | case HISTORY_TYPE_IND: |
| 355 | history = indHist; |
| 356 | break; |
| 357 | case HISTORY_TYPE_MONEY: |
| 358 | history = moneyHist; |
| 359 | break; |
| 360 | case HISTORY_TYPE_CRIME: |
| 361 | history = crimeHist; |
| 362 | break; |
| 363 | case HISTORY_TYPE_POLLUTION: |
| 364 | history = pollutionHist; |
| 365 | break; |
| 366 | default: |
| 367 | NOT_REACHED(); |
| 368 | break; |
| 369 | } |
| 370 | |
| 371 | int offset = 0; |
| 372 | switch (historyScale) { |
| 373 | case HISTORY_SCALE_SHORT: |
| 374 | offset = 0; |
| 375 | break; |
| 376 | case HISTORY_SCALE_LONG: |
| 377 | offset = 120; |
| 378 | break; |
| 379 | default: |
| 380 | NOT_REACHED(); |
| 381 | break; |
| 382 | } |
| 383 | |
| 384 | history[historyIndex + offset] = historyValue; |
| 385 | } |
| 386 | |
| 387 | |
| 388 | //////////////////////////////////////////////////////////////////////// |
nothing calls this directly
no outgoing calls
no test coverage detected