fix compile error

This commit is contained in:
shoopea 2019-07-22 17:04:19 +08:00
parent 00135161e7
commit 5e36169d7f

12
obj.go
View File

@ -591,17 +591,17 @@ func addObjItem(code string, name string, itemTypeID64 int64, weight int) (int64
muxObjItem.Lock()
defer muxObjItem.Unlock()
if obj1, ok := cacheObjItem[code]; ok {
if obj2, ok := cacheObjItem[name]; ok {
if obj, ok := cacheObjItem[code]; ok {
if _, ok := cacheObjItem[name]; ok {
// obj is already added ?
return obj1.ObjID64, nil
return obj.ObjID64, nil
} else {
err := objAddName(obj1.ObjID64, name)
err := objAddName(obj.ObjID64, name)
if err != nil {
return 0, nil
} else {
cacheObjItem[name] = obj1
return obj1.ObjID64, nil
return obj.ObjID64, nil
}
}
@ -709,7 +709,7 @@ func getSilentObjItemID(code string, name string) int64 {
i := ChatWarsItem{
ObjID64: 0,
}
for k, obj := range cacheObjItem {
for _, obj := range cacheObjItem {
if ok, _ := regexp.MatchString(`^(a|e|w)[0-9]+$`, obj.Code); ok { //only gear can be custom named
m := fmt.Sprintf("^((%s.*)|(.*%s))$", regexp.QuoteMeta(obj.Name), regexp.QuoteMeta(obj.Name))
if ok, _ := regexp.MatchString(m, basename); ok {