Skip to content

Commit

Permalink
FF7Save::importSlot returns bool now
Browse files Browse the repository at this point in the history
  • Loading branch information
sithlord48 committed Aug 4, 2024
1 parent faba680 commit 07c70df
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
11 changes: 6 additions & 5 deletions src/data/FF7Save.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,22 +474,22 @@ bool FF7Save::exportSlot(const QString &fileName, FF7SaveInfo::FORMAT exportForm
return true;
}

void FF7Save::importSlot(int s, QString fileName, int fileSlot)
bool FF7Save::importSlot(int s, QString fileName, int fileSlot)
{
if ((s < 0) || (s > 14) || filename.isEmpty())
return;
return false;

FF7SaveInfo::FORMAT inType = FF7SaveInfo::FORMAT::UNKNOWN;
int offset = 0;

QFile file(fileName);
if (!file.open(QIODevice::ReadOnly))
return;
return false;

inType = fileDataFormat(file);
if (inType == FF7SaveInfo::FORMAT::UNKNOWN) {
file.close();
return;
return false;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~Set File Type Vars ~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
Expand Down Expand Up @@ -538,10 +538,11 @@ void FF7Save::importSlot(int s, QString fileName, int fileSlot)
} else {
//Unknown or Unspecified Type Abort.
file.close();
return;
return false;
}
file.close();
setFileModified(true, s);
return true;
}

void FF7Save::clearSlot(int rmslot)
Expand Down
3 changes: 2 additions & 1 deletion src/data/FF7Save.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,9 @@ class FF7TKDATA_EXPORT FF7Save: public QObject
* \param s slot to import into
* \param fileName file that will be imported
* \param fileSlot slot to import from fileName
* \return true if successful
*/
void importSlot(int s = 0, QString fileName = "", int fileSlot = 0);
bool importSlot(int s = 0, QString fileName = "", int fileSlot = 0);

/** \brief clear a slot
* \param s slot number (0-14)
Expand Down

0 comments on commit 07c70df

Please sign in to comment.