From 5634e60ad03fe26e88f9ed54f912f3e2337e3bf2 Mon Sep 17 00:00:00 2001 From: TheTextAdventurer Date: Sun, 3 Jun 2018 19:08:52 +0100 Subject: [PATCH] Added extra code to recurse child events - the pour water action of ADV08 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 --- Adventurer/Advent - Game.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Adventurer/Advent - Game.cs b/Adventurer/Advent - Game.cs index 630bd85..0ba3eae 100644 --- a/Adventurer/Advent - Game.cs +++ b/Adventurer/Advent - Game.cs @@ -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 @@ -523,8 +523,20 @@ private static void SearchActions(int pVerb, int pNoun) //DisableUserInput(false); PerformActionComponent(64, 0, 0); //look + } - + /// + /// recurse through any children + /// + /// + private static void ChildActions (Adventurer.GameData.Action[] pActions) + { + foreach (Adventurer.GameData.Action c in pActions) + { + ExcecuteAction(c); + if (c.Children != null) + ChildActions(c.Children); + } } ///