Skip to content

Commit

Permalink
Added extra code to recurse child events - the pour water action of A…
Browse files Browse the repository at this point in the history
…DV08 has nested actions due to repeated use of 'continue with next action' which results in nesting. Other games don't appear to have this function
  • Loading branch information
TheTextAdventurer committed Jun 3, 2018
1 parent 0575728 commit 5634e60
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions Adventurer/Advent - Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ private static void SearchActions(int pVerb, int pNoun)
if (parentOutcome = ExcecuteAction(act))
{
if (act.Children != null)
act.Children.All(ch => { ExcecuteAction(ch); return true; });
ChildActions(act.Children);
}

//do more stuff
Expand Down Expand Up @@ -523,8 +523,20 @@ private static void SearchActions(int pVerb, int pNoun)
//DisableUserInput(false);
PerformActionComponent(64, 0, 0); //look

}


/// <summary>
/// recurse through any children
/// </summary>
/// <param name="pActions"></param>
private static void ChildActions (Adventurer.GameData.Action[] pActions)
{
foreach (Adventurer.GameData.Action c in pActions)
{
ExcecuteAction(c);
if (c.Children != null)
ChildActions(c.Children);
}
}

/// <summary>
Expand Down

0 comments on commit 5634e60

Please sign in to comment.