mirror of
https://github.com/renorris/openfsd
synced 2026-03-22 06:25:35 +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())
|
||||
|
||||
// Check if we need to update the sendfast state
|
||||
if client.sendFastEnabled {
|
||||
if (client.closestVelocityClientDistance / 1852.0) > 5.0 { // 5.0 nautical miles
|
||||
client.sendFastEnabled = false
|
||||
sendDisableSendFastPacket(client)
|
||||
}
|
||||
} else {
|
||||
if (client.closestVelocityClientDistance / 1852.0) < 5.0 { // 5.0 nautical miles
|
||||
client.sendFastEnabled = true
|
||||
sendEnableSendFastPacket(client)
|
||||
if client.protoRevision == 101 {
|
||||
if client.sendFastEnabled {
|
||||
if (client.closestVelocityClientDistance / 1852.0) > 5.0 { // 5.0 nautical miles
|
||||
client.sendFastEnabled = false
|
||||
sendDisableSendFastPacket(client)
|
||||
}
|
||||
} else {
|
||||
if (client.closestVelocityClientDistance / 1852.0) < 5.0 { // 5.0 nautical miles
|
||||
client.sendFastEnabled = true
|
||||
sendEnableSendFastPacket(client)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ func (p *postOffice) search(client *Client, callback func(recipient *Client) boo
|
||||
return true // Ignore self
|
||||
}
|
||||
|
||||
if foundClient.protoRevision == 101 {
|
||||
if !client.isAtc && client.protoRevision == 101 && foundClient.protoRevision == 101 {
|
||||
clientLatLon := client.latLon()
|
||||
foundClientLatLon := foundClient.latLon()
|
||||
dist := distance(clientLatLon[0], clientLatLon[1], foundClientLatLon[0], foundClientLatLon[1])
|
||||
|
||||
Reference in New Issue
Block a user