void score_init_hs(struct score *s, int timer, int coins)
{
int i;
+
strcpy(s->player[0], "Hard");
strcpy(s->player[1], "Medium");
strcpy(s->player[2], "Easy");
strcpy(s->player[3], "");
+
for (i = 0; i < NSCORE + 1; i++)
{
s->timer[i] = timer;
(strlen(states) == s->count));
for (i = 0; i < s->count && res; i++)
{
- if (states[i] == 'L')
+ switch (states[i])
{
+ case 'L':
level_v[i].is_locked = 1;
level_v[i].is_completed = 0;
- }
- else if (states[i] == 'C')
- {
+ break;
+
+ case 'C':
level_v[i].is_locked = 0;
level_v[i].is_completed = 1;
- }
- else if (states[i] == 'O')
- {
+ break;
+
+ case 'O':
level_v[i].is_locked = 0;
level_v[i].is_completed = 0;
- }
- else
+ break;
+
+ default:
res = 0;
+ }
}
res = res &&
if (!res && errno != ENOENT)
{
- fprintf(stderr, _("Error while loading user high-score file '%s': "),
- fn);
- if (errno)
- perror(NULL);
- else
- fprintf(stderr, _("Incorrect format\n"));
+ fprintf(stderr,
+ _("Error while loading user high-score file '%s': %s\n"),
+ fn, errno ? strerror(errno) : _("Incorrect format"));
}
}
-static char *chomp(char *str)
/* Remove trailing \n if any */
+
+static char *chomp(char *str)
{
char *p = str + strlen(str) - 1;
- if (p >= str && *p == '\n') *p = 0;
+ if (p >= str && *p == '\n')
+ *p = 0;
return str;
}
static int set_load(struct set *s, const char *filename)
{
FILE *fin;
-
char buf[MAXSTR];
int res;
fin = fopen(config_data(filename), "r");
+
if (!fin)
{
- fprintf(stderr, _("Cannot load the set file '%s':"), filename);
- perror(NULL);
+ fprintf(stderr, _("Cannot load the set file '%s': %s\n"),
+ filename, strerror(errno));
return 0;
}
/* Load set metadata. */
- strcpy(s->file, config_data(filename));
+ strcpy(s->file, filename);
if ((res = fgets(buf, MAXSTR, fin) != NULL))
strcpy(s->name, chomp(buf));
void set_init()
{
- struct set *set;
FILE *fin;
-
+ struct set *set;
char filename[MAXSTR];
- int res;
current_set = NULL;
-
count = 0;
if ((fin = fopen(config_data(SET_FILE), "r")))
{
- res = 1;
- while (count < MAXSET && res)
+ while (count < MAXSET && fgets(filename, MAXSTR, fin))
{
+ chomp(filename);
set = &(set_v[count]);
- res = (fgets(filename, MAXSTR, fin) != NULL);
- if (res)
+ if (set_load(set, filename))
{
- chomp(filename);
-
- res = set_load(set, filename);
- if (res)
- {
- set->number = count;
- count++;
- }
+ set->number = count;
+ count++;
}
}
-
fclose(fin);
}
}
int i = 0, res;
int nb = 1, bnb = 1;
- if ((fin = fopen(current_set->file, "r")))
+ if ((fin = fopen(config_data(current_set->file), "r")))
{
res = 1;
/* set global info */
int number; /* number of the set */
- char file[MAXSTR]; /* set file description */
+ char file[PATHMAX];
+
char user_scores[MAXSTR]; /* user highscore file */
char setname[MAXSTR]; /* internal set name */
int id, jd, kd;
-
set_init();
- /* Reset last set if it do not exists */
+ /* Reset last set if it does not exist */
if (!set_exists(last_set))
{
b = 0;
if ((jd = gui_harray(id)))
{
- shot_id = gui_image(jd, get_set(last_set)->shot, 7 * w / 16,
- 7 * h / 16);
+ shot_id = gui_image(jd, get_set(last_set)->shot,
+ 7 * w / 16, 7 * h / 16);
if ((kd = gui_varray(jd)))
{
- /* Display levels */
+ /* Display sets */
for (i = b * SET_GROUP; i < (b + 1) * SET_GROUP && set_exists(i); i++)
gui_set(kd, i);
}
gui_space(id);
- desc_id = gui_multi(id, " \\ \\ \\ \\ \\", GUI_SML, GUI_ALL, gui_yel, gui_wht);
+ desc_id = gui_multi(id, " \\ \\ \\ \\ \\", GUI_SML, GUI_ALL,
+ gui_yel, gui_wht);
gui_layout(id, 0, 0);
}
"Project-Id-Version: Neverball 1.4.1\n"
"Report-Msgid-Bugs-To: robert.kooima@gmail.com\n"
"POT-Creation-Date: 2006-07-16 20:04+0300\n"
-"PO-Revision-Date: 2006-07-11 15:27+0300\n"
+"PO-Revision-Date: 2006-07-16 20:08+0300\n"
"Last-Translator: Jānis Rūcis <parasti@gmail.com>\n"
"Language-Team: Latvian\n"
"MIME-Version: 1.0\n"
msgstr "Manuālais"
#: ball/level.c:130
-#, fuzzy, c-format
+#, c-format
msgid "Error while loading level file '%s': %s\n"
-msgstr "Kļūda, ielādējot līmeņa failu '%s': "
+msgstr "Kļūda, ielādējot līmeņa failu '%s': %s\n"
#: ball/level.c:131
-#, fuzzy
msgid "Not a valid level file"
-msgstr "nederīgs līmeņa fails.\n"
+msgstr "nederīgs līmeņa fails"
#: ball/level.c:209 ball/st_help.c:219 ball/st_start.c:251
msgid "Challenge"
#: ball/level.c:213 ball/level.c:228
msgid "Unknown"
-msgstr ""
+msgstr "Nezināms"
#: ball/level.c:223
msgid "Aborted"
msgstr "Neizdevās noteikt iestatījumu katalogu\n"
#: ball/main.c:323
-#, fuzzy, c-format
+#, c-format
msgid "Replay file '%s': %s\n"
-msgstr "Ieraksta fails '%s': %s\n"
+msgstr "Ieraksta fails '%s': %s\n"
#: ball/main.c:324
msgid "Not a replay file"
#: ball/set.c:175
#, c-format
msgid "Cannot load the set file '%s':"
-msgstr ""
+msgstr "Nav iespējams ielādēt komplekta failu '%s':"
#: ball/set.c:355
#, c-format
#: ball/st_demo.c:174 ball/st_name.c:40 putt/st_all.c:476
msgid "Player"
-msgstr ""
+msgstr "Spēlētājs"
#: ball/st_demo.c:178
msgid "State"
#: ball/st_start.c:100
msgid "Play this bonus level in practice mode"
-msgstr ""
+msgstr "Spēlē šo papildus līmeni treniņrežīmā"
#: ball/st_start.c:103
msgid "Play this level in practice mode"
#: ball/st_start.c:110
msgid "Play this bonus level in normal mode"
-msgstr "Spēlē šo papildlīmeni normālajā režīmā"
+msgstr "Spēlē šo papildus līmeni normālajā režīmā"
#: ball/st_start.c:112
msgid "Play this level in normal mode"