diff options
author | Aki <please@ignore.pl> | 2021-05-20 22:48:43 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2021-05-20 22:48:43 +0200 |
commit | 2792ef8a23112899c106c35142c7ff8dedd001e2 (patch) | |
tree | bff4546e08c2b0f0b937fad3bc06dcc34e893d4a | |
parent | 0408fade8b5650c3ce61e733d13a1fdd6dabb66b (diff) | |
download | field-2792ef8a23112899c106c35142c7ff8dedd001e2.zip field-2792ef8a23112899c106c35142c7ff8dedd001e2.tar.gz field-2792ef8a23112899c106c35142c7ff8dedd001e2.tar.bz2 |
Removed empty ids from names
-rw-r--r-- | storage.go | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -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 } |