Changeset - r14447:941a1226e642
[Not reviewed]
master
0 1 0
terkhen - 15 years ago 2010-02-05 14:11:25
terkhen@openttd.org
(svn r19016) -Fix [FS#3591]: When removing roads, the player was also charged for removing the foundations.
1 file changed with 6 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/road_cmd.cpp
Show inline comments
 
@@ -309,15 +309,17 @@ static CommandCost RemoveRoad(TileIndex 
 
					if (rt != ROADTYPE_TRAM) SetDisallowedRoadDirections(tile, DRD_NONE);
 
					SetRoadBits(tile, present, rt);
 
					MarkTileDirtyByTile(tile);
 
				}
 
			}
 

	
 
			/* If we change the foundation we have to pay for it. */
 
			return CommandCost(EXPENSES_CONSTRUCTION, CountBits(pieces) * _price[PR_CLEAR_ROAD] +
 
					((GetRoadFoundation(tileh, present) != f) ? _price[PR_BUILD_FOUNDATION] : (Money)0));
 
			CommandCost cost(EXPENSES_CONSTRUCTION, CountBits(pieces) * _price[PR_CLEAR_ROAD]);
 
			/* If we build a foundation we have to pay for it. */
 
			if (f == FOUNDATION_NONE && GetRoadFoundation(tileh, present) != FOUNDATION_NONE) cost.AddCost(_price[PR_BUILD_FOUNDATION]);
 

	
 
			return cost;
 
		}
 

	
 
		case ROAD_TILE_CROSSING: {
 
			if (pieces & ComplementRoadBits(GetCrossingRoadBits(tile))) {
 
				return CMD_ERROR;
 
			}
 
@@ -417,13 +419,13 @@ static CommandCost CheckRoadSlope(Slope 
 
				/* If we add foundation we've got to pay for it */
 
				if ((other | existing) == ROAD_NONE) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);
 

	
 
				return CommandCost();
 
			}
 
		} else {
 
			if (CountBits(existing) == 1) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);
 
			if (CountBits(existing) == 1 && GetRoadFoundation(tileh, existing) == FOUNDATION_NONE) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);
 
			return CommandCost();
 
		}
 
	}
 
	return CMD_ERROR;
 
}
 

	
0 comments (0 inline, 0 general)