Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Branching

- When starting a new task, always create a new branch with prefix `feature/` for new features and `fix/` for bugfixes.
- When starting a new task, always create a new branch with prefix `feature/` for new features and `fix/` for bugfixes. Only create a new branch when working on `main` or `master`.

## Commits

Expand Down
7 changes: 4 additions & 3 deletions cmd/editor/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import (
"log"
"os"

"github.com/redtoad/xcom-editor/internal/geoscape"
"github.com/redtoad/xcom-editor/savegame"
"golang.org/x/text/currency"
"golang.org/x/text/language"
"golang.org/x/text/message"

"github.com/redtoad/xcom-editor/internal/geoscape"
"github.com/redtoad/xcom-editor/savegame"
)

func FinishAllConstructions(path string) {
Expand Down Expand Up @@ -42,7 +43,7 @@ func main() {
if no%6 == 0 {
println()
}
fmt.Print(cell.Tile())
fmt.Print(cell.String())
}
println()
fmt.Printf("%v\n", base.Grid)
Expand Down
20 changes: 10 additions & 10 deletions savegame/bases.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type Base struct {
}

func (b *Base) Name() string {
return b.game.baseFile.Bases[b.offset].Name.String()
return b.game.BasesData.Bases[b.offset].Name.String()
}

func (b *Base) Coord() Coord {
Expand All @@ -28,7 +28,7 @@ func (b *Base) Coord() Coord {
}

func (b *Base) Tiles() []BaseTile {
data := b.game.baseFile.Bases[b.offset]
data := b.game.BasesData.Bases[b.offset]
tiles := make([]BaseTile, 36)
for i := 0; i < 36; i++ {
tiles[i] = BaseTile{
Expand All @@ -40,7 +40,7 @@ func (b *Base) Tiles() []BaseTile {
}

func (b *Base) TileAt(x, y int) BaseTile {
data := b.game.baseFile.Bases[b.offset]
data := b.game.BasesData.Bases[b.offset]
tileNo := x + y*6
return BaseTile{
Type: data.Grid[tileNo],
Expand All @@ -55,21 +55,21 @@ type BaseTile struct {

func (game *Savegame) loadBases() error {
filePath := path.Join(game.Path, "BASE.DAT")
if err := internal.LoadDATFile(filePath, &game.baseFile); err != nil {
if err := internal.LoadDATFile(filePath, &game.BasesData); err != nil {
return fmt.Errorf("could not load BASE.DAT: %w", err)
}
return nil
}

func (game *Savegame) saveBases() error {
filePath := path.Join(game.Path, "BASE.DAT")
return internal.SaveDATFile(filePath, game.baseFile)
return internal.SaveDATFile(filePath, game.BasesData)
}

// CompleteConstructions will complete all ongoing constructions in all baseFile.
// CompleteConstructions will complete all ongoing constructions in all BasesData.
func (game *Savegame) CompleteConstructions() {
for b := 0; b < len(game.baseFile.Bases); b++ {
base := &game.baseFile.Bases[b]
for b := 0; b < len(game.BasesData.Bases); b++ {
base := &game.BasesData.Bases[b]
for i := 0; i < len(base.DaysToCompletion); i++ {
if base.DaysToCompletion[i] > 0 {
log.Printf("Complete construction of %v in %s.\n", base.Grid[i].String(), base.Name)
Expand All @@ -80,7 +80,7 @@ func (game *Savegame) CompleteConstructions() {
}

func (game *Savegame) Base(offset int) *Base {
base := game.baseFile.Bases[offset]
base := game.BasesData.Bases[offset]
if base.Name.String() != "" {
return &Base{
offset: offset,
Expand All @@ -92,7 +92,7 @@ func (game *Savegame) Base(offset int) *Base {

func (game *Savegame) Bases() []*Base {
bases := make([]*Base, 0)
for idx, base := range game.baseFile.Bases {
for idx, base := range game.BasesData.Bases {
if base.Name.String() != "" {
bases = append(bases, game.Base(idx))
}
Expand Down
4 changes: 2 additions & 2 deletions savegame/savegame.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
type Savegame struct {
Path string
meta geoscape.SaveinfoFile
FinancialData geoscape.LiglobFile
baseFile geoscape.BaseFile
Financials geoscape.LiglobFile
BasesData geoscape.BaseFile
locationFile geoscape.LocFile
soldierFile geoscape.SoldierFile
transferFile geoscape.TransferFile
Expand Down