eliteEngine

package
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

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 (g *Galaxy) PrintSystem(plsy planetarySystem, compressed bool)

func (*Galaxy) SprintSystem

func (g *Galaxy) SprintSystem(plsy planetarySystem, compressed bool) string

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 InitGame

func InitGame(useNativeRand bool) Game

func (*Game) BuyCommodity

func (g *Game) BuyCommodity(commodity string, amount int) (bought int, err error)

func (*Game) BuyFuel

func (g *Game) BuyFuel(amount int16) error

func (*Game) ExecuteCommand

func (g *Game) ExecuteCommand(cmd string) (status string, output string)

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

func (g *Game) GetSystemData(systemName string) planetarySystem

Function that returns a planetary system record. Can be used for print system info

func (*Game) HyperSpaceJump

func (g *Game) HyperSpaceJump()

Jump to a new Galaxy

func (*Game) Jump

func (g *Game) Jump(planetName string) error

func (*Game) Matchsys

func (g *Game) Matchsys(platnetName string) int

TODO: Dont like the way this works. Revisit

func (*Game) PlayerCurrentPlanetName

func (g *Game) PlayerCurrentPlanetName() string

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

func (g *Game) ReachableSystems() []NavInfo

Return and array of reachable systems

func (*Game) SellCommodity

func (g *Game) SellCommodity(commodity string, amount int) (sold int, err error)

func (*Game) SprintState

func (g *Game) SprintState() string

Return game state as a string

type GameCommands

type GameCommands map[string]func(game *Game, args []string) (stauts string, output string)

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

type Market struct {
	Price     []uint16
	Quantity  []uint16
	UnitNames []string
}

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 NavInfo struct {
	System                   planetarySystem
	ReachableWithMaxFuel     bool
	ReachableWithCurrentFuel bool
	Distance                 int
}

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
}

type TradeGood

type TradeGood struct {
	Baseprice    uint16 /* one byte */
	Gradient     int16  /* five bits plus sign */
	Basequant    uint16 /* one byte */
	Maskbyte     uint16 /* one byte */
	Units        uint   /* two bits */
	Name         string /* longest="Radioactives" */
	Abbrievation string // Added for printing reasons
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL