1
This commit is contained in:
parent
60597631f3
commit
bee588b7ea
@ -23,6 +23,7 @@ type room struct {
|
|||||||
nodeId int32
|
nodeId int32
|
||||||
passwd string
|
passwd string
|
||||||
maxTeamNum int32
|
maxTeamNum int32
|
||||||
|
maxObTeamNum int32
|
||||||
}
|
}
|
||||||
owner *member
|
owner *member
|
||||||
roomState int32
|
roomState int32
|
||||||
@ -50,7 +51,12 @@ func (this *room) init(roomId string, roomIdx int64, owner common.Player, msg *c
|
|||||||
this.config.zoneId = msg.GetZoneId()
|
this.config.zoneId = msg.GetZoneId()
|
||||||
this.config.nodeId = msg.GetNodeId()
|
this.config.nodeId = msg.GetNodeId()
|
||||||
this.config.passwd = msg.GetPasswd()
|
this.config.passwd = msg.GetPasswd()
|
||||||
this.config.maxTeamNum = constant.ROOM_MAX_TEAM_NUM
|
if msg.GetMapId() == 12004 {
|
||||||
|
this.config.maxTeamNum = 2
|
||||||
|
} else {
|
||||||
|
this.config.maxTeamNum = 10
|
||||||
|
}
|
||||||
|
this.config.maxObTeamNum = 10
|
||||||
this.owner = newMember(this, owner)
|
this.owner = newMember(this, owner)
|
||||||
this.addMember(this.owner)
|
this.addMember(this.owner)
|
||||||
this.addTeam(newTeam(this, this.genTeamId(), msg.GetTeamUuid(), this.owner))
|
this.addTeam(newTeam(this, this.genTeamId(), msg.GetTeamUuid(), this.owner))
|
||||||
@ -189,7 +195,7 @@ func (this *room) isTeamFull() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *room) isObTeamFull() bool {
|
func (this *room) isObTeamFull() bool {
|
||||||
return this.getObTeamNum() >= this.config.maxTeamNum
|
return this.getObTeamNum() >= this.config.maxObTeamNum
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *room) join(hum common.Player, msg *cs.CMJoinRoom) bool {
|
func (this *room) join(hum common.Player, msg *cs.CMJoinRoom) bool {
|
||||||
|
@ -216,6 +216,13 @@ func (this *roomMgr) CMEnterObserver(hdr *f5.MsgHdr, msg *cs.CMEnterObserver) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if roomPtr.isObTeamFull() {
|
||||||
|
rspMsg.Errcode = proto.Int32(3)
|
||||||
|
rspMsg.Errmsg = proto.String("ob team is full")
|
||||||
|
hum.SendMsg(&rspMsg)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
t := memberPtr.team
|
t := memberPtr.team
|
||||||
roomPtr.removeTeam(t)
|
roomPtr.removeTeam(t)
|
||||||
roomPtr.addObTeam(t)
|
roomPtr.addObTeam(t)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user