mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
parent
cc4db1deff
commit
87399c9ada
@ -79,13 +79,11 @@ class TransitNetwork:
|
|||||||
yield from self.nodes[control_point]
|
yield from self.nodes[control_point]
|
||||||
|
|
||||||
def cost(self, a: ControlPoint, b: ControlPoint) -> float:
|
def cost(self, a: ControlPoint, b: ControlPoint) -> float:
|
||||||
|
distance = a.position.distance_to_point(b.position)
|
||||||
return {
|
return {
|
||||||
TransitConnection.Road: 1,
|
TransitConnection.Road: distance, # convoy drives distance once
|
||||||
TransitConnection.Shipping: 3,
|
TransitConnection.Shipping: 2 * distance, # ship goes back & forth
|
||||||
# Set arbitrarily high so that other methods are preferred, but still scaled
|
TransitConnection.Airlift: 3 * distance, # to pickup + back & forth
|
||||||
# by distance so that when we do need it we still pick the closest airfield.
|
|
||||||
# The units of distance are meters so there's no risk of these
|
|
||||||
TransitConnection.Airlift: a.position.distance_to_point(b.position),
|
|
||||||
}[self.link_type(a, b)]
|
}[self.link_type(a, b)]
|
||||||
|
|
||||||
def has_path_between(
|
def has_path_between(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user