Bit of cleanup.
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#include "TextureAsset.hpp"
|
||||
#include "util/memory.hpp"
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
|
@ -24,24 +24,24 @@ TrueTypeAsset::TrueTypeAsset(AssetManager *assMan, std::string name) :
|
||||
lbt.erase(it0);
|
||||
|
||||
auto it1 = this->textureByLock.find(id);
|
||||
assertTrue(it1 != this->textureByLock.end(), "Could not remove textureByLock");
|
||||
assertTrue(
|
||||
it1 != this->textureByLock.end(), "Could not remove textureByLock"
|
||||
);
|
||||
this->textureByLock.erase(it1);
|
||||
|
||||
if(lbt.empty()) {
|
||||
auto it2 = locksByTexture.find(texture);
|
||||
assertTrue(it2 != locksByTexture.end(), "Could not remove locksByTexture");
|
||||
assertTrue(
|
||||
it2 != locksByTexture.end(), "Could not remove locksByTexture"
|
||||
);
|
||||
locksByTexture.erase(it2);
|
||||
|
||||
auto it3 = textureByStyle.begin();
|
||||
while(it3 != textureByStyle.end()) {
|
||||
if(it3->second == texture) it3 = textureByStyle.erase(it3);
|
||||
++it3;
|
||||
}
|
||||
|
||||
auto it4 = std::find(textures.begin(), textures.end(), texture);
|
||||
assertTrue(it4 != textures.end(), "Could not remove textureByStyle");
|
||||
textures.erase(it4);
|
||||
std::erase_if(textureByStyle, [&](const auto &item){
|
||||
auto const& [key, value] = item;
|
||||
return value == texture;
|
||||
});
|
||||
|
||||
std::erase(textures, texture);
|
||||
delete texture;
|
||||
}
|
||||
};
|
||||
|
@ -38,7 +38,9 @@ namespace Dawn {
|
||||
std::vector<struct TrueTypeAssetStyle> assetStyles;
|
||||
std::vector<TrueTypeFaceTexture*> textures;
|
||||
std::map<usagelockid_t, TrueTypeFaceTexture*> textureByLock;
|
||||
std::map<struct TrueTypeFaceTextureStyle, TrueTypeFaceTexture*> textureByStyle;
|
||||
std::map<struct TrueTypeFaceTextureStyle, TrueTypeFaceTexture*>
|
||||
textureByStyle
|
||||
;
|
||||
std::map<TrueTypeFaceTexture*, std::vector<usagelockid_t>> locksByTexture;
|
||||
|
||||
public:
|
||||
|
Reference in New Issue
Block a user