nSnake
A ncurses implementation of the classic Snake game
 All Data Structures Files Functions Variables Enumerations Macros Pages
nsnake.c
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
2  * nSnake - The classic snake game with ncurses. *
3  * Copyright (C) 2011-2012 Alexandre Dantas (kure) *
4  * *
5  * This file is part of nSnake. *
6  * *
7  * nSnake is free software: you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation, either version 3 of the License, or *
10  * any later version. *
11  * *
12  * This program is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15  * GNU General Public License for more details. *
16  * *
17  * You should have received a copy of the GNU General Public License *
18  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
19  * *
20  * homepage: http://sourceforge.net/projects/nsnake/ *
21  * *
22 \* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
23 
29 #include <stdio.h>
30 #include <stdlib.h>
31 #include <string.h>
32 
33 #include "nsnake.h"
34 #include "engine.h"
35 #include "fruit.h"
36 #include "player.h"
37 #include "hscores.h"
38 
39 
40 struct game_t game;
41 
42 
48 void nsnake_abort (char* error_msg)
49 {
50  engine_exit ();
51  printf ("%s", error_msg);
52  exit (EXIT_FAILURE);
53 }
54 
55 
61 void nsnake_exit ()
62 {
63  if (snake.body != NULL)
64  {
65  free (snake.body);
66  snake.body = NULL;
67  }
68 
69  if (game.cant_open_hscore_file == 1)
70  printf ("* Couldn't open Highscore file! Make sure the game is installed.\n Please see 'man nsnake' for bug reports\n");
71 
72  exit (EXIT_SUCCESS);
73 }
74 
84 void nsnake_init ()
85 {
86  player_init ();
87  fruit_init ();
88  hscore_init ();
90 }
91 
92 
95 void nsnake_pause ()
96 {
98 }
99 
100 
101 /*------------------------------END-------------------------------------------*/