summaryrefslogtreecommitdiff
path: root/aircraft_cmd.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-11-16 12:01:46 +0000
committertron <tron@openttd.org>2005-11-16 12:01:46 +0000
commitce9cbb9c47beb6d17a8bf7743a8c25c1989b6ece (patch)
tree57ab7d946f33a83ab3919738a96d2b38bf80b427 /aircraft_cmd.c
parent8d57bfc921c2aa3acbbbb0330ae699032c51afd4 (diff)
downloadopenttd-ce9cbb9c47beb6d17a8bf7743a8c25c1989b6ece.tar.xz
(svn r3196) Use structs instead of magic offsets into arrays
Diffstat (limited to 'aircraft_cmd.c')
-rw-r--r--aircraft_cmd.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/aircraft_cmd.c b/aircraft_cmd.c
index 23f06217c..207793621 100644
--- a/aircraft_cmd.c
+++ b/aircraft_cmd.c
@@ -1026,13 +1026,23 @@ static void HandleBrokenAircraft(Vehicle *v)
}
}
-static const int8 _aircraft_smoke_xy[16] = {
- 5,6,5,0,-5,-6,-5,0, /* x coordinates */
- 5,0,-5,-6,-5,0,5,6, /* y coordinate */
-};
static void HandleAircraftSmoke(Vehicle *v)
{
+ static const struct {
+ int8 x;
+ int8 y;
+ } smoke_pos[] = {
+ { 5, 5 },
+ { 6, 0 },
+ { 5, -5 },
+ { 0, -6 },
+ { -5, -5 },
+ { -6, 0 },
+ { -5, 5 },
+ { 0, 6 }
+ };
+
if (!(v->vehstatus & VS_AIRCRAFT_BROKEN)) return;
if (v->cur_speed < 10) {
@@ -1043,8 +1053,8 @@ static void HandleAircraftSmoke(Vehicle *v)
if ((v->tick_counter & 0x1F) == 0) {
CreateEffectVehicleRel(v,
- _aircraft_smoke_xy[v->direction],
- _aircraft_smoke_xy[v->direction + 8],
+ smoke_pos[v->direction].x,
+ smoke_pos[v->direction].y,
2,
EV_SMOKE
);