mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-15 15:30:29 +02:00
Minor code simplification (ToMap instead of section->GetKeys)
See #18442
This commit is contained in:
1 parent
a094637ab1
commit
99962b91e5
1 file changed
+4
-9
+4
-9
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user