* Validate whether we are going to create valid trains. * @note All vehicles are/were 'heads' of their chains. * @param original_dst The original destination chain. * @param dst The destination chain after constructing the train. * @param original_src The original source chain. * @param src The source chain after constructing the train. * @param check_limit Whether to chec
| 1128 | * @return possible error of this command. |
| 1129 | */ |
| 1130 | static CommandCost ValidateTrains(Train *original_dst, Train *dst, Train *original_src, Train *src, bool check_limit) |
| 1131 | { |
| 1132 | /* Check whether we may actually construct the trains. */ |
| 1133 | CommandCost ret = CheckTrainAttachment(src); |
| 1134 | if (ret.Failed()) return ret; |
| 1135 | ret = CheckTrainAttachment(dst); |
| 1136 | if (ret.Failed()) return ret; |
| 1137 | |
| 1138 | /* Check whether we need to build a new train. */ |
| 1139 | return check_limit ? CheckNewTrain(original_dst, dst, original_src, src) : CommandCost(); |
| 1140 | } |
| 1141 | |
| 1142 | /** |
| 1143 | * Arrange the trains in the wanted way. |
no test coverage detected