gui: type safe resources part 2

- separate collections for fonts, images, animations
- no more ugly casts
- fix crash if main ui.xml did not define any resources but include did
- don't stop loading resources if one "type" attribute is missing

Change-Id: I70c1c9ca66ca65d9fba1ba3eded34f3d8a07488e
diff --git a/gui/resources.hpp b/gui/resources.hpp
index 69d2427..83fc7a5 100644
--- a/gui/resources.hpp
+++ b/gui/resources.hpp
@@ -18,7 +18,6 @@
 
 public:
 	std::string GetName() { return mName; }
-	virtual bool loadedOK() = 0;
 
 private:
 	std::string mName;
@@ -47,8 +46,6 @@
 	void* GetResource() { return this ? mFont : NULL; }
 	int GetHeight() { return gr_getMaxFontHeight(this ? mFont : NULL); }
 
-	virtual bool loadedOK() { return mFont != NULL; }
-
 protected:
 	void* mFont;
 	Type m_type;
@@ -65,8 +62,6 @@
 	int GetWidth() { return gr_get_width(this ? mSurface : NULL); }
 	int GetHeight() { return gr_get_height(this ? mSurface : NULL); }
 
-	virtual bool loadedOK() { return mSurface != NULL; }
-
 protected:
 	gr_surface mSurface;
 };
@@ -83,7 +78,6 @@
 	int GetWidth() { return gr_get_width(this ? GetResource() : NULL); }
 	int GetHeight() { return gr_get_height(this ? GetResource() : NULL); }
 	int GetResourceCount() { return mSurfaces.size(); }
-	virtual bool loadedOK() { return !mSurfaces.empty(); }
 
 protected:
 	std::vector<gr_surface> mSurfaces;
@@ -92,15 +86,19 @@
 class ResourceManager
 {
 public:
-	ResourceManager(xml_node<>* resList, ZipArchive* pZip);
+	ResourceManager();
 	virtual ~ResourceManager();
 	void LoadResources(xml_node<>* resList, ZipArchive* pZip);
 
 public:
-	Resource* FindResource(std::string name);
+	FontResource* FindFont(const std::string& name) const;
+	ImageResource* FindImage(const std::string& name) const;
+	AnimationResource* FindAnimation(const std::string& name) const;
 
 private:
-	std::vector<Resource*> mResources;
+	std::vector<FontResource*> mFonts;
+	std::vector<ImageResource*> mImages;
+	std::vector<AnimationResource*> mAnimations;
 };
 
 #endif  // _RESOURCE_HEADER