Documentation ¶
Index ¶
- type Galaxy
- type Game
- func (g *Game) BuyCommodity(commodity string, amount int) (bought int, err error)
- func (g *Game) BuyFuel(amount int16) error
- func (g *Game) ExecuteCommand(cmd string) (status string, output string)
- func (g *Game) GetPlanetaryData(systemName string) PlanetarySystem
- func (g *Game) GetSystemData(systemName string) planetarySystem
- func (g *Game) HyperSpaceJump()
- func (g *Game) Jump(planetName string) error
- func (g *Game) Matchsys(platnetName string) int
- func (g *Game) PlayerCurrentPlanetName() string
- func (g *Game) PrintLocal()
- func (g *Game) PrintState()
- func (g *Game) ReachableSystems() []NavInfo
- func (g *Game) SellCommodity(commodity string, amount int) (sold int, err error)
- func (g *Game) SprintState() string
- type GameCommands
- type Market
- type NavInfo
- type PlanetarySystem
- type TradeGood
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Galaxy ¶
type Galaxy struct { Size int Systems []planetarySystem // contains filtered or unexported fields }
func (*Galaxy) PrintSystem ¶
func (*Galaxy) SprintSystem ¶
Returns a formatted string of System Data
type Game ¶
type Game struct { Galaxy Galaxy Player player AlienItems uint16 Commodities []TradeGood GameCommands GameCommands // contains filtered or unexported fields }
func (*Game) BuyCommodity ¶
func (*Game) ExecuteCommand ¶
Execute a game command Looks up the game command in the map of commands, if it finds a match it calls the function stored in the map value
func (*Game) GetPlanetaryData ¶
func (g *Game) GetPlanetaryData(systemName string) PlanetarySystem
func (*Game) GetSystemData ¶
Function that returns a planetary system record. Can be used for print system info
func (*Game) PlayerCurrentPlanetName ¶
Convienince function to return the name of the planet that the player is at
func (*Game) PrintLocal ¶
func (g *Game) PrintLocal()
Show local systems. Replicates the orginal functionality.
func (*Game) PrintState ¶
func (g *Game) PrintState()
Print out the current state of the game. Mostly for debug or simple CLI
func (*Game) ReachableSystems ¶
Return and array of reachable systems
func (*Game) SellCommodity ¶
type GameCommands ¶
A gamecommand is a map of commands to the functions that execute the command TODO: Should func return a generic type here? For now returning strings works because all the result of a command is is some status output that goes on screen
type Market ¶
TODO: Revisit this. Storing the unit names as part of the market struct is a departure from the effiecent storage method used by the rest of the game and it doesnt really make sense to do it like this here.
type PlanetarySystem ¶
type PlanetarySystem struct { X uint16 Y uint16 /* One byte unsigned */ Economy uint16 /* These two are actually only 0-7 */ EconomyName string Govtype uint16 GovName string Techlev uint16 /* 0-16 i think */ Population uint16 /* One byte */ Productivity uint16 /* Two byte */ Radius uint16 /* Two byte (not used by game at all) */ Description string Name string }