summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatthijs <matthijs@openttd.org>2005-03-08 19:59:56 +0000
committermatthijs <matthijs@openttd.org>2005-03-08 19:59:56 +0000
commitaea57f2026725e8575c27a7671c3f012e2153dde (patch)
tree8c987666994b0ccd8a17a956af447380d10181c2
parent232e41f2ff867bd1281c76ec3037d11cb5db0e65 (diff)
downloadopenttd-aea57f2026725e8575c27a7671c3f012e2153dde.tar.xz
(svn r1964) - Add: [NPF] Added a penalty
-rw-r--r--npf.c5
-rw-r--r--settings.c1
-rw-r--r--variables.h1
3 files changed, 6 insertions, 1 deletions
diff --git a/npf.c b/npf.c
index ab7cdb5a9..786fef609 100644
--- a/npf.c
+++ b/npf.c
@@ -369,7 +369,10 @@ int32 NPFRailPathCost(AyStar* as, AyStarNode* current, OpenListNode* parent) {
cost += NPFSlopeCost(current);
/* Check for turns */
- //TODO
+ if (current->direction != parent->path.node.direction)
+ cost += _patches.npf_rail_curve_penalty;
+ //TODO, with realistic acceleration, also the amount of straight track between
+ // curves should be taken into account, as this affects the speed limit.
/* Check for occupied track */
//TODO
diff --git a/settings.c b/settings.c
index ebd2eea3c..59ac388ed 100644
--- a/settings.c
+++ b/settings.c
@@ -949,6 +949,7 @@ const SettingDesc patch_settings[] = {
*/
{"npf_rail_station_penalty", SDT_UINT32, (void*)(1 * NPF_TILE_LENGTH), &_patches.npf_rail_station_penalty, NULL},
{"npf_rail_slope_penalty", SDT_UINT32, (void*)(1 * NPF_TILE_LENGTH), &_patches.npf_rail_slope_penalty, NULL},
+ {"npf_rail_curve_penalty", SDT_UINT32, (void*)(1), &_patches.npf_rail_curve_penalty, NULL},
{NULL, 0, NULL, NULL, NULL}
};
diff --git a/variables.h b/variables.h
index ecc525749..3149f827b 100644
--- a/variables.h
+++ b/variables.h
@@ -196,6 +196,7 @@ typedef struct Patches {
uint32 npf_rail_lastred_penalty; /* The penalty for when the last signal is red */
uint32 npf_rail_station_penalty; /* The penalty for station tiles */
uint32 npf_rail_slope_penalty; /* The penalty for sloping upwards */
+ uint32 npf_rail_curve_penalty; /* The penalty for curves */
bool population_in_label; // Show the population of a town in his label?
} Patches;