Fix organisation tech level never increasing (#1587) - #1657
Merged
FilmBoy84 merged 1 commit intoSep 5, 2026
Conversation
Increment each non-player/alien/civilian organisation's tech_level by 1 in GameState::updateEndOfWeek, guarded by !gameStart, matching the weekly upgrade rule described for the original game. Cap derived from the loaded Human EquipmentSet data (highest min_score) rather than a hardcoded constant, so it tracks the extractor's equipment-set brackets. Fixes OpenApoc#1587
Contributor
Author
|
Temporary harness used for the before/after check (not committed). Loads difficulty0 like int maxOrgTechLevel = 1;
for (auto &es : state->equipment_sets)
if (es.second->type == EquipmentSet::Type::Human)
maxOrgTechLevel = std::max(maxOrgTechLevel, es.second->min_score);
std::map<UString, int> before;
for (auto &org : state->organisations)
before[org.first] = org.second->tech_level;
state->updateEndOfWeek(false);
for (auto &org : state->organisations)
{
bool exempt = org.first == state->getPlayer().id || org.first == state->getAliens().id ||
org.first == state->getCivilian().id;
int expected = exempt ? before[org.first] : std::min(before[org.first] + 1, maxOrgTechLevel);
assert(org.second->tech_level == expected);
}
assert(EquipmentSet::getForType(*state, EquipmentSet::Type::Human, maxOrgTechLevel));
assert(EquipmentSet::getForType(*state, EquipmentSet::Type::Human, maxOrgTechLevel + 5));
for (auto &org : state->organisations) before[org.first] = org.second->tech_level;
state->updateEndOfWeek(true);
for (auto &org : state->organisations)
assert(org.second->tech_level == before[org.first]);Pre-fix ( Post-fix ( |
Collaborator
|
Really nice catch! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1587.
Root cause:
Organisation::tech_levelis set once by the extractor and never changes at runtime.GameState::updateEndOfWeekhas a per-organisation finance loop but nothing for tech level, so every organisation stays at its starting level for the whole game. The original game raises each organisation's tech level by 1 per week, capped at 12.Fix: in
updateEndOfWeek, when notgameStart, incrementtech_levelfor every organisation exceptplayer,aliens, andcivilian, capped at the highestmin_scoreamongHumanEquipmentSets (12 with the shipped data) instead of a hardcoded constant. The separate "+3 on full infiltration" rule is not part of this change.Verification
ORG_CULT_OF_SIRIUS tech_level 2 -> 2, expected 3).gameStartweek leaves levels untouched.Harness core in the comment below.