Changeset - r16821:db130aa96d2d
[Not reviewed]
master
0 3 0
terkhen - 14 years ago 2010-12-21 13:56:52
terkhen@openttd.org
(svn r21565) -Codechange: Add pixel skip to DrawRoadVehImage().
3 files changed with 5 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/roadveh_gui.cpp
Show inline comments
 
@@ -125,14 +125,15 @@ void DrawRoadVehDetails(const Vehicle *v
 
 * Draws an image of a road vehicle chain
 
 * @param v         Front vehicle
 
 * @param left      The minimum horizontal position
 
 * @param right     The maximum horizontal position
 
 * @param y         Vertical position to draw at
 
 * @param selection Selected vehicle to draw a frame around
 
 * @param skip      Number of pixels to skip at the front (for scrolling)
 
 */
 
void DrawRoadVehImage(const Vehicle *v, int left, int right, int y, VehicleID selection)
 
void DrawRoadVehImage(const Vehicle *v, int left, int right, int y, VehicleID selection, int skip)
 
{
 
	bool rtl = _current_text_dir == TD_RTL;
 
	Direction dir = rtl ? DIR_E : DIR_W;
 
	const RoadVehicle *u = RoadVehicle::From(v);
 

	
 
	DrawPixelInfo tmp_dpi, *old_dpi;
 
@@ -140,13 +141,13 @@ void DrawRoadVehImage(const Vehicle *v, 
 

	
 
	if (!FillDrawPixelInfo(&tmp_dpi, left, y, max_width, 14)) return;
 

	
 
	old_dpi = _cur_dpi;
 
	_cur_dpi = &tmp_dpi;
 

	
 
	int px = rtl ? max_width : 0;
 
	int px = rtl ? max_width + skip : -skip;
 
	for (; u != NULL && (rtl ? px > 0 : px < max_width); u = u->Next()) {
 
		Point offset;
 
		int width = u->GetDisplayImageWidth(&offset);
 

	
 
		if (rtl ? px + width > 0 : px - width < max_width) {
 
			PaletteID pal = (u->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(u);
src/vehicle_gui.cpp
Show inline comments
 
@@ -995,13 +995,13 @@ static void DrawSmallOrderList(const Veh
 
 * @param skip      Number of pixels to skip at the front (for scrolling)
 
 */
 
void DrawVehicleImage(const Vehicle *v, int left, int right, int y, VehicleID selection, int skip)
 
{
 
	switch (v->type) {
 
		case VEH_TRAIN:    DrawTrainImage(Train::From(v), left, right, y, selection, skip); break;
 
		case VEH_ROAD:     DrawRoadVehImage(v, left, right, y, selection);  break;
 
		case VEH_ROAD:     DrawRoadVehImage(v, left, right, y, selection, skip);  break;
 
		case VEH_SHIP:     DrawShipImage(v, left, right, y, selection);     break;
 
		case VEH_AIRCRAFT: DrawAircraftImage(v, left, right, y, selection); break;
 
		default: NOT_REACHED();
 
	}
 
}
 

	
src/vehicle_gui.h
Show inline comments
 
@@ -46,13 +46,13 @@ enum TrainDetailsWindowTabs {
 
	TDW_TAB_TOTALS,    ///< Tab with sum of total cargo transported
 
};
 

	
 
int DrawVehiclePurchaseInfo(int left, int right, int y, EngineID engine_number);
 

	
 
void DrawTrainImage(const Train *v, int left, int right, int y, VehicleID selection, int skip, VehicleID drag_dest = INVALID_VEHICLE);
 
void DrawRoadVehImage(const Vehicle *v, int left, int right, int y, VehicleID selection);
 
void DrawRoadVehImage(const Vehicle *v, int left, int right, int y, VehicleID selection, int skip = 0);
 
void DrawShipImage(const Vehicle *v, int left, int right, int y, VehicleID selection);
 
void DrawAircraftImage(const Vehicle *v, int left, int right, int y, VehicleID selection);
 

	
 
void ShowBuildVehicleWindow(TileIndex tile, VehicleType type);
 

	
 
uint ShowRefitOptionsList(int left, int right, int y, EngineID engine);
0 comments (0 inline, 0 general)