ship_gui.c
changeset 1986 fcc849a38ae6
parent 1977 37bbebf94434
child 2084 65639f898a50
equal deleted inserted replaced
1985:46d2f03f66e4 1986:fcc849a38ae6
   614 		IsTileOwner(tile, _local_player) ? 0 : ((1 << 4) | (1 << 7));
   614 		IsTileOwner(tile, _local_player) ? 0 : ((1 << 4) | (1 << 7));
   615 
   615 
   616 	/* determine amount of items for scroller */
   616 	/* determine amount of items for scroller */
   617 	num = 0;
   617 	num = 0;
   618 	FOR_ALL_VEHICLES(v) {
   618 	FOR_ALL_VEHICLES(v) {
   619 		if (v->type == VEH_Ship && v->u.ship.state == 0x80 &&
   619 		if (v->type == VEH_Ship && v->u.ship.state == 0x80 && v->tile == tile)
   620 				v->tile == (TileIndex)tile)
   620 			num++;
   621 					num++;
       
   622 	}
   621 	}
   623 	SetVScrollCount(w, (num + w->hscroll.cap - 1) / w->hscroll.cap);
   622 	SetVScrollCount(w, (num + w->hscroll.cap - 1) / w->hscroll.cap);
   624 
   623 
   625 	/* locate the depot struct */
   624 	/* locate the depot struct */
   626 	depot = GetDepotByTile(tile);
   625 	depot = GetDepotByTile(tile);
   632 	x = 2;
   631 	x = 2;
   633 	y = 15;
   632 	y = 15;
   634 	num = w->vscroll.pos * w->hscroll.cap;
   633 	num = w->vscroll.pos * w->hscroll.cap;
   635 
   634 
   636 	FOR_ALL_VEHICLES(v) {
   635 	FOR_ALL_VEHICLES(v) {
   637 		if (v->type == VEH_Ship &&
   636 		if (v->type == VEH_Ship && v->u.ship.state == 0x80 && v->tile == tile &&
   638 				v->u.ship.state == 0x80 &&
       
   639 				v->tile == (TileIndex)tile &&
       
   640 				--num < 0 && num >= -w->vscroll.cap * w->hscroll.cap) {
   637 				--num < 0 && num >= -w->vscroll.cap * w->hscroll.cap) {
   641 
       
   642 			DrawShipImage(v, x+19, y, WP(w,traindepot_d).sel);
   638 			DrawShipImage(v, x+19, y, WP(w,traindepot_d).sel);
   643 
   639 
   644 			SetDParam(0, v->unitnumber);
   640 			SetDParam(0, v->unitnumber);
   645 			DrawString(x, y+2, (uint16)(v->max_age-366) >= v->age ? STR_00E2 : STR_00E3, 0);
   641 			DrawString(x, y+2, (uint16)(v->max_age-366) >= v->age ? STR_00E2 : STR_00E3, 0);
   646 
   642 
   673 
   669 
   674 	pos = (row + w->vscroll.pos) * w->hscroll.cap + xt;
   670 	pos = (row + w->vscroll.pos) * w->hscroll.cap + xt;
   675 
   671 
   676 	tile = w->window_number;
   672 	tile = w->window_number;
   677 	FOR_ALL_VEHICLES(v) {
   673 	FOR_ALL_VEHICLES(v) {
   678 		if (v->type == VEH_Ship &&
   674 		if (v->type == VEH_Ship && v->vehstatus & VS_HIDDEN && v->tile == tile &&
   679 				v->vehstatus&VS_HIDDEN &&
       
   680 				v->tile == (TileIndex)tile &&
       
   681 				--pos < 0) {
   675 				--pos < 0) {
   682 					*veh = v;
   676 			*veh = v;
   683 					if (xm >= 19)
   677 			if (xm >= 19) return 0;
   684 						return 0;
   678 			if (ym <= 10) return -1; /* show window */
   685 					if (ym <= 10)
   679 			return -2; /* start stop */
   686 						return -1; /* show window */
   680 		}
   687 					return -2; /* start stop */
       
   688 				}
       
   689 	}
   681 	}
   690 
   682 
   691 	return 1; /* outside */
   683 	return 1; /* outside */
   692 
   684 
   693 }
   685 }