Skip to content
This repository has been archived by the owner on Aug 19, 2022. It is now read-only.

APS not factored in DPS when using locale with comma decimal separator. #141

Closed
fivetide opened this issue Aug 21, 2015 · 1 comment
Closed
Labels

Comments

@fivetide
Copy link

Noticed this using Ubuntu 15.4 in german.

std::stod(properties_.at("Attacks per Second")); // always returns 1

@fivetide
Copy link
Author

double Item::eDPS() const {
    std::setlocale(LC_ALL, "C");
    if (elemental_damage_.empty() || !properties_.count("Attacks per Second"))
        return 0;
    double damage = 0;
    for (auto &x : elemental_damage_)
        damage += Util::AverageDamage(x.first);
    double aps = std::stod(properties_.at("Attacks per Second"));
    return aps * damage;
}

solves the problem for me, but this is propably not the correct spot to set this ;)

@xyzz xyzz added the bug label Aug 21, 2015
@xyzz xyzz closed this as completed in ac1cb65 Aug 22, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants