mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-06-13 11:24:28 +02:00
fixing new gcc warning in GPU allocator, fixing #55
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/04/10 11:59:57 by maldavid #+# #+# */
|
||||
/* Updated: 2024/03/14 17:31:55 by maldavid ### ########.fr */
|
||||
/* Updated: 2024/03/25 16:17:06 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace mlx
|
||||
std::shared_ptr<Text> TextLibrary::getTextData(TextID id)
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
if(!_cache.count(id) || std::find(_invalid_ids.begin(), _invalid_ids.end(), id) != _invalid_ids.end())
|
||||
if(!_cache.count(id))
|
||||
core::error::report(e_kind::fatal_error, "Text Library : wrong text ID '%d'", id);
|
||||
return _cache[id];
|
||||
}
|
||||
@@ -32,7 +32,7 @@ namespace mlx
|
||||
MLX_PROFILE_FUNCTION();
|
||||
auto it = std::find_if(_cache.begin(), _cache.end(), [&](const std::pair<TextID, std::shared_ptr<Text>>& v)
|
||||
{
|
||||
return v.second->getText() == text->getText() && std::find(_invalid_ids.begin(), _invalid_ids.end(), v.first) == _invalid_ids.end();
|
||||
return v.second->getText() == text->getText() && v.second->getColor() == text->getColor();
|
||||
});
|
||||
if(it != _cache.end())
|
||||
return it->first;
|
||||
@@ -44,23 +44,20 @@ namespace mlx
|
||||
void TextLibrary::removeTextFromLibrary(TextID id)
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
if(!_cache.count(id) || std::find(_invalid_ids.begin(), _invalid_ids.end(), id) != _invalid_ids.end())
|
||||
if(!_cache.count(id))
|
||||
{
|
||||
core::error::report(e_kind::warning, "Text Library : trying to remove a text with an unkown or invalid ID '%d'", id);
|
||||
return;
|
||||
}
|
||||
_cache[id]->destroy();
|
||||
_invalid_ids.push_back(id);
|
||||
_cache.erase(id);
|
||||
}
|
||||
|
||||
void TextLibrary::clearLibrary()
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
for(auto& [id, text] : _cache)
|
||||
{
|
||||
text->destroy();
|
||||
_invalid_ids.push_back(id);
|
||||
}
|
||||
_cache.clear();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user