diff options
author | tron <tron@openttd.org> | 2005-11-16 11:55:06 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2005-11-16 11:55:06 +0000 |
commit | 8d57bfc921c2aa3acbbbb0330ae699032c51afd4 (patch) | |
tree | 61593ce65d7a1ce19d929e8790b16c384a092087 | |
parent | 1806293e465800e056ba78b6ffc5de80a0161afb (diff) | |
download | openttd-8d57bfc921c2aa3acbbbb0330ae699032c51afd4.tar.xz |
(svn r3195) Use bitfields instead of explicit shifting/masking
-rw-r--r-- | industry_cmd.c | 14 | ||||
-rw-r--r-- | table/industry_land.h | 2 |
2 files changed, 9 insertions, 7 deletions
diff --git a/industry_cmd.c b/industry_cmd.c index 849c3563b..b11176aff 100644 --- a/industry_cmd.c +++ b/industry_cmd.c @@ -48,8 +48,10 @@ typedef struct DrawIndustryTileStruct { uint32 sprite_1; uint32 sprite_2; - byte subtile_xy; - byte width_height; + byte subtile_x:4; + byte subtile_y:4; + byte width:4; + byte height:4; byte dz; byte proc; } DrawIndustryTileStruct; @@ -377,10 +379,10 @@ static void DrawTile_Industry(TileInfo *ti) if (_display_opt & DO_TRANS_BUILDINGS) MAKE_TRANSPARENT(image); AddSortableSpriteToDraw(image, - ti->x | (dits->subtile_xy>>4), - ti->y | (dits->subtile_xy&0xF), - (dits->width_height>>4)+1, - (dits->width_height&0xF)+1, + ti->x + dits->subtile_x, + ti->y + dits->subtile_y, + dits->width + 1, + dits->height + 1, dits->dz, z); diff --git a/table/industry_land.h b/table/industry_land.h index 19629f4f0..6c5cc14ec 100644 --- a/table/industry_land.h +++ b/table/industry_land.h @@ -1,6 +1,6 @@ /* $Id$ */ -#define M(s1,s2,sx,sy,w,h,dz,p) {s1,s2,(sx<<4)|sy,((w-1)<<4)|(h-1),dz,p} +#define M(s1, s2, sx, sy, w, h, dz, p) { s1, s2, sx, sy, w - 1, h - 1, dz, p } static const DrawIndustryTileStruct _industry_draw_tile_data[700] = { M( 0xf54, 0x7db, 7, 0, 9, 9, 10, 0), |