mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
[System/Core] Simplify loops
This commit is contained in:
parent
8aac45fec0
commit
4b92848bdc
@ -261,20 +261,20 @@ void OnScreenDisplay::SetProgressBar(std::string_view id, std::string_view messa
|
||||
|
||||
void OnScreenDisplay::RemoveProgressBar(const std::string &id, bool success, float delay_s) {
|
||||
std::lock_guard<std::mutex> guard(mutex_);
|
||||
for (auto iter = entries_.begin(); iter != entries_.end(); iter++) {
|
||||
if (iter->type == OSDType::PROGRESS_BAR && iter->id == id) {
|
||||
for (auto &ent : entries_) {
|
||||
if (ent.type == OSDType::PROGRESS_BAR && ent.id == id) {
|
||||
if (success) {
|
||||
// Quickly shoot up to max, if we weren't there.
|
||||
if (iter->maxValue != 0.0f) {
|
||||
iter->progress = iter->maxValue;
|
||||
if (ent.maxValue != 0.0f) {
|
||||
ent.progress = ent.maxValue;
|
||||
} else {
|
||||
// Fake a full progress
|
||||
iter->minValue = 0;
|
||||
iter->maxValue = 1;
|
||||
iter->progress = 1;
|
||||
ent.minValue = 0;
|
||||
ent.maxValue = 1;
|
||||
ent.progress = 1;
|
||||
}
|
||||
}
|
||||
iter->endTime = time_now_d() + delay_s + FadeoutTime();
|
||||
ent.endTime = time_now_d() + delay_s + FadeoutTime();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1514,16 +1514,12 @@ void Config::RemoveRecent(const std::string &file) {
|
||||
|
||||
private_->ResetRecentIsosThread();
|
||||
std::lock_guard<std::mutex> guard(private_->recentIsosLock);
|
||||
const std::string filename = File::ResolvePath(file);
|
||||
for (auto iter = recentIsos.begin(); iter != recentIsos.end();) {
|
||||
const std::string recent = File::ResolvePath(*iter);
|
||||
if (filename == recent) {
|
||||
// Note that the increment-erase idiom doesn't work with vectors.
|
||||
iter = recentIsos.erase(iter);
|
||||
} else {
|
||||
iter++;
|
||||
}
|
||||
}
|
||||
|
||||
const auto &filename = File::ResolvePath(file);
|
||||
std::remove_if(recentIsos.begin(), recentIsos.end(), [filename](const auto &str) {
|
||||
const auto &recent = File::ResolvePath(str);
|
||||
return filename == recent;
|
||||
});
|
||||
}
|
||||
|
||||
void Config::CleanRecent() {
|
||||
|
Loading…
Reference in New Issue
Block a user