You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
package ent
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"github.com/jordanorelli/hyperstone/dota"
|
|
|
|
)
|
|
|
|
|
|
|
|
type field struct {
|
|
|
|
name string
|
|
|
|
tÿpe
|
|
|
|
}
|
|
|
|
|
|
|
|
func (f *field) fromProto(flat *dota.ProtoFlattenedSerializerFieldT, env *Env) error {
|
|
|
|
Debug.Printf("parse flat field: %s", prettyFlatField(flat, env))
|
|
|
|
t := parseType(flat, env)
|
|
|
|
if t == nil {
|
|
|
|
return fmt.Errorf("unable to parse type %s", prettyFlatField(flat, env))
|
|
|
|
}
|
|
|
|
if err, ok := t.(error); ok {
|
|
|
|
return wrap(err, "unable to parse type %s", prettyFlatField(flat, env))
|
|
|
|
}
|
|
|
|
|
|
|
|
Debug.Printf(" type: %v", t)
|
|
|
|
f.tÿpe = t
|
|
|
|
f.name = env.symbol(int(flat.GetVarNameSym()))
|
|
|
|
return nil
|
|
|
|
}
|