diff --git a/example/simple.story b/example/simple.story index 79efc9d..8b7361c 100644 --- a/example/simple.story +++ b/example/simple.story @@ -3,9 +3,18 @@ START One day Dane took a really big shit. Dane: "Wow, that was a really big shit" -GOTO NEXT +1) Don't die [DONTDIE] +2) Die [DIE] -NEXT +DONTDIE + +Using all of his strength, Dane didn't die. + +But then he did. + +GOTO DIE + +DIE Then he died. Fuck you Dane diff --git a/src/cyoa.leg b/src/cyoa.leg index bb6a4bf..64b5cf9 100644 --- a/src/cyoa.leg +++ b/src/cyoa.leg @@ -84,7 +84,7 @@ StatName = < [A-Za-z]+ > - { $$.string = strdup(yytext); } StatVal = < [0-9]+ > - { $$.num = atoi(yytext); } -StatRel = < ('+'|'-')? > { $$.num = 0x0 } - +StatRel = < ('+'|'-')? > { $$.num = yytext[0] == '+' ? STATCHECK_GT : STATCHECK_LT; } - EndOfFile = !. diff --git a/src/storybook.cpp b/src/storybook.cpp index cb57a5b..2caf9c3 100644 --- a/src/storybook.cpp +++ b/src/storybook.cpp @@ -52,7 +52,10 @@ void Storybook::Find(const char* id) { void print_choice(Choice* c) { printf("%d) %s", c->option, c->flavor); if (c->statcheck) { - //TODO + printf("(%s %d%c)", + c->statcheck->stat, + c->statcheck->value, + c->statcheck->rel == STATCHECK_GT ? '+' : '-'); } printf("\n"); }