Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor AnimationSet loading #964

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion NAS2D/Resource/AnimationSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ bool AnimationSet::Frame::isStopFrame() const
}


AnimationSet::AnimationSet(std::string fileName) :
AnimationSet::AnimationSet(const std::string& fileName) :
mFileName{fileName}
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the more proper solution here is to use std::move.

mFileName{std::move(fileName)}

You don't want to be passing by const& when using std::move. That would end up silently forcing a copy instead.

try {
Expand Down
2 changes: 1 addition & 1 deletion NAS2D/Resource/AnimationSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace NAS2D
bool isStopFrame() const;
};

explicit AnimationSet(std::string fileName);
explicit AnimationSet(const std::string& fileName);
explicit AnimationSet(const Xml::XmlElement& element);
AnimationSet(std::string fileName, std::map<std::string, std::string> imageSheetMap, std::map<std::string, std::vector<Frame>> actions);

Expand Down