diff options
author | Santo Cariotti <santo@dcariotti.me> | 2025-04-16 11:46:04 +0200 |
---|---|---|
committer | Santo Cariotti <santo@dcariotti.me> | 2025-04-16 11:46:04 +0200 |
commit | ba4afeb4ee19c24b393ec21d374bdd752651c1a6 (patch) | |
tree | 2082deaddd348439605a7209fbffd4a355ff7b37 /pkg/ui/views/game.go | |
parent | 76f46e54175253d4b2ba61b9cb8f2525a48c15d8 (diff) |
Remove topics on network
Diffstat (limited to 'pkg/ui/views/game.go')
-rw-r--r-- | pkg/ui/views/game.go | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/pkg/ui/views/game.go b/pkg/ui/views/game.go index 52d8459..5a0972c 100644 --- a/pkg/ui/views/game.go +++ b/pkg/ui/views/game.go @@ -4,8 +4,6 @@ import ( "encoding/json" "fmt" "os" - "strconv" - "strings" "github.com/boozec/rahanna/internal/api/database" "github.com/boozec/rahanna/pkg/ui/multiplayer" @@ -197,21 +195,13 @@ func (m *GameModel) getGame() tea.Cmd { // Establish peer connection if m.peer == "peer-1" { if game.IP2 != "" { - ipParts := strings.Split(game.IP2, ":") - if len(ipParts) == 2 { - remoteIP := ipParts[0] - remotePortInt, _ := strconv.Atoi(ipParts[1]) - go m.network.Server.AddPeer("peer-2", remoteIP, remotePortInt) - } + remote := game.IP2 + go m.network.Server.AddPeer("peer-2", remote) } } else { if game.IP1 != "" { - ipParts := strings.Split(game.IP1, ":") - if len(ipParts) == 2 { - remoteIP := ipParts[0] - remotePortInt, _ := strconv.Atoi(ipParts[1]) - go m.network.Server.AddPeer("peer-1", remoteIP, remotePortInt) - } + remote := game.IP1 + go m.network.Server.AddPeer("peer-1", remote) } } |