Skip to content

Commit fe9baf4

Browse files
committed
formatting fixes + print to stderr not stdout
1 parent e5958ea commit fe9baf4

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

pkg/demoinfocs/common/player.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,11 @@ func (p *Player) IsAlive() bool {
8585
}
8686

8787
if p.demoInfoProvider.IsSource2() {
88-
if pawnEntity := p.PlayerPawnEntity(); pawnEntity != nil {
88+
pawnEntity := p.PlayerPawnEntity()
89+
if pawnEntity != nil {
8990
return pawnEntity.PropertyValueMust("m_lifeState").S2UInt64() == 0
9091
}
92+
9193
return getBool(p.Entity, "m_bPawnIsAlive")
9294
}
9395

pkg/demoinfocs/datatables.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package demoinfocs
33
import (
44
"fmt"
55
"math"
6+
"os"
67
"strings"
78

89
"github.com/golang/geo/r3"
@@ -637,6 +638,7 @@ func (p *parser) bindNewPlayerPawnS2(pawnEntity st.Entity) {
637638
if pl == nil {
638639
return
639640
}
641+
640642
if pl.IsAlive() {
641643
pl.LastAlivePosition = pos
642644
}
@@ -919,7 +921,7 @@ func (p *parser) bindGrenadeProjectiles(entity st.Entity) {
919921
if exists {
920922
wep = weaponType
921923
} else {
922-
fmt.Printf("unknown grenade model %d\n", model)
924+
fmt.Fprintf(os.Stderr, "unknown grenade model %d\n", model)
923925
}
924926
}
925927
}

pkg/demoinfocs/sendtables2/field_state.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ func (s *fieldState) get(fp *fieldPath) interface{} {
3232
func (s *fieldState) set(fp *fieldPath, v interface{}) {
3333
x := s
3434
z := 0
35+
3536
for i := 0; i <= fp.last; i++ {
3637
z = fp.path[i]
38+
3739
if y := len(x.state); y <= z {
3840
newCap := max(z+2, y*2)
3941
if newCap > cap(x.state) {
@@ -45,15 +47,18 @@ func (s *fieldState) set(fp *fieldPath, v interface{}) {
4547
x.state = x.state[:z+1]
4648
}
4749
}
50+
4851
if i == fp.last {
4952
if _, ok := x.state[z].(*fieldState); !ok {
5053
x.state[z] = v
5154
}
5255
return
5356
}
57+
5458
if _, ok := x.state[z].(*fieldState); !ok {
5559
x.state[z] = newFieldState()
5660
}
61+
5762
x = x.state[z].(*fieldState)
5863
}
5964
}

0 commit comments

Comments
 (0)