Documentation
¶
Index ¶
- type Base
- type BicResources
- type Bldg
- type Civ3Data
- type Civ3Header
- type Continent
- type Ctzn
- type Cult
- type Date
- type DefaultGameSettings
- type Difficulty
- type Era
- type Espn
- type Expr
- type FileError
- type Flav
- type Flavor
- type Game
- type GameNext
- type Good
- type Lead
- type List
- type ListHeader
- type ListItem
- type ParseError
- type ParsedData
- type ReadError
- type Section
- type Tile
- type VerNum
- type WorldFeatures
- type Wrld
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BicResources ¶
type BicResources struct { Name [4]byte Length int32 A int32 ResourcePath [0x100]byte B int32 BicPath [0x100]byte C int32 }
BicResources is part of the second SAV file section. Guessing at the alignment
type Bldg ¶
type Bldg struct { Length int32 Description [64]byte Name [32]byte CivilopediaEntry [32]byte DoublesHappinessOf4 int32 GainInEveryCity int32 GainInEveryCityOnContinent int32 RequiredBuilding int32 Cost int32 Culture int32 BombardmentDefense int32 DefenseBonus int32 MaintenanceCost int32 HappyFacesAllCities int32 HappyFaces int32 UnhappyFacesAllCities int32 UnhappyFaces int32 NumberOfRequiredBuildings int32 AirPower int32 Pollution int32 Production int32 RequiredGovernment int32 SpaceshipPart int32 RequiredAdvance int32 RenderedObsoleteBy int32 RequiredResource1 int32 RequiredResource2 int32 ImprovementsBitMap int32 OtherCharacteristicsBitMap int32 SmallWondersBitMap int32 WondersBitMap int32 NumberOfArmiesRequired int32 FlavorsBitMap int32 A int32 UnitProducedPRTORef int32 UnitFrequency int32 }
Bldg ...
type Civ3Data ¶
type Civ3Data struct { FileName string Compressed bool Data ParsedData Civ3 Civ3Header BicResources BicResources BicFileHeader [4]byte VerNum []VerNum Bldg []Bldg Ctzn []Ctzn Cult []Cult Diff []Difficulty Eras []Era Espn []Espn Expr []Expr Flav [][]Flavor Good []Good // Wrld Wrld Tile []Tile Cont []Continent ResourceCounts []int32 Next string }
Civ3Data contains the game data
func NewCiv3Data ¶
NewCiv3Data takes a path to a file and returns a struct containing the parsed data and a rawFile field
type Civ3Header ¶
type Civ3Header struct { Name [4]byte Always0x1a00 int16 MaybeVersionMinor, MaybeVersionMajor int32 Gobbeldygook1, Gobbeldygook2, Gobbeldygook3, Gobbeldygook4 uint32 }
Civ3Header is the SAV file header The Gobbledygook values appear to be 16 bytes of uncorrelated data, perhaps a hash or checksum?
type Continent ¶
Continent is the CONT section Land is 1 for land, 0 for water Size is number of tiles
type Ctzn ¶
type Ctzn struct { Length int32 DefaultCitizen int32 CitizensSingularName [32]byte CivilopediaEntry [32]byte PluralName [32]byte Prerequisite int32 Luxuries int32 Research int32 Taxes int32 Corruption int32 Construction int32 }
Ctzn ...
type Cult ¶
type Cult struct { Length int32 CultureOpinionName [64]byte ChanceOfSuccessfulPropaganda int32 CultureRatioPercentage int32 CultureRatioDenominator int32 CultureRatioNumerator int32 InitialResistanceChance int32 ContinuedResistanceChance int32 }
Cult ...
type Date ¶
type Date struct { Name [4]byte Length int32 Text [16]byte BaseTimeUnit int32 Month int32 Week int32 Year int32 // contains filtered or unexported fields }
Date DATE section ... I don't think this is nearly right
type DefaultGameSettings ¶
type DefaultGameSettings struct { TurnsLimit int32 PointsLimit int32 DestroyedCitiesLimit int32 CityCultureLimit int32 CivCultureLimit int32 PopulationLimit int32 TerritoryLimit int32 WondersLimit int32 DestroyedUnitsLimit int32 AdvancesLimit int32 CapturedCitiesLimit int32 VictoryPointPrice int32 PrincessPrice int32 PrincessRansom int32 }
DefaultGameSettings from Antal1987's dump
type Difficulty ¶
type Difficulty struct { Length int32 DifficultyLevelName [64]byte NumberOfCitizensBornContent int32 MaxGovernmentTransitionTime int32 NumberOfDefensiveLandUnitsAIStartsWith int32 NumberOfOffensiveLandUnitsAIStartsWith int32 ExtraStartUnit1 int32 ExtraStartUnit2 int32 AdditionalFreeSupport int32 BonusForEachCity int32 AttackBonusAgainstBarbarians int32 CostFactor int32 PercentageOfOptimalCities int32 AIToAITradeRate int32 CorruptionPct int32 MilitaryLaw int32 }
Difficulty ...
type Era ¶
type Era struct { Length int32 EraName [64]byte CivilopediaEntry [32]byte Researcher1 [32]byte Researcher2 [32]byte Researcher3 [32]byte Researcher4 [32]byte Researcher5 [32]byte NumberOfUsedResearcherNames int32 A int32 }
Era ...
type Espn ¶
type Espn struct { Length int32 Description [128]byte MissionName [64]byte CivilopediaEntry [32]byte MissionPerformedByBitMap int32 BaseCost int32 }
Espn ...
type Expr ¶
type Expr struct { Length int32 ExperienceLevelName [32]byte BaseHitPoints int32 RetreatBonus int32 }
Expr ...
type FileError ¶
type FileError struct {
// contains filtered or unexported fields
}
FileError returns errors while trying to open or decompress the file. Pass it the downstream error e.g. return FileError{err}
type Flavor ¶
type Flavor struct { A int32 FlavorName [0x100]byte NumFlavorRelations int32 FlavorRelations [7]int32 }
Flavor is the leaf element of FLAV Hard-coding FlavorRelations at 7. Hopefully that always works
type Game ¶
type Game struct { // First two fields count for "class base" Name [4]byte RenderFlags int32 DifficultyLevel int32 UnitsCount int32 CitiesCount int32 GlobalWarmingLevel int32 CurrentTurn int32 Random int32 CivFlags2 int32 CivFlags1 int32 Value1 int32 GameLimitPoints int32 GameLimitTurns int32 GameLimitDestroyedCities int32 GameLimitCityCulture int32 GameLimitCivCulture int32 GameLimitPopulation int32 GameLimitTerritory int32 GameLimitWonders int32 GameLimitDestroyedWonders int32 GameLimitAdvances int32 GameLimitCapturedCities int32 GameLimitVictoryPointPrice int32 GameLimitPrincessRansom int32 DefaultDate1 int32 // contains filtered or unexported fields }
Game is the first section after the BIC.
type GameNext ¶
type GameNext struct { PLGI [10]int32 Date2 Date Date3 Date GameAggression int32 CityStatIntArray int32 ResearchedAdvances int32 Wonders int32 WonderFlags int32 ImprovementTypesData1 int32 ImprovementTypesData2 int32 UnitTypesData1 int32 UnitTypesData2 int32 DefaultGameSettings DefaultGameSettings // contains filtered or unexported fields }
GameNext is what Antal1987's dumps suggest is next, but I don't think so
type Good ¶
type Good struct { LengthOfResourceData88 int32 NaturalResourceName [24]byte CivilopediaEntry [32]byte Type int32 AppearanceRatio int32 DisappearanceProbability int32 Icon int32 Prerequisite int32 FoodBonus int32 ShieldsBonus int32 CommerceBonus int32 }
Good are the resource types
type ParseError ¶
type ParseError struct {
Expected, Hexdump string
// contains filtered or unexported fields
}
ParseError is when the data does not match an expected pattern. Pass it message string, expected value and hex dump of pertinent data.
func (ParseError) Error ¶
func (e ParseError) Error() string
type ParsedData ¶
ParsedData is the structure of the parsed data
func ParseCiv3 ¶
func ParseCiv3(r io.ReadSeeker) (ParsedData, error)
ParseCiv3 takes raw save file data and returns a map of the parsed data
type ReadError ¶
type ReadError struct {
// contains filtered or unexported fields
}
ReadError returns errors while trying to read data for parsing. Pass it the downstream error e.g. return ReadError{err}
type Section ¶
type Section interface{}
Section is the inteface for the various structs decoded from the data files
type Tile ¶
type Tile struct { Name [4]byte `json:"-"` Length int32 `json:"-"` Rivers uint8 MaybeTerritoryCivID int8 MaybeLandmarkTerrain int16 ResourceType int32 TileUnitID int32 MaybeSquarePart int16 MaybeVictoryPoint int16 MaybePreConquestsTileInfo int32 BarbTribeID int16 CityID int16 MaybeColonyID int16 ContinentID int16 A int32 B int32 Name2 [4]byte `json:"-"` Length2 int32 `json:"-"` Improvements int32 C int8 Terrain uint8 MaybeByCivBitMask uint32 TerrainFeatures uint16 Name3 [4]byte `json:"-"` Length3 int32 `json:"-"` D int32 Name4 [4]byte `json:"-"` Length4 int32 `json:"-"` VisibleToCiv uint32 VisibleNowToCivUnits uint32 MaybeVisibleToColonies uint32 VisibleToCivCulture uint32 E int32 CityID2 int16 TradeNetworkIDByCiv [32]int16 MaybeImprovementsKnownToCiv [32]uint8 F uint16 G int32 H int32 }
Tile is Conquests' 4 TILE sections per world tile combined
type VerNum ¶
type VerNum struct { Length int32 A, B uint32 BicMajorVersion int32 BicMinorVersion int32 Description [640]byte Title [64]byte }
VerNum ...
type WorldFeatures ¶
type WorldFeatures struct { Climate int32 ClimateFinal int32 Barbarians int32 BarbariansFinal int32 Landmass int32 LandmassFinal int32 OceanCoverage int32 OceanCoverageFinal int32 Temperature int32 TemperatureFinal int32 Age int32 AgeFinal int32 Size int32 }
WorldFeatures is the map generation settings Barbs: -1 is off, 0 sedendary...3 raging
type Wrld ¶
type Wrld struct { Name [4]byte `json:"-"` Length int32 `json:"-"` NumContinents int16 Name2 [4]byte `json:"-"` Length2 int32 `json:"-"` OceanContinentID int32 MapHeight int32 DistanceBetweencivs int32 MaybeCivCount int32 D int32 E int32 MapWidth int32 CivStartLocationTileID [32]int32 WorldSeed int32 G int32 Name3 [4]byte `json:"-"` Length3 int32 `json:"-"` GenOptions WorldFeatures }
Wrld is the Conquests' 3 WRLD sections combined