Skip to content

Commit 827a2db

Browse files
Add files via upload
Megamap support
1 parent ccc8d50 commit 827a2db

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

CnCTDRAMapEditor/CnCTDRAMapEditor.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@
5757
<PropertyGroup>
5858
<ApplicationIcon>Resources\GameIcon00.ico</ApplicationIcon>
5959
</PropertyGroup>
60+
<PropertyGroup>
61+
<AssemblyName>CnCTDRAMapEditorD</AssemblyName>
62+
</PropertyGroup>
6063
<ItemGroup>
6164
<Reference Include="System" />
6265
<Reference Include="System.Core" />
@@ -577,7 +580,7 @@
577580
<PackageReference Include="System.ValueTuple">
578581
<Version>4.5.0</Version>
579582
</PackageReference>
580-
<Reference Include="netstandard" />
583+
<Reference Include="netstandard" />
581584
</ItemGroup>
582585
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
583586
</Project>

CnCTDRAMapEditor/MainForm.cs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -799,17 +799,33 @@ private bool LoadFile(string loadFilename)
799799
{
800800
try
801801
{
802-
using (var reader = new StreamReader(loadFilename))
802+
using (var reader2 = new StreamReader(loadFilename))
803803
{
804804
var ini2 = new INI();
805-
ini2.ParseMapSize(reader);
805+
ini2.ParseMapSize(reader2);
806806
}
807807
}
808808
catch (FileNotFoundException)
809809
{
810810
return false;
811811
}
812812
}
813+
if (fileType == FileType.BIN) // Megamap support, if we've been given a bin, look for the ini, then parse for Megamap flag.
814+
{
815+
try
816+
{
817+
using (var reader3 = new StreamReader(Path.ChangeExtension(loadFilename, ".ini")))
818+
{
819+
var ini3 = new INI();
820+
ini3.ParseMapSize(reader3);
821+
}
822+
}
823+
catch (FileNotFoundException)
824+
{
825+
return false;
826+
}
827+
}
828+
813829
Globals.TheTeamColorManager.Reset();
814830
Globals.TheTeamColorManager.Load(@"DATA\XML\CNCTDTEAMCOLORS.XML");
815831
plugin = new TiberianDawn.GamePlugin();

0 commit comments

Comments
 (0)