This commit is contained in:
aozhiwei 2024-02-01 16:15:26 +08:00
parent 4b5d1da32c
commit 8c2c5c598f
2 changed files with 11 additions and 0 deletions

View File

@ -165,6 +165,10 @@ func (this *room) canJoin(member common.Player, msg *cs.CMJoinRoom) bool {
return true
}
func (this *room) isTeamFull() bool {
return this.getTeamNum() >= this.config.maxTeamNum
}
func (this *room) join(hum common.Player, msg *cs.CMJoinRoom) bool {
if !this.canJoin(hum, msg) {
return false

View File

@ -248,6 +248,13 @@ func (this *roomMgr) CMLeaveObserver(hdr *f5.MsgHdr, msg *cs.CMLeaveObserver) {
return;
}
if roomPtr.isTeamFull() {
rspMsg.Errcode = proto.Int32(3)
rspMsg.Errmsg = proto.String("room team is full")
hum.SendMsg(&rspMsg)
return
}
t := memberPtr.team
roomPtr.removeObTeam(t)
roomPtr.addTeam(t)