mirror of
https://github.com/renorris/openfsd
synced 2026-04-30 13:25:32 +08:00
only do velocity distance calculation for relevant clients
This commit is contained in:
@@ -165,15 +165,17 @@ func (s *Server) handlePilotPosition(client *Client, packet []byte) {
|
|||||||
client.lastUpdated.Store(time.Now())
|
client.lastUpdated.Store(time.Now())
|
||||||
|
|
||||||
// Check if we need to update the sendfast state
|
// Check if we need to update the sendfast state
|
||||||
if client.sendFastEnabled {
|
if client.protoRevision == 101 {
|
||||||
if (client.closestVelocityClientDistance / 1852.0) > 5.0 { // 5.0 nautical miles
|
if client.sendFastEnabled {
|
||||||
client.sendFastEnabled = false
|
if (client.closestVelocityClientDistance / 1852.0) > 5.0 { // 5.0 nautical miles
|
||||||
sendDisableSendFastPacket(client)
|
client.sendFastEnabled = false
|
||||||
}
|
sendDisableSendFastPacket(client)
|
||||||
} else {
|
}
|
||||||
if (client.closestVelocityClientDistance / 1852.0) < 5.0 { // 5.0 nautical miles
|
} else {
|
||||||
client.sendFastEnabled = true
|
if (client.closestVelocityClientDistance / 1852.0) < 5.0 { // 5.0 nautical miles
|
||||||
sendEnableSendFastPacket(client)
|
client.sendFastEnabled = true
|
||||||
|
sendEnableSendFastPacket(client)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ func (p *postOffice) search(client *Client, callback func(recipient *Client) boo
|
|||||||
return true // Ignore self
|
return true // Ignore self
|
||||||
}
|
}
|
||||||
|
|
||||||
if foundClient.protoRevision == 101 {
|
if !client.isAtc && client.protoRevision == 101 && foundClient.protoRevision == 101 {
|
||||||
clientLatLon := client.latLon()
|
clientLatLon := client.latLon()
|
||||||
foundClientLatLon := foundClient.latLon()
|
foundClientLatLon := foundClient.latLon()
|
||||||
dist := distance(clientLatLon[0], clientLatLon[1], foundClientLatLon[0], foundClientLatLon[1])
|
dist := distance(clientLatLon[0], clientLatLon[1], foundClientLatLon[0], foundClientLatLon[1])
|
||||||
|
|||||||
Reference in New Issue
Block a user