summaryrefslogtreecommitdiff
path: root/ship_cmd.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-07-21 06:31:02 +0000
committertron <tron@openttd.org>2005-07-21 06:31:02 +0000
commitd71788c40206fa35b792d34769fde7768b4456c1 (patch)
treedc5c9c74cec9bfa29f94932a20193cd902a80f15 /ship_cmd.c
parent5c5840417e2f03514c51098f4786c6c1d6030b59 (diff)
downloadopenttd-d71788c40206fa35b792d34769fde7768b4456c1.tar.xz
(svn r2660) Get rid of some more shifting/anding/casting
Diffstat (limited to 'ship_cmd.c')
-rw-r--r--ship_cmd.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/ship_cmd.c b/ship_cmd.c
index d7459d0bb..a0c3d7e10 100644
--- a/ship_cmd.c
+++ b/ship_cmd.c
@@ -312,10 +312,10 @@ static void UpdateShipDeltaXY(Vehicle *v, int dir)
};
#undef MKIT
uint32 x = _delta_xy_table[dir];
- v->x_offs = (byte)x;
- v->y_offs = (byte)(x>>=8);
- v->sprite_width = (byte)(x>>=8);
- v->sprite_height = (byte)(x>>=8);
+ v->x_offs = GB(x, 0, 8);
+ v->y_offs = GB(x, 8, 8);
+ v->sprite_width = GB(x, 16, 8);
+ v->sprite_height = GB(x, 24, 8);
}
static void RecalcShipStuff(Vehicle *v)
@@ -532,7 +532,7 @@ static uint FindShipTrack(Vehicle *v, TileIndex tile, int dir, uint bits, TileIn
/* if we reach this position, there's two paths of equal value so far.
* pick one randomly. */
- r = (byte)Random();
+ r = GB(Random(), 0, 8);
if (_pick_shiptrack_table[i] == ship_dir) r += 80;
if (_pick_shiptrack_table[best_track] == ship_dir) r -= 80;
if (r <= 127) goto bad;