X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FAnimation.cc;fp=src%2FAnimation.cc;h=6df85562b7252505229c22838ae9beda7fbdbbda;hp=2a3d03a5922e62a6ef68e4cf106dd3a0e8c1c99b;hb=90b2c7fb10b244b781b84965a0d36f1f323ee94d;hpb=8148b51f1bec8f662672d3ca36eea1784991e5cc diff --git a/src/Animation.cc b/src/Animation.cc index 2a3d03a..6df8556 100644 --- a/src/Animation.cc +++ b/src/Animation.cc @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -151,13 +152,18 @@ public: void init(const std::string& name) { Mf::Script script; - std::string filePath = Animation::getPath(name); + std::string path(name); + + if (!Animation::getPath(path)) + { + Mf::Error(Mf::Error::RESOURCE_NOT_FOUND).raise(); + } script.importBaseLibrary(); importLogFunctions(script); importAnimationBindings(script); - if (script.doFile(filePath) != Mf::Script::SUCCESS) + if (script.doFile(path) != Mf::Script::SUCCESS) { std::string str; script[-1].get(str); @@ -322,8 +328,8 @@ unsigned Animation::getFrame() const * the "animations" subdirectory of any of the search directories. */ -std::string Animation::getPath(const std::string& name) +bool Animation::getPath(std::string& name) { - return Mf::Resource::getPath("animations/" + name + ".lua"); + return Mf::Resource::getPath(name, "animations/", "lua"); }