File diff r8555:63e19bfda16e → r8556:c5860d29500d
src/vehicle_gui.cpp
Show inline comments
 
@@ -170,13 +170,13 @@ void DrawVehicleProfitButton(const Vehic
 

	
 
	/* draw profit-based colored icons */
 
	if (v->age <= 365 * 2) {
 
		pal = PALETTE_TO_GREY;
 
	} else if (v->profit_last_year < 0) {
 
		pal = PALETTE_TO_RED;
 
	} else if (v->profit_last_year < 10000) {
 
	} else if (v->profit_last_year >> 8 < 10000) {
 
		pal = PALETTE_TO_YELLOW;
 
	} else {
 
		pal = PALETTE_TO_GREEN;
 
	}
 
	DrawSprite(SPR_BLOT, pal, x, y);
 
}
 
@@ -595,13 +595,13 @@ static int CDECL VehicleProfitThisYearSo
 
}
 

	
 
static int CDECL VehicleProfitLastYearSorter(const void *a, const void *b)
 
{
 
	const Vehicle* va = *(const Vehicle**)a;
 
	const Vehicle* vb = *(const Vehicle**)b;
 
	int r = ClampToI32(va->profit_last_year - vb->profit_last_year);
 
	int r = ClampToI32((va->profit_last_year - vb->profit_last_year) >> 8);
 

	
 
	VEHICLEUNITNUMBERSORTER(r, va, vb);
 

	
 
	return (_internal_sort_order & 1) ? -r : r;
 
}
 

	
 
@@ -980,14 +980,14 @@ static void DrawVehicleListWindow(Window
 

	
 
	max = min(w->vscroll.pos + w->vscroll.cap, vl->l.list_length);
 
	for (i = w->vscroll.pos; i < max; ++i) {
 
		const Vehicle *v = vl->sort_list[i];
 
		StringID str;
 

	
 
		SetDParam(0, v->profit_this_year);
 
		SetDParam(1, v->profit_last_year);
 
		SetDParam(0, v->profit_this_year >> 8);
 
		SetDParam(1, v->profit_last_year >> 8);
 

	
 
		DrawVehicleImage(v, x + 19, y + 6, INVALID_VEHICLE, w->widget[VLW_WIDGET_LIST].right - w->widget[VLW_WIDGET_LIST].left - 20, 0);
 
		DrawString(x + 19, y + w->resize.step_height - 8, STR_0198_PROFIT_THIS_YEAR_LAST_YEAR, TC_FROMSTRING);
 

	
 
		if (v->name != NULL) {
 
			/* The vehicle got a name so we will print it */
 
@@ -1497,14 +1497,14 @@ static void DrawVehicleDetailsWindow(Win
 
			break;
 

	
 
		default: NOT_REACHED();
 
	}
 

	
 
	/* Draw profit */
 
	SetDParam(0, v->profit_this_year);
 
	SetDParam(1, v->profit_last_year);
 
	SetDParam(0, v->profit_this_year >> 8);
 
	SetDParam(1, v->profit_last_year >> 8);
 
	DrawString(2, 35, _vehicle_translation_table[VST_VEHICLE_PROFIT_THIS_YEAR_LAST_YEAR][v->type], TC_FROMSTRING);
 

	
 
	/* Draw breakdown & reliability */
 
	SetDParam(0, v->reliability * 100 >> 16);
 
	SetDParam(1, v->breakdowns_since_last_service);
 
	DrawString(2, 45, _vehicle_translation_table[VST_VEHICLE_RELIABILITY_BREAKDOWNS][v->type], TC_FROMSTRING);