Skip to content

Commit a71dba8

Browse files
committed
swars: Remove some misleading error messages from log
Some file not found messages did not really ment any error. Now there is less of them.
1 parent 2f493bf commit a71dba8

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

src/game_data.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ void get_user_settings_fname(char *fname, const char *name)
277277
PathInfo *pinfo;
278278

279279
pinfo = &game_dirs[DirPlace_Savegame];
280-
if (strlen(name) == 0)
280+
if (name[0] == '\0')
281281
name = "default";
282282
sprintf(fname, "%s/%.8s.ini", pinfo->directory, name);
283283
LbStringToLower(fname+strlen(pinfo->directory));

src/game_save.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,13 @@ void read_user_settings(void)
264264
int i;
265265

266266
read_mortal_salt_backup = false;
267+
fh = INVALID_FILE;
267268
get_user_settings_fname(fname, login_name);
269+
if (login_name[0] == '\0')
270+
read_mortal_salt_backup = true;
268271

269-
fh = LbFileOpen(fname, Lb_FILE_MODE_READ_ONLY);
272+
if (LbFileExists(fname))
273+
fh = LbFileOpen(fname, Lb_FILE_MODE_READ_ONLY);
270274

271275
// Try default settings file instead
272276
if ((fh == INVALID_FILE) && (strlen(login_name) > 0))

src/lvfiles.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1428,11 +1428,15 @@ void load_map_bnb(ushort mapno)
14281428
ubyte Amin, Amax;
14291429
ubyte Bmin, Bmax;
14301430

1431+
fh = INVALID_FILE;
14311432
pinfo = &game_dirs[DirPlace_Maps];
14321433
snprintf(locstr, DISKPATH_SIZE-1, "%s/map%03d.b&b", pinfo->directory, mapno);
1433-
fh = LbFileOpen(locstr, Lb_FILE_MODE_READ_ONLY);
1434+
if (LbFileExists(locstr))
1435+
fh = LbFileOpen(locstr, Lb_FILE_MODE_READ_ONLY);
1436+
14341437
if (fh == INVALID_FILE)
14351438
{
1439+
LOGSYNC("Using defaults in place of '%s' file", locstr);
14361440
map_bnb.field_0 = 0;
14371441
map_bnb.field_1 = 0;
14381442
map_bnb.field_2 = 0;

0 commit comments

Comments
 (0)