src/roadveh_cmd.cpp
changeset 8579 3efbb430092e
parent 8577 fc4b7dd34058
child 8584 a8b6dffead63
equal deleted inserted replaced
8578:55218950ce2d 8579:3efbb430092e
    35 #include "newgrf_text.h"
    35 #include "newgrf_text.h"
    36 #include "newgrf_sound.h"
    36 #include "newgrf_sound.h"
    37 #include "yapf/yapf.h"
    37 #include "yapf/yapf.h"
    38 #include "date.h"
    38 #include "date.h"
    39 #include "cargotype.h"
    39 #include "cargotype.h"
       
    40 #include "tunnelbridge_map.h"
       
    41 
    40 
    42 
    41 static const uint16 _roadveh_images[63] = {
    43 static const uint16 _roadveh_images[63] = {
    42 	0xCD4, 0xCDC, 0xCE4, 0xCEC, 0xCF4, 0xCFC, 0xD0C, 0xD14,
    44 	0xCD4, 0xCDC, 0xCE4, 0xCEC, 0xCF4, 0xCFC, 0xD0C, 0xD14,
    43 	0xD24, 0xD1C, 0xD2C, 0xD04, 0xD1C, 0xD24, 0xD6C, 0xD74,
    45 	0xD24, 0xD1C, 0xD2C, 0xD04, 0xD1C, 0xD24, 0xD6C, 0xD74,
    44 	0xD7C, 0xC14, 0xC1C, 0xC24, 0xC2C, 0xC34, 0xC3C, 0xC4C,
    46 	0xD7C, 0xC14, 0xC1C, 0xC24, 0xC2C, 0xC34, 0xC3C, 0xC4C,
   547 		return CMD_ERROR;
   549 		return CMD_ERROR;
   548 	}
   550 	}
   549 
   551 
   550 	if (IsTileType(v->tile, MP_ROAD) && GetRoadTileType(v->tile) == ROAD_TILE_NORMAL && GetDisallowedRoadDirections(v->tile) != DRD_NONE) return CMD_ERROR;
   552 	if (IsTileType(v->tile, MP_ROAD) && GetRoadTileType(v->tile) == ROAD_TILE_NORMAL && GetDisallowedRoadDirections(v->tile) != DRD_NONE) return CMD_ERROR;
   551 
   553 
   552 	if (IsTunnelTile(v->tile) && DirToDiagDir(v->direction) == GetTunnelDirection(v->tile)) return CMD_ERROR;
   554 	if (IsTunnelTile(v->tile) && DirToDiagDir(v->direction) == GetTunnelBridgeDirection(v->tile)) return CMD_ERROR;
   553 	if (IsBridgeTile(v->tile) && DirToDiagDir(v->direction) == GetBridgeRampDirection(v->tile)) return CMD_ERROR;
   555 	if (IsBridgeTile(v->tile) && DirToDiagDir(v->direction) == GetTunnelBridgeDirection(v->tile)) return CMD_ERROR;
   554 
   556 
   555 	if (flags & DC_EXEC) v->u.road.reverse_ctr = 180;
   557 	if (flags & DC_EXEC) v->u.road.reverse_ctr = 180;
   556 
   558 
   557 	return CommandCost();
   559 	return CommandCost();
   558 }
   560 }
  1404 
  1406 
  1405 	if (prev_state == RVSB_WORMHOLE || prev_state == RVSB_IN_DEPOT) {
  1407 	if (prev_state == RVSB_WORMHOLE || prev_state == RVSB_IN_DEPOT) {
  1406 		DiagDirection diag_dir = INVALID_DIAGDIR;
  1408 		DiagDirection diag_dir = INVALID_DIAGDIR;
  1407 
  1409 
  1408 		if (IsTunnelTile(tile)) {
  1410 		if (IsTunnelTile(tile)) {
  1409 			diag_dir = GetTunnelDirection(tile);
  1411 			diag_dir = GetTunnelBridgeDirection(tile);
  1410 		} else if (IsBridgeTile(tile)) {
  1412 		} else if (IsBridgeTile(tile)) {
  1411 			diag_dir = GetBridgeRampDirection(tile);
  1413 			diag_dir = GetTunnelBridgeDirection(tile);
  1412 		} else if (IsTileType(tile, MP_ROAD) && GetRoadTileType(tile) == ROAD_TILE_DEPOT) {
  1414 		} else if (IsTileType(tile, MP_ROAD) && GetRoadTileType(tile) == ROAD_TILE_DEPOT) {
  1413 			diag_dir = ReverseDiagDir(GetRoadDepotDirection(tile));
  1415 			diag_dir = ReverseDiagDir(GetRoadDepotDirection(tile));
  1414 		}
  1416 		}
  1415 
  1417 
  1416 		if (diag_dir == INVALID_DIAGDIR) return INVALID_TRACKDIR;
  1418 		if (diag_dir == INVALID_DIAGDIR) return INVALID_TRACKDIR;