another bunch of cleanup (mainly missing semicolon) signaled by jshint

This was SVN commit r17045.
This commit is contained in:
mimo 2015-09-19 12:50:48 +00:00
parent e42e02d4fe
commit 0b86bbd424
25 changed files with 55 additions and 55 deletions

View File

@ -208,7 +208,7 @@ AIProxy.prototype.GetFullRepresentation = function()
// These properties are constant and won't need to be updated
"id": this.entity,
"template": cmpTemplateManager.GetCurrentTemplateName(this.entity)
}
};
var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
if (cmpPosition)

View File

@ -337,12 +337,12 @@ Attack.prototype.GetBestAttackAgainst = function(target, allowCapture)
return "Slaughter";
var attack = this;
var isAllowed = function (type) { return !attack.GetRestrictedClasses(type).some(isTargetClass); }
var isAllowed = function (type) { return !attack.GetRestrictedClasses(type).some(isTargetClass); };
var types = this.GetAttackTypes().filter(isAllowed);
// check if the target is capturable
var captureIndex = types.indexOf("Capture")
var captureIndex = types.indexOf("Capture");
if (captureIndex != -1)
{
let cmpCapturable = QueryMiragedInterface(target, IID_Capturable);
@ -354,8 +354,8 @@ Attack.prototype.GetBestAttackAgainst = function(target, allowCapture)
types.splice(captureIndex, 1);
}
var isPreferred = function (className) { return attack.GetPreferredClasses(className).some(isTargetClass); }
var byPreference = function (a, b) { return (types.indexOf(a) + (isPreferred(a) ? types.length : 0) ) - (types.indexOf(b) + (isPreferred(b) ? types.length : 0) ); }
var isPreferred = function (className) { return attack.GetPreferredClasses(className).some(isTargetClass); };
var byPreference = function (a, b) { return (types.indexOf(a) + (isPreferred(a) ? types.length : 0) ) - (types.indexOf(b) + (isPreferred(b) ? types.length : 0) ); };
return types.sort(byPreference).pop();
@ -646,9 +646,9 @@ Attack.prototype.MissileHit = function(data, lateness)
if (this.testCollision(data.target, data.position, lateness))
{
data.attacker = this.entity
data.multiplier = this.GetAttackBonus(data.type, data.target)
data.strengths = this.GetAttackStrengths(data.type)
data.attacker = this.entity;
data.multiplier = this.GetAttackBonus(data.type, data.target);
data.strengths = this.GetAttackStrengths(data.type);
// Hit the primary target
Damage.CauseDamage(data);

View File

@ -75,7 +75,7 @@ Auras.prototype.Init = function()
for (var name in this.template)
{
this.affectedPlayers[name] = []; // will be calculated on ownership change
var aura = {}
var aura = {};
aura.affects = this.template[name].Affects;
if (this.template[name].AffectedPlayers)
aura.affectedPlayers = this.template[name].AffectedPlayers.split(/\s+/);
@ -96,7 +96,7 @@ Auras.prototype.Init = function()
Auras.prototype.GetDescriptions = function()
{
var ret = {}
var ret = {};
for each (var aura in this.template)
if (aura.AuraName)
ret[aura.AuraName] = aura.AuraDescription || null;
@ -286,7 +286,7 @@ Auras.prototype.GiveMembersWithValidClass = function(auraName, entityList)
r.push(ent);
}
return r;
}
};
Auras.prototype.OnRangeUpdate = function(msg)
{
@ -379,7 +379,7 @@ Auras.prototype.ApplyBonus = function(name, ents)
return;
for (let ent of validEnts)
{
var cmpStatusBars = Engine.QueryInterface(ent, IID_StatusBars)
var cmpStatusBars = Engine.QueryInterface(ent, IID_StatusBars);
if (cmpStatusBars)
cmpStatusBars.AddAuraSource(this.entity, name);
}
@ -400,7 +400,7 @@ Auras.prototype.RemoveBonus = function(name, ents)
return;
for (let ent of validEnts)
{
var cmpStatusBars = Engine.QueryInterface(ent, IID_StatusBars)
var cmpStatusBars = Engine.QueryInterface(ent, IID_StatusBars);
if (cmpStatusBars)
cmpStatusBars.RemoveAuraSource(this.entity, name);
}

View File

@ -61,7 +61,7 @@ Barter.prototype.PlayerHasMarket = function(playerEntity)
return true;
}
return false;
}
};
Barter.prototype.ExchangeResources = function(playerEntity, resourceToSell, resourceToBuy, amount)
{
@ -140,7 +140,7 @@ Barter.prototype.ProgressTimeout = function(data)
cmpTimer.CancelTimer(this.restoreTimer);
this.restoreTimer = undefined;
}
}
};
Engine.RegisterSystemComponentType(IID_Barter, "Barter", Barter);

View File

@ -51,7 +51,7 @@ BattleDetection.prototype.setState = function(state)
BattleDetection.prototype.GetState = function()
{
return this.state;
}
};
BattleDetection.prototype.TimerHandler = function(data, lateness)
{

View File

@ -249,11 +249,11 @@ BuildRestrictions.prototype.CheckPlacement = function()
{
var cmpIdentity = Engine.QueryInterface(id, IID_Identity);
return cmpIdentity.GetClassesList().indexOf(cat) > -1;
}
};
if (this.template.Distance.MinDistance)
{
var dist = +this.template.Distance.MinDistance
var dist = +this.template.Distance.MinDistance;
var nearEnts = cmpRangeManager.ExecuteQuery(this.entity, 0, dist, [cmpPlayer.GetPlayerID()], IID_BuildRestrictions).filter(filter);
if (nearEnts.length)
{

View File

@ -37,7 +37,7 @@ Builder.prototype.GetEntitiesList = function()
entities = string.split(/\s+/);
// Remove disabled entities
var cmpPlayer = QueryOwnerInterface(this.entity, IID_Player)
var cmpPlayer = QueryOwnerInterface(this.entity, IID_Player);
var disabledEntities = cmpPlayer.GetDisabledTemplates();
for (var i = entities.length - 1; i >= 0; --i)

View File

@ -119,7 +119,7 @@ Capturable.prototype.CanCapture = function(playerID)
if (!cmpPlayerSource)
warn(playerID + " has no player component defined on its id");
var cp = this.GetCapturePoints()
var cp = this.GetCapturePoints();
var sourceEnemyCp = 0;
for (let i in this.GetCapturePoints())
if (cmpPlayerSource.IsEnemy(i))
@ -139,7 +139,7 @@ Capturable.prototype.RegisterCapturePointsChanged = function()
if (!cmpOwnership)
return;
Engine.PostMessage(this.entity, MT_CapturePointsChanged, { "capturePoints": this.cp })
Engine.PostMessage(this.entity, MT_CapturePointsChanged, { "capturePoints": this.cp });
var owner = cmpOwnership.GetOwner();
if (owner == -1 || this.cp[owner] > 0)
@ -199,9 +199,9 @@ Capturable.prototype.TimerTick = function()
var regenRate = this.GetRegenRate();
if (regenRate < 0)
modifiedCp += this.Reduce(-regenRate, 0)
modifiedCp += this.Reduce(-regenRate, 0);
else if (regenRate > 0)
modifiedCp += this.Reduce(regenRate, owner)
modifiedCp += this.Reduce(regenRate, owner);
if (modifiedCp)
return;

View File

@ -89,7 +89,7 @@ Cost.prototype.OnValueModification = function(msg)
return;
// foundations shouldn't give a pop bonus and a pop cost
var cmpFoundation = Engine.QueryInterface(this.entity, IID_Foundation)
var cmpFoundation = Engine.QueryInterface(this.entity, IID_Foundation);
if (cmpFoundation)
return;

View File

@ -48,7 +48,7 @@ EndGameManager.prototype.MarkPlayerAsWon = function(playerID)
if (cmpPlayer.GetState() != "active")
continue;
if (playerID == cmpPlayer.GetPlayerID() || this.alliedVictory && cmpPlayer.IsMutualAlly(playerID))
cmpPlayer.SetState("won")
cmpPlayer.SetState("won");
else
Engine.PostMessage(playerEntityId, MT_PlayerDefeated, { "playerId": i, "skip": true } );
}

View File

@ -168,7 +168,7 @@ EntityLimits.prototype.AllowedToCreate = function(limitType, category, count)
notification.message = markForTranslation("%(category)s training limit of %(limit)s reached");
else
{
warn("EntityLimits.js: Unknown LimitType " + limitType)
warn("EntityLimits.js: Unknown LimitType " + limitType);
notification.message = markForTranslation("%(category)s limit of %(limit)s reached");
}
var cmpGUIInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface);
@ -178,7 +178,7 @@ EntityLimits.prototype.AllowedToCreate = function(limitType, category, count)
}
return true;
}
};
EntityLimits.prototype.AllowedToBuild = function(category)
{

View File

@ -91,7 +91,7 @@ Formation.prototype.Init = function()
this.centerGap = +(this.template.CenterGap || 0);
var animations = this.template.Animations;
this.animations = {}
this.animations = {};
for (var animationName in animations)
{
var differentAnimations = animations[animationName].split(/\s*;\s*/);
@ -274,7 +274,7 @@ Formation.prototype.UnsetInPosition = function(ent)
var ind = this.inPosition.indexOf(ent);
if (ind != -1)
this.inPosition.splice(ind, 1);
}
};
/**
* Set whether we should rearrange formation members if

View File

@ -54,7 +54,7 @@ Foundation.prototype.OnHealthChanged = function(msg)
*/
Foundation.prototype.GetBuildProgress = function()
{
var cmpHealth = Engine.QueryInterface(this.entity, IID_Health)
var cmpHealth = Engine.QueryInterface(this.entity, IID_Health);
if (!cmpHealth)
return 0;
@ -275,7 +275,7 @@ Foundation.prototype.Build = function(builderEnt, work)
// Copy various parameters from the foundation
var cmpVisual = Engine.QueryInterface(this.entity, IID_Visual);
var cmpBuildingVisual = Engine.QueryInterface(building, IID_Visual)
var cmpBuildingVisual = Engine.QueryInterface(building, IID_Visual);
if (cmpVisual && cmpBuildingVisual)
cmpBuildingVisual.SetActorSeed(cmpVisual.GetActorSeed());

View File

@ -563,7 +563,7 @@ GarrisonHolder.prototype.OnHealthChanged = function(msg)
*/
GarrisonHolder.prototype.HasEnoughHealth = function()
{
var cmpHealth = Engine.QueryInterface(this.entity, IID_Health)
var cmpHealth = Engine.QueryInterface(this.entity, IID_Health);
var hitpoints = cmpHealth.GetHitpoints();
var maxHitpoints = cmpHealth.GetMaxHitpoints();
var ejectHitpoints = Math.floor((+this.template.EjectHealth) * maxHitpoints);
@ -702,7 +702,7 @@ GarrisonHolder.prototype.OnGlobalEntityRenamed = function(msg)
*/
GarrisonHolder.prototype.OnDiplomacyChanged = function()
{
var entities = []
var entities = [];
for each (var entity in this.entities)
{
if (!IsOwnedByMutualAllyOfEntity(this.entity, entity))
@ -723,7 +723,7 @@ GarrisonHolder.prototype.EjectOrKill = function(entities)
if (cmpPosition.IsInWorld())
{
var cmpGarrisonHolder = this;
var ejectables = entities.filter(function(ent) { return cmpGarrisonHolder.IsEjectable(ent) });
var ejectables = entities.filter(function(ent) { return cmpGarrisonHolder.IsEjectable(ent); });
if (ejectables.length)
this.PerformEject(ejectables, false);
}

View File

@ -711,7 +711,7 @@ GuiInterface.prototype.AddTimeNotification = function(notification, duration = 1
notification.players.push(i);
}
this.timeNotifications.push(notification);
this.timeNotifications.sort(function (n1, n2){return n2.endTime - n1.endTime});
this.timeNotifications.sort(function (n1, n2){return n2.endTime - n1.endTime;});
cmpTimer.SetTimeout(this.entity, IID_GuiInterface, "DeleteTimeNotification", duration, this.timeNotificationID);
@ -884,7 +884,7 @@ GuiInterface.prototype.SetStatusBars = function(player, cmd)
for (let ent of affectedEnts)
{
let cmpStatusBars = Engine.QueryInterface(ent, IID_StatusBars)
let cmpStatusBars = Engine.QueryInterface(ent, IID_StatusBars);
if (cmpStatusBars)
cmpStatusBars.RegenerateSprites();
}
@ -989,7 +989,7 @@ GuiInterface.prototype.SetBuildingPlacementPreview = function(player, cmd)
"parameters": {},
"translateMessage": false,
"translateParameters": [],
}
};
// See if we're changing template
if (!this.placementEntity || this.placementEntity[0] != cmd.template)

View File

@ -771,7 +771,7 @@ Player.prototype.RemoveDisabledTechnology = function(tech)
Player.prototype.SetDisabledTechnologies = function(techs)
{
this.disabledTechnologies = {}
this.disabledTechnologies = {};
for (let tech of techs)
this.disabledTechnologies[tech] = true;
Engine.BroadcastMessage(MT_DisabledTechnologiesChanged, {});

View File

@ -220,11 +220,11 @@ ProductionQueue.prototype.IsTechnologyResearchedOrInProgress = function(tech)
if (template.top)
{
return (cmpTechnologyManager.IsTechnologyResearched(template.top) || cmpTechnologyManager.IsInProgress(template.top)
|| cmpTechnologyManager.IsTechnologyResearched(template.bottom) || cmpTechnologyManager.IsInProgress(template.bottom))
|| cmpTechnologyManager.IsTechnologyResearched(template.bottom) || cmpTechnologyManager.IsInProgress(template.bottom));
}
else
{
return (cmpTechnologyManager.IsTechnologyResearched(tech) || cmpTechnologyManager.IsInProgress(tech))
return (cmpTechnologyManager.IsTechnologyResearched(tech) || cmpTechnologyManager.IsInProgress(tech));
}
};

View File

@ -34,7 +34,7 @@ ResourceTrickle.prototype.Init = function()
{
// Call the timer
var cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer);
cmpTimer.SetInterval(this.entity, IID_ResourceTrickle, "Trickle", this.GetTimer(), this.GetTimer(), undefined)
cmpTimer.SetInterval(this.entity, IID_ResourceTrickle, "Trickle", this.GetTimer(), this.GetTimer(), undefined);
};
ResourceTrickle.prototype.GetTimer = function()

View File

@ -60,7 +60,7 @@ SkirmishReplacer.prototype.ReplaceEntities = function()
Engine.DestroyEntity(this.entity);
return;
}
var cmpReplacementPosition = Engine.QueryInterface(replacement, IID_Position)
var cmpReplacementPosition = Engine.QueryInterface(replacement, IID_Position);
var pos = cmpCurPosition.GetPosition2D();
cmpReplacementPosition.JumpTo(pos.x, pos.y);
var rot = cmpCurPosition.GetRotation();

View File

@ -177,7 +177,7 @@ StatusBars.prototype.AddResourceSupplyBar = function(cmpOverlayRenderer, yoffset
let cmpResourceSupply = QueryMiragedInterface(this.entity, IID_ResourceSupply);
if (!cmpResourceSupply)
return 0;
let value = cmpResourceSupply.IsInfinite() ? 1 : cmpResourceSupply.GetCurrentAmount() / cmpResourceSupply.GetMaxAmount()
let value = cmpResourceSupply.IsInfinite() ? 1 : cmpResourceSupply.GetCurrentAmount() / cmpResourceSupply.GetMaxAmount();
return this.AddBar(cmpOverlayRenderer, yoffset, "supply", value);
};
@ -195,7 +195,7 @@ StatusBars.prototype.AddCaptureBar = function(cmpOverlayRenderer, yoffset)
return 0;
let owner = cmpOwnership.GetOwner();
let cp = cmpCapturable.GetCapturePoints()
let cp = cmpCapturable.GetCapturePoints();
// Size of health bar (in world-space units)
let width = +this.template.BarWidth;
@ -252,7 +252,7 @@ StatusBars.prototype.AddAuraIcons = function(cmpOverlayRenderer, yoffset)
let offset = { "x": 0, "y": +this.template.HeightOffset + yoffset, "z": 0 };
let iconSize = +this.template.BarWidth / 2;
let xoffset = -iconSize * (iconSet.size - 1) * 0.6
let xoffset = -iconSize * (iconSet.size - 1) * 0.6;
for (let icon of iconSet)
{
cmpOverlayRenderer.AddSprite(

View File

@ -53,7 +53,7 @@ TechnologyManager.prototype.Init = function()
TechnologyManager.prototype.OnUpdate = function()
{
this.UpdateAutoResearch();
}
};
// This function checks if the requirements of any autoresearch techs are met and if they are it researches them
@ -71,7 +71,7 @@ TechnologyManager.prototype.UpdateAutoResearch = function()
return; // We will have recursively handled any knock-on effects so can just return
}
}
}
};
TechnologyManager.prototype.GetTechnologyTemplate = function(tech)
{

View File

@ -80,7 +80,7 @@ Trigger.prototype.RegisterTrigger = function(event, action, data)
var eventString = event + "Actions";
if (!this[eventString])
{
warn("Trigger.js: Invalid trigger event \"" + event + "\".")
warn("Trigger.js: Invalid trigger event \"" + event + "\".");
return;
}
if (this[eventString][action])
@ -171,7 +171,7 @@ Trigger.prototype.EnableTrigger = function(event, action)
return;
if (!data.interval)
{
warn("Trigger.js: An interval trigger should have an intervel in its data")
warn("Trigger.js: An interval trigger should have an intervel in its data");
return;
}
var cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer);

View File

@ -4211,7 +4211,7 @@ UnitAI.prototype.MoveToTargetAttackRange = function(target, type)
return false;
}
var cmpFormation = Engine.QueryInterface(target, IID_Formation)
var cmpFormation = Engine.QueryInterface(target, IID_Formation);
if (cmpFormation)
target = cmpFormation.GetClosestMember(this.entity);
@ -4318,7 +4318,7 @@ UnitAI.prototype.CheckTargetAttackRange = function(target, type)
return true;
}
var cmpFormation = Engine.QueryInterface(target, IID_Formation)
var cmpFormation = Engine.QueryInterface(target, IID_Formation);
if (cmpFormation)
target = cmpFormation.GetClosestMember(this.entity);

View File

@ -97,7 +97,7 @@ UnitMotionFlying.prototype.OnUpdate = function(msg)
this.pitch = 0;
// We've stopped.
if (cmpGarrisonHolder)
cmpGarrisonHolder.AllowGarrisoning(true,"UnitMotionFlying")
cmpGarrisonHolder.AllowGarrisoning(true,"UnitMotionFlying");
canTurn = false;
this.hasTarget = false;
this.landing = false;
@ -159,7 +159,7 @@ UnitMotionFlying.prototype.OnUpdate = function(msg)
if (this.speed < this.template.TakeoffSpeed && this.onGround)
{
if (cmpGarrisonHolder)
cmpGarrisonHolder.AllowGarrisoning(false,"UnitMotionFlying")
cmpGarrisonHolder.AllowGarrisoning(false,"UnitMotionFlying");
this.pitch = 0;
// Accelerate forwards
this.speed = Math.min(this.template.MaxSpeed, this.speed + turnLength * this.template.AccelRate);
@ -313,7 +313,7 @@ UnitMotionFlying.prototype.GetRunSpeed = function()
UnitMotionFlying.prototype.GetCurrentSpeed = function()
{
return this.speed;
}
};
UnitMotionFlying.prototype.FaceTowardsPoint = function(x, z)
{

View File

@ -1,4 +1,4 @@
function ValueModificationManager() {};
function ValueModificationManager() {}
/*
* A component to give the C++ defined components access to all value modifying components