mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r2447) * Add: [NPF] Penalty for road vehicles making turns.
This commit is contained in:
parent
085cc7ca0e
commit
fc5784a310
6
npf.c
6
npf.c
|
@ -322,8 +322,10 @@ int32 NPFRoadPathCost(AyStar* as, AyStarNode* current, OpenListNode* parent) {
|
||||||
/* Check for slope */
|
/* Check for slope */
|
||||||
cost += NPFSlopeCost(current);
|
cost += NPFSlopeCost(current);
|
||||||
|
|
||||||
/* Check for turns */
|
/* Check for turns. Road vehicles only really drive diagonal, turns are
|
||||||
//TODO
|
* represented by non-diagonal tracks */
|
||||||
|
if (!IsDiagonalTrackdir(current->direction))
|
||||||
|
cost += _patches.npf_road_curve_penalty;
|
||||||
|
|
||||||
NPFMarkTile(tile);
|
NPFMarkTile(tile);
|
||||||
DEBUG(npf, 4)("Calculating G for: (%d, %d). Result: %d", TileX(current->tile), TileY(current->tile), cost);
|
DEBUG(npf, 4)("Calculating G for: (%d, %d). Result: %d", TileX(current->tile), TileY(current->tile), cost);
|
||||||
|
|
|
@ -975,6 +975,8 @@ const SettingDesc patch_settings[] = {
|
||||||
* rail curve penalty, since ships (realisticly) have more trouble with
|
* rail curve penalty, since ships (realisticly) have more trouble with
|
||||||
* making turns */
|
* making turns */
|
||||||
{"npf_water_curve_penalty", SDT_UINT32, (void*)(NPF_TILE_LENGTH / 4), &_patches.npf_water_curve_penalty, NULL},
|
{"npf_water_curve_penalty", SDT_UINT32, (void*)(NPF_TILE_LENGTH / 4), &_patches.npf_water_curve_penalty, NULL},
|
||||||
|
/* This is the penalty for road, same as for rail. */
|
||||||
|
{"npf_road_curve_penalty", SDT_UINT32, (void*)(1), &_patches.npf_road_curve_penalty, NULL},
|
||||||
|
|
||||||
{NULL, 0, NULL, NULL, NULL}
|
{NULL, 0, NULL, NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
|
@ -215,6 +215,7 @@ typedef struct Patches {
|
||||||
uint32 npf_rail_depot_reverse_penalty; /* The penalty for reversing in depots */
|
uint32 npf_rail_depot_reverse_penalty; /* The penalty for reversing in depots */
|
||||||
uint32 npf_buoy_penalty; /* The penalty for going over (through) a buoy */
|
uint32 npf_buoy_penalty; /* The penalty for going over (through) a buoy */
|
||||||
uint32 npf_water_curve_penalty; /* The penalty for curves */
|
uint32 npf_water_curve_penalty; /* The penalty for curves */
|
||||||
|
uint32 npf_road_curve_penalty; /* The penalty for curves */
|
||||||
|
|
||||||
bool population_in_label; // Show the population of a town in his label?
|
bool population_in_label; // Show the population of a town in his label?
|
||||||
} Patches;
|
} Patches;
|
||||||
|
|
Loading…
Reference in New Issue