Skip to content

Commit

Permalink
Simplify help subsection printing
Browse files Browse the repository at this point in the history
The Parameters section string is 507 characters long, almost up against
the 509 character limit imposed by C89. I may have to change the code if
anything adds to the string's length in the future.
  • Loading branch information
TurkeyMcMac committed Mar 11, 2021
1 parent d020e9a commit cf5a8d8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
21 changes: 12 additions & 9 deletions src/help.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,37 +43,40 @@ static void wait_for_quit(void)

void help_overview_run(void)
{
static const char overview[] =
mvaddstr(0, 0,
"Overview\n\n"
"The objective of the game is simple: Get cash and get out\n"
"without getting got. You start at the top left and need\n"
"to get to the end at the bottom right (marked with an E.)\n"
"As you go, pick up some $$$ along the way, and stay away\n"
"from the Ms, which are randomly-wandering monsters. The\n"
"cash and monsters will spawn over time. The goal is to\n"
"leave with as much money as possible, but the longer you\n"
"stay, the more monsters appear, so be careful!";
mvprintw(0, 0, "Overview\n\n%s\n\n(q) Back", overview);
"stay, the more monsters appear, so be careful!\n"
"\n(q) Back");
clrtobot();

wait_for_quit();
}

void help_controls_run(void)
{
static const char controls[] =
mvaddstr(0, 0,
"Controls\n\n"
"You can move with the arrow keys, WASD, or HJKL. Pressing\n"
"I makes you idle for one game tick. Time only passes when\n"
"you move or idle. You can quit an ongoing game with Q.\n"
"Enter ? to bring up this help in-game. That's about it.";
mvprintw(0, 0, "Controls\n\n%s\n\n(q) Back", controls);
"Enter ? to bring up this help in-game. That's about it.\n"
"\n(q) Back");
clrtobot();

wait_for_quit();
}

void help_parameters_run(void)
{
static const char parameters[] =
mvaddstr(0, 0,
"Parameters\n\n"
"Several parameters are available to tune gameplay:\n"
"- The width and height specify the size of the maze in\n"
" (potential) path intersections, or \"nodes.\"\n"
Expand All @@ -84,8 +87,8 @@ void help_parameters_run(void)
"- The maximum placed cash is the limit on the cash amount\n"
" placed at any one time.\n"
"- The monster placement interval is self-explanatory.\n"
"- The seed is used for random generation.";
mvprintw(0, 0, "Parameters\n\n%s\n\n(q) Back", parameters);
"- The seed is used for random generation.\n"
"\n(q) Back");
clrtobot();

wait_for_quit();
Expand Down
2 changes: 1 addition & 1 deletion src/version.h
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/* The version of the program: */
#define VERSION "0.5.9"
#define VERSION "0.5.10"

0 comments on commit cf5a8d8

Please sign in to comment.