fix: use fingerprint as player ID to prevent name collision

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-24 10:50:21 +09:00
parent cd2013a917
commit e8887cd69a
4 changed files with 23 additions and 18 deletions

View File

@@ -10,6 +10,7 @@ import (
func TestGetStateNoRace(t *testing.T) {
s := NewGameSession()
p := entity.NewPlayer("Racer", entity.ClassWarrior)
p.Fingerprint = "test-fp"
s.AddPlayer(p)
s.StartGame()
@@ -30,7 +31,7 @@ func TestGetStateNoRace(t *testing.T) {
for i := 0; i < 10; i++ {
select {
case s.actionCh <- playerActionMsg{PlayerName: "Racer", Action: PlayerAction{Type: ActionWait}}:
case s.actionCh <- playerActionMsg{PlayerID: "test-fp", Action: PlayerAction{Type: ActionWait}}:
default:
}
time.Sleep(10 * time.Millisecond)
@@ -41,6 +42,7 @@ func TestGetStateNoRace(t *testing.T) {
func TestSessionTurnTimeout(t *testing.T) {
s := NewGameSession()
p := entity.NewPlayer("test", entity.ClassWarrior)
p.Fingerprint = "test-fp"
s.AddPlayer(p)
s.StartFloor()