Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/llgcode/ps v0.0.0-20150911083025-f1443b32eedb // indirect
github.com/markus-wa/go-unassert v0.1.2
github.com/markus-wa/gobitread v0.2.2
github.com/markus-wa/godispatch v1.2.1
github.com/markus-wa/godispatch v1.3.0
github.com/markus-wa/quickhull-go/v2 v2.1.0
github.com/stretchr/objx v0.1.1 // indirect
github.com/stretchr/testify v1.5.1
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ github.com/markus-wa/godispatch v1.2.0 h1:aB6epOoTbrsH3oaTE21L8/c+xiYSKOrsSDzl6Y
github.com/markus-wa/godispatch v1.2.0/go.mod h1:GNzV7xdnZ9+VBi0z+hma9oUQrJmtqRrqyAuGKTTTcKY=
github.com/markus-wa/godispatch v1.2.1 h1:Bj6blK4xJ/72pDi0rprVYluOGW9CV55FUDFPApyw91Q=
github.com/markus-wa/godispatch v1.2.1/go.mod h1:GNzV7xdnZ9+VBi0z+hma9oUQrJmtqRrqyAuGKTTTcKY=
github.com/markus-wa/godispatch v1.3.0 h1:eHT5Xm8ZEwilj9b/Tu7gyMfmtSau+yC0qpM7NRR+CQk=
github.com/markus-wa/godispatch v1.3.0/go.mod h1:GNzV7xdnZ9+VBi0z+hma9oUQrJmtqRrqyAuGKTTTcKY=
github.com/markus-wa/quickhull-go/v2 v2.1.0 h1:DA2pzEzH0k5CEnlUsouRqNdD+jzNFb4DBhrX4Hpa5So=
github.com/markus-wa/quickhull-go/v2 v2.1.0/go.mod h1:bOlBUpIzGSMMhHX0f9N8CQs0VZD4nnPeta0OocH7m4o=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand Down
12 changes: 10 additions & 2 deletions pkg/demoinfocs/parser.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package demoinfocs

import (
"errors"
"fmt"
"io"
"sync"
"time"
Expand Down Expand Up @@ -47,10 +49,10 @@ type parser struct {
stParser *st.SendTableParser
additionalNetMessageCreators map[int]NetMessageCreator // Map of net-message-IDs to NetMessageCreators (for parsing custom net-messages)
msgQueue chan interface{} // Queue of net-messages
msgDispatcher dp.Dispatcher // Net-message dispatcher
msgDispatcher *dp.Dispatcher // Net-message dispatcher
gameEventHandler gameEventHandler
userMessageHandler userMessageHandler
eventDispatcher dp.Dispatcher
eventDispatcher *dp.Dispatcher
currentFrame int // Demo-frame, not ingame-tick
tickInterval float32 // Duration between ticks in seconds
header *common.DemoHeader // Pointer so we can check for nil
Expand Down Expand Up @@ -302,6 +304,12 @@ func NewParserWithConfig(demostream io.Reader, config ParserConfig) Parser {
p.userMessageHandler = newUserMessageHandler(&p)
p.demoInfoProvider = demoInfoProvider{parser: &p}

dispatcherCfg := dp.Config{
PanicHandler: func(v interface{}) { p.setError(errors.New(fmt.Sprint(v))) },
}
p.msgDispatcher = dp.NewDispatcherWithConfig(dispatcherCfg)
p.eventDispatcher = new(dp.Dispatcher)

// Attach proto msg handlers
p.msgDispatcher.RegisterHandler(p.handlePacketEntities)
p.msgDispatcher.RegisterHandler(p.handleGameEventList)
Expand Down