mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Minor code simplification (ToMap instead of section->GetKeys)
See #18442
This commit is contained in:
parent
a094637ab1
commit
99962b91e5
1 changed files with 4 additions and 9 deletions
|
@ -1893,19 +1893,14 @@ void PlayTimeTracker::Stop(const std::string &gameId) {
|
|||
void PlayTimeTracker::Load(const Section *section) {
|
||||
tracker_.clear();
|
||||
|
||||
std::vector<std::string> keys;
|
||||
section->GetKeys(keys);
|
||||
|
||||
for (auto key : keys) {
|
||||
std::string value;
|
||||
if (!section->Get(key.c_str(), &value, nullptr)) {
|
||||
continue;
|
||||
}
|
||||
auto map = section->ToMap();
|
||||
|
||||
for (const auto &iter : map) {
|
||||
const std::string &value = iter.second;
|
||||
// Parse the string.
|
||||
PlayTime gameTime{};
|
||||
if (2 == sscanf(value.c_str(), "%d,%llu", &gameTime.totalTimePlayed, (long long *)&gameTime.lastTimePlayed)) {
|
||||
tracker_[key] = gameTime;
|
||||
tracker_[iter.first.c_str()] = gameTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue