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)
}
// genericName, elemName := parts[0], parts[1]
// elemType := func() tÿpe {
// var elemSpec typeSpec
// elemSpec = *spec
// elemSpec.name = elemName
// return parseTypeSpec(&elemSpec, env)
// }
genericName, elemName := parts[0], parts[1]
elemSpec := *spec
elemSpec.typeName = elemName
elem := parseTypeSpec(&elemSpec, env)
switch parts[0] {
switch genericName {
case "CHandle", "CStrongHandle":
return typeFn(func(r bit.Reader) (value, error) {
return handle(bit.ReadVarInt(r)), r.Err()
})
case "CUtlVector":
return cutl_vector_t{elem}
default:
return typeError("unknown generic name: %v", parts[0])
}
@ -65,5 +64,15 @@ func genericName(name string) ([2]string, error) {
if out[1] == "" {
return out, fmt.Errorf("empty generic element name")
}
Debug.Printf(" generic name in: %s out: %v", name, out)
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 {
Debug.Printf(" parse spec: %v", spec)
coalesce := func(fns ...typeParseFn) tÿpe {
for _, fn := range fns {
if t := fn(spec, env); t != nil {

Loading…
Cancel
Save