fix initialization for int64 CWItems map
This commit is contained in:
parent
92eeda481d
commit
12cdb9c87a
6
obj.go
6
obj.go
@ -681,7 +681,7 @@ func addObjItem(code string, name string, itemTypeID64 int64, weight int, exchan
|
|||||||
cacheObjItem[name] = *c
|
cacheObjItem[name] = *c
|
||||||
|
|
||||||
muxObjItemId.Lock()
|
muxObjItemId.Lock()
|
||||||
cacheObjItemId[objId] = *c
|
cacheObjItemId[c.ObjID64] = *c
|
||||||
defer muxObjItemId.Unlock()
|
defer muxObjItemId.Unlock()
|
||||||
|
|
||||||
return objId, nil
|
return objId, nil
|
||||||
@ -783,6 +783,10 @@ func loadObjItem() error {
|
|||||||
cacheObjItem = make(map[string]ChatWarsItem)
|
cacheObjItem = make(map[string]ChatWarsItem)
|
||||||
muxObjItem.Unlock()
|
muxObjItem.Unlock()
|
||||||
|
|
||||||
|
muxObjItemId.Lock()
|
||||||
|
cacheObjItemId = make(map[int64]ChatWarsItem)
|
||||||
|
muxObjItemId.Unlock()
|
||||||
|
|
||||||
items, err := db.Query(`SELECT oi.obj_id, oi.intl_id, obn.name, oi.weight FROM obj_item oi, obj_name obn WHERE obn.obj_id = oi.obj_id AND obn.priority = 0;`)
|
items, err := db.Query(`SELECT oi.obj_id, oi.intl_id, obn.name, oi.weight FROM obj_item oi, obj_name obn WHERE obn.obj_id = oi.obj_id AND obn.priority = 0;`)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user