home · contact · privacy
Server/py: Remove superfluous line.
[plomrogue] / src / server / main.c
1 /* src/server/main.c
2  *
3  * This file is part of PlomRogue. PlomRogue is licensed under the GPL version 3
4  * or any later version. For details on its copyright, license, and warranties,
5  * see the file NOTICE in the root directory of the PlomRogue source package.
6  */
7
8 #include <stdio.h> /* printf() */
9 #include <stdlib.h> /* exit() */
10 #include "../common/rexit.h" /* exit_err, set_cleanup_func() */
11 #include "cleanup.h" /* set_cleanup_flag(), cleanup() */
12 #include "hardcoded_strings.h" /* s */
13 #include "init.h" /* run_game(), obey_argv(), obey_argv(), setup_server_io() */
14 #include "world.h" /* struct World */
15
16
17
18 struct World world;
19
20
21
22 int main(int argc, char ** argv)
23 {
24     /* So error exits also go through the server's cleanup() function. */
25     set_cleanup_func(cleanup);
26
27     /* Init settings from command line / hard-coded values. Print start info. */
28     init_strings();
29     obey_argv(argc, argv);
30     if (world.is_verbose)
31     {
32         char * printf_err = "Trouble in main() with printf().";
33         int test = printf("Starting plomrogue-server.\n");
34         exit_err(-1 == test, printf_err);
35         if (world.replay)
36         {
37             test = printf("Replay mode. Auto-replaying up to turn %d.\n",
38                           world.replay);
39             exit_err(-1 == test, printf_err);
40         }
41     }
42     world.map.length = 64;                      /* Just a sane default value. */
43
44     /* Init server i/o, Enter play or replay mode loops, then leave properly. */
45     setup_server_io();
46     run_game();
47     cleanup();
48     exit(EXIT_SUCCESS);
49 }