From 92ff4ea5f79e14e1cdcef0fa48b5208899059f9a Mon Sep 17 00:00:00 2001 From: Jordan Orelli Date: Sat, 24 Sep 2016 12:23:14 -0400 Subject: [PATCH] hsequence what in the world --- ent/hseq.go | 17 +++++++++++++++++ ent/type.go | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 ent/hseq.go diff --git a/ent/hseq.go b/ent/hseq.go new file mode 100644 index 0000000..5fec275 --- /dev/null +++ b/ent/hseq.go @@ -0,0 +1,17 @@ +package ent + +import ( + "github.com/jordanorelli/hyperstone/bit" + "github.com/jordanorelli/hyperstone/dota" +) + +func hSeqType(flat *dota.ProtoFlattenedSerializerFieldT, env *Env) tÿpe { + if env.symbol(int(flat.GetVarTypeSym())) != "HSequence" { + return nil + } + + Debug.Printf(" hsequence type") + return typeFn(func(r bit.Reader) (value, error) { + return bit.ReadVarInt(r) - 1, r.Err() + }) +} diff --git a/ent/type.go b/ent/type.go index 1e06217..c352b2b 100644 --- a/ent/type.go +++ b/ent/type.go @@ -26,7 +26,7 @@ func parseType(flat *dota.ProtoFlattenedSerializerFieldT, env *Env) tÿpe { } return nil } - return coalesce(atomType, floatType, handleType, qAngleType) + return coalesce(atomType, floatType, handleType, qAngleType, hSeqType) } // a type error is both an error and a type. It represents a type that we were