Page MenuHomeWildfire Games

Remove obsolete entity query in TechMan.'s ResearchTechnology-function.
ClosedPublic

Authored by Freagarach on Feb 11 2020, 9:04 PM.

Details

Reviewers
Silier
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP23587: Cleanup ResearchTechnology function
Summary

Removes variable ents, which was introduced in rP14588 (updated in rP19637), use removed in rP22767.
Also some var -> let.

Test Plan

Verify that

  • the variable was indeed unused.
  • all techs still apply.

Event Timeline

Freagarach created this revision.Feb 11 2020, 9:04 PM

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/TechnologyManager.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/TechnologyManager.js
|  39|  39| 	for (let key of this.unresearchedAutoResearchTechs)
|  40|  40| 	{
|  41|  41| 		let tech = TechnologyTemplates.Get(key);
|  42|    |-		if ((tech.autoResearch && this.CanResearch(key))
|  43|    |-			|| (tech.top && (this.IsTechnologyResearched(tech.top) || this.IsTechnologyResearched(tech.bottom))))
|    |  42|+		if ((tech.autoResearch && this.CanResearch(key)) ||
|    |  43|+			(tech.top && (this.IsTechnologyResearched(tech.top) || this.IsTechnologyResearched(tech.bottom))))
|  44|  44| 		{
|  45|  45| 			this.unresearchedAutoResearchTechs.delete(key);
|  46|  46| 			this.ResearchTechnology(key);
|    | [NORMAL] ESLintBear (space-before-function-paren):
|    | Unexpected space before function parentheses.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/TechnologyManager.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/TechnologyManager.js
|  50|  50| };
|  51|  51| 
|  52|  52| // Checks an entity template to see if its technology requirements have been met
|  53|    |-TechnologyManager.prototype.CanProduce = function (templateName)
|    |  53|+TechnologyManager.prototype.CanProduce = function(templateName)
|  54|  54| {
|  55|  55| 	var cmpTempManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_TemplateManager);
|  56|  56| 	var template = cmpTempManager.GetTemplate(templateName);

binaries/data/mods/public/simulation/components/TechnologyManager.js
| 125| »   »   »   switch·(type)
|    | [NORMAL] ESLintBear (default-case):
|    | Expected a default case.

binaries/data/mods/public/simulation/components/TechnologyManager.js
| 140| »   switch·(entity.check)
|    | [NORMAL] ESLintBear (default-case):
|    | Expected a default case.

binaries/data/mods/public/simulation/components/TechnologyManager.js
|  43| »   »   »   ||·(tech.top·&&·(this.IsTechnologyResearched(tech.top)·||·this.IsTechnologyResearched(tech.bottom))))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '||'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/TechnologyManager.js
| 185| »   »   var·cmpTemplateManager·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_TemplateManager);
|    | [NORMAL] JSHintBear:
|    | 'cmpTemplateManager' is already defined.

binaries/data/mods/public/simulation/components/TechnologyManager.js
| 186| »   »   var·template·=·cmpTemplateManager.GetCurrentTemplateName(msg.entity);
|    | [NORMAL] JSHintBear:
|    | 'template' is already defined.

binaries/data/mods/public/simulation/components/TechnologyManager.js
| 191| »   »   »   var·cmpIdentity·=·Engine.QueryInterface(msg.entity,·IID_Identity);
|    | [NORMAL] JSHintBear:
|    | 'cmpIdentity' is already defined.

binaries/data/mods/public/simulation/components/TechnologyManager.js
| 194| »   »   »   »   var·classes·=·cmpIdentity.GetClassesList();
|    | [NORMAL] JSHintBear:
|    | 'classes' is already defined.
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1746/display/redirect

Silier accepted this revision.Apr 14 2020, 2:52 PM
Silier added a subscriber: Silier.

nice catch

binaries/data/mods/public/simulation/components/TechnologyManager.js
228

when you started with var->let :)

This revision is now accepted and ready to land.Apr 14 2020, 2:52 PM
Freagarach updated this revision to Diff 11676.Apr 15 2020, 8:46 AM
Freagarach marked an inline comment as done.
  • One extra var -> let.
  • Function comment to JSDOC.

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/TechnologyManager.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/TechnologyManager.js
|  39|  39| 	for (let key of this.unresearchedAutoResearchTechs)
|  40|  40| 	{
|  41|  41| 		let tech = TechnologyTemplates.Get(key);
|  42|    |-		if ((tech.autoResearch && this.CanResearch(key))
|  43|    |-			|| (tech.top && (this.IsTechnologyResearched(tech.top) || this.IsTechnologyResearched(tech.bottom))))
|    |  42|+		if ((tech.autoResearch && this.CanResearch(key)) ||
|    |  43|+			(tech.top && (this.IsTechnologyResearched(tech.top) || this.IsTechnologyResearched(tech.bottom))))
|  44|  44| 		{
|  45|  45| 			this.unresearchedAutoResearchTechs.delete(key);
|  46|  46| 			this.ResearchTechnology(key);
|    | [NORMAL] ESLintBear (space-before-function-paren):
|    | Unexpected space before function parentheses.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/TechnologyManager.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/TechnologyManager.js
|  50|  50| };
|  51|  51| 
|  52|  52| // Checks an entity template to see if its technology requirements have been met
|  53|    |-TechnologyManager.prototype.CanProduce = function (templateName)
|    |  53|+TechnologyManager.prototype.CanProduce = function(templateName)
|  54|  54| {
|  55|  55| 	var cmpTempManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_TemplateManager);
|  56|  56| 	var template = cmpTempManager.GetTemplate(templateName);

binaries/data/mods/public/simulation/components/TechnologyManager.js
| 125| »   »   »   switch·(type)
|    | [NORMAL] ESLintBear (default-case):
|    | Expected a default case.

binaries/data/mods/public/simulation/components/TechnologyManager.js
| 140| »   switch·(entity.check)
|    | [NORMAL] ESLintBear (default-case):
|    | Expected a default case.

binaries/data/mods/public/simulation/components/TechnologyManager.js
|  43| »   »   »   ||·(tech.top·&&·(this.IsTechnologyResearched(tech.top)·||·this.IsTechnologyResearched(tech.bottom))))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '||'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/TechnologyManager.js
| 185| »   »   var·cmpTemplateManager·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_TemplateManager);
|    | [NORMAL] JSHintBear:
|    | 'cmpTemplateManager' is already defined.

binaries/data/mods/public/simulation/components/TechnologyManager.js
| 186| »   »   var·template·=·cmpTemplateManager.GetCurrentTemplateName(msg.entity);
|    | [NORMAL] JSHintBear:
|    | 'template' is already defined.

binaries/data/mods/public/simulation/components/TechnologyManager.js
| 191| »   »   »   var·cmpIdentity·=·Engine.QueryInterface(msg.entity,·IID_Identity);
|    | [NORMAL] JSHintBear:
|    | 'cmpIdentity' is already defined.

binaries/data/mods/public/simulation/components/TechnologyManager.js
| 194| »   »   »   »   var·classes·=·cmpIdentity.GetClassesList();
|    | [NORMAL] JSHintBear:
|    | 'classes' is already defined.
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1999/display/redirect

This revision was automatically updated to reflect the committed changes.

Thanks @Angen :)