(svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
authortron
Sat, 01 Oct 2005 12:43:34 +0000
changeset 2477 d454d5152386
parent 2476 5beb5ae528fd
child 2478 16b05f1de6bb
(svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
aircraft_cmd.c
aircraft_gui.c
engine.c
engine.h
engine_gui.c
roadveh_cmd.c
roadveh_gui.c
ship_cmd.c
ship_gui.c
train_cmd.c
train_gui.c
vehicle_gui.c
--- a/aircraft_cmd.c	Fri Sep 30 20:51:20 2005 +0000
+++ b/aircraft_cmd.c	Sat Oct 01 12:43:34 2005 +0000
@@ -102,7 +102,7 @@
 	return direction + _aircraft_sprite[spritenum];
 }
 
-void DrawAircraftEngine(int x, int y, int engine, uint32 image_ormod)
+void DrawAircraftEngine(int x, int y, EngineID engine, uint32 image_ormod)
 {
 	int spritenum = AircraftVehInfo(engine)->image_index;
 	int sprite = (6 + _aircraft_sprite[spritenum]);
@@ -237,7 +237,7 @@
 
 		v->max_speed = avi->max_speed;
 		v->acceleration = avi->acceleration;
-		v->engine_type = (byte)p1;
+		v->engine_type = p1;
 
 		v->subtype = (avi->subtype & 1) == 0 ? 0 : 2;
 		v->value = value;
--- a/aircraft_gui.c	Fri Sep 30 20:51:20 2005 +0000
+++ b/aircraft_gui.c	Sat Oct 01 12:43:34 2005 +0000
@@ -128,7 +128,7 @@
 			int y = 15;
 			int sel = WP(w,buildtrain_d).sel_index;
 			int pos = w->vscroll.pos;
-			int engine_id = AIRCRAFT_ENGINES_INDEX;
+			EngineID engine_id = AIRCRAFT_ENGINES_INDEX;
 			int selected_id = -1;
 
 			do {
--- a/engine.c	Fri Sep 30 20:51:20 2005 +0000
+++ b/engine.c	Sat Oct 01 12:43:34 2005 +0000
@@ -93,7 +93,7 @@
 };
 #undef MC
 
-void ShowEnginePreviewWindow(int engine);
+void ShowEnginePreviewWindow(EngineID engine);
 
 void DeleteCustomEngineNames(void)
 {
@@ -250,7 +250,7 @@
 
 static WagonOverrides _engine_wagon_overrides[TOTAL_NUM_ENGINES];
 
-void SetWagonOverrideSprites(byte engine, SpriteGroup *group, byte *train_id,
+void SetWagonOverrideSprites(EngineID engine, SpriteGroup *group, byte *train_id,
 	int trains)
 {
 	WagonOverrides *wos;
@@ -271,7 +271,7 @@
 	memcpy(wo->train_id, train_id, trains);
 }
 
-static const SpriteGroup *GetWagonOverrideSpriteSet(byte engine, byte overriding_engine)
+static const SpriteGroup *GetWagonOverrideSpriteSet(EngineID engine, byte overriding_engine)
 {
 	const WagonOverrides *wos = &_engine_wagon_overrides[engine];
 	int i;
@@ -300,7 +300,7 @@
 // memory. --pasky)
 static SpriteGroup _engine_custom_sprites[TOTAL_NUM_ENGINES][NUM_GLOBAL_CID];
 
-void SetCustomEngineSprites(byte engine, byte cargo, SpriteGroup *group)
+void SetCustomEngineSprites(EngineID engine, byte cargo, SpriteGroup *group)
 {
 	/* FIXME: If we are replacing an override, release original SpriteGroup
 	 * to prevent leaks. But first we need to refcount the SpriteGroup.
@@ -494,7 +494,7 @@
 	}
 }
 
-static const SpriteGroup *GetVehicleSpriteGroup(byte engine, const Vehicle *v)
+static const SpriteGroup *GetVehicleSpriteGroup(EngineID engine, const Vehicle *v)
 {
 	const SpriteGroup *group;
 	byte cargo = GC_PURCHASE;
@@ -515,7 +515,7 @@
 	return group;
 }
 
-int GetCustomEngineSprite(byte engine, const Vehicle *v, byte direction)
+int GetCustomEngineSprite(EngineID engine, const Vehicle *v, byte direction)
 {
 	const SpriteGroup *group;
 	const RealSpriteGroup *rsg;
@@ -597,7 +597,7 @@
  * @param vehicle The vehicle to evaluate the callback for, NULL if it doesnt exist (yet)
  * @return The value the callback returned, or CALLBACK_FAILED if it failed
  */
-uint16 GetCallBackResult(uint16 callback_info, byte engine, const Vehicle *v)
+uint16 GetCallBackResult(uint16 callback_info, EngineID engine, const Vehicle *v)
 {
 	const SpriteGroup *group;
 	byte cargo = GC_DEFAULT;
@@ -716,7 +716,7 @@
 
 static char *_engine_custom_names[TOTAL_NUM_ENGINES];
 
-void SetCustomEngineName(int engine, const char *name)
+void SetCustomEngineName(EngineID engine, const char *name)
 {
 	_engine_custom_names[engine] = strdup(name);
 }
@@ -730,7 +730,7 @@
 	}
 }
 
-StringID GetCustomEngineName(int engine)
+StringID GetCustomEngineName(EngineID engine)
 {
 	if (!_engine_custom_names[engine])
 		return _engine_name_strings[engine];
@@ -780,7 +780,7 @@
 
 void EnginesDailyLoop(void)
 {
-	uint i;
+	EngineID i;
 
 	if (_cur_year >= 130) return;
 
@@ -837,7 +837,7 @@
 }
 
 // Determine if an engine type is a wagon (and not a loco)
-static bool IsWagon(byte index)
+static bool IsWagon(EngineID index)
 {
 	return index < NUM_TRAIN_ENGINES && RailVehInfo(index)->flags & RVI_WAGON;
 }
@@ -846,7 +846,7 @@
 {
 	Vehicle *v;
 	Player *p;
-	int index = e - _engines;
+	EngineID index = e - _engines;
 
 	// In case the player didn't build the vehicle during the intro period,
 	// prevent that player from getting future intro periods for a while.
@@ -892,11 +892,11 @@
 		}
 	}
 
-	if ((byte)index < NUM_TRAIN_ENGINES) {
+	if (index < NUM_TRAIN_ENGINES) {
 		AddNewsItem(index, NEWS_FLAGS(NM_CALLBACK, 0, NT_NEW_VEHICLES, DNC_TRAINAVAIL), 0, 0);
-	} else if ((byte)index < NUM_TRAIN_ENGINES + NUM_ROAD_ENGINES) {
+	} else if (index < NUM_TRAIN_ENGINES + NUM_ROAD_ENGINES) {
 		AddNewsItem(index, NEWS_FLAGS(NM_CALLBACK, 0, NT_NEW_VEHICLES, DNC_ROADAVAIL), 0, 0);
-	} else if ((byte)index < NUM_TRAIN_ENGINES + NUM_ROAD_ENGINES + NUM_SHIP_ENGINES) {
+	} else if (index < NUM_TRAIN_ENGINES + NUM_ROAD_ENGINES + NUM_SHIP_ENGINES) {
 		AddNewsItem(index, NEWS_FLAGS(NM_CALLBACK, 0, NT_NEW_VEHICLES, DNC_SHIPAVAIL), 0, 0);
 	} else {
 		AddNewsItem(index, NEWS_FLAGS(NM_CALLBACK, 0, NT_NEW_VEHICLES, DNC_AIRCRAFTAVAIL), 0, 0);
--- a/engine.h	Fri Sep 30 20:51:20 2005 +0000
+++ b/engine.h	Sat Oct 01 12:43:34 2005 +0000
@@ -172,11 +172,11 @@
 VARDEF const CargoID _local_cargo_id_ctype[NUM_GLOBAL_CID];
 
 VARDEF uint32 _engine_refit_masks[256];
-void SetWagonOverrideSprites(byte engine, struct SpriteGroup *group, byte *train_id, int trains);
-void SetCustomEngineSprites(byte engine, byte cargo, struct SpriteGroup *group);
+void SetWagonOverrideSprites(EngineID engine, struct SpriteGroup *group, byte *train_id, int trains);
+void SetCustomEngineSprites(EngineID engine, byte cargo, struct SpriteGroup *group);
 // loaded is in percents, overriding_engine 0xffff is none
-int GetCustomEngineSprite(byte engine, const Vehicle *v, byte direction);
-uint16 GetCallBackResult(uint16 callback_info, byte engine, const Vehicle *v);
+int GetCustomEngineSprite(EngineID engine, const Vehicle *v, byte direction);
+uint16 GetCallBackResult(uint16 callback_info, EngineID engine, const Vehicle *v);
 bool UsesWagonOverride(const Vehicle *v);
 #define GetCustomVehicleSprite(v, direction) GetCustomEngineSprite(v->engine_type, v, direction)
 #define GetCustomVehicleIcon(et, direction) GetCustomEngineSprite(et, NULL, direction)
@@ -192,14 +192,14 @@
 } VehicleTrigger;
 void TriggerVehicle(Vehicle *veh, VehicleTrigger trigger);
 
-void SetCustomEngineName(int engine, const char *name);
-StringID GetCustomEngineName(int engine);
+void SetCustomEngineName(EngineID engine, const char *name);
+StringID GetCustomEngineName(EngineID engine);
 
 
-void DrawTrainEngine(int x, int y, int engine, uint32 image_ormod);
-void DrawRoadVehEngine(int x, int y, int engine, uint32 image_ormod);
-void DrawShipEngine(int x, int y, int engine, uint32 image_ormod);
-void DrawAircraftEngine(int x, int y, int engine, uint32 image_ormod);
+void DrawTrainEngine(int x, int y, EngineID engine, uint32 image_ormod);
+void DrawRoadVehEngine(int x, int y, EngineID engine, uint32 image_ormod);
+void DrawShipEngine(int x, int y, EngineID engine, uint32 image_ormod);
+void DrawAircraftEngine(int x, int y, EngineID engine, uint32 image_ormod);
 
 void AcceptEnginePreview(Engine *e, PlayerID player);
 
@@ -225,7 +225,7 @@
 VARDEF Engine _engines[TOTAL_NUM_ENGINES];
 #define FOR_ALL_ENGINES(e) for (e = _engines; e != endof(_engines); e++)
 
-static inline Engine* GetEngine(uint i)
+static inline Engine* GetEngine(EngineID i)
 {
   assert(i < lengthof(_engines));
   return &_engines[i];
@@ -252,27 +252,27 @@
 AircraftVehicleInfo _aircraft_vehicle_info[NUM_AIRCRAFT_ENGINES];
 RoadVehicleInfo _road_vehicle_info[NUM_ROAD_ENGINES];
 
-static inline const RailVehicleInfo *RailVehInfo(uint e)
+static inline const RailVehicleInfo* RailVehInfo(EngineID e)
 {
 	assert(e < lengthof(_rail_vehicle_info));
 	return &_rail_vehicle_info[e];
 }
 
-static inline const ShipVehicleInfo *ShipVehInfo(uint e)
+static inline const ShipVehicleInfo* ShipVehInfo(EngineID e)
 {
-	assert(e - SHIP_ENGINES_INDEX < lengthof(_ship_vehicle_info));
+	assert(e >= SHIP_ENGINES_INDEX && e < SHIP_ENGINES_INDEX + lengthof(_ship_vehicle_info));
 	return &_ship_vehicle_info[e - SHIP_ENGINES_INDEX];
 }
 
-static inline const AircraftVehicleInfo *AircraftVehInfo(uint e)
+static inline const AircraftVehicleInfo* AircraftVehInfo(EngineID e)
 {
-	assert(e - AIRCRAFT_ENGINES_INDEX < lengthof(_aircraft_vehicle_info));
+	assert(e >= AIRCRAFT_ENGINES_INDEX && e < AIRCRAFT_ENGINES_INDEX + lengthof(_aircraft_vehicle_info));
 	return &_aircraft_vehicle_info[e - AIRCRAFT_ENGINES_INDEX];
 }
 
-static inline const RoadVehicleInfo *RoadVehInfo(uint e)
+static inline const RoadVehicleInfo* RoadVehInfo(EngineID e)
 {
-	assert(e - ROAD_ENGINES_INDEX < lengthof(_road_vehicle_info));
+	assert(e >= ROAD_ENGINES_INDEX && e < ROAD_ENGINES_INDEX + lengthof(_road_vehicle_info));
 	return &_road_vehicle_info[e - ROAD_ENGINES_INDEX];
 }
 
--- a/engine_gui.c	Fri Sep 30 20:51:20 2005 +0000
+++ b/engine_gui.c	Sat Oct 01 12:43:34 2005 +0000
@@ -15,7 +15,7 @@
 #include "variables.h"
 
 
-static StringID GetEngineCategoryName(byte engine)
+static StringID GetEngineCategoryName(EngineID engine)
 {
 	if (engine < NUM_TRAIN_ENGINES) {
 		switch (GetEngine(engine)->railtype) {
@@ -46,18 +46,18 @@
 {   WIDGETS_END},
 };
 
-typedef void DrawEngineProc(int x, int y, int engine, uint32 image_ormod);
-typedef void DrawEngineInfoProc(int x, int y, int engine, int maxw);
+typedef void DrawEngineProc(int x, int y, EngineID engine, uint32 image_ormod);
+typedef void DrawEngineInfoProc(EngineID, int x, int y, int maxw);
 
 typedef struct DrawEngineInfo {
 	DrawEngineProc *engine_proc;
 	DrawEngineInfoProc *info_proc;
 } DrawEngineInfo;
 
-static void DrawTrainEngineInfo(int engine, int x, int y, int maxw);
-static void DrawRoadVehEngineInfo(int engine, int x, int y, int maxw);
-static void DrawShipEngineInfo(int engine, int x, int y, int maxw);
-static void DrawAircraftEngineInfo(int engine, int x, int y, int maxw);
+static void DrawTrainEngineInfo(EngineID engine, int x, int y, int maxw);
+static void DrawRoadVehEngineInfo(EngineID engine, int x, int y, int maxw);
+static void DrawShipEngineInfo(EngineID engine, int x, int y, int maxw);
+static void DrawAircraftEngineInfo(EngineID engine, int x, int y, int maxw);
 
 static const DrawEngineInfo _draw_engine_list[4] = {
 	{DrawTrainEngine,DrawTrainEngineInfo},
@@ -68,31 +68,30 @@
 
 static void EnginePreviewWndProc(Window *w, WindowEvent *e)
 {
-	byte eng;
-	int engine;
 	const DrawEngineInfo *dei;
 	int width;
 
 	switch(e->event) {
-	case WE_PAINT:
+	case WE_PAINT: {
+		EngineID engine = w->window_number;
+
 		DrawWindowWidgets(w);
-		engine = w->window_number;
 
 		SetDParam(0, GetEngineCategoryName(engine));
 		DrawStringMultiCenter(150, 44, STR_8101_WE_HAVE_JUST_DESIGNED_A, 296);
 
 		DrawStringCentered(w->width >> 1, 80, GetCustomEngineName(engine), 0x10);
 
-		eng = (byte)engine;
-		(dei = _draw_engine_list,eng < NUM_TRAIN_ENGINES) ||
-		(dei++,eng < NUM_TRAIN_ENGINES + NUM_ROAD_ENGINES) ||
-		(dei++,eng < NUM_TRAIN_ENGINES + NUM_ROAD_ENGINES + NUM_SHIP_ENGINES) ||
+		(dei = _draw_engine_list,engine < NUM_TRAIN_ENGINES) ||
+		(dei++,engine < NUM_TRAIN_ENGINES + NUM_ROAD_ENGINES) ||
+		(dei++,engine < NUM_TRAIN_ENGINES + NUM_ROAD_ENGINES + NUM_SHIP_ENGINES) ||
 		(dei++, true);
 
 		width = w->width;
 		dei->engine_proc(width >> 1, 100, engine, 0);
 		dei->info_proc(engine, width >> 1, 130, width - 52);
 		break;
+	}
 
 	case WE_CLICK:
 		switch(e->click.widget) {
@@ -115,7 +114,7 @@
 };
 
 
-void ShowEnginePreviewWindow(int engine)
+void ShowEnginePreviewWindow(EngineID engine)
 {
 	Window *w;
 
@@ -123,7 +122,7 @@
 	w->window_number = engine;
 }
 
-static void DrawTrainEngineInfo(int engine, int x, int y, int maxw)
+static void DrawTrainEngineInfo(EngineID engine, int x, int y, int maxw)
 {
 	const RailVehicleInfo *rvi = RailVehInfo(engine);
 	int cap;
@@ -147,7 +146,7 @@
 
 void DrawNewsNewTrainAvail(Window *w)
 {
-	int engine;
+	EngineID engine;
 
 	DrawNewsBorder(w);
 
@@ -167,14 +166,14 @@
 
 StringID GetNewsStringNewTrainAvail(const NewsItem *ni)
 {
-	int engine = ni->string_id;
+	EngineID engine = ni->string_id;
 	SetDParam(0, STR_8859_NEW_NOW_AVAILABLE);
 	SetDParam(1, GetEngineCategoryName(engine));
 	SetDParam(2, GetCustomEngineName(engine));
 	return STR_02B6;
 }
 
-static void DrawAircraftEngineInfo(int engine, int x, int y, int maxw)
+static void DrawAircraftEngineInfo(EngineID engine, int x, int y, int maxw)
 {
 	const AircraftVehicleInfo *avi = AircraftVehInfo(engine);
 	SetDParam(0, (_price.aircraft_base >> 3) * avi->base_cost >> 5);
@@ -188,7 +187,7 @@
 
 void DrawNewsNewAircraftAvail(Window *w)
 {
-	int engine;
+	EngineID engine;
 
 	DrawNewsBorder(w);
 
@@ -207,13 +206,13 @@
 
 StringID GetNewsStringNewAircraftAvail(const NewsItem *ni)
 {
-	int engine = ni->string_id;
+	EngineID engine = ni->string_id;
 	SetDParam(0, STR_A02C_NEW_AIRCRAFT_NOW_AVAILABLE);
 	SetDParam(1, GetCustomEngineName(engine));
 	return STR_02B6;
 }
 
-static void DrawRoadVehEngineInfo(int engine, int x, int y, int maxw)
+static void DrawRoadVehEngineInfo(EngineID engine, int x, int y, int maxw)
 {
 	const RoadVehicleInfo *rvi = RoadVehInfo(engine);
 
@@ -229,7 +228,7 @@
 
 void DrawNewsNewRoadVehAvail(Window *w)
 {
-	int engine;
+	EngineID engine;
 
 	DrawNewsBorder(w);
 
@@ -247,13 +246,13 @@
 
 StringID GetNewsStringNewRoadVehAvail(const NewsItem *ni)
 {
-	int engine = ni->string_id;
+	EngineID engine = ni->string_id;
 	SetDParam(0, STR_9028_NEW_ROAD_VEHICLE_NOW_AVAILABLE);
 	SetDParam(1, GetCustomEngineName(engine));
 	return STR_02B6;
 }
 
-static void DrawShipEngineInfo(int engine, int x, int y, int maxw)
+static void DrawShipEngineInfo(EngineID engine, int x, int y, int maxw)
 {
 	const ShipVehicleInfo *svi = ShipVehInfo(engine);
 	SetDParam(0, svi->base_cost * (_price.ship_base >> 3) >> 5);
@@ -266,7 +265,7 @@
 
 void DrawNewsNewShipAvail(Window *w)
 {
-	int engine;
+	EngineID engine;
 
 	DrawNewsBorder(w);
 
@@ -285,7 +284,7 @@
 
 StringID GetNewsStringNewShipAvail(const NewsItem *ni)
 {
-	int engine = ni->string_id;
+	EngineID engine = ni->string_id;
 	SetDParam(0, STR_982C_NEW_SHIP_NOW_AVAILABLE);
 	SetDParam(1, GetCustomEngineName(engine));
 	return STR_02B6;
--- a/roadveh_cmd.c	Fri Sep 30 20:51:20 2005 +0000
+++ b/roadveh_cmd.c	Sat Oct 01 12:43:34 2005 +0000
@@ -77,7 +77,7 @@
 	return image;
 }
 
-void DrawRoadVehEngine(int x, int y, int engine, uint32 image_ormod)
+void DrawRoadVehEngine(int x, int y, EngineID engine, uint32 image_ormod)
 {
 	int spritenum = RoadVehInfo(engine)->image_index;
 
--- a/roadveh_gui.c	Fri Sep 30 20:51:20 2005 +0000
+++ b/roadveh_gui.c	Sat Oct 01 12:43:34 2005 +0000
@@ -411,7 +411,7 @@
 		int y = 15;
 		int sel = WP(w,buildtrain_d).sel_index;
 		int pos = w->vscroll.pos;
-		int engine_id = ROAD_ENGINES_INDEX;
+		EngineID engine_id = ROAD_ENGINES_INDEX;
 		int selected_id = -1;
 
 		do {
--- a/ship_cmd.c	Fri Sep 30 20:51:20 2005 +0000
+++ b/ship_cmd.c	Sat Oct 01 12:43:34 2005 +0000
@@ -28,7 +28,7 @@
 	return r | r >> 8;
 }
 
-void DrawShipEngine(int x, int y, int engine, uint32 image_ormod)
+void DrawShipEngine(int x, int y, EngineID engine, uint32 image_ormod)
 {
 	int spritenum = ShipVehInfo(engine)->image_index;
 
@@ -905,7 +905,7 @@
 
 		v->last_station_visited = INVALID_STATION;
 		v->max_speed = svi->max_speed;
-		v->engine_type = (byte)p1;
+		v->engine_type = p1;
 
 		e = GetEngine(p1);
 		v->reliability = e->reliability;
--- a/ship_gui.c	Fri Sep 30 20:51:20 2005 +0000
+++ b/ship_gui.c	Sat Oct 01 12:43:34 2005 +0000
@@ -351,7 +351,7 @@
 			int y = 15;
 			int sel = WP(w,buildtrain_d).sel_index;
 			int pos = w->vscroll.pos;
-			int engine_id = SHIP_ENGINES_INDEX;
+			EngineID engine_id = SHIP_ENGINES_INDEX;
 			int selected_id = -1;
 
 			do {
--- a/train_cmd.c	Fri Sep 30 20:51:20 2005 +0000
+++ b/train_cmd.c	Sat Oct 01 12:43:34 2005 +0000
@@ -364,7 +364,7 @@
 	return base;
 }
 
-void DrawTrainEngine(int x, int y, int engine, uint32 image_ormod)
+void DrawTrainEngine(int x, int y, EngineID engine, uint32 image_ormod)
 {
 	const RailVehicleInfo *rvi = RailVehInfo(engine);
 
@@ -397,7 +397,7 @@
 }
 
 
-static int32 CmdBuildRailWagon(uint engine, TileIndex tile, uint32 flags)
+static int32 CmdBuildRailWagon(EngineID engine, TileIndex tile, uint32 flags)
 {
 	int32 value;
 	Vehicle *v;
@@ -642,7 +642,7 @@
 			v->last_station_visited = INVALID_STATION;
 			v->dest_tile = 0;
 
-			v->engine_type = (byte)p1;
+			v->engine_type = p1;
 
 			v->reliability = e->reliability;
 			v->reliability_spd_dec = e->reliability_spd_dec;
@@ -735,7 +735,7 @@
 static Vehicle *FindGoodVehiclePos(const Vehicle *src)
 {
 	Vehicle *dst;
-	uint16 eng = src->engine_type;
+	EngineID eng = src->engine_type;
 	TileIndex tile = src->tile;
 
 	FOR_ALL_VEHICLES(dst) {
@@ -955,7 +955,7 @@
  * engine is 'started', first 'close' that before 'closing' our
  * searched engine
  */
-static Vehicle *GetRearEngine(const Vehicle *v, uint16 engine)
+static Vehicle *GetRearEngine(const Vehicle *v, EngineID engine)
 {
 	Vehicle *u;
 	int en_count = 1;
@@ -1737,7 +1737,7 @@
 	u = v;
 
 	do {
-		int engtype = v->engine_type;
+		EngineID engtype = v->engine_type;
 
 		// no smoke?
 		if (RailVehInfo(engtype)->flags & 2 ||
@@ -1783,7 +1783,7 @@
 		SND_0A_TRAIN_HORN
 	};
 
-	int engtype = v->engine_type;
+	EngineID engtype = v->engine_type;
 
 	switch (GetEngine(engtype)->railtype) {
 		case 0:
--- a/train_gui.c	Fri Sep 30 20:51:20 2005 +0000
+++ b/train_gui.c	Sat Oct 01 12:43:34 2005 +0000
@@ -175,7 +175,7 @@
 static void engine_drawing_loop(int *x, int *y, int *pos, int *sel,
 	int *selected_id, byte railtype, byte show_max, bool is_engine)
 {
-	int i;
+	EngineID i;
 
 	for (i = 0; i < NUM_TRAIN_ENGINES; i++) {
 		const Engine *e = GetEngine(i);
@@ -209,7 +209,7 @@
 		{
 			int count = 0;
 			byte railtype = WP(w,buildtrain_d).railtype;
-			int i;
+			EngineID i;
 
 			for (i = 0; i < NUM_TRAIN_ENGINES; i++) {
 				const Engine *e = GetEngine(i);
--- a/vehicle_gui.c	Fri Sep 30 20:51:20 2005 +0000
+++ b/vehicle_gui.c	Sat Oct 01 12:43:34 2005 +0000
@@ -417,7 +417,7 @@
 static void train_engine_drawing_loop(int *x, int *y, int *pos, int *sel, int *selected_id, byte railtype,
 	uint8 lines_drawn, bool is_engine, bool show_cars, bool show_outdated)
 {
-	int i;
+	EngineID i;
 	byte colour;
 
 	for (i = 0; i < NUM_TRAIN_ENGINES; i++) {
@@ -467,7 +467,7 @@
 	int sel[2];
 	int count = 0;
 	int count2 = 0;
-	int engine_id;
+	EngineID engine_id;
 
 	sel[0] = WP(w,replaceveh_d).sel_index[0];
 	sel[1] = WP(w,replaceveh_d).sel_index[1];
@@ -643,7 +643,7 @@
 		case VEH_Road: {
 			int num = NUM_ROAD_ENGINES;
 			Engine *e = GetEngine(ROAD_ENGINES_INDEX);
-			int engine_id = ROAD_ENGINES_INDEX;
+			EngineID engine_id = ROAD_ENGINES_INDEX;
 			byte cargo;
 			EngineInfo *info;
 
@@ -679,7 +679,7 @@
 		case VEH_Ship: {
 			int num = NUM_SHIP_ENGINES;
 			Engine *e = GetEngine(SHIP_ENGINES_INDEX);
-			int engine_id = SHIP_ENGINES_INDEX;
+			EngineID engine_id = SHIP_ENGINES_INDEX;
 			byte cargo, refittable;
 			EngineInfo *info;
 
@@ -718,7 +718,7 @@
 			if ( selected_id[0] != -1 ) {
 				int num = NUM_AIRCRAFT_ENGINES;
 				Engine *e = GetEngine(AIRCRAFT_ENGINES_INDEX);
-				int engine_id = AIRCRAFT_ENGINES_INDEX;
+				EngineID engine_id = AIRCRAFT_ENGINES_INDEX;
 				byte subtype = AircraftVehInfo(selected_id[0])->subtype;
 				EngineInfo *info;