2 * Copyright (C) 2003 Robert Kooima
4 * NEVERBALL is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published
6 * by the Free Software Foundation; either version 2 of the License,
7 * or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
24 /*---------------------------------------------------------------------------*/
28 char init_levels
[MAXSTR
];
29 char init_scores
[MAXSTR
];
30 char user_scores
[MAXSTR
];
37 static int set_state
= 0;
42 static struct set set_v
[MAXSET
];
44 /*---------------------------------------------------------------------------*/
55 if ((fin
= fopen(config_data(SET_FILE
), "r")))
57 while (fscanf(fin
, "%s %s %s %s\n",
58 set_v
[count
].init_levels
,
59 set_v
[count
].init_scores
,
60 set_v
[count
].user_scores
,
61 set_v
[count
].shot
) == 4 &&
62 fgets(set_v
[count
].name
, MAXSTR
, fin
) &&
63 fgets(set_v
[count
].desc
, MAXSTR
, fin
))
65 char *p
= set_v
[count
].name
+ strlen(set_v
[count
].name
) - 1;
66 char *q
= set_v
[count
].desc
+ strlen(set_v
[count
].desc
) - 1;
68 if (*p
== '\n') *p
= 0;
69 if (*q
== '\n') *q
= 0;
82 return (0 <= i
&& i
< count
);
87 level_init(set_v
[i
].init_levels
,
89 set_v
[i
].user_scores
);
104 /*---------------------------------------------------------------------------*/
106 const char *set_name(int i
)
108 return set_exists(i
) ? set_v
[i
].name
: "";
111 const char *set_desc(int i
)
113 return set_exists(i
) ? set_v
[i
].desc
: "";
116 const char *set_shot(int i
)
118 return set_exists(i
) ? set_v
[i
].shot
: set_v
[0].shot
;
121 /*---------------------------------------------------------------------------*/