1
This commit is contained in:
parent
4b5d1da32c
commit
8c2c5c598f
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user