Skip to content

Commit

Permalink
Fix Linux Build
Browse files Browse the repository at this point in the history
  • Loading branch information
caxanga334 committed Dec 3, 2024
1 parent 044d927 commit d0d5cc8
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions extension/bot/interfaces/profile.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ class DifficultyProfile
* @brief Retrieves a custom data value from the difficulty profile.
* @tparam T Data type to convert to.
*
* A static assertion will fail if the data type is not supported.
* If type is not supported, will always return the default value.
*
* Supported types: bool, int, float, double.
*
* The data is internally stored as a float.
* @param key Custom data key name
* @param defaultValue Default value to return if the key doesn't exists.
* @return Key value or default if not found
Expand Down Expand Up @@ -123,9 +127,25 @@ class DifficultyProfile
return defaultValue;
}
}
else if constexpr (std::is_same<T, double>::value || std::is_same<T, const double>::value)
{
auto it = custom_data.find(key);

if (it != custom_data.end())
{
return static_cast<double>(it->second);

}
else // not found
{
return defaultValue;
}
}
else
{
static_assert(false, "GetCustomData unsupported data type!");
// this always fails on Clang
// static_assert(false, "GetCustomData unsupported data type!");
return defaultValue;
}
}

Expand Down

0 comments on commit d0d5cc8

Please sign in to comment.