| 847 | } |
| 848 | |
| 849 | static Train *FindGoodVehiclePos(const Train *src) |
| 850 | { |
| 851 | EngineID eng = src->engine_type; |
| 852 | |
| 853 | for (VehicleID vehicle : GetFreeWagonsInDepot(src->tile)) { |
| 854 | Train *dst = Train::Get(vehicle); |
| 855 | |
| 856 | /* check so all vehicles in the line have the same engine. */ |
| 857 | Train *t = dst; |
| 858 | while (t->engine_type == eng) { |
| 859 | t = t->Next(); |
| 860 | if (t == nullptr) return dst; |
| 861 | } |
| 862 | } |
| 863 | |
| 864 | return nullptr; |
| 865 | } |
| 866 | |
| 867 | /** Helper type for lists/vectors of trains */ |
| 868 | typedef std::vector<Train *> TrainList; |
no test coverage detected