Changeset - r10004:149db8fd4b85
[Not reviewed]
master
0 1 0
peter1138 - 16 years ago 2008-08-24 23:29:58
peter1138@openttd.org
(svn r14162) -Fix: Allow rail type conversion if the rail type cost multipliers are the same.
1 file changed with 4 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/rail.h
Show inline comments
 
@@ -180,21 +180,23 @@ static inline Money RailConvertCost(Rail
 
{
 
	/* rail -> el. rail
 
	 * calculate the price as 5 / 4 of (cost build el. rail) - (cost build rail)
 
	 * (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
 
	 * calculate the price as 1 / 4 of (cost build el. rail) - (cost build rail)
 
	 * (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 */
 
	return RailBuildCost(to) + _price.remove_rail;
 
}
 

	
0 comments (0 inline, 0 general)