This commit is contained in:
aozhiwei 2024-03-19 19:21:16 +08:00
parent 2daa458610
commit 8c0b66f891

View File

@ -23,17 +23,18 @@ func (this *teamMgr) UnInit() {
}
func (this *teamMgr) CreateTeam(hum common.Player, msg *cs.CMLogin, mapInfo* common.MapInfoRsp) common.Team {
teamUuid := this.genTeamUuid(hum.GetZoneId(), hum.GetNodeId())
var copyIdx int32 = 0
teamUuid := this.genTeamUuid(copyIdx, hum.GetZoneId(), hum.GetNodeId())
team := newTeam()
team.init(0, teamUuid, hum, msg, mapInfo)
team.init(copyIdx, teamUuid, hum, msg, mapInfo)
this.teamUuidHash[team.teamUuid] = team
return team
}
func (this *teamMgr) genTeamUuid(zoneId int32, nodeId int32) string {
func (this *teamMgr) genTeamUuid(zoneId int32, nodeId int32, copyIdx int32) string {
teamUuid := ""
for true {
teamUuid = this.internalGenTeamUuid(zoneId, nodeId)
teamUuid = this.internalGenTeamUuid(zoneId, nodeId, copyIdx)
if this.GetTeamByUuid(teamUuid) == nil {
return teamUuid
}
@ -41,9 +42,9 @@ func (this *teamMgr) genTeamUuid(zoneId int32, nodeId int32) string {
panic("genTeamUuid error")
}
func (this *teamMgr) internalGenTeamUuid(zoneId int32, nodeId int32) string {
func (this *teamMgr) internalGenTeamUuid(zoneId int32, nodeId int32, copyIdx int32) string {
this.curIdx++
teamUuid := q5.ToString(zoneId) + "_" + q5.ToString(nodeId) + "_" +
teamUuid := q5.ToString(zoneId) + "_" + q5.ToString(nodeId) + "_" + q5.ToString(copyIdx) + "_" +
q5.Md5Str(q5.ToString(f5.GetApp().NewUuid()) + q5.ToString(f5.GetApp().GetPid()) +
q5.ToString(this.curIdx) +
mt.Table.MatchCluster.GetIp() + "520d8eAbB(8cf1^#$^&!@d833a42c820432PDAFE^^)")