Skip to content

Commit 020693c

Browse files
committed
Fix zoom in savegames
1 parent ee2691a commit 020693c

19 files changed

Lines changed: 103 additions & 66 deletions

File tree

.idea/.idea.Civ2clone/.idea/workspace.xml

Lines changed: 37 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Civ2/Civ2Interface.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,11 +422,12 @@ public IInterfaceAction HandleLoadScenario(IGame game, string scnName, string sc
422422
return DialogHandlers[ScenarioLoadedDialog.Title].Show(this);
423423
}
424424

425-
public IInterfaceAction HandleLoadGame(IGame game, Civ2engine.Rules rules, Ruleset ruleset)
425+
public IInterfaceAction HandleLoadGame(IGame game, Civ2engine.Rules rules, Ruleset ruleset,
426+
Dictionary<string, string?> viewData)
426427
{
427428
ExpectedMaps = game.NoMaps;
428429
Initialization.LoadGraphicsAssets(this);
429-
430+
Initialization.ViewData = viewData;
430431
Initialization.Start(game);
431432
return DialogHandlers[LoadOk.Title].Show(this);
432433
}

Civ2/Dialogs/LoadOk.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public ICivDialogHandler UpdatePopupData(Dictionary<string, PopupBox?> popups)
2626
public IInterfaceAction HandleDialogResult(DialogResult result,
2727
Dictionary<string, ICivDialogHandler> civDialogHandlers, Civ2Interface civ2Interface)
2828
{
29-
return new StartGame(Initialization.GameInstance);
29+
return new StartGame(Initialization.GameInstance, Initialization.ViewData);
3030
}
3131

3232
public IInterfaceAction Show(Civ2Interface activeInterface)

Civ2/Dialogs/NewGame/EnterName.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public override IInterfaceAction HandleDialogResult(DialogResult result,
7373

7474
civ2Interface.ScenTitleImage = null;
7575
Initialization.Start(game);
76-
return new StartGame(Initialization.GameInstance);
76+
return new StartGame(Initialization.GameInstance, Initialization.ViewData);
7777
}
7878
else
7979
{

Civ2/Dialogs/NewGame/Init.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ public override IInterfaceAction Show(Civ2Interface activeInterface)
3939

4040
public override IInterfaceAction HandleDialogResult(DialogResult result, Dictionary<string, ICivDialogHandler> civDialogHandlers, Civ2Interface civ2Interface)
4141
{
42-
return new StartGame(Initialization.GameInstance);
42+
return new StartGame(Initialization.GameInstance, Initialization.ViewData);
4343
}
4444
}

Civ2/Rules/Initialization.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public static class Initialization
1313
{
1414
private static GameInitializationConfig? _config;
1515
public static GameInitializationConfig ConfigObject => _config ??= GetConfig() ;
16+
public static IDictionary<string,string?>? ViewData { get; set; }
1617

1718
private static GameInitializationConfig GetConfig()
1819
{

Civ2clone.sln.DotSettings.user

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AFile_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FLibrary_003FApplication_0020Support_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fa0741529c8554d199992ef9e50684668d82800_003Fbb_003Ffb5eabec_003FFile_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
66
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AJsonConverter_00601_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FLibrary_003FApplication_0020Support_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F94125f469e4d403caa9218894df9d5f0191800_003F23_003F9a30c93f_003FJsonConverter_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
77
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AJsonEncodedText_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FLibrary_003FApplication_0020Support_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F94125f469e4d403caa9218894df9d5f0191800_003F77_003Ffcfefd15_003FJsonEncodedText_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
8+
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AList_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FLibrary_003FApplication_0020Support_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fe747192abb38e2df82cbdb37e721567726f559914a7b81f8b26ba537de632f4_003FList_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
89
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AList_00601_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FLibrary_003FApplication_0020Support_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fa0741529c8554d199992ef9e50684668d82800_003F34_003F9a88beed_003FList_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
910
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ALuaTable_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FLibrary_003FApplication_0020Support_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F774a1c59431948cbbbfabd8853de8e434e600_003Ff7_003Ff3680171_003FLuaTable_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
1011
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AMethodBaseInvoker_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FLibrary_003FApplication_0020Support_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F3ad82f9910d5c82d76b445db10584a60305639dcad2533e08e6c47f85e3b6d83_003FMethodBaseInvoker_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>

Engine/src/GameExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ public static void SetImprovementsForCities(this IGame game,Civilization civiliz
4141
{
4242
tile.Improvements.Clear();
4343
tile.EffectsList.Clear();
44-
var visibleTo = tile.PlayerKnowledge.Select(((playerTile, civId) => new { playerTile, civId } ))
45-
.Where(arg => arg != null).Select(arg => arg.civId).ToList();
44+
var visibleTo = tile.PlayerKnowledge?.Select(((playerTile, civId) => new { playerTile, civId } ))
45+
.Where(arg => arg.playerTile != null).Select(arg => arg.civId).ToList();
4646
foreach (var can in improvements)
4747
{
4848
var terrain = can.improvement.AllowedTerrains[tile.Z]

0 commit comments

Comments
 (0)