summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2008-08-24 23:29:58 +0000
committerpeter1138 <peter1138@openttd.org>2008-08-24 23:29:58 +0000
commite3fad31f31455816b1a3cc205f989ec8fcdde3b5 (patch)
treec5b9b8f3c61b6c52c7ecc50137db32a0c8b6f2c5
parentbd14bd872e4b6e518b12f7c7c140424b30eee816 (diff)
downloadopenttd-e3fad31f31455816b1a3cc205f989ec8fcdde3b5.tar.xz
(svn r14162) -Fix: Allow rail type conversion if the rail type cost multipliers are the same.
-rw-r--r--src/rail.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/rail.h b/src/rail.h
index 7e3cd4b75..f90105242 100644
--- a/src/rail.h
+++ b/src/rail.h
@@ -183,7 +183,8 @@ static inline Money RailConvertCost(RailType from, RailType to)
* (the price of workers to get to place is that 1/4)
*/
if (HasPowerOnRail(from, to)) {
- return ((RailBuildCost(to) - RailBuildCost(from)) * 5) >> 2;
+ Money cost = ((RailBuildCost(to) - RailBuildCost(from)) * 5) >> 2;
+ if (cost != 0) return cost;
}
/* el. rail -> rail
@@ -191,7 +192,8 @@ static inline Money RailConvertCost(RailType from, RailType to)
* (the price of workers is 1 / 4 + price of copper sold to a recycle center)
*/
if (HasPowerOnRail(to, from)) {
- return (RailBuildCost(from) - RailBuildCost(to)) >> 2;
+ Money cost = (RailBuildCost(from) - RailBuildCost(to)) >> 2;
+ if (cost != 0) return cost;
}
/* make the price the same as remove + build new type */