Skip to content

Commit

Permalink
fix linter (#56)
Browse files Browse the repository at this point in the history
* fix linter

* more fixes

* more

* more

* more
  • Loading branch information
loganmc10 authored Mar 27, 2024
1 parent 09e056a commit 47b734c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions internal/gameServer/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (g *GameServer) ManageBuffer() {
return
}
// Adjust the buffer size for the lead player(s)
for i := 0; i < 4; i++ {
for i := range 4 {
if g.GameData.BufferHealth[i] != -1 && g.GameData.CountLag[i] == 0 {
if g.GameData.BufferHealth[i] > BufferTarget && g.GameData.BufferSize[i] > 0 {
g.GameData.BufferSize[i]--
Expand All @@ -112,7 +112,7 @@ func (g *GameServer) ManagePlayers() {
var i byte

g.GameDataMutex.Lock() // PlayerAlive and Status can be modified by processUDP in a different thread
for i = 0; i < 4; i++ {
for i = range 4 {
_, ok := g.Registrations[i]
if ok {
if g.GameData.PlayerAlive[i] {
Expand Down
4 changes: 2 additions & 2 deletions internal/gameServer/tcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (g *GameServer) tcpSendReg(conn *net.TCPConn) {
var i byte
registrations := make([]byte, 24) //nolint:gomnd
current := 0
for i = 0; i < 4; i++ {
for i = range 4 {
_, ok := g.Registrations[i]
if ok {
binary.BigEndian.PutUint32(registrations[current:], g.Registrations[i].RegID)
Expand Down Expand Up @@ -293,7 +293,7 @@ func (g *GameServer) processTCP(conn *net.TCPConn) {
}
regID := binary.BigEndian.Uint32(regIDBytes)
var i byte
for i = 0; i < 4; i++ {
for i = range 4 {
v, ok := g.Registrations[i]
if ok {
if v.RegID == regID {
Expand Down
8 changes: 4 additions & 4 deletions internal/gameServer/udp.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func uintLarger(v uint32, w uint32) bool {

func (g *GameServer) getPlayerNumberByID(regID uint32) (byte, error) {
var i byte
for i = 0; i < 4; i++ {
for i = range 4 {
v, ok := g.Registrations[i]
if ok {
if v.RegID == regID {
Expand Down Expand Up @@ -125,7 +125,7 @@ func (g *GameServer) processUDP(addr *net.UDPAddr, buf []byte) {
g.GameData.PendingInput[playerNumber] = binary.BigEndian.Uint32(buf[6:])
g.GameData.PendingPlugin[playerNumber] = buf[10]

for i := 0; i < 4; i++ {
for i := range 4 {
if g.GameData.PlayerAddresses[i] != nil {
g.sendUDPInput(count, g.GameData.PlayerAddresses[i], playerNumber, true, NoRegID)
}
Expand Down Expand Up @@ -214,11 +214,11 @@ func (g *GameServer) createUDPServer() error {
g.GameData.BufferSize = []uint32{3, 3, 3, 3}
g.GameData.BufferHealth = []int32{-1, -1, -1, -1}
g.GameData.Inputs = make([]map[uint32]uint32, 4) //nolint:gomnd
for i := 0; i < 4; i++ {
for i := range 4 {
g.GameData.Inputs[i] = make(map[uint32]uint32)
}
g.GameData.Plugin = make([]map[uint32]byte, 4) //nolint:gomnd
for i := 0; i < 4; i++ {
for i := range 4 {
g.GameData.Plugin[i] = make(map[uint32]byte)
}
g.GameData.PendingInput = make([]uint32, 4) //nolint:gomnd
Expand Down
7 changes: 4 additions & 3 deletions internal/lobbyServer/lobby.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func (s *LobbyServer) announceDiscord(g *gameserver.GameServer) {
message := fmt.Sprintf("New %s netplay room running in %s has been created! Come play %s", roomType, s.Name, g.GameName)

if roomType == "public" {
for i := 0; i < 10; i++ {
for i := range 10 {
channel := os.Getenv(fmt.Sprintf("%s_CHANNEL_%d", strings.ToUpper(g.Emulator), i))
if channel != "" {
s.publishDiscord(message, channel)
Expand Down Expand Up @@ -427,8 +427,9 @@ func (s *LobbyServer) wsHandler(ws *websocket.Conn) {
message = "Player name already in use"
} else {
var number int
for number = 0; number < 4; number++ {
goodNumber := true
var goodNumber bool
for number = range 4 {
goodNumber = true
for _, v := range g.Players {
if v.Number == number {
goodNumber = false
Expand Down

0 comments on commit 47b734c

Please sign in to comment.