This commit is contained in:
aozhiwei 2024-02-05 16:54:51 +08:00
parent 9e99bdad64
commit 60597631f3
3 changed files with 12 additions and 1 deletions

View File

@ -39,9 +39,11 @@ type room struct {
delayDeleteTimer *f5.TimerWp
attacher *f5.TimerAttacher
gameStartNotifyMsg *cs.SMRoomGameStartNotify
curTeamId int32
}
func (this *room) init(roomId string, roomIdx int64, owner common.Player, msg *cs.CMCreateRoom) {
this.curTeamId = 0
this.roomId = roomId
this.roomIdx = roomIdx
this.config.mapId = msg.GetMapId()
@ -221,6 +223,7 @@ func (this *room) join(hum common.Player, msg *cs.CMJoinRoom) bool {
}
func (this *room) autoStartCountdown() {
return
if this.getTeamNum() != this.config.maxTeamNum {
return
}
@ -625,6 +628,9 @@ func (this *room) getNextOwner() *member {
}
func (this *room) genTeamId() int32 {
this.curTeamId += 1
return this.curTeamId
/*
teamId := int32(-1)
for i := int32(1); i <= this.config.maxTeamNum; i++ {
if _, ok := this.teamIdHash[i]; !ok {
@ -636,6 +642,7 @@ func (this *room) genTeamId() int32 {
panic("room.genTeamId error")
}
return teamId
*/
}
func (this *room) removeMember(accountId string) {

View File

@ -123,6 +123,7 @@ func (this *roomMgr) CMJoinRoom(hdr *f5.MsgHdr, msg *cs.CMJoinRoom) {
r.join(hum, msg)
r.notifyRoomInfo(hum)
/*
if len(msg.GetTeamInfo()) > 0 {
teamInfo := &TeamInfo{}
err := json.Unmarshal([]byte(msg.GetTeamInfo()), teamInfo)
@ -130,7 +131,7 @@ func (this *roomMgr) CMJoinRoom(hdr *f5.MsgHdr, msg *cs.CMJoinRoom) {
t := r.getTeamByUuid(msg.GetTeamUuid())
t.SaveTeamLeader(teamInfo)
}
}
}*/
rspMsg.Room = new(cs.MFRoom)
r.fillMFRoom(hum, rspMsg.Room)

View File

@ -54,6 +54,8 @@ func (this *team) unInit() {
}
delete(this.room.teamUuidHash, this.teamUuid)
delete(this.room.teamIdHash, this.teamId)
delete(this.room.obTeamUuidHash, this.teamUuid)
delete(this.room.obTeamIdHash, this.teamId)
this.room = nil
}
@ -170,6 +172,7 @@ func (this *team) isFull() bool {
func newTeam(room *room, teamId int32, teamUuid string, leader *member) *team {
t := new(team)
leader.isLeader = 1
t.init(room, teamId, teamUuid)
t.addMember(leader)
return t