mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
make sonar cloud (a little bit) happy
This commit is contained in:
parent
9b3a5c7925
commit
e31ace2661
@ -100,7 +100,7 @@ bool ChroniclesExtractor::extractGogInstaller(QString file)
|
||||
try
|
||||
{
|
||||
process_file(file.toStdString(), o, [this](float progress) {
|
||||
float overallProgress = ((1.0 / float(fileCount)) * float(extractionFile)) + (progress / float(fileCount));
|
||||
float overallProgress = ((1.0 / static_cast<float>(fileCount)) * static_cast<float>(extractionFile)) + (progress / static_cast<float>(fileCount));
|
||||
if(cb)
|
||||
cb(overallProgress);
|
||||
});
|
||||
@ -133,7 +133,7 @@ bool ChroniclesExtractor::extractGogInstaller(QString file)
|
||||
#endif
|
||||
}
|
||||
|
||||
void ChroniclesExtractor::createBaseMod()
|
||||
void ChroniclesExtractor::createBaseMod() const
|
||||
{
|
||||
QDir dir(pathToQString(VCMIDirs::get().userDataPath() / "Mods"));
|
||||
dir.mkdir("chronicles");
|
||||
@ -180,7 +180,7 @@ void ChroniclesExtractor::createChronicleMod(int no)
|
||||
extractFiles(no);
|
||||
}
|
||||
|
||||
void ChroniclesExtractor::extractFiles(int no)
|
||||
void ChroniclesExtractor::extractFiles(int no) const
|
||||
{
|
||||
QByteArray tmpChronicles = chronicles.at(no);
|
||||
tmpChronicles.replace('\0', "");
|
||||
@ -202,14 +202,14 @@ void ChroniclesExtractor::extractFiles(int no)
|
||||
archive.extractToFolder(dest.absolutePath().toStdString(), "", entry.second, true);
|
||||
else
|
||||
{
|
||||
for(auto & item : files)
|
||||
for(const auto & item : files)
|
||||
if(!boost::algorithm::to_lower_copy(entry.second.name).find(boost::algorithm::to_lower_copy(item)))
|
||||
archive.extractToFolder(dest.absolutePath().toStdString(), "", entry.second, true);
|
||||
}
|
||||
};
|
||||
auto rename = [no](QDir dest){
|
||||
dest.refresh();
|
||||
for(auto & entry : dest.entryList())
|
||||
for(const auto & entry : dest.entryList())
|
||||
{
|
||||
if(entry.toUpper().startsWith("HPS") || entry.toUpper().startsWith("HPL"))
|
||||
dest.rename(entry, "Hc_" + entry);
|
||||
@ -229,7 +229,7 @@ void ChroniclesExtractor::extractFiles(int no)
|
||||
if(tmpDir.entryList({"maps"}, QDir::Filter::Dirs).size())
|
||||
{
|
||||
QDir tmpDirMaps = tmpDir.filePath(tmpDir.entryList({"maps"}, QDir::Filter::Dirs).front());
|
||||
for(auto & entry : tmpDirMaps.entryList())
|
||||
for(const auto & entry : tmpDirMaps.entryList())
|
||||
QFile(tmpDirMaps.filePath(entry)).copy(outDirData.filePath(entry));
|
||||
}
|
||||
|
||||
|
@ -25,9 +25,9 @@ class ChroniclesExtractor : public QObject
|
||||
bool handleTempDir(bool create);
|
||||
int getChronicleNo(QFile & file);
|
||||
bool extractGogInstaller(QString filePath);
|
||||
void createBaseMod();
|
||||
void createBaseMod() const;
|
||||
void createChronicleMod(int no);
|
||||
void extractFiles(int no);
|
||||
void extractFiles(int no) const;
|
||||
|
||||
const std::map<int, QByteArray> chronicles = {
|
||||
{1, QByteArray{reinterpret_cast<const char*>(u"Warlords of the Wasteland"), 50}},
|
||||
|
@ -854,7 +854,7 @@ void CModListView::installFiles(QStringList files)
|
||||
|
||||
while(futureExtract.wait_for(std::chrono::milliseconds(10)) != std::future_status::ready)
|
||||
{
|
||||
emit extractionProgress(int(prog * 1000.f), 1000);
|
||||
emit extractionProgress(static_cast<int>(prog * 1000.f), 1000);
|
||||
qApp->processEvents();
|
||||
}
|
||||
|
||||
|
@ -481,36 +481,36 @@ void Campaign::overrideCampaign(bool scenario)
|
||||
{
|
||||
JsonNode node = JsonUtils::assembleFromFiles("config/campaignOverrides.json");
|
||||
for (auto & entry : node.Struct())
|
||||
if(filename == entry.first)
|
||||
{
|
||||
if(!scenario)
|
||||
if(filename == entry.first)
|
||||
{
|
||||
if(!entry.second["regions"].isNull() && !entry.second["scenarioCount"].isNull())
|
||||
loadLegacyData(CampaignRegions::fromJson(entry.second["regions"]), entry.second["scenarioCount"].Integer());
|
||||
if(!entry.second["loadingBackground"].isNull())
|
||||
loadingBackground = ImagePath::builtin(entry.second["loadingBackground"].String());
|
||||
if(!entry.second["introVideoRim"].isNull())
|
||||
introVideoRim = ImagePath::builtin(entry.second["introVideoRim"].String());
|
||||
if(!entry.second["introVideo"].isNull())
|
||||
introVideo = VideoPath::builtin(entry.second["introVideo"].String());
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!entry.second["scenarios"].isNull())
|
||||
if(!scenario)
|
||||
{
|
||||
auto sc = entry.second["scenarios"].Vector();
|
||||
for(int i = 0; i < sc.size(); i++)
|
||||
if(!entry.second["regions"].isNull() && !entry.second["scenarioCount"].isNull())
|
||||
loadLegacyData(CampaignRegions::fromJson(entry.second["regions"]), entry.second["scenarioCount"].Integer());
|
||||
if(!entry.second["loadingBackground"].isNull())
|
||||
loadingBackground = ImagePath::builtin(entry.second["loadingBackground"].String());
|
||||
if(!entry.second["introVideoRim"].isNull())
|
||||
introVideoRim = ImagePath::builtin(entry.second["introVideoRim"].String());
|
||||
if(!entry.second["introVideo"].isNull())
|
||||
introVideo = VideoPath::builtin(entry.second["introVideo"].String());
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!entry.second["scenarios"].isNull())
|
||||
{
|
||||
auto it = scenarios.begin();
|
||||
std::advance(it, i);
|
||||
if(!sc.at(i)["voiceProlog"].isNull())
|
||||
it->second.prolog.prologVoice = AudioPath::builtin(sc.at(i)["voiceProlog"].String());
|
||||
if(!sc.at(i)["voiceEpilog"].isNull())
|
||||
it->second.epilog.prologVoice = AudioPath::builtin(sc.at(i)["voiceEpilog"].String());
|
||||
auto sc = entry.second["scenarios"].Vector();
|
||||
for(int i = 0; i < sc.size(); i++)
|
||||
{
|
||||
auto it = scenarios.begin();
|
||||
std::advance(it, i);
|
||||
if(!sc.at(i)["voiceProlog"].isNull())
|
||||
it->second.prolog.prologVoice = AudioPath::builtin(sc.at(i)["voiceProlog"].String());
|
||||
if(!sc.at(i)["voiceEpilog"].isNull())
|
||||
it->second.epilog.prologVoice = AudioPath::builtin(sc.at(i)["voiceEpilog"].String());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int Campaign::scenariosCount() const
|
||||
|
Loading…
Reference in New Issue
Block a user