summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-02-12 15:53:32 +0000
committertron <tron@openttd.org>2005-02-12 15:53:32 +0000
commit6d2b9d2c3a773f415cf65cd071453b9a47d73f7e (patch)
treeca1e02fe05c2c7241836503d7f08bb634c442bfd
parenteefb125dc7a266ba3b522c4de71fd431dc8ebba9 (diff)
downloadopenttd-6d2b9d2c3a773f415cf65cd071453b9a47d73f7e.tar.xz
(svn r1863) Give the effect vehicle type enums more descriptive names and use the enum as parameter type for CreateEffectVehicle*()
-Fix: [1116619] Generate the correct smoke type for diesel trains
-rw-r--r--aircraft_cmd.c6
-rw-r--r--disaster_cmd.c16
-rw-r--r--industry_cmd.c6
-rw-r--r--landscape.c4
-rw-r--r--road_cmd.c2
-rw-r--r--roadveh_cmd.c2
-rw-r--r--train_cmd.c8
-rw-r--r--vehicle.c6
-rw-r--r--vehicle.h33
-rw-r--r--water_cmd.c2
10 files changed, 41 insertions, 44 deletions
diff --git a/aircraft_cmd.c b/aircraft_cmd.c
index 7656c689e..f9641782f 100644
--- a/aircraft_cmd.c
+++ b/aircraft_cmd.c
@@ -1057,7 +1057,7 @@ static void HandleCrashedAircraft(Vehicle *v)
4 + (r&0xF),
4 + ((r>>4)&0xF),
((r>>8)&0xF),
- EV_DEMOLISH);
+ EV_EXPLOSION_SMALL);
}
} else if (v->u.air.crashed_counter >= 10000) {
// remove rubble of crashed airplane
@@ -1108,7 +1108,7 @@ static void HandleAircraftSmoke(Vehicle *v)
_aircraft_smoke_xy[v->direction],
_aircraft_smoke_xy[v->direction + 8],
2,
- EV_SMOKE_3
+ EV_SMOKE
);
}
}
@@ -1206,7 +1206,7 @@ static void CrashAirplane(Vehicle *v)
v->vehstatus |= VS_CRASHED;
v->u.air.crashed_counter = 0;
- CreateEffectVehicleRel(v, 4, 4, 8, EV_CRASHED_SMOKE);
+ CreateEffectVehicleRel(v, 4, 4, 8, EV_EXPLOSION_LARGE);
InvalidateWindow(WC_VEHICLE_VIEW, v->index);
diff --git a/disaster_cmd.c b/disaster_cmd.c
index f31487de1..c6ec0ea49 100644
--- a/disaster_cmd.c
+++ b/disaster_cmd.c
@@ -166,7 +166,7 @@ static void DisasterTick_Zeppeliner(Vehicle *v)
}
if ((v->tick_counter&7)==0) {
- CreateEffectVehicleRel(v, 0, -17, 2, EV_SMOKE_3);
+ CreateEffectVehicleRel(v, 0, -17, 2, EV_SMOKE);
}
} else if (v->current_order.station == 0) {
tile = v->tile; /**/
@@ -219,7 +219,7 @@ static void DisasterTick_Zeppeliner(Vehicle *v)
SetDisasterVehiclePos(v, x, y, z);
if (++v->age == 1) {
- CreateEffectVehicleRel(v, 0, 7, 8, EV_CRASHED_SMOKE);
+ CreateEffectVehicleRel(v, 0, 7, 8, EV_EXPLOSION_LARGE);
SndPlayVehicleFx(SND_12_EXPLOSION, v);
v->u.disaster.image_override = 0xF42;
} else if (v->age == 70) {
@@ -232,7 +232,7 @@ static void DisasterTick_Zeppeliner(Vehicle *v)
-7 + (r&0xF),
-7 + (r>>4&0xF),
5 + (r>>8&0x7),
- EV_DEMOLISH);
+ EV_EXPLOSION_SMALL);
}
} else if (v->age == 350) {
v->current_order.station = 3;
@@ -323,7 +323,7 @@ static void DisasterTick_UFO(Vehicle *v)
// destroy?
if (v->age > 50) {
- CreateEffectVehicleRel(v, 0, 7, 8, EV_CRASHED_SMOKE);
+ CreateEffectVehicleRel(v, 0, 7, 8, EV_EXPLOSION_LARGE);
SndPlayVehicleFx(SND_12_EXPLOSION, v);
DeleteDisasterVeh(v);
}
@@ -370,7 +370,7 @@ static void DisasterTick_2(Vehicle *v)
x + (r & 0x3F),
y + (r >> 6 & 0x3F),
(r >> 12 & 0xF),
- EV_DEMOLISH);
+ EV_EXPLOSION_SMALL);
if (++v->age >= 55)
v->current_order.station = 3;
@@ -441,7 +441,7 @@ static void DisasterTick_3(Vehicle *v)
x + (r & 0x3F),
y + (r >> 6 & 0x3F),
(r >> 12 & 0xF),
- EV_DEMOLISH);
+ EV_EXPLOSION_SMALL);
if (++v->age >= 55)
v->current_order.station = 3;
@@ -614,7 +614,7 @@ static void DisasterTick_4b(Vehicle *v)
return;
v->current_order.station = 1;
- CreateEffectVehicleRel(u, 0, 7, 8, EV_CRASHED_SMOKE);
+ CreateEffectVehicleRel(u, 0, 7, 8, EV_EXPLOSION_LARGE);
SndPlayVehicleFx(SND_12_EXPLOSION, u);
DeleteDisasterVeh(u);
@@ -625,7 +625,7 @@ static void DisasterTick_4b(Vehicle *v)
v->x_pos-32+(r&0x3F),
v->y_pos-32+(r>>5&0x3F),
0,
- EV_DEMOLISH);
+ EV_EXPLOSION_SMALL);
}
BEGIN_TILE_LOOP(tile,6,6,v->tile - TILE_XY(3,3))
diff --git a/industry_cmd.c b/industry_cmd.c
index 961f44499..1a2971fb5 100644
--- a/industry_cmd.c
+++ b/industry_cmd.c
@@ -669,7 +669,7 @@ static void MakeIndustryTileBiggerCase8(uint tile)
{
TileInfo ti;
FindLandscapeHeight(&ti, TileX(tile) * 16, TileY(tile) * 16);
- CreateEffectVehicle(ti.x + 15, ti.y + 14, ti.z + 59 + (ti.tileh != 0 ? 8 : 0), EV_INDUSTRYSMOKE);
+ CreateEffectVehicle(ti.x + 15, ti.y + 14, ti.z + 59 + (ti.tileh != 0 ? 8 : 0), EV_CHIMNEY_SMOKE);
}
static void MakeIndustryTileBigger(uint tile, byte size)
@@ -735,7 +735,7 @@ static void TileLoopIndustryCase161(uint tile)
TileX(tile) * 16 + _tileloop_ind_case_161[dir + 0],
TileY(tile) * 16 + _tileloop_ind_case_161[dir + 4],
_tileloop_ind_case_161[dir + 8],
- EV_INDUSTRY_SMOKE
+ EV_BUBBLE
);
if (v != NULL)
@@ -819,7 +819,7 @@ static void TileLoop_Industry(uint tile)
break;
case 49: {
- CreateEffectVehicleAbove(TileX(tile) * 16 + 6, TileY(tile) * 16 + 6, 43, EV_SMOKE_3);
+ CreateEffectVehicleAbove(TileX(tile) * 16 + 6, TileY(tile) * 16 + 6, 43, EV_SMOKE);
} break;
diff --git a/landscape.c b/landscape.c
index dfcdbe8c2..e406c76fa 100644
--- a/landscape.c
+++ b/landscape.c
@@ -334,7 +334,9 @@ int32 CmdClearArea(int ex, int ey, uint32 flags, uint32 p1, uint32 p2)
// draw explosion animation...
if ((x==sx || x==ex) && (y==sy || y==ey)) {
// big explosion in each corner, or small explosion for single tiles
- CreateEffectVehicleAbove(x + 8,y + 8, 2, sy==ey && sx==ex ? EV_DEMOLISH : EV_CRASHED_SMOKE);
+ CreateEffectVehicleAbove(x + 8, y + 8, 2,
+ sy == ey && sx == ex ? EV_EXPLOSION_SMALL : EV_EXPLOSION_LARGE
+ );
}
}
}
diff --git a/road_cmd.c b/road_cmd.c
index 5b221c9d6..3e607c554 100644
--- a/road_cmd.c
+++ b/road_cmd.c
@@ -980,7 +980,7 @@ static void TileLoop_Road(uint tile)
TileX(tile) * 16 + 7,
TileY(tile) * 16 + 7,
0,
- EV_ROADWORK);
+ EV_BULLDOZER);
MarkTileDirtyByTile(tile);
return;
}
diff --git a/roadveh_cmd.c b/roadveh_cmd.c
index 6dd84da5a..25270fc5e 100644
--- a/roadveh_cmd.c
+++ b/roadveh_cmd.c
@@ -509,7 +509,7 @@ static void RoadVehIsCrashed(Vehicle *v)
{
v->u.road.crashed_ctr++;
if (v->u.road.crashed_ctr == 2) {
- CreateEffectVehicleRel(v,4,4,8,EV_CRASHED_SMOKE);
+ CreateEffectVehicleRel(v, 4, 4, 8, EV_EXPLOSION_LARGE);
} else if (v->u.road.crashed_ctr <= 45) {
if ((v->tick_counter&7)==0)
RoadVehSetRandomDirection(v);
diff --git a/train_cmd.c b/train_cmd.c
index b78c9f1a1..9443ff93d 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -1454,14 +1454,14 @@ static void HandleLocomotiveSmokeCloud(Vehicle *v)
case 1:
// diesel smoke
if (u->cur_speed <= 40 && !IsTileDepotType(v->tile, TRANSPORT_RAIL) && !IsTunnelTile(v->tile) && (uint16)Random() <= 0x1E00) {
- CreateEffectVehicleRel(v, 0,0,10, EV_SMOKE_3);
+ CreateEffectVehicleRel(v, 0, 0, 10, EV_DIESEL_SMOKE);
}
break;
case 2:
// blue spark
if ( (v->tick_counter&0x3) == 0 && !IsTileDepotType(v->tile, TRANSPORT_RAIL) && !IsTunnelTile(v->tile) && (uint16)Random() <= 0x5B0) {
- CreateEffectVehicleRel(v, 0,0,10, EV_SMOKE_2);
+ CreateEffectVehicleRel(v, 0, 0, 10, EV_ELECTRIC_SPARK);
}
break;
}
@@ -2658,7 +2658,7 @@ static void HandleCrashedTrain(Vehicle *v)
Vehicle *u;
if ( (state == 4) && (v->u.rail.track != 0x40) ) {
- CreateEffectVehicleRel(v, 4, 4, 8, EV_CRASHED_SMOKE);
+ CreateEffectVehicleRel(v, 4, 4, 8, EV_EXPLOSION_LARGE);
}
if (state <= 200 && (uint16)(r=Random()) <= 0x2492) {
@@ -2673,7 +2673,7 @@ static void HandleCrashedTrain(Vehicle *v)
2 + ((r>>8)&7),
2 + ((r>>16)&7),
5 + (r&7),
- EV_DEMOLISH);
+ EV_EXPLOSION_SMALL);
break;
}
} while ( (u=u->next) != NULL);
diff --git a/vehicle.c b/vehicle.c
index 2ed6bf626..1eee0db5c 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -1104,7 +1104,7 @@ static EffectTickProc * const _effect_tick_procs[] = {
};
-Vehicle *CreateEffectVehicle(int x, int y, int z, int type)
+Vehicle *CreateEffectVehicle(int x, int y, int z, EffectVehicle type)
{
Vehicle *v;
@@ -1129,12 +1129,12 @@ Vehicle *CreateEffectVehicle(int x, int y, int z, int type)
return v;
}
-Vehicle *CreateEffectVehicleAbove(int x, int y, int z, int type)
+Vehicle *CreateEffectVehicleAbove(int x, int y, int z, EffectVehicle type)
{
return CreateEffectVehicle(x, y, GetSlopeZ(x, y) + z, type);
}
-Vehicle *CreateEffectVehicleRel(Vehicle *v, int x, int y, int z, int type)
+Vehicle *CreateEffectVehicleRel(const Vehicle *v, int x, int y, int z, EffectVehicle type)
{
return CreateEffectVehicle(v->x_pos + x, v->y_pos + y, v->z_pos + z, type);
}
diff --git a/vehicle.h b/vehicle.h
index 15e985889..f13d6877c 100644
--- a/vehicle.h
+++ b/vehicle.h
@@ -238,23 +238,18 @@ enum TrainSubtype {
};
/* Effect vehicle types */
-enum {
- EV_INDUSTRYSMOKE = 0,
- EV_STEAM_SMOKE = 1,
-
- EV_SMOKE_1 = 2,
- EV_SMOKE_2 = 3,
- EV_SMOKE_3 = 4,
-
- EV_CRASHED_SMOKE = 5,
+typedef enum EffectVehicle {
+ EV_CHIMNEY_SMOKE = 0,
+ EV_STEAM_SMOKE = 1,
+ EV_DIESEL_SMOKE = 2,
+ EV_ELECTRIC_SPARK = 3,
+ EV_SMOKE = 4,
+ EV_EXPLOSION_LARGE = 5,
EV_BREAKDOWN_SMOKE = 6,
-
- EV_DEMOLISH = 7,
- EV_ROADWORK = 8,
-
- EV_INDUSTRY_SMOKE = 9,
-
-};
+ EV_EXPLOSION_SMALL = 7,
+ EV_BULLDOZER = 8,
+ EV_BUBBLE = 9
+} EffectVehicle;
typedef void VehicleTickProc(Vehicle *v);
typedef void *VehicleFromPosProc(Vehicle *v, void *data);
@@ -295,9 +290,9 @@ int GetAircraftImage(Vehicle *v, byte direction);
int GetRoadVehImage(Vehicle *v, byte direction);
int GetShipImage(Vehicle *v, byte direction);
-Vehicle *CreateEffectVehicle(int x, int y, int z, int type);
-Vehicle *CreateEffectVehicleAbove(int x, int y, int z, int type);
-Vehicle *CreateEffectVehicleRel(Vehicle *v, int x, int y, int z, int type);
+Vehicle *CreateEffectVehicle(int x, int y, int z, EffectVehicle type);
+Vehicle *CreateEffectVehicleAbove(int x, int y, int z, EffectVehicle type);
+Vehicle *CreateEffectVehicleRel(const Vehicle *v, int x, int y, int z, EffectVehicle type);
uint32 VehicleEnterTile(Vehicle *v, uint tile, int x, int y);
diff --git a/water_cmd.c b/water_cmd.c
index c1533e04c..263a482bd 100644
--- a/water_cmd.c
+++ b/water_cmd.c
@@ -601,7 +601,7 @@ static void FloodVehicle(Vehicle *v)
NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ACCIDENT, 0),
v->index,
0);
- CreateEffectVehicleRel(v,4,4,8,EV_CRASHED_SMOKE); // show cool destruction effects
+ CreateEffectVehicleRel(v, 4, 4, 8, EV_EXPLOSION_LARGE); // show cool destruction effects
SndPlayVehicleFx(SND_12_EXPLOSION, v); // create sound
}
}