1
0
forked from mirrors/0ad

Workaround renamed property in gamereport

The gendered citizen feature changed stat counter names in
3592814aa8 which are submitted to echelon
for rated games with the game report, the change in name for the property
means it no longer matches the database column name effectively breaking
rated games.

Translate the property name on the fly.

Fixes: #8687
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
(cherry picked from commit 0691e7f0ff)
Signed-off-by: phosit <phosit@autistici.org>
This commit is contained in:
Ralph Sennhauser
2026-01-25 21:01:11 +01:00
committed by phosit
parent 63d4513ebf
commit 0d1cdc0eaa
+11 -1
View File
@@ -394,11 +394,21 @@ void XmppClient::SendIqGameReport(const ScriptRequest& rq, JS::HandleValue data)
// Iterate through all the properties reported and add them to the stanza.
std::vector<std::string> properties;
Script::EnumeratePropertyNames(rq, data, true, properties);
// https://gitea.wildfiregames.com/0ad/0ad/issues/8687
const std::map<std::string, std::string> mappings{
{ "civilianUnitsLost", "femaleCitizenUnitsLost" },
{ "civilianUnitsTrained", "femaleCitizenUnitsTrained" },
{ "enemyCivilianUnitsKilled", "enemyFemaleCitizenUnitsKilled"}
};
for (const std::string& p : properties)
{
std::wstring value;
Script::GetProperty(rq, data, p.c_str(), value);
report->addAttribute(p, utf8_from_wstring(value));
if (mappings.contains(p))
report->addAttribute(mappings.at(p), utf8_from_wstring(value));
else
report->addAttribute(p, utf8_from_wstring(value));
}
// Add stanza to IQ