diff -r eec5a7dcbf61 -r fcf5fb2548eb src/train_gui.cpp --- a/src/train_gui.cpp Mon Apr 14 20:32:36 2008 +0000 +++ b/src/train_gui.cpp Tue Apr 15 00:47:19 2008 +0000 @@ -16,18 +16,19 @@ #include "strings_func.h" #include "vehicle_func.h" #include "settings_type.h" +#include "order_func.h" +#include "engine_func.h" #include "table/sprites.h" #include "table/strings.h" void CcBuildWagon(bool success, TileIndex tile, uint32 p1, uint32 p2) { - Vehicle *v, *found; - if (!success) return; /* find a locomotive in the depot. */ - found = NULL; + Vehicle *found = NULL; + Vehicle *v; FOR_ALL_VEHICLES(v) { if (v->type == VEH_TRAIN && IsFrontEngine(v) && v->tile == tile && @@ -48,11 +49,9 @@ void CcBuildLoco(bool success, TileIndex tile, uint32 p1, uint32 p2) { - const Vehicle *v; - if (!success) return; - v = GetVehicle(_new_vehicle_id); + const Vehicle *v = GetVehicle(_new_vehicle_id); if (tile == _backup_orders_tile) { _backup_orders_tile = 0; RestoreVehicleOrders(v); @@ -96,6 +95,8 @@ /* Set the highlight position */ highlight_l = WagonLengthToPixels(dx) + 1; highlight_r = WagonLengthToPixels(dx + width) + 1; + } else if (_cursor.vehchain && highlight_r != 0) { + highlight_r += WagonLengthToPixels(width); } } } @@ -193,8 +194,6 @@ for (;;) { if (--vscroll_pos < 0 && vscroll_pos >= -vscroll_cap) { int dx = 0; - int px; - int py; u = v; do { @@ -204,8 +203,8 @@ u = u->Next(); } while (u != NULL && IsArticulatedPart(u) && u->cargo_cap == 0); - px = x + WagonLengthToPixels(dx) + 2; - py = y + 2; + int px = x + WagonLengthToPixels(dx) + 2; + int py = y + 2; switch (det_tab) { default: NOT_REACHED(); case 0: TrainDetailsCargoTab( v, px, py); break;