xy hace 1 semana
padre
commit
a2fe78a0d9
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      src/server/game/ludo/match_robot.go

+ 2 - 2
src/server/game/ludo/match_robot.go

@@ -64,7 +64,7 @@ func Scheduling() {
 }
 
 func RemoveColorByColor(temp []msg.RoleType, color msg.RoleType) []msg.RoleType {
-	result := make([]msg.RoleType, 4)
+	result := make([]msg.RoleType, 0, len(temp))
 	for _, item := range temp {
 		if item != color {
 			result = append(result, item)
@@ -81,7 +81,7 @@ func getRoomLackColor(room_info *msg.RoomInfo) msg.RoleType {
 			select_color = msg.RoleType_BLUE
 		}
 	} else if room_info.RoomType == msg.RoomType_SIREN_REN {
-		var temp []msg.RoleType = make([]msg.RoleType, 4)
+		var temp []msg.RoleType = make([]msg.RoleType, 0, 4)
 		temp = append(temp, msg.RoleType_BLUE)
 		temp = append(temp, msg.RoleType_GREEN)
 		temp = append(temp, msg.RoleType_RED)