X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fsprite%2Fsprite_data.cpp;h=e4d29e4dda0a7ef04a91c1deaa675bda60c8faab;hb=0ebb40343bafd9f8b047c1917c91ab3611ded965;hp=38e58d5fc5151cff1635adb78d30729eb6a29b8a;hpb=8099ed94a2642c410ebcd1315a28d14fa6524d49;p=supertux.git diff --git a/src/sprite/sprite_data.cpp b/src/sprite/sprite_data.cpp index 38e58d5fc..e4d29e4dd 100644 --- a/src/sprite/sprite_data.cpp +++ b/src/sprite/sprite_data.cpp @@ -102,7 +102,7 @@ SpriteData::parse_action(const Reader& lisp, const std::string& basedir) std::string mirror_action; lisp.get("mirror-action", mirror_action); if(!mirror_action.empty()) { - Action* act_tmp = get_action(mirror_action); + const Action* act_tmp = get_action(mirror_action); if(act_tmp == NULL) { throw std::runtime_error("Could not mirror action. Action not found.\n" "Mirror actions must be defined after the real one!"); @@ -110,7 +110,7 @@ SpriteData::parse_action(const Reader& lisp, const std::string& basedir) float max_w = 0; float max_h = 0; for(int i = 0; static_cast(i) < act_tmp->surfaces.size(); i++) { - SurfacePtr surface(new Surface(*act_tmp->surfaces[i])); + SurfacePtr surface = act_tmp->surfaces[i]->clone(); surface->hflip(); max_w = std::max(max_w, (float) surface->get_width()); max_h = std::max(max_h, (float) surface->get_height()); @@ -142,8 +142,8 @@ SpriteData::parse_action(const Reader& lisp, const std::string& basedir) actions[action->name] = action; } -SpriteData::Action* -SpriteData::get_action(std::string act) +const SpriteData::Action* +SpriteData::get_action(const std::string& act) { Actions::iterator i = actions.find(act); if(i == actions.end()) {