Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var IDMAP map[int]bool
IDMAP is a map of current in use IDs... this is overkill for this game, but it's here
Functions ¶
func HandleMessages ¶
func HandleMessages(p *Player, s *GameServer)
Types ¶
type Command ¶
type Command struct {
Row, Col int
Name string
Message string
Rooms []int
CommType CommandType
ShipPlacements []*PlaceShipType
}
type CommandType ¶
type CommandType int
const ( CommandConnected CommandType = iota CommandAttack CommandDisconnected CommandSetTheBoard CommandHello CommandFull CommandHealthCheck CommandJoinRoom CommandListRooms CommandLeaveRoom CommandRoomFull CommandYouStart )
type GameServer ¶
type GameServer struct { Players []*Player // contains filtered or unexported fields }
GameServer is our main netorking entity
func CreateGameServer ¶
func CreateGameServer(port string) *GameServer
CreateGameServer returns a pointer to a GameServer struct
func (*GameServer) CheckPlayers ¶
func (s *GameServer) CheckPlayers(t time.Time)
func (*GameServer) CreatePlayer ¶
func (s *GameServer) CreatePlayer(conn *net.TCPConn) bool
CreatePlayer adds the player to the slice of players
func (*GameServer) ShutDown ¶
func (s *GameServer) ShutDown()
type PlaceShipType ¶
Click to show internal directories.
Click to hide internal directories.