src/npf.cpp
branchcpp_gui
changeset 6254 abc6ad7c035c
parent 5849 58039c9dc565
child 6268 4b5241e5dd10
equal deleted inserted replaced
6253:23983700e3d7 6254:abc6ad7c035c
   277 			cost = NPF_TILE_LENGTH;
   277 			cost = NPF_TILE_LENGTH;
   278 			/* Increase the cost for level crossings */
   278 			/* Increase the cost for level crossings */
   279 			if (IsLevelCrossing(tile)) cost += _patches.npf_crossing_penalty;
   279 			if (IsLevelCrossing(tile)) cost += _patches.npf_crossing_penalty;
   280 			break;
   280 			break;
   281 
   281 
       
   282 		case MP_STATION:
       
   283 			cost = NPF_TILE_LENGTH;
       
   284 			/* Increase the cost for drive-through road stops */
       
   285 			if (IsDriveThroughStopTile(tile)) cost += _patches.npf_road_drive_through_penalty;
       
   286 			break;
       
   287 
   282 		default:
   288 		default:
   283 			break;
   289 			break;
   284 	}
   290 	}
   285 
   291 
   286 	/* Determine extra costs */
   292 	/* Determine extra costs */
   451 static bool VehicleMayEnterTile(Owner owner, TileIndex tile, DiagDirection enterdir)
   457 static bool VehicleMayEnterTile(Owner owner, TileIndex tile, DiagDirection enterdir)
   452 {
   458 {
   453 	if (IsTileType(tile, MP_RAILWAY) ||           /* Rail tile (also rail depot) */
   459 	if (IsTileType(tile, MP_RAILWAY) ||           /* Rail tile (also rail depot) */
   454 			IsRailwayStationTile(tile) ||               /* Rail station tile */
   460 			IsRailwayStationTile(tile) ||               /* Rail station tile */
   455 			IsTileDepotType(tile, TRANSPORT_ROAD) ||  /* Road depot tile */
   461 			IsTileDepotType(tile, TRANSPORT_ROAD) ||  /* Road depot tile */
   456 			IsRoadStopTile(tile) ||                /* Road station tile */
   462 			IsStandardRoadStopTile(tile) || /* Road station tile (but not drive-through stops) */
   457 			IsTileDepotType(tile, TRANSPORT_WATER)) { /* Water depot tile */
   463 			IsTileDepotType(tile, TRANSPORT_WATER)) { /* Water depot tile */
   458 		return IsTileOwner(tile, owner); /* You need to own these tiles entirely to use them */
   464 		return IsTileOwner(tile, owner); /* You need to own these tiles entirely to use them */
   459 	}
   465 	}
   460 
   466 
   461 	switch (GetTileType(tile)) {
   467 	switch (GetTileType(tile)) {
   527 		dst_tile = GetOtherTunnelEnd(src_tile);
   533 		dst_tile = GetOtherTunnelEnd(src_tile);
   528 		override_dst_check = true;
   534 		override_dst_check = true;
   529 	} else if (IsBridgeTile(src_tile) && GetBridgeRampDirection(src_tile) == src_exitdir) {
   535 	} else if (IsBridgeTile(src_tile) && GetBridgeRampDirection(src_tile) == src_exitdir) {
   530 		dst_tile = GetOtherBridgeEnd(src_tile);
   536 		dst_tile = GetOtherBridgeEnd(src_tile);
   531 		override_dst_check = true;
   537 		override_dst_check = true;
   532 	} else if (type != TRANSPORT_WATER && (IsRoadStopTile(src_tile) || IsTileDepotType(src_tile, type))) {
   538 	} else if (type != TRANSPORT_WATER && (IsStandardRoadStopTile(src_tile) || IsTileDepotType(src_tile, type))) {
   533 		/* This is a road station or a train or road depot. We can enter and exit
   539 		/* This is a road station (non drive-through) or a train or road depot. We can enter and exit
   534 		 * those from one side only. Trackdirs don't support that (yet), so we'll
   540 		 * those from one side only. Trackdirs don't support that (yet), so we'll
   535 		 * do this here. */
   541 		 * do this here. */
   536 
   542 
   537 		DiagDirection exitdir;
   543 		DiagDirection exitdir;
   538 		/* Find out the exit direction first */
   544 		/* Find out the exit direction first */
   597 	if (!VehicleMayEnterTile((Owner)aystar->user_data[NPF_OWNER], dst_tile, TrackdirToExitdir(src_trackdir))) {
   603 	if (!VehicleMayEnterTile((Owner)aystar->user_data[NPF_OWNER], dst_tile, TrackdirToExitdir(src_trackdir))) {
   598 		return;
   604 		return;
   599 	}
   605 	}
   600 
   606 
   601 	/* Determine available tracks */
   607 	/* Determine available tracks */
   602 	if (type != TRANSPORT_WATER && (IsRoadStopTile(dst_tile) || IsTileDepotType(dst_tile, type))){
   608 	if (type != TRANSPORT_WATER && (IsStandardRoadStopTile(dst_tile) || IsTileDepotType(dst_tile, type))){
   603 		/* Road stations and road and train depots return 0 on GTTS, so we have to do this by hand... */
   609 		/* Road stations and road and train depots return 0 on GTTS, so we have to do this by hand... */
   604 		DiagDirection exitdir;
   610 		DiagDirection exitdir;
   605 		if (IsRoadStopTile(dst_tile)) {
   611 		if (IsRoadStopTile(dst_tile)) {
   606 			exitdir = GetRoadStopDir(dst_tile);
   612 			exitdir = GetRoadStopDir(dst_tile);
   607 		} else { /* Road or train depot */
   613 		} else { /* Road or train depot */