industry_cmd.c
changeset 2484 0e45d70ae908
parent 2469 59a0073914d8
child 2492 b4785c8f3700
--- a/industry_cmd.c	Mon Oct 03 21:10:51 2005 +0000
+++ b/industry_cmd.c	Mon Oct 03 21:20:01 2005 +0000
@@ -934,7 +934,7 @@
 		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 @@
 	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 @@
 		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;