Skip to content

Commit

Permalink
Corrections to XML output sections
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTextAdventurer committed Jun 3, 2018
1 parent 482bd18 commit 0575728
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Adventurer/GameData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ public void SaveAsUnFormattedXML(string pFile)
new XElement("Actions",

Enumerable.Range(0, header[2] + 1).
Select(a => new XElement("Action", Datafile.GetTokensAsInt(8).Select((val, ind) => new XElement(String.Format("{0}", actionsDesc[ind]), val)))
Select(a => new XElement("Action", new XAttribute("Index",a),Datafile.GetTokensAsInt(8).Select((val, ind) => new XElement(String.Format("{0}", actionsDesc[ind]), val)))
))
);

Expand All @@ -532,6 +532,7 @@ public void SaveAsUnFormattedXML(string pFile)
Enumerable.Range(0, header[4] + 1).
Select(a =>
new XElement("Room"
, new XAttribute("Index", a)
, new object[] {
Datafile.getTokens(7).Select((val, ind) => new XElement(String.Format("{0}", roomDesc[ind]), val.Trim())) }
))
Expand All @@ -547,7 +548,7 @@ public void SaveAsUnFormattedXML(string pFile)
(
new XElement("Messages",
Enumerable.Range(0, header[10] + 1).
Select(a => new XElement("Message", Datafile.getTokens(1))))
Select(a => new XElement("Message", new XAttribute("Index", a),Datafile.getTokens(1))))
);

string[] itemDescripion = { "Name", "Word" };
Expand All @@ -556,6 +557,7 @@ public void SaveAsUnFormattedXML(string pFile)
new XElement("Items",
Enumerable.Range(0, header[1] + 1).
Select(a => new XElement("Item",
new XAttribute("Index", a),
Datafile.getTokens(1).First().Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries)
.Select((v,i) => new XElement(itemDescripion[i], v))
, new XElement("Location", Datafile.GetTokensAsInt(1))
Expand All @@ -565,9 +567,9 @@ public void SaveAsUnFormattedXML(string pFile)
gameData.Add
(
new XElement("Comments",

Enumerable.Range(0, header[2] + 1).
Select(a => new XElement("Comment", Datafile.getTokens(1))
Select(a => new XElement("Comment", new XAttribute("Index", a), Datafile.getTokens(1))
))
);

Expand Down Expand Up @@ -715,7 +717,7 @@ public void SaveAsFormattedXML()
,"item ARG1 is moved to room ARG2" //62
,"game over"
,"look"
,"score"
,"score"//65
," output inventory"
,"Set bit 0 true"
,"Set bit 0 false"
Expand Down Expand Up @@ -745,7 +747,7 @@ public void SaveAsFormattedXML()


static int[] actionArgsWithOneItem = { 52, 53, 55, 59, 74, 62 }; //note 62, a two arg action which moves item arg1 to room arg2
static int[] actionsWithTwoItems = { 72, 65 };
static int[] actionsWithTwoItems = { 72, 75 };

/// <summary>
/// Build an XML element for the provided action in a big, messy statement which I had a lot of fun writing ;)
Expand Down

0 comments on commit 0575728

Please sign in to comment.