summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2021-05-20 22:48:43 +0200
committerAki <please@ignore.pl>2021-05-20 22:48:43 +0200
commit2792ef8a23112899c106c35142c7ff8dedd001e2 (patch)
treebff4546e08c2b0f0b937fad3bc06dcc34e893d4a
parent0408fade8b5650c3ce61e733d13a1fdd6dabb66b (diff)
downloadfield-2792ef8a23112899c106c35142c7ff8dedd001e2.zip
field-2792ef8a23112899c106c35142c7ff8dedd001e2.tar.gz
field-2792ef8a23112899c106c35142c7ff8dedd001e2.tar.bz2
Removed empty ids from names
-rw-r--r--storage.go9
1 files 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
}