src/station_gui.cpp
changeset 7824 5a63d41b59ea
parent 7474 1daa825ba893
child 7842 08babe3cf58a
equal deleted inserted replaced
7823:7445cb71f080 7824:5a63d41b59ea
    77 			w += x;
    77 			w += x;
    78 			GfxFillRect(w, y + 6 - rest, w, y + 6, colour);
    78 			GfxFillRect(w, y + 6 - rest, w, y + 6, colour);
    79 		}
    79 		}
    80 	}
    80 	}
    81 
    81 
    82 	DrawString(x + 1, y, cs->abbrev, 0x10);
    82 	DrawString(x + 1, y, cs->abbrev, TC_BLACK);
    83 
    83 
    84 	/* Draw green/red ratings bar (fits into 14 pixels) */
    84 	/* Draw green/red ratings bar (fits into 14 pixels) */
    85 	y += 8;
    85 	y += 8;
    86 	GfxFillRect(x + 1, y, x + 14, y, 0xB8);
    86 	GfxFillRect(x + 1, y, x + 14, y, 0xB8);
    87 	rating = minu(rating,  224) / 16;
    87 	rating = minu(rating,  224) / 16;
   312 			SetDParam(0, owner);
   312 			SetDParam(0, owner);
   313 			SetDParam(1, w->vscroll.count);
   313 			SetDParam(1, w->vscroll.count);
   314 			DrawWindowWidgets(w);
   314 			DrawWindowWidgets(w);
   315 
   315 
   316 			/* draw sorting criteria string */
   316 			/* draw sorting criteria string */
   317 			DrawString(85, 26, _station_sort_listing[sl->sort_type], 0x10);
   317 			DrawString(85, 26, _station_sort_listing[sl->sort_type], TC_BLACK);
   318 			/* draw arrow pointing up/down for ascending/descending sorting */
   318 			/* draw arrow pointing up/down for ascending/descending sorting */
   319 			DoDrawString(sl->flags & SL_ORDER ? DOWNARROW : UPARROW, 69, 26, 0x10);
   319 			DoDrawString(sl->flags & SL_ORDER ? DOWNARROW : UPARROW, 69, 26, TC_BLACK);
   320 
   320 
   321 			int cg_ofst;
   321 			int cg_ofst;
   322 			int x = 89;
   322 			int x = 89;
   323 			int y = 14;
   323 			int y = 14;
   324 			int xb = 2; ///< offset from left of widget
   324 			int xb = 2; ///< offset from left of widget
   328 				const CargoSpec *cs = GetCargo(c);
   328 				const CargoSpec *cs = GetCargo(c);
   329 				if (!cs->IsValid()) continue;
   329 				if (!cs->IsValid()) continue;
   330 
   330 
   331 				cg_ofst = HASBIT(_cargo_filter, c) ? 2 : 1;
   331 				cg_ofst = HASBIT(_cargo_filter, c) ? 2 : 1;
   332 				GfxFillRect(x + cg_ofst, y + cg_ofst, x + cg_ofst + 10 , y + cg_ofst + 7, cs->rating_colour);
   332 				GfxFillRect(x + cg_ofst, y + cg_ofst, x + cg_ofst + 10 , y + cg_ofst + 7, cs->rating_colour);
   333 				DrawStringCentered(x + 6 + cg_ofst, y + cg_ofst, cs->abbrev, 0x10);
   333 				DrawStringCentered(x + 6 + cg_ofst, y + cg_ofst, cs->abbrev, TC_BLACK);
   334 				x += 14;
   334 				x += 14;
   335 				i++;
   335 				i++;
   336 			}
   336 			}
   337 
   337 
   338 			x += 6;
   338 			x += 6;
   339 			cg_ofst = IsWindowWidgetLowered(w, STATIONLIST_WIDGET_NOCARGOWAITING) ? 2 : 1;
   339 			cg_ofst = IsWindowWidgetLowered(w, STATIONLIST_WIDGET_NOCARGOWAITING) ? 2 : 1;
   340 			DrawStringCentered(x + cg_ofst, y + cg_ofst, STR_ABBREV_NONE, 16);
   340 			DrawStringCentered(x + cg_ofst, y + cg_ofst, STR_ABBREV_NONE, TC_BLACK);
   341 			x += 14;
   341 			x += 14;
   342 			cg_ofst = IsWindowWidgetLowered(w, STATIONLIST_WIDGET_CARGOALL) ? 2 : 1;
   342 			cg_ofst = IsWindowWidgetLowered(w, STATIONLIST_WIDGET_CARGOALL) ? 2 : 1;
   343 			DrawStringCentered(x + cg_ofst, y + cg_ofst, STR_ABBREV_ALL, 16);
   343 			DrawStringCentered(x + cg_ofst, y + cg_ofst, STR_ABBREV_ALL, TC_BLACK);
   344 
   344 
   345 			cg_ofst = IsWindowWidgetLowered(w, STATIONLIST_WIDGET_FACILALL) ? 2 : 1;
   345 			cg_ofst = IsWindowWidgetLowered(w, STATIONLIST_WIDGET_FACILALL) ? 2 : 1;
   346 			DrawString(71 + cg_ofst, y + cg_ofst, STR_ABBREV_ALL, 16);
   346 			DrawString(71 + cg_ofst, y + cg_ofst, STR_ABBREV_ALL, TC_BLACK);
   347 
   347 
   348 			if (w->vscroll.count == 0) { // player has no stations
   348 			if (w->vscroll.count == 0) { // player has no stations
   349 				DrawString(xb, 40, STR_304A_NONE, 0);
   349 				DrawString(xb, 40, STR_304A_NONE, TC_FROMSTRING);
   350 				return;
   350 				return;
   351 			}
   351 			}
   352 
   352 
   353 			int max = min(w->vscroll.pos + w->vscroll.cap, sl->list_length);
   353 			int max = min(w->vscroll.pos + w->vscroll.cap, sl->list_length);
   354 			y = 40; // start of the list-widget
   354 			y = 40; // start of the list-widget
   360 				assert(st->xy != 0);
   360 				assert(st->xy != 0);
   361 				assert(st->owner == owner);
   361 				assert(st->owner == owner);
   362 
   362 
   363 				SetDParam(0, st->index);
   363 				SetDParam(0, st->index);
   364 				SetDParam(1, st->facilities);
   364 				SetDParam(1, st->facilities);
   365 				x = DrawString(xb, y, STR_3049_0, 0) + 5;
   365 				x = DrawString(xb, y, STR_3049_0, TC_FROMSTRING) + 5;
   366 
   366 
   367 				/* show cargo waiting and station ratings */
   367 				/* show cargo waiting and station ratings */
   368 				for (CargoID j = 0; j < NUM_CARGO; j++) {
   368 				for (CargoID j = 0; j < NUM_CARGO; j++) {
   369 					if (!st->goods[j].cargo.Empty()) {
   369 					if (!st->goods[j].cargo.Empty()) {
   370 						StationsWndShowStationRating(x, y, j, st->goods[j].cargo.Count(), st->goods[j].rating);
   370 						StationsWndShowStationRating(x, y, j, st->goods[j].cargo.Count(), st->goods[j].rating);
   727 		str = STR_00D0_NOTHING;
   727 		str = STR_00D0_NOTHING;
   728 		for (CargoID i = 0; i < NUM_CARGO; i++) {
   728 		for (CargoID i = 0; i < NUM_CARGO; i++) {
   729 			if (!st->goods[i].cargo.Empty()) str = STR_EMPTY;
   729 			if (!st->goods[i].cargo.Empty()) str = STR_EMPTY;
   730 		}
   730 		}
   731 		SetDParam(0, str);
   731 		SetDParam(0, str);
   732 		DrawString(x, y, STR_0008_WAITING, 0);
   732 		DrawString(x, y, STR_0008_WAITING, TC_FROMSTRING);
   733 		y += 10;
   733 		y += 10;
   734 	}
   734 	}
   735 
   735 
   736 	for (CargoID i = 0; i < NUM_CARGO && pos > -5; i++) {
   736 	for (CargoID i = 0; i < NUM_CARGO && pos > -5; i++) {
   737 		uint waiting = st->goods[i].cargo.Count();
   737 		uint waiting = st->goods[i].cargo.Count();
   740 		if (st->goods[i].cargo.Source() == station_id) {
   740 		if (st->goods[i].cargo.Source() == station_id) {
   741 			if (--pos < 0) {
   741 			if (--pos < 0) {
   742 				DrawCargoIcons(i, waiting, x, y);
   742 				DrawCargoIcons(i, waiting, x, y);
   743 				SetDParam(1, waiting);
   743 				SetDParam(1, waiting);
   744 				SetDParam(0, i);
   744 				SetDParam(0, i);
   745 				DrawStringRightAligned(x + 234, y, STR_0009, 0);
   745 				DrawStringRightAligned(x + 234, y, STR_0009, TC_FROMSTRING);
   746 				y += 10;
   746 				y += 10;
   747 			}
   747 			}
   748 		} else {
   748 		} else {
   749 			/* enroute */
   749 			/* enroute */
   750 			if (--pos < 0) {
   750 			if (--pos < 0) {
   751 				DrawCargoIcons(i, waiting, x, y);
   751 				DrawCargoIcons(i, waiting, x, y);
   752 				SetDParam(1, waiting);
   752 				SetDParam(1, waiting);
   753 				SetDParam(0, i);
   753 				SetDParam(0, i);
   754 				DrawStringRightAligned(x + 234, y, STR_000A_EN_ROUTE_FROM, 0);
   754 				DrawStringRightAligned(x + 234, y, STR_000A_EN_ROUTE_FROM, TC_FROMSTRING);
   755 				y += 10;
   755 				y += 10;
   756 			}
   756 			}
   757 
   757 
   758 			if (pos > -5 && --pos < 0) {
   758 			if (pos > -5 && --pos < 0) {
   759 				SetDParam(0, st->goods[i].cargo.Source());
   759 				SetDParam(0, st->goods[i].cargo.Source());
   760 				DrawStringRightAligned(x + 234, y, STR_000B, 0);
   760 				DrawStringRightAligned(x + 234, y, STR_000B, TC_FROMSTRING);
   761 				y += 10;
   761 				y += 10;
   762 			}
   762 			}
   763 		}
   763 		}
   764 	}
   764 	}
   765 
   765 
   787 		if (first) b = InlineString(b, STR_00D0_NOTHING);
   787 		if (first) b = InlineString(b, STR_00D0_NOTHING);
   788 
   788 
   789 		*b = '\0';
   789 		*b = '\0';
   790 		DrawStringMultiLine(2, 67, STR_SPEC_USERSTRING, 245);
   790 		DrawStringMultiLine(2, 67, STR_SPEC_USERSTRING, 245);
   791 	} else {
   791 	} else {
   792 		DrawString(2, 67, STR_3034_LOCAL_RATING_OF_TRANSPORT, 0);
   792 		DrawString(2, 67, STR_3034_LOCAL_RATING_OF_TRANSPORT, TC_FROMSTRING);
   793 
   793 
   794 		y = 77;
   794 		y = 77;
   795 		for (CargoID i = 0; i < NUM_CARGO; i++) {
   795 		for (CargoID i = 0; i < NUM_CARGO; i++) {
   796 			const CargoSpec *cs = GetCargo(i);
   796 			const CargoSpec *cs = GetCargo(i);
   797 			if (!cs->IsValid()) continue;
   797 			if (!cs->IsValid()) continue;
   800 			if (!HASBIT(ge->acceptance_pickup, GoodsEntry::PICKUP)) continue;
   800 			if (!HASBIT(ge->acceptance_pickup, GoodsEntry::PICKUP)) continue;
   801 
   801 
   802 			SetDParam(0, cs->name);
   802 			SetDParam(0, cs->name);
   803 			SetDParam(2, ge->rating * 101 >> 8);
   803 			SetDParam(2, ge->rating * 101 >> 8);
   804 			SetDParam(1, STR_3035_APPALLING + (ge->rating >> 5));
   804 			SetDParam(1, STR_3035_APPALLING + (ge->rating >> 5));
   805 			DrawString(8, y, STR_303D, 0);
   805 			DrawString(8, y, STR_303D, TC_FROMSTRING);
   806 			y += 10;
   806 			y += 10;
   807 		}
   807 		}
   808 	}
   808 	}
   809 }
   809 }
   810 
   810