diff options
author | tron <tron@openttd.org> | 2006-06-10 08:37:41 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2006-06-10 08:37:41 +0000 |
commit | a2362674e33e66bf1d27df208db5b2250a01012e (patch) | |
tree | ddcc7798b94be03152e4b31cee4bf48bc73774e4 /ai/trolly/build.c | |
parent | fee9ee2c05a107e458c20e8773c9adce38a54a4c (diff) | |
download | openttd-a2362674e33e66bf1d27df208db5b2250a01012e.tar.xz |
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
Diffstat (limited to 'ai/trolly/build.c')
-rw-r--r-- | ai/trolly/build.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/ai/trolly/build.c b/ai/trolly/build.c index 1f4324355..64339245e 100644 --- a/ai/trolly/build.c +++ b/ai/trolly/build.c @@ -68,14 +68,15 @@ int AiNew_Build_Bridge(Player *p, TileIndex tile_a, TileIndex tile_b, byte flag) if (type2 != 0) break; } } - // There is only one bridge that can be build.. + // There is only one bridge that can be built if (type2 == 0 && type != 0) type2 = type; // Now, simply, build the bridge! - if (p->ainew.tbt == AI_TRAIN) - return AI_DoCommand(tile_a, tile_b, (0<<8) + type2, flag | DC_AUTO, CMD_BUILD_BRIDGE); - - return AI_DoCommand(tile_a, tile_b, (0x80 << 8) + type2, flag | DC_AUTO, CMD_BUILD_BRIDGE); + if (p->ainew.tbt == AI_TRAIN) { + return AI_DoCommand(tile_a, tile_b, (0x00 << 8) + type2, flag | DC_AUTO, CMD_BUILD_BRIDGE); + } else { + return AI_DoCommand(tile_a, tile_b, (0x80 << 8) + type2, flag | DC_AUTO, CMD_BUILD_BRIDGE); + } } @@ -102,7 +103,10 @@ int AiNew_Build_RoutePart(Player *p, Ai_PathFinderInfo *PathFinderInfo, byte fla // the first pieces and the last piece if (part < 1) part = 1; // When we are done, stop it - if (part >= PathFinderInfo->route_length - 1) { PathFinderInfo->position = -2; return 0; } + if (part >= PathFinderInfo->route_length - 1) { + PathFinderInfo->position = -2; + return 0; + } if (PathFinderInfo->rail_or_road) { @@ -112,7 +116,7 @@ int AiNew_Build_RoutePart(Player *p, Ai_PathFinderInfo *PathFinderInfo, byte fla PathFinderInfo->position++; // TODO: problems! if (CmdFailed(cost)) { - DEBUG(ai,0)("[AiNew - BuildPath] We have a serious problem: tunnel could not be build!"); + DEBUG(ai,0)("[AiNew - BuildPath] We have a serious problem: tunnel could not be built!"); return 0; } return cost; @@ -123,7 +127,7 @@ int AiNew_Build_RoutePart(Player *p, Ai_PathFinderInfo *PathFinderInfo, byte fla PathFinderInfo->position++; // TODO: problems! if (CmdFailed(cost)) { - DEBUG(ai,0)("[AiNew - BuildPath] We have a serious problem: bridge could not be build!"); + DEBUG(ai,0)("[AiNew - BuildPath] We have a serious problem: bridge could not be built!"); return 0; } return cost; @@ -131,7 +135,7 @@ int AiNew_Build_RoutePart(Player *p, Ai_PathFinderInfo *PathFinderInfo, byte fla // Build normal rail // Keep it doing till we go an other way - if (route_extra[part-1] == 0 && route_extra[part] == 0) { + if (route_extra[part - 1] == 0 && route_extra[part] == 0) { while (route_extra[part] == 0) { // Get the current direction dir = AiNew_GetRailDirection(route[part-1], route[part], route[part+1]); |