src/road_cmd.cpp
changeset 7675 93f4f0f33c9a
parent 7670 e1ccf5df70cc
child 7730 4293ba29ce21
equal deleted inserted replaced
7674:b03105e8f035 7675:93f4f0f33c9a
   834 {
   834 {
   835 	switch (GetRoadTileType(tile)) {
   835 	switch (GetRoadTileType(tile)) {
   836 		case ROAD_TILE_NORMAL: {
   836 		case ROAD_TILE_NORMAL: {
   837 			RoadBits b = GetAllRoadBits(tile);
   837 			RoadBits b = GetAllRoadBits(tile);
   838 
   838 
   839 #define M(x) (1 << (x))
       
   840 			/* Clear the road if only one piece is on the tile OR the AI tries
   839 			/* Clear the road if only one piece is on the tile OR the AI tries
   841 			 * to clear town road OR we are not using the DC_AUTO flag */
   840 			 * to clear town road OR we are not using the DC_AUTO flag */
   842 			if ((M(b) & (M(ROAD_NW) | M(ROAD_SW) | M(ROAD_SE) | M(ROAD_NE))) ||
   841 			if ((COUNTBITS(b) == 1 && GetRoadBits(tile, ROADTYPE_TRAM) == ROAD_NONE) ||
   843 			    ((flags & DC_AI_BUILDING) && IsTileOwner(tile, OWNER_TOWN)) ||
   842 			    ((flags & DC_AI_BUILDING) && IsTileOwner(tile, OWNER_TOWN)) ||
   844 			    !(flags & DC_AUTO)
   843 			    !(flags & DC_AUTO)
   845 				) {
   844 				) {
   846 				RoadTypes rts = GetRoadTypes(tile);
   845 				RoadTypes rts = GetRoadTypes(tile);
   847 				CommandCost ret;
   846 				CommandCost ret;
   854 				}
   853 				}
   855 				return ret;
   854 				return ret;
   856 			}
   855 			}
   857 			return_cmd_error(STR_1801_MUST_REMOVE_ROAD_FIRST);
   856 			return_cmd_error(STR_1801_MUST_REMOVE_ROAD_FIRST);
   858 		}
   857 		}
   859 #undef M
       
   860 
   858 
   861 		case ROAD_TILE_CROSSING: {
   859 		case ROAD_TILE_CROSSING: {
   862 			RoadTypes rts = GetRoadTypes(tile);
   860 			RoadTypes rts = GetRoadTypes(tile);
   863 			CommandCost ret;
   861 			CommandCost ret;
   864 
   862