mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 05:13:58 -07:00
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>
This commit is contained in:
parent
cce01f4d6c
commit
0691e7f0ff
1 changed files with 11 additions and 1 deletions
|
|
@ -390,11 +390,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
|
||||
|
|
|
|||
Loading…
Reference in a new issue