diff options
author | smatz <smatz@openttd.org> | 2007-12-03 22:40:18 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2007-12-03 22:40:18 +0000 |
commit | 05fca79cf05a72e03052b0f2312d4c6081853f5a (patch) | |
tree | 243b96994644c83816e5fbbf8986e629ccb4347d | |
parent | 82913a21348a741eaacee6c81a57eba9a2c00250 (diff) | |
download | openttd-05fca79cf05a72e03052b0f2312d4c6081853f5a.tar.xz |
(svn r11565) -Revert: part of r11564
-rw-r--r-- | src/ai/default/default.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/ai/default/default.cpp b/src/ai/default/default.cpp index d1979ed82..e84217ddc 100644 --- a/src/ai/default/default.cpp +++ b/src/ai/default/default.cpp @@ -1646,18 +1646,22 @@ clear_town_stuff:; rating += _cleared_town_rating; } } else if (p->mode == 2) { - // Rail + /* Rail */ if (IsTileType(c, MP_RAILWAY)) return CMD_ERROR; j = p->attr; k = 0; - // Build the rail - FOR_EACH_SET_BIT(i, j) { - k = i; - ret = DoCommand(c, railtype, i, flag | DC_AUTO | DC_NO_WATER, CMD_BUILD_SINGLE_RAIL); - if (CmdFailed(ret)) return CMD_ERROR; - total_cost.AddCost(ret); + /* Build the rail + * note: FOR_EACH_SET_BIT cannot be used here + */ + for (i = 0; i != 6; i++, j >>= 1) { + if (j & 1) { + k = i; + ret = DoCommand(c, railtype, i, flag | DC_AUTO | DC_NO_WATER, CMD_BUILD_SINGLE_RAIL); + if (CmdFailed(ret)) return CMD_ERROR; + total_cost.AddCost(ret); + } } /* signals too? */ |