summaryrefslogtreecommitdiff
path: root/industry_cmd.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-10-03 21:20:01 +0000
committertron <tron@openttd.org>2005-10-03 21:20:01 +0000
commitdb3b1228bfad7fb42ce708dc93db21d840b07577 (patch)
tree4379525d1560a92903c1fdc87cdbad70a36ea271 /industry_cmd.c
parentb0a365ee676b8b612d88a3df1cac904db73e8bcf (diff)
downloadopenttd-db3b1228bfad7fb42ce708dc93db21d840b07577.tar.xz
(svn r3010) Get rid of quite some dubious casts, either by using GB(), proper types or just removing them
Diffstat (limited to 'industry_cmd.c')
-rw-r--r--industry_cmd.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/industry_cmd.c b/industry_cmd.c
index ff24f6711..3ba5adbc7 100644
--- a/industry_cmd.c
+++ b/industry_cmd.c
@@ -934,7 +934,7 @@ static void SetupFarmFieldFence(TileIndex tile, int size, byte type, int directi
if (IsTileType(tile, MP_CLEAR) || IsTileType(tile, MP_TREES)) {
or = type;
- if (or == 1 && (uint16)Random() <= 9362) or = 2;
+ if (or == 1 && GB(Random(), 0, 16) <= 9362) or = 2;
or <<= 2;
and = (byte)~0x1C;
@@ -1486,9 +1486,9 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, int type, const Ind
i->town = t;
i->owner = owner;
- r = Random() & 0xFFF;
- i->color_map = (byte)(r >> 8);
- i->counter = (uint16)r;
+ r = Random();
+ i->color_map = GB(r, 8, 8);
+ i->counter = GB(r, 0, 16);
i->cargo_waiting[0] = 0;
i->cargo_waiting[1] = 0;
i->last_mo_production[0] = 0;
@@ -1626,7 +1626,7 @@ Industry *CreateNewIndustry(TileIndex tile, int type)
return NULL;
/* pick a random layout */
- it = spec->table[(spec->num_table * (uint16)Random()) >> 16];
+ it = spec->table[(spec->num_table * GB(Random(), 0, 16)) >> 16];
if (!CheckIfIndustryTilesAreFree(tile, it, type, t))
return NULL;