public void chooseChoiceIndex ( int choiceIdx ) throws Exception { List < Choice > choices = getCurrentChoices ( ) ; Assert ( choiceIdx >= 0 && choiceIdx < choices . size ( ) , "choice out of range" ) ; // Replace callstack with the one from the thread at the choosing point, // so that we can jump into the right place in the flow. // This is important in case the flow was forked by a new thread, which // can create multiple leading edges for the story, each of // which has its own context. Choice choiceToChoose = choices . get ( choiceIdx ) ; state . getCallStack ( ) . setCurrentThread ( choiceToChoose . getThreadAtGeneration ( ) ) ; choosePath ( choiceToChoose . targetPath ) ; }
Chooses the Choice from the currentChoices list with the given index . Internally this sets the current content path to that pointed to by the Choice ready to continue story evaluation .