Skip to content

Commit 06fee1c

Browse files
committed
fix: possible wrong players team
ref #494 ref #492
1 parent 6c73556 commit 06fee1c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pkg/demoinfocs/game_events.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,14 @@ func (geh gameEventHandler) playerTeam(data map[string]*msg.CSVCMsg_GameEventKey
668668

669669
if player != nil {
670670
if player.Team != newTeam {
671+
if geh.parser.isSource2() {
672+
// The "team" field may be incorrect with CS2 demos.
673+
// As the prop m_iTeamNum (bound to player.Team) is updated before the game-event is fired we can force
674+
// the correct team here.
675+
// https://github.com/markus-wa/demoinfocs-golang/issues/494
676+
newTeam = player.Team
677+
}
678+
671679
player.Team = newTeam
672680
}
673681

0 commit comments

Comments
 (0)