forked from mirrors/0ad
Fix eslint rule 'prefer-const' in gui/campaigns
eslint --no-config-lookup --fix --rule '"prefer-const": 1' \
binaries/data/mods/public/gui/campaigns
Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
This commit is contained in:
@@ -172,9 +172,9 @@ class CampaignMenu extends AutoWatcher
|
||||
displayLevelsList()
|
||||
{
|
||||
let list = [];
|
||||
for (let key in this.run.template.Levels)
|
||||
for (const key in this.run.template.Levels)
|
||||
{
|
||||
let level = this.run.template.Levels[key];
|
||||
const level = this.run.template.Levels[key];
|
||||
|
||||
if (!this.shouldShowLevel(level))
|
||||
continue;
|
||||
@@ -212,7 +212,7 @@ class CampaignMenu extends AutoWatcher
|
||||
return;
|
||||
}
|
||||
|
||||
let level = this.getSelectedLevelData();
|
||||
const level = this.getSelectedLevelData();
|
||||
|
||||
Engine.GetGUIObjectByName("scenarioName").caption = this.getLevelName(level);
|
||||
Engine.GetGUIObjectByName("scenarioDesc").caption = this.getLevelDescription(level);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
function init(endGameData)
|
||||
{
|
||||
let run = CampaignRun.getCurrentRun();
|
||||
const run = CampaignRun.getCurrentRun();
|
||||
if (endGameData.won)
|
||||
markLevelComplete(run, endGameData.initData.levelID);
|
||||
}
|
||||
|
||||
@@ -62,11 +62,11 @@ class LoadModal extends AutoWatcher
|
||||
|
||||
getRuns()
|
||||
{
|
||||
let out = [];
|
||||
let files = Engine.ListDirectoryFiles("saves/campaigns/", "*.0adcampaign", false);
|
||||
for (let file of files)
|
||||
const out = [];
|
||||
const files = Engine.ListDirectoryFiles("saves/campaigns/", "*.0adcampaign", false);
|
||||
for (const file of files)
|
||||
{
|
||||
let name = file.replace("saves/campaigns/", "").replace(".0adcampaign", "");
|
||||
const name = file.replace("saves/campaigns/", "").replace(".0adcampaign", "");
|
||||
try
|
||||
{
|
||||
out.push(new CampaignRun(name).load());
|
||||
@@ -82,8 +82,8 @@ class LoadModal extends AutoWatcher
|
||||
|
||||
loadCampaign()
|
||||
{
|
||||
let filename = this.currentRuns[this.selectedRun].filename;
|
||||
let run = new CampaignRun(filename)
|
||||
const filename = this.currentRuns[this.selectedRun].filename;
|
||||
const run = new CampaignRun(filename)
|
||||
.load()
|
||||
.setCurrent();
|
||||
|
||||
@@ -97,7 +97,7 @@ class LoadModal extends AutoWatcher
|
||||
if (this.selectedRun === -1)
|
||||
return;
|
||||
|
||||
let run = this.currentRuns[this.selectedRun];
|
||||
const run = this.currentRuns[this.selectedRun];
|
||||
|
||||
const buttonIndex = await messageBox(
|
||||
400, 200,
|
||||
|
||||
@@ -20,8 +20,8 @@ class NewCampaignModal
|
||||
|
||||
createAndStartCampaign()
|
||||
{
|
||||
let filename = this.template.identifier + "_" + Date.now() + "_" + Math.floor(Math.random()*100000);
|
||||
let run = new CampaignRun(filename)
|
||||
const filename = this.template.identifier + "_" + Date.now() + "_" + Math.floor(Math.random()*100000);
|
||||
const run = new CampaignRun(filename)
|
||||
.setTemplate(this.template)
|
||||
.setMeta(Engine.GetGUIObjectByName('runDescription').caption)
|
||||
.save()
|
||||
|
||||
Reference in New Issue
Block a user