roadveh_gui.c
changeset 3959 48f178431701
parent 3948 a09379beffd5
child 3960 67dadc46ca74
equal deleted inserted replaced
3958:228b5729d164 3959:48f178431701
     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 "roadveh.h"
     7 #include "table/sprites.h"
     8 #include "table/sprites.h"
     8 #include "table/strings.h"
     9 #include "table/strings.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"
   552 		IsTileOwner(tile, _local_player) ? 0 : ((1<<4) | (1<<7) | (1<<8));
   553 		IsTileOwner(tile, _local_player) ? 0 : ((1<<4) | (1<<7) | (1<<8));
   553 
   554 
   554 	/* determine amount of items for scroller */
   555 	/* determine amount of items for scroller */
   555 	num = 0;
   556 	num = 0;
   556 	FOR_ALL_VEHICLES(v) {
   557 	FOR_ALL_VEHICLES(v) {
   557 		if (v->type == VEH_Road && v->u.road.state == 254 && v->tile == tile)
   558 		if (v->type == VEH_Road && IsRoadVehInDepot(v) && v->tile == tile)
   558 			num++;
   559 			num++;
   559 	}
   560 	}
   560 	SetVScrollCount(w, (num + w->hscroll.cap - 1) / w->hscroll.cap);
   561 	SetVScrollCount(w, (num + w->hscroll.cap - 1) / w->hscroll.cap);
   561 
   562 
   562 	/* locate the depot struct */
   563 	/* locate the depot struct */
   569 	x = 2;
   570 	x = 2;
   570 	y = 15;
   571 	y = 15;
   571 	num = w->vscroll.pos * w->hscroll.cap;
   572 	num = w->vscroll.pos * w->hscroll.cap;
   572 
   573 
   573 	FOR_ALL_VEHICLES(v) {
   574 	FOR_ALL_VEHICLES(v) {
   574 		if (v->type == VEH_Road && v->u.road.state == 254 && v->tile == tile &&
   575 		if (v->type == VEH_Road && IsRoadVehInDepot(v) && v->tile == tile &&
   575 				--num < 0 && num >=	-w->vscroll.cap * w->hscroll.cap) {
   576 				--num < 0 && num >=	-w->vscroll.cap * w->hscroll.cap) {
   576 			DrawRoadVehImage(v, x+24, y, WP(w,traindepot_d).sel);
   577 			DrawRoadVehImage(v, x+24, y, WP(w,traindepot_d).sel);
   577 
   578 
   578 			SetDParam(0, v->unitnumber);
   579 			SetDParam(0, v->unitnumber);
   579 			DrawString(x, y+2, (uint16)(v->max_age-366) >= v->age ? STR_00E2 : STR_00E3, 0);
   580 			DrawString(x, y+2, (uint16)(v->max_age-366) >= v->age ? STR_00E2 : STR_00E3, 0);
   606 
   607 
   607 	pos = (row + w->vscroll.pos) * w->hscroll.cap + xt;
   608 	pos = (row + w->vscroll.pos) * w->hscroll.cap + xt;
   608 
   609 
   609 	tile = w->window_number;
   610 	tile = w->window_number;
   610 	FOR_ALL_VEHICLES(v) {
   611 	FOR_ALL_VEHICLES(v) {
   611 		if (v->type == VEH_Road && v->u.road.state == 254 && v->tile == tile &&
   612 		if (v->type == VEH_Road && IsRoadVehInDepot(v) && v->tile == tile &&
   612 				--pos < 0) {
   613 				--pos < 0) {
   613 			*veh = v;
   614 			*veh = v;
   614 			if (xm >= 24) return 0;
   615 			if (xm >= 24) return 0;
   615 			if (xm <= 16) return -1; /* show window */
   616 			if (xm <= 16) return -1; /* show window */
   616 			return -2; /* start stop */
   617 			return -2; /* start stop */
   915 
   916 
   916 			DrawRoadVehImage(v, x + 22, y + 6, INVALID_VEHICLE);
   917 			DrawRoadVehImage(v, x + 22, y + 6, INVALID_VEHICLE);
   917 			DrawVehicleProfitButton(v, x, y + 13);
   918 			DrawVehicleProfitButton(v, x, y + 13);
   918 
   919 
   919 			SetDParam(0, v->unitnumber);
   920 			SetDParam(0, v->unitnumber);
   920 			if (IsTileDepotType(v->tile, TRANSPORT_ROAD) && (v->vehstatus & VS_HIDDEN))
   921 			if (IsRoadVehInDepot(v))
   921 				str = STR_021F;
   922 				str = STR_021F;
   922 			else
   923 			else
   923 				str = v->age > v->max_age - 366 ? STR_00E3 : STR_00E2;
   924 				str = v->age > v->max_age - 366 ? STR_00E3 : STR_00E2;
   924 			DrawString(x, y + 2, str, 0);
   925 			DrawString(x, y + 2, str, 0);
   925 
   926