(svn r12917) -Codechange: standardise variable names called with FOR_ALL_ENGINEIDS_OF_TYPE
authorpeter1138
Tue, 29 Apr 2008 07:11:54 +0000
changeset 10376 a1207076a5c7
parent 10375 947e542f2bfc
child 10377 69e632bacb40
(svn r12917) -Codechange: standardise variable names called with FOR_ALL_ENGINEIDS_OF_TYPE
src/autoreplace_gui.cpp
src/depot_gui.cpp
src/rail.cpp
src/road.cpp
src/vehicle.cpp
--- a/src/autoreplace_gui.cpp	Mon Apr 28 23:48:45 2008 +0000
+++ b/src/autoreplace_gui.cpp	Tue Apr 29 07:11:54 2008 +0000
@@ -191,7 +191,6 @@
  */
 static void GenerateReplaceVehList(Window *w, bool draw_left)
 {
-	EngineID e;
 	EngineID selected_engine = INVALID_ENGINE;
 	VehicleType type = (VehicleType)w->window_number;
 	byte i = draw_left ? 0 : 1;
@@ -199,27 +198,28 @@
 	EngineList *list = &WP(w, replaceveh_d).list[i];
 	EngList_RemoveAll(list);
 
-	FOR_ALL_ENGINEIDS_OF_TYPE(e, type) {
-		if (type == VEH_TRAIN && !GenerateReplaceRailList(e, draw_left, WP(w, replaceveh_d).wagon_btnstate)) continue; // special rules for trains
+	EngineID eid;
+	FOR_ALL_ENGINEIDS_OF_TYPE(eid, type) {
+		if (type == VEH_TRAIN && !GenerateReplaceRailList(eid, draw_left, WP(w, replaceveh_d).wagon_btnstate)) continue; // special rules for trains
 
 		if (draw_left) {
 			const GroupID selected_group = WP(w, replaceveh_d).sel_group;
-			const uint num_engines = GetGroupNumEngines(_local_player, selected_group, e);
+			const uint num_engines = GetGroupNumEngines(_local_player, selected_group, eid);
 
 			/* Skip drawing the engines we don't have any of and haven't set for replacement */
-			if (num_engines == 0 && EngineReplacementForPlayer(GetPlayer(_local_player), e, selected_group) == INVALID_ENGINE) continue;
+			if (num_engines == 0 && EngineReplacementForPlayer(GetPlayer(_local_player), eid, selected_group) == INVALID_ENGINE) continue;
 		} else {
 			/* This is for engines we can replace to and they should depend on what we selected to replace from */
-			if (!IsEngineBuildable(e, type, _local_player)) continue; // we need to be able to build the engine
-			if (!EnginesGotCargoInCommon(e, WP(w, replaceveh_d).sel_engine[0])) continue; // the engines needs to be able to carry the same cargo
+			if (!IsEngineBuildable(eid, type, _local_player)) continue; // we need to be able to build the engine
+			if (!EnginesGotCargoInCommon(eid, WP(w, replaceveh_d).sel_engine[0])) continue; // the engines needs to be able to carry the same cargo
 
 			/* Road vehicles can't be replaced by trams and vice-versa */
-			if (type == VEH_ROAD && HasBit(EngInfo(WP(w, replaceveh_d).sel_engine[0])->misc_flags, EF_ROAD_TRAM) != HasBit(EngInfo(e)->misc_flags, EF_ROAD_TRAM)) continue;
-			if (e == WP(w, replaceveh_d).sel_engine[0]) continue; // we can't replace an engine into itself (that would be autorenew)
+			if (type == VEH_ROAD && HasBit(EngInfo(WP(w, replaceveh_d).sel_engine[0])->misc_flags, EF_ROAD_TRAM) != HasBit(EngInfo(eid)->misc_flags, EF_ROAD_TRAM)) continue;
+			if (eid == WP(w, replaceveh_d).sel_engine[0]) continue; // we can't replace an engine into itself (that would be autorenew)
 		}
 
-		EngList_Add(list, e);
-		if (e == WP(w, replaceveh_d).sel_engine[i]) selected_engine = e; // The selected engine is still in the list
+		EngList_Add(list, eid);
+		if (eid == WP(w, replaceveh_d).sel_engine[i]) selected_engine = eid; // The selected engine is still in the list
 	}
 	WP(w, replaceveh_d).sel_engine[i] = selected_engine; // update which engine we selected (the same or none, if it's not in the list anymore)
 	if (type == VEH_TRAIN) EngList_Sort(list, &TrainEngineNumberSorter);
--- a/src/depot_gui.cpp	Mon Apr 28 23:48:45 2008 +0000
+++ b/src/depot_gui.cpp	Tue Apr 29 07:11:54 2008 +0000
@@ -653,17 +653,17 @@
 
 static void ResizeDefaultWindowSize(VehicleType type)
 {
-	EngineID engine;
 	uint max_width  = 0;
 	uint max_height = 0;
 
-	FOR_ALL_ENGINEIDS_OF_TYPE(engine, type) {
+	EngineID eid;
+	FOR_ALL_ENGINEIDS_OF_TYPE(eid, type) {
 		uint x, y;
 
 		switch (type) {
 			default: NOT_REACHED();
-			case VEH_SHIP:     GetShipSpriteSize(    engine, x, y); break;
-			case VEH_AIRCRAFT: GetAircraftSpriteSize(engine, x, y); break;
+			case VEH_SHIP:     GetShipSpriteSize(    eid, x, y); break;
+			case VEH_AIRCRAFT: GetAircraftSpriteSize(eid, x, y); break;
 		}
 		if (x > max_width)  max_width  = x;
 		if (y > max_height) max_height = y;
--- a/src/rail.cpp	Mon Apr 28 23:48:45 2008 +0000
+++ b/src/rail.cpp	Tue Apr 29 07:11:54 2008 +0000
@@ -202,14 +202,14 @@
 {
 	RailTypes rt = RAILTYPES_NONE;
 
-	EngineID i;
-	FOR_ALL_ENGINEIDS_OF_TYPE(i, VEH_TRAIN) {
-		const Engine* e = GetEngine(i);
-		const EngineInfo *ei = EngInfo(i);
+	EngineID eid;
+	FOR_ALL_ENGINEIDS_OF_TYPE(eid, VEH_TRAIN) {
+		const Engine* e = GetEngine(eid);
+		const EngineInfo *ei = EngInfo(eid);
 
 		if (HasBit(ei->climates, _opt.landscape) &&
 				(HasBit(e->player_avail, p) || _date >= e->intro_date + 365)) {
-			const RailVehicleInfo *rvi = RailVehInfo(i);
+			const RailVehicleInfo *rvi = RailVehInfo(eid);
 
 			if (rvi->railveh_type != RAILVEH_WAGON) {
 				assert(rvi->railtype < RAILTYPE_END);
--- a/src/road.cpp	Mon Apr 28 23:48:45 2008 +0000
+++ b/src/road.cpp	Tue Apr 29 07:11:54 2008 +0000
@@ -96,10 +96,10 @@
 {
 	RoadTypes rt = ROADTYPES_NONE;
 
-	EngineID i;
-	FOR_ALL_ENGINEIDS_OF_TYPE(i, VEH_ROAD) {
-		const Engine* e = GetEngine(i);
-		const EngineInfo *ei = EngInfo(i);
+	EngineID eid;
+	FOR_ALL_ENGINEIDS_OF_TYPE(eid, VEH_ROAD) {
+		const Engine* e = GetEngine(eid);
+		const EngineInfo *ei = EngInfo(eid);
 
 		if (HasBit(ei->climates, _opt.landscape) &&
 				(HasBit(e->player_avail, p) || _date >= e->intro_date + 365)) {
--- a/src/vehicle.cpp	Mon Apr 28 23:48:45 2008 +0000
+++ b/src/vehicle.cpp	Tue Apr 29 07:11:54 2008 +0000
@@ -1985,9 +1985,9 @@
 	/* We can build vehicle infrastructure when we may build the vehicle type */
 	if (max > 0) {
 		/* Can we actually build the vehicle type? */
-		EngineID e;
-		FOR_ALL_ENGINEIDS_OF_TYPE(e, type) {
-			if (HasBit(GetEngine(e)->player_avail, _local_player)) return true;
+		EngineID eid;
+		FOR_ALL_ENGINEIDS_OF_TYPE(eid, type) {
+			if (HasBit(GetEngine(eid)->player_avail, _local_player)) return true;
 		}
 		return false;
 	}