mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-28 18:12:26 +00:00
Fix paired techs following a754b1bad4. Patch by Imarok, fixes #4251, refs #3823.
This was SVN commit r18790.
This commit is contained in:
@@ -745,9 +745,15 @@ g_SelectionPanels.Research = {
|
||||
// Remove the techs we already have in ret (with the same name and techCostMultiplier)
|
||||
let filteredTechs = state.production.technologies.filter(
|
||||
tech => tech != null && !ret.some(
|
||||
item => item.tech == tech && Object.keys(item.techCostMultiplier).every(
|
||||
k => item.techCostMultiplier[k] == state.production.techCostMultiplier[k]
|
||||
)));
|
||||
item =>
|
||||
(item.tech == tech ||
|
||||
item.tech.pair &&
|
||||
tech.pair &&
|
||||
item.tech.bottom == tech.bottom &&
|
||||
item.tech.top == tech.top) &&
|
||||
Object.keys(item.techCostMultiplier).every(
|
||||
k => item.techCostMultiplier[k] == state.production.techCostMultiplier[k])
|
||||
));
|
||||
|
||||
if (filteredTechs.length + ret.length <= this.getMaxNumberOfItems() &&
|
||||
getNumberOfRightPanelButtons() <= this.getMaxNumberOfItems() * (filteredTechs.some(tech => !!tech.pair) ? 1 : 2))
|
||||
|
||||
@@ -337,9 +337,13 @@ ProductionQueue.prototype.AddBatch = function(templateName, type, count, metadat
|
||||
var template = cmpDataTemplateManager.GetTechnologyTemplate(templateName);
|
||||
if (!template)
|
||||
return;
|
||||
if (this.GetTechnologiesList().indexOf(templateName) == -1)
|
||||
if (!this.GetTechnologiesList().some(tech =>
|
||||
tech &&
|
||||
(tech == templateName ||
|
||||
tech.pair &&
|
||||
(tech.top == templateName || tech.bottom == templateName))))
|
||||
{
|
||||
warn("This entity cannot research " + JSON.stringify(templateName));
|
||||
error("This entity cannot research " + templateName);
|
||||
return;
|
||||
}
|
||||
var cmpPlayer = QueryOwnerInterface(this.entity);
|
||||
|
||||
Reference in New Issue
Block a user