From 6e7eee40a953286d9b3e3703b3bc74908d861d1b Mon Sep 17 00:00:00 2001 From: Eric James Michael Ritz Date: Mon, 6 Apr 2015 22:22:56 -0400 Subject: [PATCH] [Fix] Include 'START' in LNVL.VisitedScenes and LNVL.SceneHistory Because 'START' is always the first scene we should automatically add it to these two tables, as no other code does so. This allows us to use 'START' as a valid precondition for scenes. --- LNVL.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/LNVL.lua b/LNVL.lua index 15d687e..a4e2136 100644 --- a/LNVL.lua +++ b/LNVL.lua @@ -131,9 +131,12 @@ LNVL.CurrentScene = nil -- each key is always 'true', allowing us to perform a simple look-up -- to determine if we have already shown a scene or not. -- +-- Because LNVL requires all stories to have a 'START' scene we +-- automatically include it in the list of visited scenes. +-- -- N.B. This table does not represent the order in which we displayed -- each scene. -LNVL.VisitedScenes = {} +LNVL.VisitedScenes = { ["START"] = true } -- This table is a stack respresenting the exact order in which the -- player has traversed through the scenes. Using various gameplay @@ -149,7 +152,10 @@ LNVL.VisitedScenes = {} -- -- to access each LNVL.Scene (as 'scene' above) in the order in which -- the player encountered those scenes (indicated by 'index' above). -LNVL.SceneHistory = {} +-- +-- This table contains the 'START' scene for the same reason given in +-- the commentary for the LNVL.VisitedScenes table. +LNVL.SceneHistory = { "START" } -- This function loads all of the LNVL sub-modules, initializing the -- engine. The argument, if given, must be a string that will be