mirror of https://github.com/OpenTTD/OpenTTD
(svn r5067) -Codechange: [YAPF] Platform selection feature now applies penalty per platform instead of per tile (should give better results)
parent
bd25f49d3f
commit
d680fcec77
|
@ -1408,8 +1408,8 @@ const SettingDesc _patch_settings[] = {
|
||||||
SDT_CONDVAR (Patches, yapf.rail_look_ahead_signal_p1 , SLE_INT , 28, SL_MAX_VERSION, 0, 0, -100 , -1000000, 1000000, STR_NULL, NULL),
|
SDT_CONDVAR (Patches, yapf.rail_look_ahead_signal_p1 , SLE_INT , 28, SL_MAX_VERSION, 0, 0, -100 , -1000000, 1000000, STR_NULL, NULL),
|
||||||
SDT_CONDVAR (Patches, yapf.rail_look_ahead_signal_p2 , SLE_INT , 28, SL_MAX_VERSION, 0, 0, 5 , -1000000, 1000000, STR_NULL, NULL),
|
SDT_CONDVAR (Patches, yapf.rail_look_ahead_signal_p2 , SLE_INT , 28, SL_MAX_VERSION, 0, 0, 5 , -1000000, 1000000, STR_NULL, NULL),
|
||||||
// penalties for too long or too short station platforms (TODO: NS flag or higher revision?)
|
// penalties for too long or too short station platforms (TODO: NS flag or higher revision?)
|
||||||
SDT_CONDVAR (Patches, yapf.rail_longer_platform_penalty, SLE_UINT, 28, SL_MAX_VERSION,NS, 0, 10 * YAPF_TILE_LENGTH, 0, 20000, STR_NULL, NULL),
|
SDT_CONDVAR (Patches, yapf.rail_longer_platform_penalty, SLE_UINT, 28, SL_MAX_VERSION,NS, 0, 8 * YAPF_TILE_LENGTH, 0, 20000, STR_NULL, NULL),
|
||||||
SDT_CONDVAR (Patches, yapf.rail_shorter_platform_penalty, SLE_UINT, 28, SL_MAX_VERSION,NS, 0, 100 * YAPF_TILE_LENGTH, 0, 20000, STR_NULL, NULL),
|
SDT_CONDVAR (Patches, yapf.rail_shorter_platform_penalty, SLE_UINT, 28, SL_MAX_VERSION,NS, 0, 40 * YAPF_TILE_LENGTH, 0, 20000, STR_NULL, NULL),
|
||||||
|
|
||||||
SDT_END()
|
SDT_END()
|
||||||
};
|
};
|
||||||
|
|
|
@ -148,10 +148,10 @@ public:
|
||||||
int needed_platform_length = (v->u.rail.cached_total_length + TILE_SIZE - 1) / TILE_SIZE;
|
int needed_platform_length = (v->u.rail.cached_total_length + TILE_SIZE - 1) / TILE_SIZE;
|
||||||
if (platform_length > needed_platform_length) {
|
if (platform_length > needed_platform_length) {
|
||||||
// apply penalty for longer platform than needed
|
// apply penalty for longer platform than needed
|
||||||
cost += Yapf().PfGetSettings().rail_longer_platform_penalty * (platform_length - needed_platform_length);
|
cost += Yapf().PfGetSettings().rail_longer_platform_penalty;
|
||||||
} else {
|
} else if (needed_platform_length > platform_length) {
|
||||||
// apply penalty for shorter platform than needed
|
// apply penalty for shorter platform than needed
|
||||||
cost += Yapf().PfGetSettings().rail_shorter_platform_penalty * (needed_platform_length - platform_length);
|
cost += Yapf().PfGetSettings().rail_shorter_platform_penalty;
|
||||||
}
|
}
|
||||||
return cost;
|
return cost;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue