This commit is contained in:
aozhiwei 2024-09-05 16:46:35 +08:00
parent 0c7047a18b
commit d1a289b78d

View File

@ -18,6 +18,7 @@ struct AttrAddition : public std::enable_shared_from_this<AttrAddition>
list_head list_entry;
int attr_id;
float value;
float finaly_value;
int source_type = kAstNone;
std::shared_ptr<AttrAddition> holder;
std::shared_ptr<std::function<std::string()>> get_source;
@ -45,6 +46,7 @@ static std::array<std::vector<std::shared_ptr<AttrAddition>>, kAstEnd> s_speed_r
static float CalcSpeedRateIn(list_head* head)
{
{
list_head* pos = nullptr;
list_head* next = nullptr;
list_for_each_safe(pos, next, head) {
@ -66,9 +68,21 @@ static float CalcSpeedRateIn(list_head* head)
break;
}
}
}
{
for (auto& itr : s_speed_ratein_list) {
std::sort(itr.begin(), itr.end(),
[] (std::shared_ptr<AttrAddition> a, std::shared_ptr<AttrAddition> b) -> bool
{
return std::fabs(a->value) > std::fabs(b->value);
});
}
}
{
for (auto& itr : s_speed_ratein_list) {
itr.clear();
}
}
return 0.0f;
}