snprintf(tempPath, sizeof tempPath, "%smusic.mod", userHomeDirectory);
fp = fopen(tempPath, "wb");
}
-
- if (fileType == PAK_TAGS)
+ else if (fileType == PAK_TAGS)
{
snprintf(tempPath, sizeof tempPath, "%smusic.tags", userHomeDirectory);
fp = fopen(tempPath, "wb");
}
-
- if (fileType == PAK_FONT)
+ else if (fileType == PAK_FONT)
{
snprintf(tempPath, sizeof tempPath, "%sfont.ttf", userHomeDirectory);
fp = fopen(tempPath, "wb");
if (!pak)
{
- showPakErrorAndExit();
+ return showPakErrorAndExit();
}
fseek(pak, (-sizeof(Uint32)) * 2, SEEK_END);
if (fread(&listPos, sizeof(Uint32), 1, pak) != 1)
{
fclose(pak);
- showPakErrorAndExit();
+ return showPakErrorAndExit();
}
if (fread(&numberOfFiles, sizeof(Uint32), 1, pak) != 1)
{
fclose(pak);
- showPakErrorAndExit();
+ return showPakErrorAndExit();
}
debug(("Pak : File list resides at %d\n", (int)listPos));
if (!result)
{
fclose(pak);
- showPakErrorAndExit();
+ return showPakErrorAndExit();
}
debug(("Read FileData #%d / %d : %s\n", (i + 1), numberOfFiles, fd[i].filename));
if (fread(input, 1, currentFile->cSize, pak) != currentFile->cSize)
{
fclose(pak);
- showPakErrorAndExit();
+ return showPakErrorAndExit(), false;
}
uLongf fSize = (uLongf)currentFile->fSize;
if (fread(&game, sizeof(Game), 1, fp) != 1)
{
fclose(fp);
- graphics.showErrorAndExit("The save data loaded was not in the format expected", "");
+ return graphics.showErrorAndExit("The save data loaded was not in the format expected", ""), false;
}
fclose(fp);
{
if (!fgets(line, 1024, fp)) {
fclose(fp);
- graphics.showErrorAndExit("Unexpected end of file reading save data", "");
+ return graphics.showErrorAndExit("Unexpected end of file reading save data", ""), false;
}
sscanf(line, "%*c %[^\"] %*c %*c %[^\"] %*c %d %d", string[0], string[1], ¶m[0], ¶m[1]);
if (!fp)
{
- graphics.showErrorAndExit("File write error whilst saving game", "");
+ return graphics.showErrorAndExit("File write error whilst saving game", "");
}
if (fwrite(&game, sizeof(Game), 1, fp) != 1)
{
fclose(fp);
- graphics.showErrorAndExit("File write error whilst saving game", strerror(errno));
+ return graphics.showErrorAndExit("File write error whilst saving game", strerror(errno));
}
fclose(fp);
if (!fp)
{
- graphics.showErrorAndExit("File write error whilst saving game", "");
+ return graphics.showErrorAndExit("File write error whilst saving game", "");
}
createPersistantMapData();