Changeset - r13589:d06fa116bfaa
[Not reviewed]
master
0 4 0
rubidium - 15 years ago 2009-11-16 17:58:46
rubidium@openttd.org
(svn r18123) -Codechange: try our best to keep the vehicles within the build vehicle list/autoreplace lists instead of overflowing.
4 files changed with 21 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/aircraft_cmd.cpp
Show inline comments
 
@@ -200,7 +200,10 @@ static SpriteID GetAircraftIcon(EngineID
 

	
 
void DrawAircraftEngine(int left, int right, int preferred_x, int y, EngineID engine, SpriteID pal)
 
{
 
	DrawSprite(GetAircraftIcon(engine), pal, preferred_x, y);
 
	SpriteID sprite = GetAircraftIcon(engine);
 
	const Sprite *real_sprite = GetSprite(sprite, ST_NORMAL);
 
	preferred_x = Clamp(preferred_x, left - real_sprite->x_offs, right - real_sprite->width - real_sprite->x_offs);
 
	DrawSprite(sprite, pal, preferred_x, y);
 

	
 
	if (!(AircraftVehInfo(engine)->subtype & AIR_CTOL)) {
 
		SpriteID rotor_sprite = GetCustomRotorIcon(engine);
src/roadveh_cmd.cpp
Show inline comments
 
@@ -36,6 +36,7 @@
 
#include "effectvehicle_func.h"
 
#include "roadstop_base.h"
 
#include "cargotype.h"
 
#include "spritecache.h"
 

	
 
#include "table/strings.h"
 
#include "table/sprites.h"
 
@@ -140,7 +141,10 @@ SpriteID RoadVehicle::GetImage(Direction
 

	
 
void DrawRoadVehEngine(int left, int right, int preferred_x, int y, EngineID engine, SpriteID pal)
 
{
 
	DrawSprite(GetRoadVehIcon(engine), pal, preferred_x, y);
 
	SpriteID sprite = GetRoadVehIcon(engine);
 
	const Sprite *real_sprite = GetSprite(sprite, ST_NORMAL);
 
	preferred_x = Clamp(preferred_x, left - real_sprite->x_offs, right - real_sprite->width - real_sprite->x_offs);
 
	DrawSprite(sprite, pal, preferred_x, y);
 
}
 

	
 
static uint GetRoadVehLength(const RoadVehicle *v)
src/ship_cmd.cpp
Show inline comments
 
@@ -70,7 +70,10 @@ static SpriteID GetShipIcon(EngineID eng
 

	
 
void DrawShipEngine(int left, int right, int preferred_x, int y, EngineID engine, SpriteID pal)
 
{
 
	DrawSprite(GetShipIcon(engine), pal, preferred_x, y);
 
	SpriteID sprite = GetShipIcon(engine);
 
	const Sprite *real_sprite = GetSprite(sprite, ST_NORMAL);
 
	preferred_x = Clamp(preferred_x, left - real_sprite->x_offs, right - real_sprite->width - real_sprite->x_offs);
 
	DrawSprite(sprite, pal, preferred_x, y);
 
}
 

	
 
/** Get the size of the sprite of a ship sprite heading west (used for lists)
src/train_cmd.cpp
Show inline comments
 
@@ -35,6 +35,7 @@
 
#include "effectvehicle_func.h"
 
#include "gamelog.h"
 
#include "network/network.h"
 
#include "spritecache.h"
 

	
 
#include "table/strings.h"
 
#include "table/train_cmd.h"
 
@@ -665,10 +666,17 @@ void DrawTrainEngine(int left, int right
 

	
 
		SpriteID spritef = GetRailIcon(engine, false, yf);
 
		SpriteID spriter = GetRailIcon(engine, true, yr);
 
		const Sprite *real_spritef = GetSprite(spritef, ST_NORMAL);
 
		const Sprite *real_spriter = GetSprite(spriter, ST_NORMAL);
 

	
 
		preferred_x = Clamp(preferred_x, left - real_spritef->x_offs + 14, right - real_spriter->width - real_spriter->x_offs - 15);
 

	
 
		DrawSprite(spritef, pal, preferred_x - 14, yf);
 
		DrawSprite(spriter, pal, preferred_x + 15, yr);
 
	} else {
 
		SpriteID sprite = GetRailIcon(engine, false, y);
 
		const Sprite *real_sprite = GetSprite(sprite, ST_NORMAL);
 
		preferred_x = Clamp(preferred_x, left - real_sprite->x_offs, right - real_sprite->width - real_sprite->x_offs);
 
		DrawSprite(sprite, pal, preferred_x, y);
 
	}
 
}
0 comments (0 inline, 0 general)