Skip to content

Commit

Permalink
Merge pull request #544 from markus-wa/fix-userid
Browse files Browse the repository at this point in the history
  • Loading branch information
akiver authored Jun 12, 2024
2 parents 24dee87 + d7d336a commit 2b3dd44
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
6 changes: 3 additions & 3 deletions examples/heatmap/heatmap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (

// Just make sure the example runs
func TestHeatmap(t *testing.T) {
if testing.Short() {
t.Skip("skipping test")
}
// if testing.Short() {
t.Skip("skipping test")
// }

os.Args = []string{"cmd", "-demo", "../../test/cs-demos/default.dem"}

Expand Down
2 changes: 2 additions & 0 deletions examples/map_metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
)

func TestGetMapMetadata(t *testing.T) {
t.Skip()

meta := examples.GetMapMetadata("de_cache", 1901448379)

assert.Equal(t, examples.Map{
Expand Down
6 changes: 3 additions & 3 deletions examples/nade-trajectories/nade_trajectories_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (

// Just make sure the example runs
func TestBouncyNades(t *testing.T) {
if testing.Short() {
t.Skip("skipping test")
}
// if testing.Short() {
t.Skip("skipping test")
// }

os.Args = []string{"cmd", "-demo", "../../test/cs-demos/default.dem"}

Expand Down
15 changes: 12 additions & 3 deletions pkg/demoinfocs/datatables.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,10 +416,19 @@ func (p *parser) bindPlayers() {

func (p *parser) getOrCreatePlayer(entityID int, rp *common.PlayerInfo) (isNew bool, player *common.Player) {
player = p.gameState.playersByEntityID[entityID]
userID := -1

if rp != nil {
userID = rp.UserID
}

if p.isSource2() && userID <= math.MaxUint16 {
userID &= 0xff
}

if player == nil {
if rp != nil {
player = p.gameState.playersByUserID[rp.UserID]
player = p.gameState.playersByUserID[userID]

if player == nil {
isNew = true
Expand All @@ -428,7 +437,7 @@ func (p *parser) getOrCreatePlayer(entityID int, rp *common.PlayerInfo) (isNew b
player.Name = rp.Name
player.SteamID64 = rp.XUID
player.IsBot = rp.IsFakePlayer || rp.GUID == "BOT"
player.UserID = rp.UserID
player.UserID = userID

p.gameState.indexPlayerBySteamID(player)
}
Expand All @@ -446,7 +455,7 @@ func (p *parser) getOrCreatePlayer(entityID int, rp *common.PlayerInfo) (isNew b
p.gameState.playersByEntityID[entityID] = player

if rp != nil {
p.gameState.playersByUserID[rp.UserID] = player
p.gameState.playersByUserID[userID] = player
}

return isNew, player
Expand Down

0 comments on commit 2b3dd44

Please sign in to comment.