View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
---|---|---|---|---|---|---|---|---|---|
0005358 | Spring engine | General | public | 2016-09-28 22:39 | 2017-04-30 01:07 | ||||
Reporter | abma | ||||||||
Assigned To | Kloot | ||||||||
Priority | normal | Severity | crash | Reproducibility | have not tried | ||||
Status | resolved | Resolution | fixed | ||||||
Product Version | |||||||||
Target Version | 104.0 | Fixed in Version | 103.0 +git | ||||||
Summary | 0005358: theoretical desync with strtod / atof | ||||||||
Description | these functions depend on the current locale, so imo they could cause desyncs. | ||||||||
Additional Information | in rts/Sim: $ grep -R strto * Projectiles/ExplosionGenerator.cpp: const float v = (float)strtod(&script.c_str()[p], &endp); Projectiles/ExplosionGenerator.cpp: const int v = std::max(0, std::min(16, (int)strtol(&script.c_str()[p], &endp, 10))); grep -R atof * Misc/AllyTeam.cpp: startRectTop = std::atof(value.c_str()); Misc/AllyTeam.cpp: startRectBottom = std::atof(value.c_str()); Misc/AllyTeam.cpp: startRectLeft = std::atof(value.c_str()); Misc/AllyTeam.cpp: startRectRight = std::atof(value.c_str()); Misc/TeamBase.cpp: SetAdvantage(std::atof(value.c_str()) / 100.0f); Misc/TeamBase.cpp: SetAdvantage(std::atof(value.c_str())); Misc/TeamBase.cpp: SetIncomeMultiplier(std::atof(value.c_str())); | ||||||||
Tags | No tags attached. | ||||||||
Checked infolog.txt for Errors | |||||||||
Attached Files |
|
![]() |
|
abma (administrator) 2016-09-28 22:39 |
especially the conversation in Projectiles/ExplosionGenerator.cpp could lead to a desync?! |
abma (administrator) 2016-09-28 22:42 |
as workarround we could set the locale to C? i.e.: setlocale( LC_NUMERIC, "C"); |
abma (administrator) 2016-09-28 22:49 Last edited: 2016-09-28 22:49 |
if i remember right we tapped into this already in lua code (and made a workarround for it) $ lua > print(os.setlocale("de_DE.utf-8")) de_DE.utf-8 > print(tostring(tonumber("5.1")) .." - " .. tostring(tonumber("5,1"))) nil - 5,1 > print(os.setlocale("C")) C > print(tostring(tonumber("5.1")) .." - " .. tostring(tonumber("5,1"))) 5.1 - nil |
abma (administrator) 2016-09-28 23:07 |
added a test gadget in devgame: https://github.com/spring/devgame.sdd/commit/588a70fc7bf4ed2fa4842cb6f7cb0b88fec31843 |
![]() |
|||
Date Modified | Username | Field | Change |
---|---|---|---|
2016-09-28 22:39 | abma | New Issue | |
2016-09-28 22:39 | abma | Note Added: 0016706 | |
2016-09-28 22:42 | abma | Note Added: 0016707 | |
2016-09-28 22:49 | abma | Note Added: 0016708 | |
2016-09-28 22:49 | abma | Note Edited: 0016708 | View Revisions |
2016-09-28 23:07 | abma | Note Added: 0016709 | |
2017-04-30 01:07 | Kloot | Assigned To | => Kloot |
2017-04-30 01:07 | Kloot | Status | new => resolved |
2017-04-30 01:07 | Kloot | Resolution | open => fixed |
2017-04-30 01:07 | Kloot | Fixed in Version | => 103.0 +git |