Skip to content

Commit

Permalink
Merge pull request #24 from adri1wcrow/master
Browse files Browse the repository at this point in the history
fix the 1.0.1 crash
  • Loading branch information
adri1wcrow authored Jun 26, 2018
2 parents 4bcb54c + 4d062c5 commit 2e37117
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 4 deletions.
14 changes: 11 additions & 3 deletions TankInspector/Modeling/Tank/ConsumableScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,18 @@ public static ConsumableScript Resolve(XmlReader reader, Database database)
case "RemovedRpmLimiter":
script = new RemovedRpmLimiterScript(database);
break;
case "Artillery":
case "RageArtillery":
case "ConsumableArtillery":
script = new ArtilleryScript(database);
break;
case "Bomber":
case "RageBomber":
case "ConsumableBomber":
script = new BomberScript(database);
break;
case "EpicRecon":
case "ConsumableRecon":
script = new ReconScript(database);
break;
case "Afterburning":
script = new AfterburningScript(database);
break;
Expand Down Expand Up @@ -60,7 +66,9 @@ public static ConsumableScript Resolve(XmlReader reader, Database database)
script = new LastEffortBattleBoosterScript(database);
break;
default:
throw new NotSupportedException();
script = new DefaultScript(database,type);
break;
//TODO throw new NotSupportedException();
}

script.Deserialize(reader);
Expand Down
29 changes: 29 additions & 0 deletions TankInspector/Modeling/Tank/DefaultScript.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System.Xml;

namespace Smellyriver.TankInspector.Modeling
{
internal class DefaultScript : ConsumableScript
{
public override string[] EffectiveDomains => new[] { "unknown" };

public DefaultScript(Database database,string type)
: base(database)
{
EffectiveDomains.SetValue(type, 0);
}

public override bool DeserializeSection(string name, XmlReader reader)
{
switch (name)
{
default:
return base.DeserializeSection(name, reader);
}
}

public override void Execute(ModificationContext context, object args)
{

}
}
}
29 changes: 29 additions & 0 deletions TankInspector/Modeling/Tank/ReconScript.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System.Xml;

namespace Smellyriver.TankInspector.Modeling
{
internal class ReconScript : ConsumableScript
{
public override string[] EffectiveDomains => new[] { "recon" };

public ReconScript(Database database)
: base(database)
{

}

public override bool DeserializeSection(string name, XmlReader reader)
{
switch (name)
{
default:
return base.DeserializeSection(name, reader);
}
}

public override void Execute(ModificationContext context, object args)
{

}
}
}
2 changes: 2 additions & 0 deletions TankInspector/Modeling/Tank/Shell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ private ShellType ParseShellType(string type)
return ShellType.APHE;
case "HIGH_EXPLOSIVE_PREMIUM":
return ShellType.PremiumHE;
case "SMOKE":
return ShellType.SMOKE;
default:
throw new NotSupportedException();
}
Expand Down
8 changes: 7 additions & 1 deletion TankInspector/Modeling/Tank/ShellType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ public enum ShellType
HE,
PremiumHE,
HEAT,
APHE
APHE,
SMOKE
}

internal static class ShellTypeExtensions
Expand All @@ -21,6 +22,7 @@ public static bool IsKineticShellType(this ShellType type)
{
case ShellType.HE:
case ShellType.PremiumHE:
case ShellType.SMOKE:
return false;
case ShellType.AP:
case ShellType.APCR:
Expand All @@ -39,6 +41,7 @@ public static bool HasNormalizationEffect(this ShellType type)
case ShellType.HE:
case ShellType.PremiumHE:
case ShellType.HEAT:
case ShellType.SMOKE:
return false;
case ShellType.AP:
case ShellType.APCR:
Expand All @@ -56,6 +59,7 @@ public static double BasicNormalization(this ShellType type)
case ShellType.HE:
case ShellType.PremiumHE:
case ShellType.HEAT:
case ShellType.SMOKE:
return 0.0;
case ShellType.AP:
case ShellType.APHE:
Expand All @@ -71,6 +75,8 @@ public static double RicochetAngle(this ShellType type)
{
switch (type)
{
case ShellType.SMOKE:
return 0.0;
case ShellType.HE:
case ShellType.PremiumHE:
return 90.0;
Expand Down

0 comments on commit 2e37117

Please sign in to comment.