summaryrefslogtreecommitdiff
path: root/roadveh_cmd.c
diff options
context:
space:
mode:
authorcelestar <celestar@openttd.org>2004-11-13 18:01:33 +0000
committercelestar <celestar@openttd.org>2004-11-13 18:01:33 +0000
commit20e9a8061d797bdc17657831ca7182954e5c898a (patch)
tree1888ec4fb56755afee11b82560dc1b218baf1588 /roadveh_cmd.c
parentdae7b4ae21c0ba63083cca7d63b11def87ada7b6 (diff)
downloadopenttd-20e9a8061d797bdc17657831ca7182954e5c898a.tar.xz
(svn r567) -newgrf: Support for road vehicles customization (seems to work at
least with tropicset). (pasky)
Diffstat (limited to 'roadveh_cmd.c')
-rw-r--r--roadveh_cmd.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/roadveh_cmd.c b/roadveh_cmd.c
index f4a66bcd9..becb2605e 100644
--- a/roadveh_cmd.c
+++ b/roadveh_cmd.c
@@ -56,13 +56,11 @@ int GetRoadVehImage(Vehicle *v, byte direction)
int img = v->spritenum;
int image;
-#ifdef ROADVEH_CUSTOM_SPRITES // TODO --pasky
if (is_custom_sprite(img)) {
image = GetCustomVehicleSprite(v, direction);
if (image) return image;
img = _engine_original_sprites[v->engine_type];
}
-#endif
image = direction + _roadveh_images[img];
if (v->cargo_count >= (v->cargo_cap >> 1))
@@ -72,7 +70,18 @@ int GetRoadVehImage(Vehicle *v, byte direction)
void DrawRoadVehEngine(int x, int y, int engine, uint32 image_ormod)
{
- DrawSprite((6 + _roadveh_images[road_vehicle_info(engine)->image_index]) | image_ormod, x, y);
+ int spritenum = road_vehicle_info(engine)->image_index;
+
+ if (is_custom_sprite(spritenum)) {
+ int sprite = GetCustomVehicleIcon(engine, 6);
+
+ if (sprite) {
+ DrawSprite(sprite | image_ormod, x, y);
+ return;
+ }
+ spritenum = _engine_original_sprites[engine];
+ }
+ DrawSprite((6 + _roadveh_images[spritenum]) | image_ormod, x, y);
}
void DrawRoadVehEngineInfo(int engine, int x, int y, int maxw)