From c95cbdc2c913d4234554e3643051e1ca1e124d33 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 4 May 2018 11:50:51 +0200 Subject: JANITORIAL: Fix formatting --- engines/prince/resource.h | 94 +++++++++++++++++++++++------------------------ 1 file changed, 47 insertions(+), 47 deletions(-) (limited to 'engines') diff --git a/engines/prince/resource.h b/engines/prince/resource.h index 6c823a7702..a2cd8a6262 100644 --- a/engines/prince/resource.h +++ b/engines/prince/resource.h @@ -32,66 +32,66 @@ namespace Prince { namespace Resource { - template - bool loadFromStream(T &resource, Common::SeekableReadStream &stream) { - return resource.loadStream(stream); - } - - template - bool loadResource(T *resource, const char *resourceName, bool required) { - Common::ScopedPtr stream(SearchMan.createReadStreamForMember(resourceName)); - if (!stream) { - if (required) - error("Can't load %s", resourceName); - return false; - } +template +bool loadFromStream(T &resource, Common::SeekableReadStream &stream) { + return resource.loadStream(stream); +} - return loadFromStream(*resource, *stream); +template +bool loadResource(T *resource, const char *resourceName, bool required) { + Common::ScopedPtr stream(SearchMan.createReadStreamForMember(resourceName)); + if (!stream) { + if (required) + error("Can't load %s", resourceName); + return false; } - template - bool loadResource(Common::Array &array, Common::SeekableReadStream &stream, bool required = true) { - T t; - while (t.loadFromStream(stream)) - array.push_back(t); + return loadFromStream(*resource, *stream); +} - return true; - } +template +bool loadResource(Common::Array &array, Common::SeekableReadStream &stream, bool required = true) { + T t; + while (t.loadFromStream(stream)) + array.push_back(t); + return true; +} - template - bool loadResource(Common::Array &array, const char *resourceName, bool required = true) { - Common::ScopedPtr stream(SearchMan.createReadStreamForMember(resourceName)); - if (!stream) { - if (required) - error("Can't load %s", resourceName); - return false; - } - return loadResource(array, *stream, required); +template +bool loadResource(Common::Array &array, const char *resourceName, bool required = true) { + Common::ScopedPtr stream(SearchMan.createReadStreamForMember(resourceName)); + if (!stream) { + if (required) + error("Can't load %s", resourceName); + return false; } - template - bool loadResource(Common::Array &array, const char *resourceName, bool required = true) { + return loadResource(array, *stream, required); +} - Common::ScopedPtr stream(SearchMan.createReadStreamForMember(resourceName)); - if (!stream) { - if (required) - error("Can't load %s", resourceName); - return false; - } +template +bool loadResource(Common::Array &array, const char *resourceName, bool required = true) { - // FIXME: This is stupid. Maybe loadFromStream should be helper method that returns initialized object - while (true) { - T* t = new T(); - if (!t->loadFromStream(*stream)) { - delete t; - break; - } - array.push_back(t); + Common::ScopedPtr stream(SearchMan.createReadStreamForMember(resourceName)); + if (!stream) { + if (required) + error("Can't load %s", resourceName); + return false; + } + + // FIXME: This is stupid. Maybe loadFromStream should be helper method that returns initialized object + while (true) { + T* t = new T(); + if (!t->loadFromStream(*stream)) { + delete t; + break; } - return true; + array.push_back(t); } + return true; +} } -- cgit v1.2.3