diff --git a/src/roadveh.h b/src/roadveh.h --- a/src/roadveh.h +++ b/src/roadveh.h @@ -90,7 +90,7 @@ struct RoadVehicle : public GroundVehicl uint16 blocked_ctr; byte overtaking; ///< Set to #RVSB_DRIVE_SIDE when overtaking, otherwise 0. byte overtaking_ctr; ///< The length of the current overtake attempt. - uint16 crashed_ctr; + uint16 crashed_ctr; ///< Animation counter when the vehicle has crashed. @see RoadVehIsCrashed byte reverse_ctr; RoadType roadtype; diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -415,6 +415,10 @@ FORCEINLINE int RoadVehicle::GetCurrentM return max_speed; } +/** + * Delete last vehicle of a chain road vehicles. + * @param v First roadvehicle. + */ static void DeleteLastRoadVeh(RoadVehicle *v) { Vehicle *u = v; @@ -441,6 +445,11 @@ static void RoadVehSetRandomDirection(Ro } while ((v = v->Next()) != NULL); } +/** + * Road vehicle chain has crashed. + * @param v First roadvehicle. + * @return whether the chain still exists. + */ static bool RoadVehIsCrashed(RoadVehicle *v) { v->crashed_ctr++; @@ -457,6 +466,12 @@ static bool RoadVehIsCrashed(RoadVehicle return true; } +/** + * Check routine whether a road and a train vehicle have collided. + * @param v %Train vehicle to test. + * @param data Road vehicle to test. + * @return %Train vehicle if the vehicles collided, else \c NULL. + */ static Vehicle *EnumCheckRoadVehCrashTrain(Vehicle *v, void *data) { const Vehicle *u = (Vehicle*)data; diff --git a/src/train.h b/src/train.h --- a/src/train.h +++ b/src/train.h @@ -73,7 +73,7 @@ struct Train : public GroundVehicleNext()) != NULL); } +/** + * Handle a crashed train. + * @param v First train vehicle. + * @return %Vehicle chain still exists. + */ static bool HandleCrashedTrain(Train *v) { int state = ++v->crash_anim_pos;