* Mark a train as stuck and stop it if it isn't stopped right now. * @param v %Train to mark as being stuck. */
| 1558 | * @param v %Train to mark as being stuck. |
| 1559 | */ |
| 1560 | static void MarkTrainAsStuck(Train *v) |
| 1561 | { |
| 1562 | if (!v->flags.Test(VehicleRailFlag::Stuck)) { |
| 1563 | /* It is the first time the problem occurred, set the "train stuck" flag. */ |
| 1564 | v->flags.Set(VehicleRailFlag::Stuck); |
| 1565 | |
| 1566 | v->wait_counter = 0; |
| 1567 | |
| 1568 | /* Stop train */ |
| 1569 | v->cur_speed = 0; |
| 1570 | v->subspeed = 0; |
| 1571 | v->SetLastSpeed(); |
| 1572 | |
| 1573 | SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, WID_VV_START_STOP); |
| 1574 | } |
| 1575 | } |
| 1576 | |
| 1577 | /** |
| 1578 | * Swap the two up/down flags in two ways: |
no test coverage detected