summaryrefslogtreecommitdiff
path: root/ai_old.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-07-20 15:29:28 +0000
committertron <tron@openttd.org>2005-07-20 15:29:28 +0000
commitac66e3e28f35c6939d3af68d1f0e26eb9b34e377 (patch)
treea82679a91beaee405777f0f3c5e3c45814f1ea5d /ai_old.c
parentf432314fa907d4f3ee63537d399bad64a35033bd (diff)
downloadopenttd-ac66e3e28f35c6939d3af68d1f0e26eb9b34e377.tar.xz
(svn r2650) Convert many explicit shifts+ands to extract bits to invocations of GB - should be a bit nicer to read
Diffstat (limited to 'ai_old.c')
-rw-r--r--ai_old.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/ai_old.c b/ai_old.c
index 41cffcd97..f6cd06bed 100644
--- a/ai_old.c
+++ b/ai_old.c
@@ -1534,15 +1534,16 @@ static void AiStateWantNewRoute(Player *p)
static bool AiCheckTrackResources(TileIndex tile, const AiDefaultBlockData *p, byte cargo)
{
uint values[NUM_CARGO];
- int w,h;
int rad;
for(;p->mode != 4;p++) if (p->mode == 1) {
TileIndex tile2 = TILE_ADD(tile, ToTileIndexDiff(p->tileoffs));
+ uint w;
+ uint h;
- w = ((p->attr>>1) & 7);
- h = ((p->attr>>4) & 7);
- if (p->attr&1) intswap(w, h);
+ w = GB(p->attr, 1, 3);
+ h = GB(p->attr, 4, 3);
+ if (p->attr & 1) uintswap(w, h);
if (_patches.modified_catchment) {