Skip to content

Commit

Permalink
use std::optional in calcantipodes() for #268
Browse files Browse the repository at this point in the history
  • Loading branch information
no-lex committed Jan 21, 2024
1 parent a6f6935 commit 9ddc7c7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/engine/model/skelmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,18 +276,18 @@ void skelmodel::skeleton::calcantipodes()
}
if(i + 1 == schedule.size())
{
int conflict = INT_MAX;
std::optional<int> conflict = std::nullopt;
for(int j = 0; j < numbones; ++j)
{
if(bones[j].group < numbones && bones[j].scheduled < 0)
{
conflict = std::min(conflict, std::abs(bones[j].group));
conflict = std::min(conflict.value(), std::abs(bones[j].group));
}
}
if(conflict < numbones)
if(conflict)
{
bones[conflict].scheduled = schedule.size();
schedule.push_back(conflict);
bones[conflict.value()].scheduled = schedule.size();
schedule.push_back(conflict.value());
}
}
}
Expand Down

0 comments on commit 9ddc7c7

Please sign in to comment.