From 60597631f31b3ccd7ad5872337e024056b80468b Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 5 Feb 2024 16:54:51 +0800 Subject: [PATCH] 1 --- server/hallserver/room/room.go | 7 +++++++ server/hallserver/room/roommgr.go | 3 ++- server/hallserver/room/team.go | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/server/hallserver/room/room.go b/server/hallserver/room/room.go index f78ca586..49c92f56 100644 --- a/server/hallserver/room/room.go +++ b/server/hallserver/room/room.go @@ -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) { diff --git a/server/hallserver/room/roommgr.go b/server/hallserver/room/roommgr.go index ca307c83..810fa998 100644 --- a/server/hallserver/room/roommgr.go +++ b/server/hallserver/room/roommgr.go @@ -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) diff --git a/server/hallserver/room/team.go b/server/hallserver/room/team.go index 8ce2557d..336976c0 100644 --- a/server/hallserver/room/team.go +++ b/server/hallserver/room/team.go @@ -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