src/yapf/yapf_road.cpp
branchnoai
changeset 9694 e72987579514
parent 9629 66dde6412125
child 8329 77e50bd6ad67
equal deleted inserted replaced
9693:31fcaa5375a1 9694:e72987579514
    46 		int cost = 0;
    46 		int cost = 0;
    47 		// set base cost
    47 		// set base cost
    48 		if (IsDiagonalTrackdir(trackdir)) {
    48 		if (IsDiagonalTrackdir(trackdir)) {
    49 			cost += YAPF_TILE_LENGTH;
    49 			cost += YAPF_TILE_LENGTH;
    50 			switch (GetTileType(tile)) {
    50 			switch (GetTileType(tile)) {
    51 				case MP_STREET:
    51 				case MP_ROAD:
    52 					/* Increase the cost for level crossings */
    52 					/* Increase the cost for level crossings */
    53 					if (IsLevelCrossing(tile))
    53 					if (IsLevelCrossing(tile))
    54 						cost += Yapf().PfGetSettings().road_crossing_penalty;
    54 						cost += Yapf().PfGetSettings().road_crossing_penalty;
    55 					break;
    55 					break;
    56 				case MP_STATION:
    56 				case MP_STATION:
   440 	Trackdir trackdir = GetVehicleTrackdir(v);
   440 	Trackdir trackdir = GetVehicleTrackdir(v);
   441 	if ((GetTileTrackStatus(tile, TRANSPORT_ROAD, v->u.road.compatible_roadtypes) & TrackdirToTrackdirBits(trackdir)) == 0)
   441 	if ((GetTileTrackStatus(tile, TRANSPORT_ROAD, v->u.road.compatible_roadtypes) & TrackdirToTrackdirBits(trackdir)) == 0)
   442 		return NULL;
   442 		return NULL;
   443 
   443 
   444 	// handle the case when our vehicle is already in the depot tile
   444 	// handle the case when our vehicle is already in the depot tile
   445 	if (IsTileType(tile, MP_STREET) && IsTileDepotType(tile, TRANSPORT_ROAD)) {
   445 	if (IsTileType(tile, MP_ROAD) && IsTileDepotType(tile, TRANSPORT_ROAD)) {
   446 		// only what we need to return is the Depot*
   446 		// only what we need to return is the Depot*
   447 		return GetDepotByTile(tile);
   447 		return GetDepotByTile(tile);
   448 	}
   448 	}
   449 
   449 
   450 	// default is YAPF type 2
   450 	// default is YAPF type 2