diff options
| author | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2024-06-15 13:58:30 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-15 13:58:30 +0300 |
| commit | 77e4b066cb8d506b4bc944ab4eb2d6e4679e2202 (patch) | |
| tree | 1d549eca619ed36cb881e487cb054c4643ac8376 /pkg/messages/types/netSetConVar.go | |
| parent | change project name to sdp.go (diff) | |
| download | sdp.go-77e4b066cb8d506b4bc944ab4eb2d6e4679e2202.tar.gz sdp.go-77e4b066cb8d506b4bc944ab4eb2d6e4679e2202.tar.bz2 sdp.go-77e4b066cb8d506b4bc944ab4eb2d6e4679e2202.zip | |
enable multithreading with goroutines (#20)
Diffstat (limited to 'pkg/messages/types/netSetConVar.go')
| -rw-r--r-- | pkg/messages/types/netSetConVar.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/pkg/messages/types/netSetConVar.go b/pkg/messages/types/netSetConVar.go index e9902b5..0c62fdd 100644 --- a/pkg/messages/types/netSetConVar.go +++ b/pkg/messages/types/netSetConVar.go | |||
| @@ -2,29 +2,29 @@ package messages | |||
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "github.com/pektezol/bitreader" | 4 | "github.com/pektezol/bitreader" |
| 5 | "github.com/pektezol/sdp.go/pkg/writer" | 5 | "github.com/pektezol/sdp.go/pkg/types" |
| 6 | ) | 6 | ) |
| 7 | 7 | ||
| 8 | type NetSetConVar struct { | 8 | type NetSetConVar struct { |
| 9 | Length uint8 | 9 | Length uint8 `json:"length"` |
| 10 | ConVars []conVar | 10 | ConVars []conVar `json:"con_vars"` |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | type conVar struct { | 13 | type conVar struct { |
| 14 | Name string | 14 | Name string `json:"name"` |
| 15 | Value string | 15 | Value string `json:"value"` |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | func ParseNetSetConVar(reader *bitreader.Reader) NetSetConVar { | 18 | func ParseNetSetConVar(reader *bitreader.Reader, demo *types.Demo) NetSetConVar { |
| 19 | length := reader.TryReadUInt8() | 19 | length := reader.TryReadUInt8() |
| 20 | convars := []conVar{} | 20 | convars := []conVar{} |
| 21 | writer.TempAppendLine("\t\tLength: %d", length) | 21 | demo.Writer.TempAppendLine("\t\tLength: %d", length) |
| 22 | for count := 0; count < int(length); count++ { | 22 | for count := 0; count < int(length); count++ { |
| 23 | convar := conVar{ | 23 | convar := conVar{ |
| 24 | Name: reader.TryReadString(), | 24 | Name: reader.TryReadString(), |
| 25 | Value: reader.TryReadString(), | 25 | Value: reader.TryReadString(), |
| 26 | } | 26 | } |
| 27 | writer.TempAppendLine("\t\t[%d] %s: %s", count, convar.Name, convar.Value) | 27 | demo.Writer.TempAppendLine("\t\t[%d] %s: %s", count, convar.Name, convar.Value) |
| 28 | convars = append(convars, convar) | 28 | convars = append(convars, convar) |
| 29 | } | 29 | } |
| 30 | return NetSetConVar{ | 30 | return NetSetConVar{ |