This commit is contained in:
shoopea 2020-01-12 20:16:42 +08:00
parent 13591b9eda
commit 74c72e90d4

21
obj.go
View File

@ -968,7 +968,7 @@ func loadObjItem2() error {
if id == 0 { if id == 0 {
id = getSilentObjItemID(i.Code, ``) id = getSilentObjItemID(i.Code, ``)
if id == 0 { if id == 0 {
id, err = addObjItem(i.Code, n, i.ItemTypeID, i.Weight, (i.Exchange != ``), i.Auction) id, err = addObjItem(i.Code, n, i.ItemTypeID, i.Weight, i.Exchange, i.Auction)
logOnError(err, "loadObjItem2 : addObjItem") logOnError(err, "loadObjItem2 : addObjItem")
} }
} else { } else {
@ -1014,7 +1014,9 @@ func loadObjItem() error {
c.ObjID64 = id c.ObjID64 = id
c.ItemTypeID = type_id c.ItemTypeID = type_id
c.Code = intl_id c.Code = intl_id
c.Name = name n := make([]string, 1)
n = append(n, name)
c.Names = n
c.Weight = weight c.Weight = weight
muxObjItem.Lock() muxObjItem.Lock()
@ -1039,14 +1041,15 @@ func loadObjItem() error {
return err return err
} }
if _, ok := cacheObjItem[intl_id]; ok { if c, ok := cacheObjItem[intl_id]; ok {
c := new(ChatWarsItem) n := c.Names
c.ObjID64 = id n = append(n, name)
c.Code = intl_id c.Names = n
c.Name = name
c.Weight = weight
muxObjItem.Lock() muxObjItem.Lock()
cacheObjItem[name] = *c cacheObjItem[intl_id] = *c
for _, n := range c.Names {
cacheObjItem[name] = *c
}
muxObjItem.Unlock() muxObjItem.Unlock()
} else { } else {
log.Printf("loadObjItem : orphaned obj_name for `%s` : %s.\n", intl_id, name) log.Printf("loadObjItem : orphaned obj_name for `%s` : %s.\n", intl_id, name)