Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add -f option to allow falling through the pits and returning upstairs #5

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Prev Previous commit
Next Next commit
Exit nhss by stepping on stairs up
Signed-off-by: Vitaly Ostrosablin <[email protected]>
  • Loading branch information
ostrosablin committed Apr 26, 2018
commit 3fb6951266a1df196f13984c35b3d0de16c429cb
10 changes: 10 additions & 0 deletions move.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <ncurses.h>
#include "nhss.h"
#include "move.h"
#include "record.h"

extern nhss_info_t info;
extern int boulders;
Expand Down Expand Up @@ -70,6 +73,13 @@ void moveto(int x, int y) { // Moves the character to the position specified by
POS = '@';
statusline("You fall through the pit to the level below and return upstairs");
break;
case '<': // stairs up, we escape this level
statusline("You have completed this Sokoban level!");
refresh();
sleep(1);
endwin();
record_close();
exit(E_SUCCESS);
case '>': // stairs down
case '.': // an empty space
switch (isdiag(x, y)) {
Expand Down
1 change: 1 addition & 0 deletions record.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include "nhss.h"

extern nhss_info_t info;
Expand Down
2 changes: 2 additions & 0 deletions record.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#define RECORD_H

int record_open(const char *filename, const char *mode);
int record_add(const char dir);
int record_close();
char record_get();

#endif