File diff r4076:ac684fc44bc2 → r4077:259c4c4aacad
npf.c
Show inline comments
 
@@ -204,27 +204,25 @@ static uint NPFSlopeCost(AyStarNode* cur
 
	return 0;
 
	/* Should we give a bonus for slope down? Probably not, we
 
	 * could just substract that bonus from the penalty, because
 
	 * there is only one level of steepness... */
 
}
 

	
 
/**
 
 * Mark tiles by mowing the grass when npf debug level >= 1.
 
 * Will not work for multiplayer games, since it can (will) cause desyncs.
 
 */
 
static void NPFMarkTile(TileIndex tile)
 
{
 
#ifdef NO_DEBUG_MESSAGES
 
	return;
 
#else
 
#ifndef NO_DEBUG_MESSAGES
 
	if (_debug_npf_level < 1 || _networking) return;
 
	switch (GetTileType(tile)) {
 
		case MP_RAILWAY:
 
			/* DEBUG: mark visited tiles by mowing the grass under them ;-) */
 
			if (!IsTileDepotType(tile, TRANSPORT_RAIL)) {
 
				SetRailGroundType(tile, RAIL_GROUND_BARREN);
 
				MarkTileDirtyByTile(tile);
 
			}
 
			break;
 

	
 
		case MP_STREET:
 
			if (!IsTileDepotType(tile, TRANSPORT_ROAD)) {
 
@@ -797,32 +795,30 @@ NPFFoundTargetData NPFRouteToDepotTrialE
 
		if (IsValidDepot(depot) && IsTileDepotType(depot->xy, type) && IsTileOwner(depot->xy, owner))
 
			/* If so, let's add it to the queue, sorted by distance */
 
			depots.push(&depots, depot, DistanceManhattan(tile, depot->xy));
 
	}
 

	
 
	/* Now, let's initialise the aystar */
 

	
 
	/* Initialize procs */
 
	_npf_aystar.CalculateH = NPFCalcStationOrTileHeuristic;
 
	_npf_aystar.EndNodeCheck = NPFFindStationOrTile;
 
	_npf_aystar.FoundEndNode = NPFSaveTargetData;
 
	_npf_aystar.GetNeighbours = NPFFollowTrack;
 
	if (type == TRANSPORT_RAIL)
 
		_npf_aystar.CalculateG = NPFRailPathCost;
 
	else if (type == TRANSPORT_ROAD)
 
		_npf_aystar.CalculateG = NPFRoadPathCost;
 
	else if (type == TRANSPORT_WATER)
 
		_npf_aystar.CalculateG = NPFWaterPathCost;
 
	else
 
		assert(0);
 
	switch (type) {
 
		default: NOT_REACHED();
 
		case TRANSPORT_RAIL:  _npf_aystar.CalculateG = NPFRailPathCost;  break;
 
		case TRANSPORT_ROAD:  _npf_aystar.CalculateG = NPFRoadPathCost;  break;
 
		case TRANSPORT_WATER: _npf_aystar.CalculateG = NPFWaterPathCost; break;
 
	}
 

	
 
	/* Initialize target */
 
	target.station_index = INVALID_STATION; /* We will initialize dest_coords inside the loop below */
 
	_npf_aystar.user_target = &target;
 

	
 
	/* Initialize user_data */
 
	_npf_aystar.user_data[NPF_TYPE] = type;
 
	_npf_aystar.user_data[NPF_OWNER] = owner;
 

	
 
	/* Initialize Start Node */
 
	start.tile = tile;
 
	start.direction = trackdir; /* We will initialize user_data inside the loop below */