ecs/servers/game/data_old/function_open_ext.go
2025-06-04 18:17:39 +08:00

39 lines
908 B
Go

package data
import (
"github.com/oylshe1314/framework/errors"
"github.com/oylshe1314/framework/util"
)
func (this *FunctionOpenTable) check() error {
for _, d := range this.l {
if len(d.UnlockValue) != len(d.UnlockType) {
return errors.Error("incorrect 'FunctionOpen' table, error: len(d.UnlockValue) != len(d.UnlockType), id: ", d.id())
}
}
return nil
}
type FunctionOpenTableExtend struct {
*FunctionOpenTable
extMap map[uint64]*FunctionOpen
}
func (this *FunctionOpenTableExtend) init() error {
if this.FunctionOpenTable == nil {
return nil
}
this.extMap = map[uint64]*FunctionOpen{}
for _, d := range this.l {
this.extMap[util.Compose2uint32(uint32(d.ModuelId), uint32(d.SubModuleId))] = d
}
return nil
}
func (this *FunctionOpenTableExtend) Get(moduelId, subModuleId int) *FunctionOpen {
return this.extMap[util.Compose2uint32(uint32(moduelId), uint32(subModuleId))]
}