(svn r22801) -Feature: [YAPF] Take canal/ocean speed fraction of ships into account.
This commit is contained in:
@@ -133,8 +133,14 @@ public:
|
||||
c += YAPF_TILE_LENGTH;
|
||||
}
|
||||
|
||||
/* Skipped tile cost for aqueducts. */
|
||||
c += YAPF_TILE_LENGTH * tf->m_tiles_skipped;
|
||||
|
||||
/* Ocean/canal speed penalty. */
|
||||
const ShipVehicleInfo *svi = ShipVehInfo(Yapf().GetVehicle()->engine_type);
|
||||
byte speed_frac = (GetEffectiveWaterClass(n.GetTile()) == WATER_CLASS_SEA) ? svi->ocean_speed_frac : svi->canal_speed_frac;
|
||||
if (speed_frac > 0) c += YAPF_TILE_LENGTH * (1 + tf->m_tiles_skipped) * speed_frac / (256 - speed_frac);
|
||||
|
||||
/* apply it */
|
||||
n.m_cost = n.m_parent->m_cost + c;
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user