diff options
author | tron <tron@openttd.org> | 2006-03-08 08:16:31 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2006-03-08 08:16:31 +0000 |
commit | fa6632ec3240c1407668f55169d316c1c4b6bd45 (patch) | |
tree | d22cc6ddd9856b7d1f71491480efca03c24ec3c9 /roadveh_cmd.c | |
parent | f0d82204e072437212b5f5a0dd699443346913a5 (diff) | |
download | openttd-fa6632ec3240c1407668f55169d316c1c4b6bd45.tar.xz |
(svn r3786) More work for DirDiff
Diffstat (limited to 'roadveh_cmd.c')
-rw-r--r-- | roadveh_cmd.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/roadveh_cmd.c b/roadveh_cmd.c index 7a97722ce..6c3d27d69 100644 --- a/roadveh_cmd.c +++ b/roadveh_cmd.c @@ -494,9 +494,13 @@ static byte SetRoadVehPosition(Vehicle *v, int x, int y) static void RoadVehSetRandomDirection(Vehicle *v) { - static const int8 _turn_prob[4] = { -1, 0, 0, 1 }; + static const DirDiff delta[] = { + DIRDIFF_45LEFT, DIRDIFF_SAME, DIRDIFF_SAME, DIRDIFF_45RIGHT + }; + uint32 r = Random(); - v->direction = (v->direction + _turn_prob[r & 3]) & 7; + + v->direction = ChangeDir(v->direction, delta[r & 3]); BeginVehicleMove(v); UpdateRoadVehDeltaXY(v); v->cur_image = GetRoadVehImage(v, v->direction); |