(svn r4893) - Fix (FS#57): Disable NPF totally for ships as it wholly kills performance (blathijs). Only for 0.4/ branch and 0.4.8.

This commit is contained in:
Darkvater 2006-05-16 21:38:41 +00:00
parent 8892c1d1de
commit d27bedce36
2 changed files with 9 additions and 3 deletions

View File

@ -323,8 +323,7 @@ int32 CmdInsertOrder(int x, int y, uint32 flags, uint32 p1, uint32 p2)
/* For ships, make sure that the station is not too far away from the /* For ships, make sure that the station is not too far away from the
* previous destination, for human players with new pathfinding disabled */ * previous destination, for human players with new pathfinding disabled */
if (v->type == VEH_Ship && IS_HUMAN_PLAYER(v->owner) && if (v->type == VEH_Ship && IS_HUMAN_PLAYER(v->owner) &&
sel_ord != 0 && GetVehicleOrder(v, sel_ord - 1)->type == OT_GOTO_STATION sel_ord != 0 && GetVehicleOrder(v, sel_ord - 1)->type == OT_GOTO_STATION) {
&& !_patches.new_pathfinding_all) {
int dist = DistanceManhattan( int dist = DistanceManhattan(
GetStation(GetVehicleOrder(v, sel_ord - 1)->station)->xy, GetStation(GetVehicleOrder(v, sel_ord - 1)->station)->xy,

View File

@ -64,7 +64,7 @@ static const Depot* FindClosestShipDepot(const Vehicle* v)
uint best_dist = (uint)-1; uint best_dist = (uint)-1;
TileIndex tile; TileIndex tile;
TileIndex tile2 = v->tile; TileIndex tile2 = v->tile;
#if 0
if (_patches.new_pathfinding_all) { if (_patches.new_pathfinding_all) {
NPFFoundTargetData ftd; NPFFoundTargetData ftd;
byte trackdir = GetVehicleTrackdir(v); byte trackdir = GetVehicleTrackdir(v);
@ -75,6 +75,8 @@ static const Depot* FindClosestShipDepot(const Vehicle* v)
best_depot = NULL; /* Did not find target */ best_depot = NULL; /* Did not find target */
} }
} else { } else {
#else
{
FOR_ALL_DEPOTS(depot) { FOR_ALL_DEPOTS(depot) {
tile = depot->xy; tile = depot->xy;
if (IsValidDepot(depot) && IsTileDepotType(tile, TRANSPORT_WATER) && IsTileOwner(tile, v->owner)) { if (IsValidDepot(depot) && IsTileDepotType(tile, TRANSPORT_WATER) && IsTileOwner(tile, v->owner)) {
@ -86,6 +88,7 @@ static const Depot* FindClosestShipDepot(const Vehicle* v)
} }
} }
} }
#endif
return best_depot; return best_depot;
} }
@ -534,6 +537,7 @@ static int ChooseShipTrack(Vehicle *v, TileIndex tile, int enterdir, uint tracks
{ {
assert(enterdir>=0 && enterdir<=3); assert(enterdir>=0 && enterdir<=3);
#if 0
if (_patches.new_pathfinding_all) { if (_patches.new_pathfinding_all) {
NPFFindStationOrTileData fstd; NPFFindStationOrTileData fstd;
NPFFoundTargetData ftd; NPFFoundTargetData ftd;
@ -555,6 +559,8 @@ static int ChooseShipTrack(Vehicle *v, TileIndex tile, int enterdir, uint tracks
return -1; /* Already at target, reverse? */ return -1; /* Already at target, reverse? */
} }
} else { } else {
#else
{
uint b; uint b;
uint tot_dist, dist; uint tot_dist, dist;
int track; int track;
@ -577,6 +583,7 @@ static int ChooseShipTrack(Vehicle *v, TileIndex tile, int enterdir, uint tracks
return -1; return -1;
return track; return track;
} }
#endif
} }
static const byte _new_vehicle_direction_table[11] = { static const byte _new_vehicle_direction_table[11] = {