Changeset - r9067:925f96cda5d5
[Not reviewed]
master
0 1 0
smatz - 16 years ago 2008-04-29 16:36:44
smatz@openttd.org
(svn r12919) -Fix [FS#1965]: flood road tiles even when there are road works in progress
1 file changed with 11 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/road_cmd.cpp
Show inline comments
 
@@ -230,13 +230,13 @@ static CommandCost RemoveRoad(TileIndex 
 
		case ROAD_TILE_NORMAL: {
 
			const Slope tileh = GetTileSlope(tile, NULL);
 
			RoadBits present = GetRoadBits(tile, rt);
 
			const RoadBits other = GetOtherRoadBits(tile, rt);
 
			const Foundation f = GetRoadFoundation(tileh, present);
 

	
 
			if (HasRoadWorks(tile)) return_cmd_error(STR_ROAD_WORKS_IN_PROGRESS);
 
			if (HasRoadWorks(tile) && _current_player != OWNER_WATER) return_cmd_error(STR_ROAD_WORKS_IN_PROGRESS);
 

	
 
			/* Autocomplete to a straight road
 
			 * @li on steep slopes
 
			 * @li if the bits of the other roadtypes result in another foundation
 
			 * @li if build on slopes is disabled */
 
			if (IsSteepSlope(tileh) || (IsStraightRoad(other) &&
 
@@ -257,12 +257,22 @@ static CommandCost RemoveRoad(TileIndex 
 
					(present & _invalid_tileh_slopes_road[0][tileh & SLOPE_ELEVATED]) == present) {
 
				return CMD_ERROR;
 
			}
 

	
 
			if (town_check) ChangeTownRating(t, -road_remove_cost[(byte)edge_road], RATING_ROAD_MINIMUM);
 
			if (flags & DC_EXEC) {
 
				if (HasRoadWorks(tile)) {
 
					/* flooding tile with road works, don't forget to remove the effect vehicle too */
 
					assert(_current_player == OWNER_WATER);
 
					Vehicle *v;
 
					FOR_ALL_VEHICLES(v) {
 
						if (v->type == VEH_EFFECT && TileVirtXY(v->x_pos, v->y_pos) == tile) {
 
							delete v;
 
						}
 
					}
 
				}
 
				if (present == ROAD_NONE) {
 
					RoadTypes rts = GetRoadTypes(tile) & ComplementRoadTypes(RoadTypeToRoadTypes(rt));
 
					if (rts == ROADTYPES_NONE) {
 
						/* Includes MarkTileDirtyByTile() */
 
						DoClearSquare(tile);
 
					} else {
0 comments (0 inline, 0 general)