* Update train vehicle data for a tick. * @return True if the vehicle still exists, false if it has ceased to exist (front of consists only). */
| 4113 | * @return True if the vehicle still exists, false if it has ceased to exist (front of consists only). |
| 4114 | */ |
| 4115 | bool Train::Tick() |
| 4116 | { |
| 4117 | this->tick_counter++; |
| 4118 | |
| 4119 | if (this->IsFrontEngine()) { |
| 4120 | PerformanceAccumulator framerate(PFE_GL_TRAINS); |
| 4121 | |
| 4122 | if (!this->vehstatus.Test(VehState::Stopped) || this->cur_speed > 0) this->running_ticks++; |
| 4123 | |
| 4124 | this->current_order_time++; |
| 4125 | |
| 4126 | if (!TrainLocoHandler(this, false)) return false; |
| 4127 | |
| 4128 | return TrainLocoHandler(this, true); |
| 4129 | } else if (this->IsFreeWagon() && this->vehstatus.Test(VehState::Crashed)) { |
| 4130 | /* Delete flooded standalone wagon chain */ |
| 4131 | if (++this->crash_anim_pos >= 4400) { |
| 4132 | delete this; |
| 4133 | return false; |
| 4134 | } |
| 4135 | } |
| 4136 | |
| 4137 | return true; |
| 4138 | } |
| 4139 | |
| 4140 | /** |
| 4141 | * Check whether a train needs service, and if so, find a depot or service it. |
nothing calls this directly
no test coverage detected