fix type
This commit is contained in:
parent
e7b171fcbb
commit
00135161e7
14
obj.go
14
obj.go
@ -661,8 +661,8 @@ func addObjItem(code string, name string, itemTypeID64 int64, weight int) (int64
|
||||
c.Code = code
|
||||
c.Name = name
|
||||
c.Weight = weight
|
||||
cacheObjItem[code] = c
|
||||
cacheObjItem[name] = c
|
||||
cacheObjItem[code] = *c
|
||||
cacheObjItem[name] = *c
|
||||
|
||||
return objId, nil
|
||||
}
|
||||
@ -709,7 +709,7 @@ func getSilentObjItemID(code string, name string) int64 {
|
||||
i := ChatWarsItem{
|
||||
ObjID64: 0,
|
||||
}
|
||||
for k, obj := range items {
|
||||
for k, 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 {
|
||||
@ -767,8 +767,8 @@ func loadObjItem() error {
|
||||
c.Name = name
|
||||
c.Weight = weight
|
||||
muxObjItem.Lock()
|
||||
cacheObjItem[intl_id] = c
|
||||
cacheObjItem[name] = c
|
||||
cacheObjItem[intl_id] = *c
|
||||
cacheObjItem[name] = *c
|
||||
muxObjItem.Unlock()
|
||||
}
|
||||
|
||||
@ -784,14 +784,14 @@ func loadObjItem() error {
|
||||
return err
|
||||
}
|
||||
|
||||
if _, ok := cacheObjItem.Load(intl_id); ok {
|
||||
if _, ok := cacheObjItem[intl_id]; ok {
|
||||
c := new(ChatWarsItem)
|
||||
c.ObjID64 = id
|
||||
c.Code = intl_id
|
||||
c.Name = name
|
||||
c.Weight = weight
|
||||
muxObjItem.Lock()
|
||||
cacheObjItem[name] = c
|
||||
cacheObjItem[name] = *c
|
||||
muxObjItem.Unlock()
|
||||
} else {
|
||||
log.Printf("loadObjItem : orphaned obj_name for `%s` : %s.\n", intl_id, name)
|
||||
|
Loading…
Reference in New Issue
Block a user