This commit is contained in:
shoopea 2020-01-12 21:30:42 +08:00
parent 3bc3742bda
commit fece838964

12
obj.go
View File

@ -981,13 +981,19 @@ func loadObjItem2() error {
log.Printf("loadObjItem2 : %s : orphaned item in database (id : %d)\n", intl_id, id) log.Printf("loadObjItem2 : %s : orphaned item in database (id : %d)\n", intl_id, id)
} else { } else {
obj.ObjID64 = id obj.ObjID64 = id
delete(cacheObjItem, intl_id)
cacheObjItem[intl_id] = obj cacheObjItem[intl_id] = obj
for _, n := range obj.Names { for _, n := range obj.Names {
delete(cacheObjItem, n)
cacheObjItem[n] = obj cacheObjItem[n] = obj
} }
if weight != obj.Weight { if weight != obj.Weight {
log.Printf("loadObjItem2 : %s : weight changed : %d => %d\n", weight, obj.Weight) log.Printf("loadObjItem2 : %s : weight changed : %d => %d\n", weight, obj.Weight)
} }
cacheObjItemId[id] = obj cacheObjItemId[id] = obj
} }
} }
@ -1020,10 +1026,12 @@ func loadObjItem2() error {
count := 0 count := 0
for _, n := range i.Names { for _, n := range i.Names {
if count == 0 { if count == 0 {
cacheObjItemId[id] = i delete(cacheObjItem, n)
cacheObjItem[n] = i
continue continue
} else { } else {
objAddName(id, n) objAddName(id, n)
delete(cacheObjItem, n)
cacheObjItem[n] = i cacheObjItem[n] = i
} }
} }
@ -1035,7 +1043,7 @@ func loadObjItem2() error {
for _, v := range cacheObjItemId { for _, v := range cacheObjItemId {
log.Printf("Item cached : %d\n", v.ObjID64) log.Printf("Item cached : %d\n", v.ObjID64)
for _, n := range v.Names { for _, n := range v.Names {
log.Printf("cacheObjItemId[%d] : %s : %s.\n", v.ObjID64, v.Names[0], n) log.Printf("cacheObjItemId[%d] : %s : %s.\n", v.ObjID64, n)
} }
} }