summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-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
}