summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2008-04-29 07:11:54 +0000
committerpeter1138 <peter1138@openttd.org>2008-04-29 07:11:54 +0000
commit5ca6fd67fcf22c9293a79d0c04d9f487a9b853d9 (patch)
tree36d5420c98695a693d66dfeb7cbd25242891e281 /src
parent868c17a175236b7cc0d08e6df881a2e1124e895e (diff)
downloadopenttd-5ca6fd67fcf22c9293a79d0c04d9f487a9b853d9.tar.xz
(svn r12917) -Codechange: standardise variable names called with FOR_ALL_ENGINEIDS_OF_TYPE
Diffstat (limited to 'src')
-rw-r--r--src/autoreplace_gui.cpp22
-rw-r--r--src/depot_gui.cpp8
-rw-r--r--src/rail.cpp10
-rw-r--r--src/road.cpp8
-rw-r--r--src/vehicle.cpp6
5 files changed, 27 insertions, 27 deletions
diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp
index 80148341d..7dc37ab3b 100644
--- a/src/autoreplace_gui.cpp
+++ b/src/autoreplace_gui.cpp
@@ -191,7 +191,6 @@ static bool EnginesGotCargoInCommon(EngineID engine_a, EngineID engine_b)
*/
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 @@ static void GenerateReplaceVehList(Window *w, bool draw_left)
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);
diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp
index e964a8d84..e88fb6de8 100644
--- a/src/depot_gui.cpp
+++ b/src/depot_gui.cpp
@@ -653,17 +653,17 @@ static void ResizeDefaultWindowSizeForRoadVehicles()
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;
diff --git a/src/rail.cpp b/src/rail.cpp
index fe799f09d..6ab511a2b 100644
--- a/src/rail.cpp
+++ b/src/rail.cpp
@@ -202,14 +202,14 @@ RailTypes GetPlayerRailtypes(PlayerID p)
{
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);
diff --git a/src/road.cpp b/src/road.cpp
index e96e79358..095f82f9c 100644
--- a/src/road.cpp
+++ b/src/road.cpp
@@ -96,10 +96,10 @@ RoadTypes GetPlayerRoadtypes(PlayerID p)
{
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)) {
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 03351b149..fc92bc7fc 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -1985,9 +1985,9 @@ bool CanBuildVehicleInfrastructure(VehicleType type)
/* 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;
}