Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/composer/vector.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (c *Composer) ComposeVectorResponse(response brevity.VectorResponse) Natura
distance,
),
Speech: fmt.Sprintf(
"%s, vector to %s, %s %d",
"%s, vector to %s, %s, %d",
callsign,
response.Location,
pronounceBearing(response.Vector.Bearing()),
Expand Down
4 changes: 4 additions & 0 deletions pkg/controller/vector.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ func (c *Controller) HandleVector(ctx context.Context, request *brevity.VectorRe
response.Status = targetLocation != nil

if response.Status {
if len(targetLocation.Names) > 0 {
response.Location = targetLocation.Names[0]
}

origin := trackfile.LastKnown().Point
target := targetLocation.Point()
declination := c.scope.Declination(origin)
Expand Down
22 changes: 22 additions & 0 deletions pkg/controller/vector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,28 @@ func TestHandleVector_HappyPath(t *testing.T) {
assert.Nil(t, resp.BRA)
}

func TestHandleVector_UsesCanonicalConfiguredLocationName(t *testing.T) {
t.Parallel()
locs := []locations.Location{
{Names: []string{"home plate", "base"}, Longitude: 30.0, Latitude: 40.0},
}
h := newControllerTestHarness(t, locs)
h.insertAircraft(t, "Eagle 1 Reaper", acmiF15C, coalitions.Blue, orb.Point{30.1, 40.1})

h.ctrl.HandleVector(h.ctx, &brevity.VectorRequest{
Callsign: "eagle 1",
Location: "base",
})
got := h.expectResponse(t)
resp, ok := got.(brevity.VectorResponse)
require.True(t, ok)
assert.Equal(t, "home plate", resp.Location)
assert.True(t, resp.Contact)
assert.True(t, resp.Status)
require.NotNil(t, resp.Vector)
assert.Nil(t, resp.BRA)
}

func TestHandleVector_Tanker_NoCompatibleTanker(t *testing.T) {
t.Parallel()
h := newControllerTestHarness(t, nil)
Expand Down
Loading