likely broken cutlvector

types
Jordan Orelli 8 years ago
parent 3b11093a32
commit cf787781e9

@ -17,19 +17,18 @@ func genericType(spec *typeSpec, env *Env) tÿpe {
return typeError("bad generic name: %v", err) return typeError("bad generic name: %v", err)
} }
// genericName, elemName := parts[0], parts[1] genericName, elemName := parts[0], parts[1]
// elemType := func() tÿpe { elemSpec := *spec
// var elemSpec typeSpec elemSpec.typeName = elemName
// elemSpec = *spec elem := parseTypeSpec(&elemSpec, env)
// elemSpec.name = elemName
// return parseTypeSpec(&elemSpec, env)
// }
switch parts[0] { switch genericName {
case "CHandle", "CStrongHandle": case "CHandle", "CStrongHandle":
return typeFn(func(r bit.Reader) (value, error) { return typeFn(func(r bit.Reader) (value, error) {
return handle(bit.ReadVarInt(r)), r.Err() return handle(bit.ReadVarInt(r)), r.Err()
}) })
case "CUtlVector":
return cutl_vector_t{elem}
default: default:
return typeError("unknown generic name: %v", parts[0]) return typeError("unknown generic name: %v", parts[0])
} }
@ -65,5 +64,15 @@ func genericName(name string) ([2]string, error) {
if out[1] == "" { if out[1] == "" {
return out, fmt.Errorf("empty generic element name") return out, fmt.Errorf("empty generic element name")
} }
Debug.Printf(" generic name in: %s out: %v", name, out)
return out, nil return out, nil
} }
type cutl_vector_t struct {
elem tÿpe
}
func (t cutl_vector_t) read(r bit.Reader) (value, error) {
count := bit.ReadVarInt32(r)
return make(array, count), r.Err()
}

@ -24,6 +24,7 @@ func parseFieldType(flat *dota.ProtoFlattenedSerializerFieldT, env *Env) tÿpe {
} }
func parseTypeSpec(spec *typeSpec, env *Env) tÿpe { func parseTypeSpec(spec *typeSpec, env *Env) tÿpe {
Debug.Printf(" parse spec: %v", spec)
coalesce := func(fns ...typeParseFn) tÿpe { coalesce := func(fns ...typeParseFn) tÿpe {
for _, fn := range fns { for _, fn := range fns {
if t := fn(spec, env); t != nil { if t := fn(spec, env); t != nil {

Loading…
Cancel
Save