1 /*
2     XorGramana Copyright 2009 James W. Morris, james@jwm-art.net
3 
4     This file is part of XorGramana.
5 
6     XorGramana is free software: you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation, either version 3 of the License, or
9     (at your option) any later version.
10 
11     XorGramana is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15 
16     You should have received a copy of the GNU General Public License
17     along with XorGramana.  If not, see <http://www.gnu.org/licenses/>.
18 */
19 #ifndef _OPTIONS_H
20 #define _OPTIONS_H
21 
22 #include "types.h"
23 #include "defs.h"
24 
25 #include <stdlib.h>
26 
27 /*  dir in this context = directory
28     elsewhere, dir = direction...
29 */
30 
31 extern const char *map_dir;
32 extern const char *xormap_dir;
33 extern const char *data_dir;
34 
35 enum DATA_LOC
36 {
37     DATA_INST_LOC=  0,  /* installed location                   */
38     DATA_CWD_LOC=   1,  /* current working directory location   */
39     DATA_USER_LOC=  2   /* unused - user specified loc cmdline  */
40 };
41 
42 extern char* map_name[MAX_LEVEL+1];
43 
44 struct xor_options
45 {
46     unsigned game           : 1; /* 0=XorGramana, 1=Xor */
47     unsigned show_indicators: 1;
48     unsigned scroll_thresh  : 2;
49     unsigned good_opt_dir   : 1;
50     unsigned replay_speed   : 4;
51     unsigned dir_opt        : 2; /* 0=default, 1=cwd, 2=other */
52     const char* data_dir;/* ie install dir where maps & help are. */
53     char* user_dir; /* ie /home/username */
54     char* map_dir;
55 };
56 
57 extern struct xor_options* options;
58 
59 su_t options_create();
60 void options_destroy();
61 
62 su_t set_game(su_t n);
63 
64 su_t options_set_dir_opt(enum DATA_LOC loc);
65 
66 su_t options_create_map_names();
67 void options_destroy_map_names();
68 
69 /*  options_replay_speed accepts either 1-9 or '1'-'9'  */
70 long options_replay_speed(char n);
71 
72 char* options_map_filename(su_t level);
73 char* options_file_path(const char* fname, const char *path);
74 #endif
75