building

package
v0.0.0-...-3cf5308 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const ForrestTerrain = 101
View Source
const MineralTerrain = 200
View Source
const WaterTerrain = 110

Variables

This section is empty.

Functions

This section is empty.

Types

type Building

type Building int
const (
	BuildingNone Building = iota

	BuildingBarracks
	BuildingArmory
	BuildingFightersGuild
	BuildingArmorersGuild
	BuildingWarCollege
	BuildingSmithy
	BuildingStables
	BuildingAnimistsGuild
	BuildingFantasticStable
	BuildingShipwrightsGuild
	BuildingShipYard
	BuildingMaritimeGuild
	BuildingSawmill
	BuildingLibrary
	BuildingSagesGuild
	BuildingOracle
	BuildingAlchemistsGuild
	BuildingUniversity
	BuildingWizardsGuild
	BuildingShrine
	BuildingTemple
	BuildingParthenon
	BuildingCathedral
	BuildingMarketplace
	BuildingBank
	BuildingMerchantsGuild
	BuildingGranary
	BuildingFarmersMarket
	BuildingForestersGuild
	BuildingBuildersHall
	BuildingMechaniciansGuild
	BuildingMinersGuild
	BuildingCityWalls
	BuildingFortress

	BuildingSummoningCircle
	BuildingAltarOfBattle
	BuildingAstralGate
	BuildingStreamOfLife
	BuildingEarthGate
	BuildingDarkRituals

	BuildingHousing
	BuildingTradeGoods

	// not a real building, just a marker
	BuildingLast
)

func Buildings

func Buildings() []Building

the buildings that can be built in the order that they usually show up in the build screen

func (Building) Index

func (building Building) Index() int

the index in cityscap.lbx for the picture of this building

func (Building) IsReligous

func (building Building) IsReligous() bool

func (Building) ReplacedBy

func (building Building) ReplacedBy() Building

the building which is shown in the city scape instead

func (Building) Size

func (building Building) Size() (int, int)

the size of the picture for this building (in squares)

type BuildingDescriptions

type BuildingDescriptions struct {
	Descriptions []string
}

func MakeBuildDescriptions

func MakeBuildDescriptions(cache *lbx.LbxCache) *BuildingDescriptions

func (*BuildingDescriptions) Get

func (descriptions *BuildingDescriptions) Get(building Building) string

type BuildingInfo

type BuildingInfo struct {
	Name string

	// index of building that must exist first, or 0 if no dependency
	BuildingDependency1 int
	BuildingDependency2 int

	// -1 for no terrain, otherwise specifies a tile index that the building can be built on
	TerrainDependency int

	// replaces the given building
	BuildingReplace int

	Grant20XP bool
	Grant60XP bool
	// grants magic weapons to new units if appropriate minerals around
	Alchemist bool

	// required gold to maintain this building
	UpkeepGold       int
	UpkeepPower      int
	PopulationGrowth int
	Religion         int
	// points of research produced each turn
	Research int

	ConstructionCost int
	Animation        int

	// 0:  None, Trade, Housing
	// 1:  Marketplace, Bank, Merchants Guild, Maritime Guild
	// 2:  Shrine, Temple, Parthenon, Cathedral
	// 3:  Library, Sages Guild, Oracle, Alchemists Guild, University, Wizards Guild
	// 4:  Barracks, Armory, Fighters Guild, Armorers Guild, War College, Smithy, Stables, Fantastic Stable, Mechanicians Guild, City Walls
	Category int
}

type BuildingInfos

type BuildingInfos []BuildingInfo

func ReadBuildingInfo

func ReadBuildingInfo(cache *lbx.LbxCache) (BuildingInfos, error)

func (BuildingInfos) Allows

func (info BuildingInfos) Allows(building Building) []Building

return the buildings that have the provided building as a dependency

func (BuildingInfos) BuildingInfo

func (info BuildingInfos) BuildingInfo(building Building) BuildingInfo

func (BuildingInfos) Dependencies

func (info BuildingInfos) Dependencies(building Building) []Building

func (BuildingInfos) GetBuildingByName

func (info BuildingInfos) GetBuildingByName(name string) *BuildingInfo

func (BuildingInfos) GetBuildingIndex

func (info BuildingInfos) GetBuildingIndex(building Building) int

func (BuildingInfos) ManaProduction

func (info BuildingInfos) ManaProduction(building Building) int

func (BuildingInfos) Name

func (info BuildingInfos) Name(building Building) string

func (BuildingInfos) ProductionCost

func (info BuildingInfos) ProductionCost(building Building) int

func (BuildingInfos) ResearchProduction

func (info BuildingInfos) ResearchProduction(building Building) int

func (BuildingInfos) UpkeepCost

func (info BuildingInfos) UpkeepCost(building Building) int

type BuildingPosition

type BuildingPosition struct {
	Building Building
	Area     image.Rectangle
}

a position within some patch of land where this building is located. the Area field implicitly contains the x,y position within the overall patch of land

type Rect

type Rect struct {
	Width     int
	Height    int
	Id        int
	X         int
	Y         int
	Buildings []BuildingPosition
	// true if this rect should contain the fortress
	Fortress bool
}

represents a patch of land (in between roads) that can have buildings placed on it

func LayoutBuildings

func LayoutBuildings(buildings []Building, rects []*Rect, random *randomlib.Rand) ([]*Rect, bool)

func StandardRects

func StandardRects() []*Rect

func (*Rect) Add

func (rect *Rect) Add(building Building, width, height int, random *randomlib.Rand) bool

try to add the building to this patch of land. returns true if successful each possible point the new building could be placed is tried in a random order. if the building overlaps with any existing buildings then that point is skipped

func (*Rect) Area

func (rect *Rect) Area() int

func (*Rect) Clone

func (rect *Rect) Clone() *Rect

func (*Rect) EmptySpace

func (rect *Rect) EmptySpace() int

compute how much space is unused in this rectangle

func (*Rect) Equals

func (rect *Rect) Equals(other *Rect) bool

func (*Rect) Remove

func (rect *Rect) Remove(building Building)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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