Commit 60bb189e authored by nanahira's avatar nanahira

resolve alternative alias chain rule_code in DataManager

parent 04e02997
Pipeline #43655 failed with stages
in 3 minutes and 41 seconds
......@@ -85,6 +85,19 @@ bool DataManager::ReadDB(sqlite3* pDB) {
}
}
sqlite3_finalize(pStmt);
// Resolve one extra hop for alternative alias chains, mirroring get_original_code_rule logic:
// For A->B->C (all alternative), A.rule_code should be C, not B.
// Strictly one extra hop: look up the alias target's get_duel_code().
for (auto& entry : _datas) {
auto& cd = entry.second;
if (cd.rule_code != 0) continue;
if (!is_alternative(cd.code, cd.alias)) continue;
auto it = _datas.find(cd.alias);
if (it == _datas.end()) continue;
auto rule = it->second.get_duel_code();
if (rule != cd.alias)
cd.rule_code = rule;
}
for (const auto& entry : extra_setcode) {
const auto& code = entry.first;
const auto& list = entry.second;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment