private void finishedResearch(string tecName) { ATecTreeNode ttn = this.allNodes[tecName.ToLower()]; ResearchBar researchProgress = this.data[ttn].progress; if (researchProgress.currentResearch < researchProgress.requiredResearch) { // Not enough research has been done return; } // Remove the newly finished research from the avaliable pool this.data[ttn].avaliableToResearch = false; }
// TODO: Make this work with things that have the same string name public int forceDoResearch(string tecName, int researchPoints) { /** * Do research on the tecName TecTreeNode, regardless of the pre-recs for the node * * Returns the amound of overflow research points. Overflow is the number of RP over the requiredResearch * A non 0 result impliess the tech is finished researching * * // TODO: Move this functunality into the ResearchBar maybe? * This will never cause the ResearchBar.currentResearch to go over the requiredResearch */ ATecTreeNode ttn = this.allNodes[tecName.ToLower()]; ResearchBar rb = this.data[ttn].progress; int overflow = Math.Max(0, (rb.currentResearch + researchPoints) - rb.requiredResearch); rb.currentResearch += researchPoints - overflow; if (overflow > 0) { finishedResearch(tecName); } return(overflow); }