1
1
forked from 0ad/0ad

Some cleanup. Fix a comment.

This was SVN commit r15928.
This commit is contained in:
leper 2014-11-05 00:22:14 +00:00
parent 518d2d0c2a
commit 7dad37c78f
3 changed files with 21 additions and 23 deletions

View File

@ -90,7 +90,7 @@ TechnologyManager.prototype.CanProduce = function (templateName)
return true; // If there is no required technology then this entity can be produced
};
TechnologyManager.prototype.IsTechnologyResearched = function (tech)
TechnologyManager.prototype.IsTechnologyResearched = function(tech)
{
return (this.researchedTechs[tech] !== undefined);
};
@ -126,7 +126,7 @@ TechnologyManager.prototype.CanResearch = function(tech)
};
// Private function for checking a set of requirements is met
TechnologyManager.prototype.CheckTechnologyRequirements = function (reqs)
TechnologyManager.prototype.CheckTechnologyRequirements = function(reqs)
{
// If there are no requirements then all requirements are met
if (!reqs)
@ -185,7 +185,7 @@ TechnologyManager.prototype.CheckTechnologyRequirements = function (reqs)
return false;
};
TechnologyManager.prototype.OnGlobalOwnershipChanged = function (msg)
TechnologyManager.prototype.OnGlobalOwnershipChanged = function(msg)
{
// This automatically updates typeCounts, classCounts and typeCountsByClass
var playerID = (Engine.QueryInterface(this.entity, IID_Player)).GetPlayerID();
@ -275,7 +275,7 @@ TechnologyManager.prototype.OnGlobalOwnershipChanged = function (msg)
};
// Marks a technology as researched. Note that this does not verify that the requirements are met.
TechnologyManager.prototype.ResearchTechnology = function (tech)
TechnologyManager.prototype.ResearchTechnology = function(tech)
{
this.StoppedResearch(tech); // The tech is no longer being currently researched
@ -395,19 +395,19 @@ TechnologyManager.prototype.ApplyModificationsTemplate = function(valueName, cur
};
// Marks a technology as being queued for research
TechnologyManager.prototype.QueuedResearch = function (tech, researcher)
TechnologyManager.prototype.QueuedResearch = function(tech, researcher)
{
this.researchQueued[tech] = researcher;
};
// Marks a technology as actively being researched
TechnologyManager.prototype.StartedResearch = function (tech)
TechnologyManager.prototype.StartedResearch = function(tech)
{
this.researchStarted[tech] = true;
};
// Marks a technology as not being currently researched
TechnologyManager.prototype.StoppedResearch = function (tech)
TechnologyManager.prototype.StoppedResearch = function(tech)
{
delete this.researchQueued[tech];
delete this.researchStarted[tech];

View File

@ -2,13 +2,12 @@
function ApplyValueModificationsToEntity(tech_type, current_value, entity)
{
var cmpTechMan = QueryOwnerInterface(entity, IID_TechnologyManager);
if (cmpTechMan)
var value = cmpTechMan.ApplyModifications(tech_type, current_value, entity);
else
var value = current_value;
let value = current_value;
let cmpTechnologyManager = QueryOwnerInterface(entity, IID_TechnologyManager);
if (cmpTechnologyManager)
value = cmpTechnologyManager.ApplyModifications(tech_type, current_value, entity);
var cmpAuraManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_AuraManager);
let cmpAuraManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_AuraManager);
if (!cmpAuraManager)
return value;
return cmpAuraManager.ApplyModifications(tech_type, value, entity);
@ -16,23 +15,22 @@ function ApplyValueModificationsToEntity(tech_type, current_value, entity)
function ApplyValueModificationsToPlayer(tech_type, current_value, player_entity)
{
var cmpTechMan = Engine.QueryInterface(player_entity, IID_TechnologyManager);
let cmpTechnologyManager = Engine.QueryInterface(player_entity, IID_TechnologyManager);
if (!cmpTechMan)
if (!cmpTechnologyManager)
return current_value;
return cmpTechMan.ApplyModifications(tech_type, current_value, player_entity);
return cmpTechnologyManager.ApplyModifications(tech_type, current_value, player_entity);
}
function ApplyValueModificationsToTemplate(tech_type, current_value, playerID, template)
{
var cmpTechMan = QueryPlayerIDInterface(playerID, IID_TechnologyManager);
if (cmpTechMan)
var value = cmpTechMan.ApplyModificationsTemplate(tech_type, current_value, template);
else
var value = current_value;
let value = current_value;
let cmpTechnologyManager = QueryPlayerIDInterface(playerID, IID_TechnologyManager);
if (cmpTechnologyManager)
value = cmpTechnologyManager.ApplyModificationsTemplate(tech_type, current_value, template);
var cmpAuraManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_AuraManager);
let cmpAuraManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_AuraManager);
if (!cmpAuraManager)
return value;
return cmpAuraManager.ApplyTemplateModifications(tech_type, value, playerID, template);

View File

@ -1047,7 +1047,7 @@ void CComponentManager::SendGlobalMessage(entity_id_t ent, const CMessage& msg)
std::vector<ComponentTypeId>::const_iterator ctit = it->second.begin();
for (; ctit != it->second.end(); ++ctit)
{
// Special case: Messages for non-local entities shouldn't be sent to script
// Special case: Messages for local entities shouldn't be sent to script
// components that subscribed globally, so that we don't have to worry about
// them accidentally picking up non-network-synchronised data.
if (ENTITY_IS_LOCAL(ent))