This commit is contained in:
aozhiwei 2023-09-11 19:10:01 +08:00
parent 66b4e6bb1b
commit 9b47526bcc
3 changed files with 8 additions and 3 deletions

View File

@ -12,11 +12,13 @@ type member struct {
joinTime int64
state int32
entry q5.ListHead
teamEntry q5.ListHead
hum common.Player
}
func (this *member) init(hum common.Player) {
this.entry.Init(this)
this.teamEntry.Init(this)
this.hum = hum
this.joinTime = f5.GetApp().GetNowSeconds()
}

View File

@ -36,7 +36,7 @@ func (this *room) init(roomId string, roomIdx int64, owner common.Player, passwd
owner.GetAccountId(): this.owner,
}
this.teams = map[string]*team {
"": newTeam(""),
owner.GetTeamUuid(): newTeam(this.owner),
}
this.owner.hum.SetRoom(this)
}

View File

@ -17,10 +17,13 @@ func (this *team) addMember(m *member) {
if this.teamUuid != m.hum.GetTeamUuid() {
panic("team.addMember team_uuid error")
}
this.members.AddTail(&m.teamEntry)
}
func newTeam(teamUuid string) *team {
func newTeam(leader *member) *team {
t := new(team)
t.teamUuid = teamUuid
t.members.Init(nil)
t.teamUuid = leader.hum.GetTeamUuid()
t.addMember(leader)
return t
}