1
This commit is contained in:
parent
a1ec14faaf
commit
e21483a6a3
@ -33,6 +33,8 @@ type playerMgr struct {
|
|||||||
pendingLoginHash map[string]*pendingLoginRequest
|
pendingLoginHash map[string]*pendingLoginRequest
|
||||||
socketCloseEventHash map[f5.WspCliConn]*q5.ListHead
|
socketCloseEventHash map[f5.WspCliConn]*q5.ListHead
|
||||||
currReqId int64
|
currReqId int64
|
||||||
|
recommendHumans []*player
|
||||||
|
lastRefreshRecommendTick int64
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *playerMgr) Init() {
|
func (this *playerMgr) Init() {
|
||||||
@ -359,4 +361,15 @@ func (this *playerMgr) traverseHumans(cb func(*player) bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *playerMgr) GetRecommendPlayers(excludeHums map[string]int32, outHums map[string]int32, num int32) {
|
func (this *playerMgr) GetRecommendPlayers(excludeHums map[string]int32, outHums map[string]int32, num int32) {
|
||||||
|
if len(this.accountIdHash) < 50 ||
|
||||||
|
q5.GetTickCount() - this.lastRefreshRecommendTick > 1000 * 60 {
|
||||||
|
this.recommendHumans = []*player{}
|
||||||
|
this.traverseHumans(
|
||||||
|
func (hum *player) bool {
|
||||||
|
if _, ok := excludeHums[hum.GetAccountId()]; !ok {
|
||||||
|
q5.AppendSlice(&this.recommendHumans, hum)
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user