Fix some bugz

This commit is contained in:
Li 2023-03-07 21:27:27 +13:00
parent 609c8fc4dd
commit 0edb1d8918
3 changed files with 35 additions and 18 deletions

View File

@ -20,33 +20,34 @@ namespace LibW4M.Data.Teams
} }
} }
private string secretWeaponUuid; private WeaponData secretWeapon;
private string secretWeaponClusterUuid; private WeaponData secretWeaponCluster;
public WeaponData SecretWeapon public WeaponData SecretWeapon
{ {
get get
{ {
WeaponData? data = fileBelongs.WeaponFactoryCollective.findWeaponWithContainerUuid(secretWeaponUuid); WeaponData? data = fileBelongs.WeaponFactoryCollective.findWeaponWithContainerUuid(this.secretWeapon.mainContainer.Uuid);
if (data is null) return new WeaponData(fileBelongs, fileBelongs.LookupContainerByUuid(secretWeaponUuid)); if (data is null) return secretWeapon;
return data; return data;
} }
set set
{ {
this.secretWeaponUuid = value.mainContainer.Uuid; this.secretWeapon = value;
} }
} }
public WeaponData SecretWeaponCluster public WeaponData SecretWeaponCluster
{ {
get get
{ {
WeaponData? data = fileBelongs.WeaponFactoryCollective.findWeaponWithContainerUuid(secretWeaponClusterUuid); WeaponData? data = fileBelongs.WeaponFactoryCollective.findWeaponWithContainerUuid(this.secretWeaponCluster.mainContainer.Uuid);
if(data is null) return new WeaponData(fileBelongs, fileBelongs.LookupContainerByUuid(secretWeaponClusterUuid)); if (data is null) return secretWeaponCluster;
return data; return data;
} }
set set
{ {
this.secretWeaponClusterUuid = value.mainContainer.Uuid; this.secretWeaponCluster = value;
} }
} }
@ -78,14 +79,14 @@ namespace LibW4M.Data.Teams
{ {
// delete weapon if its not in weapon collective, and this is the last reference to it. // delete weapon if its not in weapon collective, and this is the last reference to it.
if(fileBelongs.WeaponFactoryCollective.findWeaponWithContainerUuid(secretWeaponUuid) is null) if(fileBelongs.WeaponFactoryCollective.findWeaponWithContainerUuid(secretWeapon.mainContainer.Uuid) is null)
{ {
bool delete = true; bool delete = true;
foreach (TeamData team in fileBelongs.TeamDataColective) foreach (TeamData team in fileBelongs.TeamDataColective)
{ {
if (team.Equals(this)) continue; if (team.Equals(this)) continue;
if (team.secretWeaponUuid.Equals(this.secretWeaponUuid, StringComparison.InvariantCultureIgnoreCase)) delete = false; if (team.secretWeapon.mainContainer.Uuid.Equals(this.secretWeapon.mainContainer.Uuid, StringComparison.InvariantCultureIgnoreCase)) delete = false;
} }
if (delete) if (delete)
@ -95,14 +96,14 @@ namespace LibW4M.Data.Teams
} }
// delete cluster if its not in weapon collective, and this is the last reference to it. // delete cluster if its not in weapon collective, and this is the last reference to it.
if (fileBelongs.WeaponFactoryCollective.findWeaponWithContainerUuid(secretWeaponClusterUuid) is null) if (fileBelongs.WeaponFactoryCollective.findWeaponWithContainerUuid(secretWeaponCluster.mainContainer.Uuid) is null)
{ {
bool delete = true; bool delete = true;
foreach (TeamData team in fileBelongs.TeamDataColective) foreach (TeamData team in fileBelongs.TeamDataColective)
{ {
if (team.Equals(this)) continue; if (team.Equals(this)) continue;
if (team.secretWeaponClusterUuid.Equals(this.secretWeaponClusterUuid, StringComparison.InvariantCultureIgnoreCase)) delete = false; if (team.secretWeaponCluster.mainContainer.Uuid.Equals(this.secretWeaponCluster.mainContainer.Uuid, StringComparison.InvariantCultureIgnoreCase)) delete = false;
} }
if (delete) if (delete)
@ -134,8 +135,8 @@ namespace LibW4M.Data.Teams
this.AllMissionsDone = reader.ReadBool(); this.AllMissionsDone = reader.ReadBool();
this.Player = fileBelongs.LookupStringFromId(reader.ReadCompressedInt()); this.Player = fileBelongs.LookupStringFromId(reader.ReadCompressedInt());
this.secretWeaponUuid = fileBelongs.LookupContainerById(reader.ReadCompressedInt()).Uuid; this.secretWeapon = new WeaponData(fileBelongs, fileBelongs.LookupContainerById(reader.ReadCompressedInt()));
this.secretWeaponClusterUuid = fileBelongs.LookupContainerById(reader.ReadCompressedInt()).Uuid; this.secretWeaponCluster = new WeaponData(fileBelongs, fileBelongs.LookupContainerById(reader.ReadCompressedInt()));
this.CustomWeapon = fileBelongs.LookupStringFromId(reader.ReadCompressedInt()); this.CustomWeapon = fileBelongs.LookupStringFromId(reader.ReadCompressedInt());

View File

@ -20,6 +20,22 @@
<DebugType>none</DebugType> <DebugType>none</DebugType>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Content Include="EditorIcon.ico" /> <Content Include="EditorIcon.ico" />
</ItemGroup> </ItemGroup>

View File

@ -250,15 +250,15 @@
{ {
"Name" = "8:Microsoft Visual Studio" "Name" = "8:Microsoft Visual Studio"
"ProductName" = "8:Worms 4 Mayhem! Save Editor" "ProductName" = "8:Worms 4 Mayhem! Save Editor"
"ProductCode" = "8:{945DC231-F49D-4FEE-8080-62674DBFAD4F}" "ProductCode" = "8:{BBBE798E-046D-40F4-A0E0-63A489BCE191}"
"PackageCode" = "8:{33346D44-99FA-47AE-B7DB-4450DF4DD632}" "PackageCode" = "8:{5425088E-E3A8-47AC-9016-200F9A153C6A}"
"UpgradeCode" = "8:{258DF422-36AE-473E-8BF8-047D23F10982}" "UpgradeCode" = "8:{258DF422-36AE-473E-8BF8-047D23F10982}"
"AspNetVersion" = "8:2.0.50727.0" "AspNetVersion" = "8:2.0.50727.0"
"RestartWWWService" = "11:FALSE" "RestartWWWService" = "11:FALSE"
"RemovePreviousVersions" = "11:FALSE" "RemovePreviousVersions" = "11:FALSE"
"DetectNewerInstalledVersion" = "11:TRUE" "DetectNewerInstalledVersion" = "11:FALSE"
"InstallAllUsers" = "11:TRUE" "InstallAllUsers" = "11:TRUE"
"ProductVersion" = "8:1.0.0" "ProductVersion" = "8:1.0.1"
"Manufacturer" = "8:Non-Binary Inc" "Manufacturer" = "8:Non-Binary Inc"
"ARPHELPTELEPHONE" = "8:" "ARPHELPTELEPHONE" = "8:"
"ARPHELPLINK" = "8:" "ARPHELPLINK" = "8:"