let's try for multiple entities in a packet now

master
Jordan Orelli 8 years ago
parent 47a2d37537
commit e8ba2c2ca4

@ -92,8 +92,7 @@ func (d *Dict) updateEntity(id int) error {
if e == nil { if e == nil {
return fmt.Errorf("update entity %d refused: no such entity", id) return fmt.Errorf("update entity %d refused: no such entity", id)
} }
// e.Read(d.br, d.sr) return fillSlots(e, e.Class.String(), d.sr, d.br)
return nil
} }
func (d *Dict) deleteEntity(id int) error { func (d *Dict) deleteEntity(id int) error {
@ -122,7 +121,9 @@ func (d *Dict) Handle(m proto.Message) {
d.syncBaselines() d.syncBaselines()
case *dota.CSVCMsg_PacketEntities: case *dota.CSVCMsg_PacketEntities:
d.mergeEntities(v) if err := d.mergeEntities(v); err != nil {
Debug.Printf("merge entities error: %v", err)
}
} }
} }
@ -133,8 +134,7 @@ func (d *Dict) mergeEntities(m *dota.CSVCMsg_PacketEntities) error {
d.br.SetSource(data) d.br.SetSource(data)
id := -1 id := -1
// for i := 0; i < int(m.GetUpdatedEntries()); i++ { for i := 0; i < int(m.GetUpdatedEntries()); i++ {
for i := 0; i < 1; i++ {
id++ id++
// there may be a jump indicator, indicating how many id positions // there may be a jump indicator, indicating how many id positions
// to skip. // to skip.

@ -20,6 +20,7 @@ func (s selection) String() string { return fmt.Sprint(s.path()) }
func (s selection) path() []int { return s.vals[:s.count] } func (s selection) path() []int { return s.vals[:s.count] }
func (s selection) fill(offset int, displayPath string, dest slotted, br bit.Reader) error { func (s selection) fill(offset int, displayPath string, dest slotted, br bit.Reader) error {
Debug.Printf("fill selection: %s offset: %d displayPath: %s dest: %v", s, offset, displayPath, dest)
slot := s.vals[offset] slot := s.vals[offset]
if s.count-offset <= 0 { if s.count-offset <= 0 {
panic("selection makes no sense") panic("selection makes no sense")

@ -82,7 +82,7 @@ func parseArrayName(s string) (string, int) {
n, err := strconv.Atoi(ns) n, err := strconv.Atoi(ns)
if err != nil { if err != nil {
n = cIdents[ns] n = cIdents[ns]
if n == 0 { if n <= 0 {
panic("invalid array type name: " + err.Error()) panic("invalid array type name: " + err.Error())
} }
} }

Loading…
Cancel
Save