From 2792ef8a23112899c106c35142c7ff8dedd001e2 Mon Sep 17 00:00:00 2001 From: Aki Date: Thu, 20 May 2021 22:48:43 +0200 Subject: Removed empty ids from names --- storage.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/storage.go b/storage.go index 67c71f1..b97e8db 100644 --- a/storage.go +++ b/storage.go @@ -57,6 +57,7 @@ func (b *Battle) From(stub *BattleStub) error { b.Ships = make(map[int32]Ship) b.Locations = make(map[int32]Location) b.Names = make(map[int32]string) + mark := func (id int32) { if id != 0 { b.Names[id] = "" } } for _, km := range stub.Killmails { details, err := GetKillmail(km.Id, km.Hash) if err != nil { @@ -65,10 +66,10 @@ func (b *Battle) From(stub *BattleStub) error { details.Hash = km.Hash b.Locations[details.SolarSystemId] = Location{} b.Ships[details.Victim.ShipTypeId] = Ship{} - b.Names[details.Victim.CharacterId] = "" - b.Names[details.Victim.CorporationId] = "" - b.Names[details.Victim.AllianceId] = "" - b.Names[details.Victim.FactionId] = "" + mark(details.Victim.CharacterId) + mark(details.Victim.CorporationId) + mark(details.Victim.AllianceId) + mark(details.Victim.FactionId) if b.StartTime.IsZero() || b.StartTime.After(details.Time) { b.StartTime = details.Time } -- cgit v1.1