summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/ui/views/game_api.go7
-rw-r--r--pkg/ui/views/game_restore.go8
2 files changed, 11 insertions, 4 deletions
diff --git a/pkg/ui/views/game_api.go b/pkg/ui/views/game_api.go
index f39a771..66b63c1 100644
--- a/pkg/ui/views/game_api.go
+++ b/pkg/ui/views/game_api.go
@@ -18,8 +18,11 @@ func (m GameModel) handleDatabaseGameMsg(msg database.Game) (GameModel, tea.Cmd)
peers := map[int]string{
1: m.game.IP1,
2: m.game.IP2,
- 3: m.game.IP3,
- 4: m.game.IP4,
+ }
+
+ if m.game.Type == database.PairGameType {
+ peers[3] = m.game.IP3
+ peers[4] = m.game.IP4
}
myPlayerNum := -1
diff --git a/pkg/ui/views/game_restore.go b/pkg/ui/views/game_restore.go
index 95f8844..64d99ce 100644
--- a/pkg/ui/views/game_restore.go
+++ b/pkg/ui/views/game_restore.go
@@ -5,6 +5,7 @@ import (
"strings"
"time"
+ "github.com/boozec/rahanna/internal/api/database"
"github.com/boozec/rahanna/pkg/p2p"
tea "github.com/charmbracelet/bubbletea"
)
@@ -23,8 +24,11 @@ func (m GameModel) handleSendRestoreMsg(source p2p.NetworkID) tea.Cmd {
peers := map[int]string{
1: m.game.IP1,
2: m.game.IP2,
- 3: m.game.IP3,
- 4: m.game.IP4,
+ }
+
+ if m.game.Type == database.PairGameType {
+ peers[3] = m.game.IP3
+ peers[4] = m.game.IP4
}
myPlayerNum := -1