@@ -125,9 +125,9 @@ func chatMsg(userID, name, text string) *LbsMessage {
125
125
WriteString (userID ).
126
126
WriteString (name ).
127
127
WriteString (text ).
128
- Write8 (0 ). // chat_type
129
- Write8 (0 ). // id color
130
- Write8 (0 ). // handle color
128
+ Write8 (0 ). // chat_type
129
+ Write8 (0 ). // id color
130
+ Write8 (0 ). // handle color
131
131
Write8 (0 ).Msg () // msg color
132
132
}
133
133
@@ -558,20 +558,24 @@ func teamShuffle(seed int64, peers []*LbsPeer, mode int) []uint16 {
558
558
})
559
559
560
560
// Special case - Shuffle twice if the team is same of the previous match
561
- sameTeam := false
562
- for i , p := range peers {
563
- for j , q := range peers {
564
- if i != j && teams [i ] == teams [j ] {
565
- if getLastTeamUserID (p .UserID ) == q .UserID && getLastTeamUserID (q .UserID ) == p .UserID {
566
- sameTeam = true
561
+ for t := 0 ; t < 2 ; t ++ {
562
+ sameTeam := false
563
+ for i , p := range peers {
564
+ for j , q := range peers {
565
+ if i != j && teams [i ] == teams [j ] {
566
+ if getLastTeamUserID (p .UserID ) == q .UserID && getLastTeamUserID (q .UserID ) == p .UserID {
567
+ sameTeam = true
568
+ }
567
569
}
568
570
}
569
571
}
570
- }
571
- if sameTeam {
572
- r .Shuffle (len (teams ), func (i , j int ) {
573
- teams [i ], teams [j ] = teams [j ], teams [i ]
574
- })
572
+ if sameTeam {
573
+ r .Shuffle (len (teams ), func (i , j int ) {
574
+ teams [i ], teams [j ] = teams [j ], teams [i ]
575
+ })
576
+ } else {
577
+ break
578
+ }
575
579
}
576
580
577
581
if mode == TeamShuffleRegionFriendly {
0 commit comments