memory-related refactor
This commit is contained in:
+12
-12
@@ -18,8 +18,8 @@ Texture* Assets::getTexture(std::string name) const {
|
||||
return found->second.get();
|
||||
}
|
||||
|
||||
void Assets::store(Texture* texture, std::string name){
|
||||
textures.emplace(name, texture);
|
||||
void Assets::store(std::unique_ptr<Texture> texture, std::string name){
|
||||
textures.emplace(name, std::move(texture));
|
||||
}
|
||||
|
||||
|
||||
@@ -30,8 +30,8 @@ Shader* Assets::getShader(std::string name) const{
|
||||
return found->second.get();
|
||||
}
|
||||
|
||||
void Assets::store(Shader* shader, std::string name){
|
||||
shaders.emplace(name, shader);
|
||||
void Assets::store(std::unique_ptr<Shader> shader, std::string name){
|
||||
shaders.emplace(name, std::move(shader));
|
||||
}
|
||||
|
||||
Font* Assets::getFont(std::string name) const {
|
||||
@@ -41,8 +41,8 @@ Font* Assets::getFont(std::string name) const {
|
||||
return found->second.get();
|
||||
}
|
||||
|
||||
void Assets::store(Font* font, std::string name){
|
||||
fonts.emplace(name, font);
|
||||
void Assets::store(std::unique_ptr<Font> font, std::string name){
|
||||
fonts.emplace(name, std::move(font));
|
||||
}
|
||||
|
||||
Atlas* Assets::getAtlas(std::string name) const {
|
||||
@@ -52,8 +52,8 @@ Atlas* Assets::getAtlas(std::string name) const {
|
||||
return found->second.get();
|
||||
}
|
||||
|
||||
void Assets::store(Atlas* atlas, std::string name){
|
||||
atlases.emplace(name, atlas);
|
||||
void Assets::store(std::unique_ptr<Atlas> atlas, std::string name){
|
||||
atlases.emplace(name, std::move(atlas));
|
||||
}
|
||||
|
||||
audio::Sound* Assets::getSound(std::string name) const {
|
||||
@@ -63,8 +63,8 @@ audio::Sound* Assets::getSound(std::string name) const {
|
||||
return found->second.get();
|
||||
}
|
||||
|
||||
void Assets::store(audio::Sound* sound, std::string name) {
|
||||
sounds.emplace(name, sound);
|
||||
void Assets::store(std::unique_ptr<audio::Sound> sound, std::string name) {
|
||||
sounds.emplace(name, std::move(sound));
|
||||
}
|
||||
|
||||
const std::vector<TextureAnimation>& Assets::getAnimations() {
|
||||
@@ -82,6 +82,6 @@ UiDocument* Assets::getLayout(std::string name) const {
|
||||
return found->second.get();
|
||||
}
|
||||
|
||||
void Assets::store(UiDocument* layout, std::string name) {
|
||||
layouts[name] = std::shared_ptr<UiDocument>(layout);
|
||||
void Assets::store(std::unique_ptr<UiDocument> layout, std::string name) {
|
||||
layouts[name] = std::shared_ptr<UiDocument>(std::move(layout));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user