I want to have brach story trees in the game meaning that if the player makes for example the A choice a story is described, if he makes a choice B another story unravels and so on. Right know I have a repeating code which I don't like very much wich chenges the "flag" of the file and I use the flag to read the corresponding document that;s in the file. Meaning something like this:
void branches (char c){
cout << l << l;
// Introduction
if (flag == "Introduction.txt" && c == 'a') { flag = "Intro A.txt"; }
else if (flag == "Introduction.txt" && c == 'b') { flag = "Intro B.txt"; }
// Rebels After Start
else if (flag == "Intro B.txt" && c == 'a') { NAME = "Aenaeas" flag = "Name - Ok.txt"; }
else if (flag == "Intro B.txt" && c == 'b') { flag = "Name - Noone.txt"; }
else if (flag == "Intro B.txt" && c == 'c') { getName(); flag = "Name - Ok.txt"; }
// Rebels After Peblo
else if (flag == "Intro A.txt" && c == 'a') { flag = "House_Not.txt"; }
else if (flag == "Intro A.txt" && c == 'b') { flag = "Rebels_after_Peblo.txt"; }
else if (flag == "Intro A.txt" && c == 'c') { flag = "Saritonae_Not.txt"; }
else if (flag == "Intro A.txt" && c == 'd') { flag = "Limbordo_Not.txt"; }
else if (flag == "Intro A.txt" && c == 'e') { flag = "Gavrama_Not.txt"; }
else if (flag == "Intro A.txt" && c == 'f') { flag = "Castle_Not.txt"; }
// Exit
else { flag = "Exit"; }
story(flag);
}////////////// branches
And this is just the first two choice inputs. Can anyone think of a clever system where I can kind of do the above process automated?
I really can't think of really smart way of naming the files and understand what they are about and also have an automated read system according to current and previous choices of the player. Is there such a way or should I just change the design of the game?