equal
deleted
inserted
replaced
2 |
2 |
3 #include "stdafx.h" |
3 #include "stdafx.h" |
4 #include "openttd.h" |
4 #include "openttd.h" |
5 #include "debug.h" |
5 #include "debug.h" |
6 #include "functions.h" |
6 #include "functions.h" |
|
7 #include "ship.h" |
7 #include "table/strings.h" |
8 #include "table/strings.h" |
8 #include "table/sprites.h" |
9 #include "table/sprites.h" |
9 #include "map.h" |
10 #include "map.h" |
10 #include "window.h" |
11 #include "window.h" |
11 #include "gui.h" |
12 #include "gui.h" |
464 Vehicle *v = GetVehicle(w->window_number); |
465 Vehicle *v = GetVehicle(w->window_number); |
465 uint32 disabled = 1<<8; |
466 uint32 disabled = 1<<8; |
466 StringID str; |
467 StringID str; |
467 |
468 |
468 // Possible to refit? |
469 // Possible to refit? |
469 if (ShipVehInfo(v->engine_type)->refittable && |
470 if (ShipVehInfo(v->engine_type)->refittable && IsShipInDepotStopped(v)) { |
470 v->vehstatus&VS_STOPPED && |
|
471 v->u.ship.state == 0x80 && |
|
472 IsTileDepotType(v->tile, TRANSPORT_WATER)) |
|
473 disabled = 0; |
471 disabled = 0; |
|
472 } |
474 |
473 |
475 if (v->owner != _local_player) |
474 if (v->owner != _local_player) |
476 disabled |= 1<<8 | 1<<7; |
475 disabled |= 1<<8 | 1<<7; |
477 w->disabled_state = disabled; |
476 w->disabled_state = disabled; |
478 |
477 |
566 case WE_MOUSELOOP: |
565 case WE_MOUSELOOP: |
567 { |
566 { |
568 Vehicle *v; |
567 Vehicle *v; |
569 uint32 h; |
568 uint32 h; |
570 v = GetVehicle(w->window_number); |
569 v = GetVehicle(w->window_number); |
571 h = IsTileDepotType(v->tile, TRANSPORT_WATER) && v->vehstatus & VS_HIDDEN ? (1<< 7) : (1 << 11); |
570 h = IsShipInDepot(v) ? 1 << 7 : 1 << 11; |
572 if (h != w->hidden_state) { |
571 if (h != w->hidden_state) { |
573 w->hidden_state = h; |
572 w->hidden_state = h; |
574 SetWindowDirty(w); |
573 SetWindowDirty(w); |
575 } |
574 } |
576 } |
575 } |
627 IsTileOwner(tile, _local_player) ? 0 : ((1 << 4) | (1 << 7)); |
626 IsTileOwner(tile, _local_player) ? 0 : ((1 << 4) | (1 << 7)); |
628 |
627 |
629 /* determine amount of items for scroller */ |
628 /* determine amount of items for scroller */ |
630 num = 0; |
629 num = 0; |
631 FOR_ALL_VEHICLES(v) { |
630 FOR_ALL_VEHICLES(v) { |
632 if (v->type == VEH_Ship && v->u.ship.state == 0x80 && v->tile == tile) |
631 if (v->type == VEH_Ship && IsShipInDepot(v) && v->tile == tile) |
633 num++; |
632 num++; |
634 } |
633 } |
635 SetVScrollCount(w, (num + w->hscroll.cap - 1) / w->hscroll.cap); |
634 SetVScrollCount(w, (num + w->hscroll.cap - 1) / w->hscroll.cap); |
636 |
635 |
637 /* locate the depot struct */ |
636 /* locate the depot struct */ |
644 x = 2; |
643 x = 2; |
645 y = 15; |
644 y = 15; |
646 num = w->vscroll.pos * w->hscroll.cap; |
645 num = w->vscroll.pos * w->hscroll.cap; |
647 |
646 |
648 FOR_ALL_VEHICLES(v) { |
647 FOR_ALL_VEHICLES(v) { |
649 if (v->type == VEH_Ship && v->u.ship.state == 0x80 && v->tile == tile && |
648 if (v->type == VEH_Ship && IsShipInDepot(v) && v->tile == tile && |
650 --num < 0 && num >= -w->vscroll.cap * w->hscroll.cap) { |
649 --num < 0 && num >= -w->vscroll.cap * w->hscroll.cap) { |
651 DrawShipImage(v, x+19, y, WP(w,traindepot_d).sel); |
650 DrawShipImage(v, x+19, y, WP(w,traindepot_d).sel); |
652 |
651 |
653 SetDParam(0, v->unitnumber); |
652 SetDParam(0, v->unitnumber); |
654 DrawString(x, y+2, (uint16)(v->max_age-366) >= v->age ? STR_00E2 : STR_00E3, 0); |
653 DrawString(x, y+2, (uint16)(v->max_age-366) >= v->age ? STR_00E2 : STR_00E3, 0); |
1011 |
1010 |
1012 DrawShipImage(v, x + 19, y + 6, INVALID_VEHICLE); |
1011 DrawShipImage(v, x + 19, y + 6, INVALID_VEHICLE); |
1013 DrawVehicleProfitButton(v, x, y + 13); |
1012 DrawVehicleProfitButton(v, x, y + 13); |
1014 |
1013 |
1015 SetDParam(0, v->unitnumber); |
1014 SetDParam(0, v->unitnumber); |
1016 if (IsTileDepotType(v->tile, TRANSPORT_WATER) && (v->vehstatus & VS_HIDDEN)) |
1015 if (IsShipInDepot(v)) |
1017 str = STR_021F; |
1016 str = STR_021F; |
1018 else |
1017 else |
1019 str = v->age > v->max_age - 366 ? STR_00E3 : STR_00E2; |
1018 str = v->age > v->max_age - 366 ? STR_00E3 : STR_00E2; |
1020 DrawString(x, y + 2, str, 0); |
1019 DrawString(x, y + 2, str, 0); |
1021 |
1020 |