Skip to content
Open
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 C7/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public override void _Ready() {
civ3AnimData = new AnimationManager(animSoundPlayer);
animTracker = new AnimationTracker(civ3AnimData);

controller = CreateGame.createGame(Global.LoadGamePath, Global.DefaultBicPath, (scenarioSearchPath) => {
controller = CreateGame.createGame(Global.LoadGamePath, GlobalSingleton.DefaultBicPath, (scenarioSearchPath) => {
// WHen the game loading logic tries to load the PediaIcons file, set the
// scenario search path and then use our Civ3MediaPath searching logic to
// find the correct version of the file.
Expand Down
6 changes: 3 additions & 3 deletions C7/GlobalSingleton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ public partial class GlobalSingleton : Node {
// and back to game
public string LoadGamePath;
// For now this needs to get passed to QueryCiv3 when importing.
public string DefaultBicPath { get => Util.GetCiv3Path() + @"/Conquests/conquests.biq"; }
public static string DefaultBicPath { get => Util.GetCiv3Path() + @"/Conquests/conquests.biq"; }

// This is the 'static map' used in lieu of terrain generation
public string DefaultGamePath { get => @"./Text/c7-static-map-save.json"; }
public static string DefaultGamePath { get => ProjectSettings.GlobalizePath(@"res://Text/c7-static-map-save.json"); }

// The file where a generated map is saved, until we get more advanced ways
// to generate new games.
// TODO: improve this.
public string DefaultGeneratedGamePath { get => @"./Text/c7-autosave-turn-0.json"; }
public static string DefaultGeneratedGamePath { get => ProjectSettings.GlobalizePath(@"user://generated-game.json"); }

public void ResetLoadGamePath() {
LoadGamePath = DefaultGamePath;
Expand Down
13 changes: 3 additions & 10 deletions C7/UIElements/NewGame/PlayerSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,7 @@ private void DisplaySelectedLeader() {
}

private SaveGame GetSave() {
if (!Engine.IsEditorHint()) {
GlobalSingleton Global = GetNode<GlobalSingleton>("/root/GlobalSingleton");
return SaveManager.LoadSave(Global.DefaultGamePath, Global.DefaultBicPath, (string unused) => { return unused; });
} else {
// Hardcoded fallback for the godot editor, which doesn't handle the
// global.
return SaveManager.LoadSave(@"./Text/c7-static-map-save.json", "", (string unused) => { return unused; });
}
return SaveManager.LoadSave(GlobalSingleton.DefaultGamePath, GlobalSingleton.DefaultBicPath, (string unused) => { return unused; });
}

private void CreateGame() {
Expand Down Expand Up @@ -276,8 +269,8 @@ private void DoWorldGenerationAndstartGame(SaveGame save, GlobalSingleton Global
save.GameDifficulty = difficulty;

log.Information("saving generated map");
save.Save(Global.DefaultGeneratedGamePath);
Global.LoadGamePath = Global.DefaultGeneratedGamePath;
save.Save(GlobalSingleton.DefaultGeneratedGamePath);
Global.LoadGamePath = GlobalSingleton.DefaultGeneratedGamePath;

log.Information("opening map");
CallDeferred("StartGame");
Expand Down
2 changes: 1 addition & 1 deletion C7/UIElements/NewGame/WorldSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ private void ResetAgeGraphics() {
private void CreateGame() {
GlobalSingleton Global = GetNode<GlobalSingleton>("/root/GlobalSingleton");
Global.ResetLoadGamePath();
SaveGame save = SaveManager.LoadSave(Global.DefaultGamePath, Global.DefaultBicPath, (string unused) => { return unused; });
SaveGame save = SaveManager.LoadSave(GlobalSingleton.DefaultGamePath, GlobalSingleton.DefaultBicPath, (string unused) => { return unused; });

Global.WorldCharacteristics = new WorldCharacteristics() {
landform = landform,
Expand Down