src/road_cmd.cpp
changeset 8592 3b75a1a7ecd2
parent 8584 a8b6dffead63
child 8598 14ae80fe4c8f
equal deleted inserted replaced
8591:46eca2eb57ba 8592:3b75a1a7ecd2
   591 		MarkTileDirtyByTile(tile);
   591 		MarkTileDirtyByTile(tile);
   592 	}
   592 	}
   593 	return cost;
   593 	return cost;
   594 }
   594 }
   595 
   595 
   596 /**
       
   597  * Switches the rail type on a level crossing.
       
   598  * @param tile        The tile on which the railtype is to be convert.
       
   599  * @param totype      The railtype we want to convert to
       
   600  * @param exec        Switches between test and execute mode
       
   601  * @return            The cost and state of the operation
       
   602  * @retval CMD_ERROR  An error occured during the operation.
       
   603  */
       
   604 CommandCost DoConvertStreetRail(TileIndex tile, RailType totype, bool exec)
       
   605 {
       
   606 	/* not a railroad crossing? */
       
   607 	if (!IsLevelCrossing(tile)) return CMD_ERROR;
       
   608 
       
   609 	if (exec) {
       
   610 		SetRailType(tile, totype);
       
   611 		MarkTileDirtyByTile(tile);
       
   612 		YapfNotifyTrackLayoutChange(tile, FindFirstTrack(GetCrossingRailBits(tile)));
       
   613 		VehicleFromPos(tile, NULL, &UpdateTrainPowerProc);
       
   614 	}
       
   615 
       
   616 	return CommandCost(RailConvertCost(GetRailType(tile), totype));
       
   617 }
       
   618 
       
   619 
       
   620 /** Build a long piece of road.
   596 /** Build a long piece of road.
   621  * @param end_tile end tile of drag
   597  * @param end_tile end tile of drag
   622  * @param flags operation to perform
   598  * @param flags operation to perform
   623  * @param p1 start tile of drag
   599  * @param p1 start tile of drag
   624  * @param p2 various bitstuffed elements
   600  * @param p2 various bitstuffed elements