rail_cmd.c
changeset 2952 6a26eeda9679
parent 2951 2db3adee7736
child 2989 99c95a3ebcaa
equal deleted inserted replaced
2951:2db3adee7736 2952:6a26eeda9679
   420 
   420 
   421 	// allow building rail under bridge
   421 	// allow building rail under bridge
   422 	if (!IsTileType(tile, MP_TUNNELBRIDGE) && !EnsureNoVehicle(tile))
   422 	if (!IsTileType(tile, MP_TUNNELBRIDGE) && !EnsureNoVehicle(tile))
   423 		return CMD_ERROR;
   423 		return CMD_ERROR;
   424 
   424 
   425 	switch(GetTileType(tile))
   425 	switch (GetTileType(tile))
   426 	{
   426 	{
   427 		case MP_TUNNELBRIDGE:
   427 		case MP_TUNNELBRIDGE:
   428 			if (!EnsureNoVehicleZ(tile, TilePixelHeight(tile)))
   428 			if (!EnsureNoVehicleZ(tile, TilePixelHeight(tile)))
   429 				return CMD_ERROR;
   429 				return CMD_ERROR;
   430 
   430 
   590 
   590 
   591 	if (CmdFailed(ValidateAutoDrag(&trackdir, x, y, ex, ey))) return CMD_ERROR;
   591 	if (CmdFailed(ValidateAutoDrag(&trackdir, x, y, ex, ey))) return CMD_ERROR;
   592 
   592 
   593 	if (flags & DC_EXEC) SndPlayTileFx(SND_20_SPLAT_2, TileVirtXY(x, y));
   593 	if (flags & DC_EXEC) SndPlayTileFx(SND_20_SPLAT_2, TileVirtXY(x, y));
   594 
   594 
   595 	for(;;) {
   595 	for (;;) {
   596 		ret = DoCommand(x, y, railtype, TrackdirToTrack(trackdir), flags, (mode == 0) ? CMD_BUILD_SINGLE_RAIL : CMD_REMOVE_SINGLE_RAIL);
   596 		ret = DoCommand(x, y, railtype, TrackdirToTrack(trackdir), flags, (mode == 0) ? CMD_BUILD_SINGLE_RAIL : CMD_REMOVE_SINGLE_RAIL);
   597 
   597 
   598 		if (CmdFailed(ret)) {
   598 		if (CmdFailed(ret)) {
   599 			if ((_error_message != STR_1007_ALREADY_BUILT) && (mode == 0))
   599 			if ((_error_message != STR_1007_ALREADY_BUILT) && (mode == 0))
   600 				break;
   600 				break;