Skip to content

Commit

Permalink
Fixed an inconsistency in how research efficiency decay was computed.
Browse files Browse the repository at this point in the history
  • Loading branch information
DaloLorn committed Feb 13, 2020
1 parent 6bd2f14 commit 664b140
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.db
.steam
modinfo.*
*.bat
*.bat
*.code-workspace
2 changes: 1 addition & 1 deletion Rising Stars/scripts/definitions/ABEM_version.as
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import version;

// ABEMMOD's last revision was 724.
const string MOD_REVISION = "935";
const string MOD_REVISION = "936";
const array<string> VERSIONS = {
"v2.0.3",
};
Expand Down
8 changes: 4 additions & 4 deletions Rising Stars/scripts/server/components/ResearchGrid.as
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class ResearchGrid : Component_ResearchGrid, Savable {
genPts *= ResearchEfficiency;
points += genPts;
if(penalized)
totalGenerated += genPts;
totalGenerated += genPts * emp.ResearchDecaySpeed * config::RESEARCH_EFFICIENCY_DECAY_MULT;
}

bool consumeResearchPoints(int amount) {
Expand All @@ -137,9 +137,9 @@ class ResearchGrid : Component_ResearchGrid, Savable {
points += amount;
}

void reduceResearchPenalty(int points) {
void reduceResearchPenalty(Empire& emp, int points) {
WriteLock lock(mtx);
totalGenerated = max(0.0, totalGenerated - points);
totalGenerated = max(0.0, totalGenerated - points * emp.ResearchDecaySpeed * config::RESEARCH_EFFICIENCY_DECAY_MULT);
}

void initResearch(Empire& emp) {
Expand Down Expand Up @@ -268,7 +268,7 @@ class ResearchGrid : Component_ResearchGrid, Savable {
if(!node.consumeSecondary(emp))
return;
node.secondaryUnlock = true;
totalGenerated += node.getPointCost(emp);
totalGenerated += node.getPointCost(emp) * emp.ResearchDecaySpeed * config::RESEARCH_EFFICIENCY_DECAY_MULT;
}
else {
if(cost == 0)
Expand Down

0 comments on commit 664b140

Please sign in to comment.