diff --git a/inf3.csproj b/inf3.csproj
index 87944bf..4f81ce7 100644
--- a/inf3.csproj
+++ b/inf3.csproj
@@ -65,9 +65,9 @@
-
-
+
+
\ No newline at end of file
diff --git a/src/Parser.cs b/src/Parser.cs
index ae99be2..21ed0b7 100644
--- a/src/Parser.cs
+++ b/src/Parser.cs
@@ -226,10 +226,12 @@ namespace WorldOfPeacecraft
Decision d;
if (stringValue == "DRAGON")
d = Decision.DRAGON;
- if (stringValue == "STAGHUNT")
+ else if (stringValue == "STAGHUNT")
d = Decision.STAGHUNT;
- if (stringValue == "SKIRMISH")
+ else if (stringValue == "SKIRMISH")
d = Decision.SKIRMISH;
+ else
+ throw new ParsingException("Wrong param"); // TODO Better message
Opponent o = new Opponent (id, points, total, d);
}
@@ -243,17 +245,22 @@ namespace WorldOfPeacecraft
{
int id = challengeBlock.GetIntValue("id");
String type;
- switch (challengeBlock.GetStringValue())
+ LinkedList value = challengeBlock.GetUnnamedValues();
+ // TODO check value size, better name
+ switch (value.First.Value)
{
- case "DRAGON":
- type = "Dragon";
- break;
- case "STAGHUNT":
- type = "Staghunt";
- break;
- case "SKIRMISCH":
- type = "Skirmisch";
- break;
+ case "DRAGON":
+ type = "Dragon";
+ break;
+ case "STAGHUNT":
+ type = "Staghunt";
+ break;
+ case "SKIRMISCH":
+ type = "Skirmisch";
+ break;
+ default:
+ throw new ParsingException("Invalid type"); // TODO Better message
+ break;
}
bool accepted = challengeBlock.GetBoolValue("accepted");
Challenge c = new Challenge(id, type, accepted);