src/road_cmd.cpp
changeset 6442 10b44714b85d
parent 6317 c73bda71ac16
child 6459 8c66c58bf6cf
equal deleted inserted replaced
6441:2fe73e3c3629 6442:10b44714b85d
    33 	if (r & ROAD_NE) ++count;
    33 	if (r & ROAD_NE) ++count;
    34 	return count;
    34 	return count;
    35 }
    35 }
    36 
    36 
    37 
    37 
    38 static bool CheckAllowRemoveRoad(TileIndex tile, RoadBits remove, bool* edge_road)
    38 bool CheckAllowRemoveRoad(TileIndex tile, RoadBits remove, Owner owner, bool *edge_road)
    39 {
    39 {
    40 	RoadBits present;
    40 	RoadBits present;
    41 	RoadBits n;
    41 	RoadBits n;
    42 	Owner owner;
       
    43 	*edge_road = true;
    42 	*edge_road = true;
    44 
    43 
    45 	if (_game_mode == GM_EDITOR) return true;
    44 	if (_game_mode == GM_EDITOR) return true;
    46 
    45 
    47 	// Only do the special processing for actual players.
    46 	// Only do the special processing for actual players.
    48 	if (!IsValidPlayer(_current_player)) return true;
    47 	if (!IsValidPlayer(_current_player)) return true;
    49 
       
    50 	owner = IsLevelCrossingTile(tile) ? GetCrossingRoadOwner(tile) : GetTileOwner(tile);
       
    51 
    48 
    52 	// Only do the special processing if the road is owned
    49 	// Only do the special processing if the road is owned
    53 	// by a town
    50 	// by a town
    54 	if (owner != OWNER_TOWN) return (owner == OWNER_NONE) || CheckOwnership(owner);
    51 	if (owner != OWNER_TOWN) return (owner == OWNER_NONE) || CheckOwnership(owner);
    55 
    52 
    79 	}
    76 	}
    80 
    77 
    81 	return true;
    78 	return true;
    82 }
    79 }
    83 
    80 
       
    81 static bool CheckAllowRemoveRoad(TileIndex tile, RoadBits remove, bool *edge_road)
       
    82 {
       
    83 	return CheckAllowRemoveRoad(tile, remove, IsLevelCrossingTile(tile) ? GetCrossingRoadOwner(tile) : GetTileOwner(tile), edge_road);
       
    84 }
    84 
    85 
    85 /** Delete a piece of road.
    86 /** Delete a piece of road.
    86  * @param tile tile where to remove road from
    87  * @param tile tile where to remove road from
    87  * @param p1 road piece flags
    88  * @param p1 road piece flags
    88  * @param p2 unused
    89  * @param p2 unused