summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-06-28 06:10:20 +0000
committertron <tron@openttd.org>2006-06-28 06:10:20 +0000
commit2b7089c637c2540948973e1eb5a4f05c1c33e142 (patch)
tree437dbb31ed36170ab24cef5c5a7bd68ca3c1c4dd
parentbe0ec7bbf594bec1e88b50927298b4e9e24e9f2b (diff)
downloadopenttd-2b7089c637c2540948973e1eb5a4f05c1c33e142.tar.xz
(svn r5396) - Remove two fixed parameters
- Simplify an expresssion: c ? f(x) : f(y) -> f(c ? x : y)
-rw-r--r--pathfind.c2
-rw-r--r--rail_cmd.c12
-rw-r--r--road_cmd.c5
3 files changed, 7 insertions, 12 deletions
diff --git a/pathfind.c b/pathfind.c
index 3e2b3f31f..ae5f32ca6 100644
--- a/pathfind.c
+++ b/pathfind.c
@@ -756,7 +756,7 @@ start_at:
/* Check the rail type only if the train is *NOT* on top of a bridge. */
if (!(IsBridgeTile(tile) && IsBridgeMiddle(tile) && GetBridgeAxis(tile) == DiagDirToAxis(direction))) {
- if (IsTileType(tile, MP_STREET) ? !HASBIT(tpf->railtypes, GetRailTypeCrossing(tile)) : !HASBIT(tpf->railtypes, GetRailType(tile))) {
+ if (!HASBIT(tpf->railtypes, IsTileType(tile, MP_STREET) ? GetRailTypeCrossing(tile) : GetRailType(tile))) {
bits = 0;
break;
}
diff --git a/rail_cmd.c b/rail_cmd.c
index ea3e989f1..7935efc85 100644
--- a/rail_cmd.c
+++ b/rail_cmd.c
@@ -1205,7 +1205,7 @@ static void DrawSpecialBuilding(
* @param snow Draw as snow
* @param flat Always draw foundation
*/
-static void DrawTrackBits(TileInfo* ti, TrackBits track, bool flat)
+static void DrawTrackBits(TileInfo* ti, TrackBits track)
{
const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(ti->tile));
PalSpriteID image;
@@ -1233,13 +1233,7 @@ static void DrawTrackBits(TileInfo* ti, TrackBits track, bool flat)
(image++, true);
if (ti->tileh != SLOPE_FLAT) {
- int foundation;
-
- if (flat) {
- foundation = ti->tileh;
- } else {
- foundation = GetRailFoundation(ti->tileh, track);
- }
+ uint foundation = GetRailFoundation(ti->tileh, track);
if (foundation != 0) DrawFoundation(ti, foundation);
@@ -1313,7 +1307,7 @@ static void DrawTile_Track(TileInfo *ti)
if (GetRailTileType(ti->tile) != RAIL_TILE_DEPOT_WAYPOINT) {
TrackBits rails = GetTrackBits(ti->tile);
- DrawTrackBits(ti, rails, false);
+ DrawTrackBits(ti, rails);
if (_display_opt & DO_FULL_DETAIL) DrawTrackDetails(ti);
diff --git a/road_cmd.c b/road_cmd.c
index 21c837762..ff815b670 100644
--- a/road_cmd.c
+++ b/road_cmd.c
@@ -696,8 +696,9 @@ const byte _road_sloped_sprites[14] = {
* @param ti TileInfo
* @param road RoadBits to draw
*/
-static void DrawRoadBits(TileInfo* ti, RoadBits road)
+static void DrawRoadBits(TileInfo* ti)
{
+ RoadBits road = GetRoadBits(ti->tile);
const DrawRoadTileStruct *drts;
PalSpriteID image = 0;
Roadside roadside;
@@ -752,7 +753,7 @@ static void DrawTile_Road(TileInfo *ti)
{
switch (GetRoadTileType(ti->tile)) {
case ROAD_TILE_NORMAL:
- DrawRoadBits(ti, GetRoadBits(ti->tile));
+ DrawRoadBits(ti);
break;
case ROAD_TILE_CROSSING: {