Update acceleration of the train from the cached power and weight. */
| 428 | |
| 429 | /** Update acceleration of the train from the cached power and weight. */ |
| 430 | void Train::UpdateAcceleration() |
| 431 | { |
| 432 | assert(this->IsFrontEngine() || this->IsFreeWagon()); |
| 433 | |
| 434 | uint power = this->gcache.cached_power; |
| 435 | uint weight = this->gcache.cached_weight; |
| 436 | assert(weight != 0); |
| 437 | this->acceleration = Clamp(power / weight * 4, 1, 255); |
| 438 | } |
| 439 | |
| 440 | int Train::GetCursorImageOffset() const |
| 441 | { |
no test coverage detected