summaryrefslogtreecommitdiff
path: root/ai
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-11-14 08:09:57 +0000
committertron <tron@openttd.org>2005-11-14 08:09:57 +0000
commit833032adc09ce95c68d4a4b412221a0b3f88e670 (patch)
tree80b15078ff5a1c09815ccb23f4c9e7629774dae4 /ai
parent357aba747578ecd3b8cc1a29bc740634211ada37 (diff)
downloadopenttd-833032adc09ce95c68d4a4b412221a0b3f88e670.tar.xz
(svn r3177) GB, CLRBIT, HASBIT, TOGGLEBIT
Diffstat (limited to 'ai')
-rw-r--r--ai/default/default.c6
-rw-r--r--ai/trolly/trolly.c5
2 files changed, 6 insertions, 5 deletions
diff --git a/ai/default/default.c b/ai/default/default.c
index 7f0ae2aa8..1d763e483 100644
--- a/ai/default/default.c
+++ b/ai/default/default.c
@@ -1086,9 +1086,9 @@ static void AiWantPassengerRoute(Player *p)
static void AiWantTrainRoute(Player *p)
{
- uint16 r;
+ uint16 r = GB(Random(), 0, 16);
+
p->ai.railtype_to_use = GetBestRailtype(p);
- r = (uint16)Random();
if (r > 0xD000) {
AiWantLongIndustryRoute(p);
@@ -1349,7 +1349,7 @@ static void AiWantPassengerRouteInsideTown(Player *p)
static void AiWantRoadRoute(Player *p)
{
- uint16 r = (uint16)Random();
+ uint16 r = GB(Random(), 0, 16);
if (r > 0x4000) {
AiWantLongRoadIndustryRoute(p);
diff --git a/ai/trolly/trolly.c b/ai/trolly/trolly.c
index c40b0faef..f57644b10 100644
--- a/ai/trolly/trolly.c
+++ b/ai/trolly/trolly.c
@@ -781,7 +781,8 @@ static void AiNew_State_FindDepot(Player *p)
// To make the depot stand in the middle of the route, we start from the center..
// But first we walk through the route see if we can find a depot that is ours
// this keeps things nice ;)
- int g, i, j, r;
+ int g, i, r;
+ uint j;
TileIndex tile;
assert(p->ainew.state == AI_STATE_FIND_DEPOT);
@@ -796,7 +797,7 @@ static void AiNew_State_FindDepot(Player *p)
// We found a depot, is it ours? (TELL ME!!!)
if (IsTileOwner(tile + TileOffsByDir(j), _current_player)) {
// Now, is it pointing to the right direction.........
- if ((_m[tile + TileOffsByDir(j)].m5 & 3) == (j ^ 2)) {
+ if (GB(_m[tile + TileOffsByDir(j)].m5, 0, 2) == (j ^ 2)) {
// Yeah!!!
p->ainew.depot_tile = tile + TileOffsByDir(j);
p->ainew.depot_direction = j ^ 2; // Reverse direction