(svn r1964) - Add: [NPF] Added a penalty
authormatthijs
Tue, 08 Mar 2005 19:59:56 +0000
changeset 1460 ebd1cfae9588
parent 1459 6c1f01803928
child 1461 b1505c82ebae
(svn r1964) - Add: [NPF] Added a penalty
npf.c
settings.c
variables.h
--- a/npf.c	Tue Mar 08 19:54:10 2005 +0000
+++ b/npf.c	Tue Mar 08 19:59:56 2005 +0000
@@ -369,7 +369,10 @@
 	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
--- a/settings.c	Tue Mar 08 19:54:10 2005 +0000
+++ b/settings.c	Tue Mar 08 19:59:56 2005 +0000
@@ -949,6 +949,7 @@
 	*/
 	{"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}
 };
--- a/variables.h	Tue Mar 08 19:54:10 2005 +0000
+++ b/variables.h	Tue Mar 08 19:59:56 2005 +0000
@@ -196,6 +196,7 @@
 	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;