173 case VEH_TRAIN: |
173 case VEH_TRAIN: |
174 DrawTrainImage(v, x + 21, sprite_y, w->hscroll.cap + 4, w->hscroll.pos, WP(w,depot_d).sel); |
174 DrawTrainImage(v, x + 21, sprite_y, w->hscroll.cap + 4, w->hscroll.pos, WP(w,depot_d).sel); |
175 |
175 |
176 /* Number of wagons relative to a standard length wagon (rounded up) */ |
176 /* Number of wagons relative to a standard length wagon (rounded up) */ |
177 SetDParam(0, (v->u.rail.cached_total_length + 7) / 8); |
177 SetDParam(0, (v->u.rail.cached_total_length + 7) / 8); |
178 DrawStringRightAligned(w->widget[DEPOT_WIDGET_MATRIX].right - 1, y + 4, STR_TINY_BLACK, 0); // Draw the counter |
178 DrawStringRightAligned(w->widget[DEPOT_WIDGET_MATRIX].right - 1, y + 4, STR_TINY_BLACK, TC_FROMSTRING); // Draw the counter |
179 break; |
179 break; |
180 |
180 |
181 case VEH_ROAD: DrawRoadVehImage( v, x + 24, sprite_y, 1, WP(w, depot_d).sel); break; |
181 case VEH_ROAD: DrawRoadVehImage( v, x + 24, sprite_y, 1, WP(w, depot_d).sel); break; |
182 case VEH_SHIP: DrawShipImage( v, x + 19, sprite_y - 1, WP(w, depot_d).sel); break; |
182 case VEH_SHIP: DrawShipImage( v, x + 19, sprite_y - 1, WP(w, depot_d).sel); break; |
183 case VEH_AIRCRAFT: { |
183 case VEH_AIRCRAFT: { |
198 } |
198 } |
199 |
199 |
200 DrawSprite((v->vehstatus & VS_STOPPED) ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, PAL_NONE, x + diff_x, y + diff_y); |
200 DrawSprite((v->vehstatus & VS_STOPPED) ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, PAL_NONE, x + diff_x, y + diff_y); |
201 |
201 |
202 SetDParam(0, v->unitnumber); |
202 SetDParam(0, v->unitnumber); |
203 DrawString(x, y + 2, (uint16)(v->max_age-366) >= v->age ? STR_00E2 : STR_00E3, 0); |
203 DrawString(x, y + 2, (uint16)(v->max_age-366) >= v->age ? STR_00E2 : STR_00E3, TC_FROMSTRING); |
204 } |
204 } |
205 |
205 |
206 static void DrawDepotWindow(Window *w) |
206 static void DrawDepotWindow(Window *w) |
207 { |
207 { |
208 Vehicle **vl = WP(w, depot_d).vehicle_list; |
208 Vehicle **vl = WP(w, depot_d).vehicle_list; |
272 for (; num < maxval; num++, y += 14) { |
272 for (; num < maxval; num++, y += 14) { |
273 const Vehicle *v = WP(w, depot_d).wagon_list[num - WP(w, depot_d).engine_count]; |
273 const Vehicle *v = WP(w, depot_d).wagon_list[num - WP(w, depot_d).engine_count]; |
274 const Vehicle *u; |
274 const Vehicle *u; |
275 |
275 |
276 DrawTrainImage(v, x + 50, y, w->hscroll.cap - 29, 0, WP(w,depot_d).sel); |
276 DrawTrainImage(v, x + 50, y, w->hscroll.cap - 29, 0, WP(w,depot_d).sel); |
277 DrawString(x, y + 2, STR_8816, 0); |
277 DrawString(x, y + 2, STR_8816, TC_FROMSTRING); |
278 |
278 |
279 /*Draw the train counter */ |
279 /*Draw the train counter */ |
280 i = 0; |
280 i = 0; |
281 u = v; |
281 u = v; |
282 do i++; while ((u = u->Next()) != NULL); // Determine length of train |
282 do i++; while ((u = u->Next()) != NULL); // Determine length of train |
283 SetDParam(0, i); // Set the counter |
283 SetDParam(0, i); // Set the counter |
284 DrawStringRightAligned(w->widget[DEPOT_WIDGET_MATRIX].right - 1, y + 4, STR_TINY_BLACK, 0); // Draw the counter |
284 DrawStringRightAligned(w->widget[DEPOT_WIDGET_MATRIX].right - 1, y + 4, STR_TINY_BLACK, TC_FROMSTRING); // Draw the counter |
285 } |
285 } |
286 } |
286 } |
287 |
287 |
288 struct GetDepotVehiclePtData { |
288 struct GetDepotVehiclePtData { |
289 Vehicle *head; |
289 Vehicle *head; |
412 GetDepotVehiclePtData gdvp; |
412 GetDepotVehiclePtData gdvp; |
413 Vehicle *v = NULL; |
413 Vehicle *v = NULL; |
414 int mode = GetVehicleFromDepotWndPt(w, x, y, &v, &gdvp); |
414 int mode = GetVehicleFromDepotWndPt(w, x, y, &v, &gdvp); |
415 |
415 |
416 /* share / copy orders */ |
416 /* share / copy orders */ |
417 if (_thd.place_mode && mode <= 0) { |
417 if (_thd.place_mode != VHM_NONE && mode <= 0) { |
418 _place_clicked_vehicle = (WP(w, depot_d).type == VEH_TRAIN ? gdvp.head : v); |
418 _place_clicked_vehicle = (WP(w, depot_d).type == VEH_TRAIN ? gdvp.head : v); |
419 return; |
419 return; |
420 } |
420 } |
421 |
421 |
422 if (WP(w, depot_d).type == VEH_TRAIN) v = gdvp.wagon; |
422 if (WP(w, depot_d).type == VEH_TRAIN) v = gdvp.wagon; |
434 } else if (v != NULL) { |
434 } else if (v != NULL) { |
435 int image = v->GetImage(DIR_W); |
435 int image = v->GetImage(DIR_W); |
436 |
436 |
437 WP(w, depot_d).sel = v->index; |
437 WP(w, depot_d).sel = v->index; |
438 SetWindowDirty(w); |
438 SetWindowDirty(w); |
439 SetObjectToPlaceWnd(image, GetVehiclePalette(v), 4, w); |
439 SetObjectToPlaceWnd(image, GetVehiclePalette(v), VHM_DRAG, w); |
440 } |
440 } |
441 } |
441 } |
442 break; |
442 break; |
443 |
443 |
444 case MODE_SHOW_VEHICLE: // show info window |
444 case MODE_SHOW_VEHICLE: // show info window |