summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-06-21 11:13:02 +0000
committertron <tron@openttd.org>2006-06-21 11:13:02 +0000
commitb8778e6341bfa9be2de27d4bcaf3b8a24669ae1f (patch)
tree29f38ee93cecc0572246f9bef4c4b89b9696f706
parenteebcec949b64f36cb9bda94f6a639eafb95ca3fa (diff)
downloadopenttd-b8778e6341bfa9be2de27d4bcaf3b8a24669ae1f.tar.xz
(svn r5325) Don't test something if we already know the result true, because the same test was performed just a few lines before
-rw-r--r--waypoint.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/waypoint.c b/waypoint.c
index a660a9e8f..5881a30f8 100644
--- a/waypoint.c
+++ b/waypoint.c
@@ -213,17 +213,16 @@ int32 CmdBuildTrainWaypoint(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
}
if (flags & DC_EXEC) {
- const StationSpec *statspec = NULL;
+ const StationSpec* statspec;
+
MakeRailWaypoint(tile, GetTileOwner(tile), axis, GetRailType(tile), wp->index);
MarkTileDirtyByTile(tile);
- if (GB(p1, 0, 8) < GetNumCustomStations(STAT_CLASS_WAYP)) {
- statspec = GetCustomStationSpec(STAT_CLASS_WAYP, GB(p1, 0, 8));
- }
+ statspec = GetCustomStationSpec(STAT_CLASS_WAYP, p1);
if (statspec != NULL) {
SetCustomWaypointSprite(tile);
- wp->stat_id = GB(p1, 0, 8);
+ wp->stat_id = p1;
wp->grfid = statspec->grfid;
wp->localidx = statspec->localidx;
} else {