150 |
150 |
151 // if we found a loco, |
151 // if we found a loco, |
152 if (found != NULL) { |
152 if (found != NULL) { |
153 found = GetLastVehicleInChain(found); |
153 found = GetLastVehicleInChain(found); |
154 // put the new wagon at the end of the loco. |
154 // put the new wagon at the end of the loco. |
155 DoCommandP(0, _new_wagon_id | (found->index<<16), 0, NULL, CMD_MOVE_RAIL_VEHICLE); |
155 DoCommandP(0, _new_vehicle_id | (found->index << 16), 0, NULL, CMD_MOVE_RAIL_VEHICLE); |
156 RebuildVehicleLists(); |
156 RebuildVehicleLists(); |
157 } |
157 } |
158 } |
158 } |
159 |
159 |
160 void CcBuildLoco(bool success, TileIndex tile, uint32 p1, uint32 p2) |
160 void CcBuildLoco(bool success, TileIndex tile, uint32 p1, uint32 p2) |
161 { |
161 { |
162 const Vehicle* v; |
162 const Vehicle* v; |
163 |
163 |
164 if (!success) return; |
164 if (!success) return; |
165 |
165 |
166 v = GetVehicle(_new_train_id); |
166 v = GetVehicle(_new_vehicle_id); |
167 if (tile == _backup_orders_tile) { |
167 if (tile == _backup_orders_tile) { |
168 _backup_orders_tile = 0; |
168 _backup_orders_tile = 0; |
169 RestoreVehicleOrders(v, _backup_orders_data); |
169 RestoreVehicleOrders(v, _backup_orders_data); |
170 } |
170 } |
171 ShowTrainViewWindow(v); |
171 ShowTrainViewWindow(v); |
172 } |
172 } |
173 |
173 |
174 void CcCloneTrain(bool success, TileIndex tile, uint32 p1, uint32 p2) |
174 void CcCloneTrain(bool success, TileIndex tile, uint32 p1, uint32 p2) |
175 { |
175 { |
176 if (success) ShowTrainViewWindow(GetVehicle(_new_train_id)); |
176 if (success) ShowTrainViewWindow(GetVehicle(_new_vehicle_id)); |
177 } |
177 } |
178 |
178 |
179 static void engine_drawing_loop(int *x, int *y, int *pos, int *sel, |
179 static void engine_drawing_loop(int *x, int *y, int *pos, int *sel, |
180 EngineID* selected_id, RailType railtype, byte show_max, bool is_engine) |
180 EngineID* selected_id, RailType railtype, byte show_max, bool is_engine) |
181 { |
181 { |