-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
40 changed files
with
1,485 additions
and
742 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/**************************************************************************** | ||
** Deling Final Fantasy VIII Field Editor | ||
** Copyright (C) 2009-2020 Arzel Jérôme <[email protected]> | ||
** | ||
** This program is free software: you can redistribute it and/or modify | ||
** it under the terms of the GNU General Public License as published by | ||
** the Free Software Foundation, either version 3 of the License, or | ||
** (at your option) any later version. | ||
** | ||
** This program is distributed in the hope that it will be useful, | ||
** but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
** GNU General Public License for more details. | ||
** | ||
** You should have received a copy of the GNU General Public License | ||
** along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
****************************************************************************/ | ||
#include "EncounterExporter.h" | ||
#include "FieldPC.h" | ||
#include "FieldArchivePC.h" | ||
|
||
EncounterExporter::EncounterExporter(FieldArchive *archive) : | ||
_archive(archive) | ||
{ | ||
|
||
} | ||
|
||
bool EncounterExporter::toDir(const QDir &dir, ArchiveObserver *observer) | ||
{ | ||
if (!_archive) { | ||
return false; | ||
} | ||
|
||
FieldArchiveIterator it = _archive->iterator(); | ||
|
||
if (observer) { | ||
observer->setObserverMaximum(quint32(_archive->nbFields())); | ||
} | ||
|
||
int i = 0; | ||
|
||
while (it.hasNext()) { | ||
Field *f = it.next(); | ||
|
||
if (observer) { | ||
if (observer->observerWasCanceled()) { | ||
return false; | ||
} | ||
observer->setObserverValue(i++); | ||
} | ||
|
||
if (f && f->isOpen() && (!f->isPc() || ((FieldPC *)f)->open2(((FieldArchivePC *)_archive)->getFsArchive())) && f->hasMrtFile()) { | ||
MrtFile *mrt = f->getMrtFile(); | ||
QString fieldName = f->name(); | ||
|
||
if (fieldName.isEmpty()) { | ||
fieldName = QObject::tr("sans-nom"); | ||
} | ||
|
||
QFile file(dir.filePath(fieldName + ".txt")); | ||
if (file.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)) { | ||
for (int i = 0; i < 4; ++i) { | ||
file.write(QString("Stage %1\n").arg(mrt->formation(i)).toUtf8()); | ||
} | ||
if (f->hasRatFile()) { | ||
RatFile *rat = f->getRatFile(); | ||
file.write(QString("Rate %1\n").arg(rat->rate()).toUtf8()); | ||
} else { | ||
file.write(QString("Rate -\n").toUtf8()); | ||
} | ||
} else { | ||
_lastErrorString = file.errorString(); | ||
return false; | ||
} | ||
} | ||
} | ||
|
||
return true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/**************************************************************************** | ||
** Deling Final Fantasy VIII Field Editor | ||
** Copyright (C) 2009-2020 Arzel Jérôme <[email protected]> | ||
** | ||
** This program is free software: you can redistribute it and/or modify | ||
** it under the terms of the GNU General Public License as published by | ||
** the Free Software Foundation, either version 3 of the License, or | ||
** (at your option) any later version. | ||
** | ||
** This program is distributed in the hope that it will be useful, | ||
** but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
** GNU General Public License for more details. | ||
** | ||
** You should have received a copy of the GNU General Public License | ||
** along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
****************************************************************************/ | ||
#ifndef ENCOUNTEREXPORTER_H | ||
#define ENCOUNTEREXPORTER_H | ||
|
||
#include "FieldArchive.h" | ||
|
||
class EncounterExporter | ||
{ | ||
public: | ||
explicit EncounterExporter(FieldArchive *archive); | ||
bool toDir(const QDir &dir, ArchiveObserver *observer = nullptr); | ||
inline const QString &errorString() const { | ||
return _lastErrorString; | ||
} | ||
private: | ||
FieldArchive *_archive; | ||
QString _lastErrorString; | ||
}; | ||
|
||
#endif // ENCOUNTEREXPORTER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.