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