roadveh_gui.c
changeset 1986 5dd3db2b86d7
parent 1977 4392ae3d8e31
child 2084 d67790a49f78
equal deleted inserted replaced
1985:c4ec1653a337 1986:5dd3db2b86d7
   538 		IsTileOwner(tile, _local_player) ? 0 : ((1 << 4) | (1 << 7));
   538 		IsTileOwner(tile, _local_player) ? 0 : ((1 << 4) | (1 << 7));
   539 
   539 
   540 	/* determine amount of items for scroller */
   540 	/* determine amount of items for scroller */
   541 	num = 0;
   541 	num = 0;
   542 	FOR_ALL_VEHICLES(v) {
   542 	FOR_ALL_VEHICLES(v) {
   543 		if (v->type == VEH_Road && v->u.road.state == 254 &&
   543 		if (v->type == VEH_Road && v->u.road.state == 254 && v->tile == tile)
   544 				v->tile == (TileIndex)tile)
   544 			num++;
   545 					num++;
       
   546 	}
   545 	}
   547 	SetVScrollCount(w, (num + w->hscroll.cap - 1) / w->hscroll.cap);
   546 	SetVScrollCount(w, (num + w->hscroll.cap - 1) / w->hscroll.cap);
   548 
   547 
   549 	/* locate the depot struct */
   548 	/* locate the depot struct */
   550 	depot = GetDepotByTile(tile);
   549 	depot = GetDepotByTile(tile);
   556 	x = 2;
   555 	x = 2;
   557 	y = 15;
   556 	y = 15;
   558 	num = w->vscroll.pos * w->hscroll.cap;
   557 	num = w->vscroll.pos * w->hscroll.cap;
   559 
   558 
   560 	FOR_ALL_VEHICLES(v) {
   559 	FOR_ALL_VEHICLES(v) {
   561 		if (v->type == VEH_Road &&
   560 		if (v->type == VEH_Road && v->u.road.state == 254 && v->tile == tile &&
   562 				v->u.road.state == 254 &&
       
   563 				v->tile == (TileIndex)tile &&
       
   564 				--num < 0 && num >=	-w->vscroll.cap * w->hscroll.cap) {
   561 				--num < 0 && num >=	-w->vscroll.cap * w->hscroll.cap) {
   565 
       
   566 			DrawRoadVehImage(v, x+24, y, WP(w,traindepot_d).sel);
   562 			DrawRoadVehImage(v, x+24, y, WP(w,traindepot_d).sel);
   567 
   563 
   568 			SetDParam(0, v->unitnumber);
   564 			SetDParam(0, v->unitnumber);
   569 			DrawString(x, y+2, (uint16)(v->max_age-366) >= v->age ? STR_00E2 : STR_00E3, 0);
   565 			DrawString(x, y+2, (uint16)(v->max_age-366) >= v->age ? STR_00E2 : STR_00E3, 0);
   570 
   566 
   596 
   592 
   597 	pos = (row + w->vscroll.pos) * w->hscroll.cap + xt;
   593 	pos = (row + w->vscroll.pos) * w->hscroll.cap + xt;
   598 
   594 
   599 	tile = w->window_number;
   595 	tile = w->window_number;
   600 	FOR_ALL_VEHICLES(v) {
   596 	FOR_ALL_VEHICLES(v) {
   601 		if (v->type == VEH_Road &&
   597 		if (v->type == VEH_Road && v->u.road.state == 254 && v->tile == tile &&
   602 				v->u.road.state == 254 &&
       
   603 				v->tile == (TileIndex)tile &&
       
   604 				--pos < 0) {
   598 				--pos < 0) {
   605 					*veh = v;
   599 			*veh = v;
   606 					if (xm >= 24)
   600 			if (xm >= 24) return 0;
   607 						return 0;
   601 			if (xm <= 16) return -1; /* show window */
   608 
   602 			return -2; /* start stop */
   609 					if (xm <= 16)
   603 		}
   610 						return -1; /* show window */
       
   611 
       
   612 					return -2; /* start stop */
       
   613 				}
       
   614 	}
   604 	}
   615 
   605 
   616 	return 1; /* outside */
   606 	return 1; /* outside */
   617 }
   607 }
   618 
   608