Daniele Bartolini пре 10 година
родитељ
комит
869b447042

+ 60 - 2
src/compilers/bundle_compiler.cpp

@@ -13,8 +13,20 @@
 #include "path.h"
 #include "disk_filesystem.h"
 #include "compile_options.h"
-#include "resource_registry.h"
 #include "temp_allocator.h"
+#include "sort_map.h"
+#include "lua_resource.h"
+#include "texture_resource.h"
+#include "mesh_resource.h"
+#include "sound_resource.h"
+#include "sprite_resource.h"
+#include "package_resource.h"
+#include "unit_resource.h"
+#include "physics_resource.h"
+#include "material_resource.h"
+#include "font_resource.h"
+#include "level_resource.h"
+#include "shader.h"
 
 namespace crown
 {
@@ -22,7 +34,38 @@ namespace crown
 BundleCompiler::BundleCompiler(const char* source_dir, const char* bundle_dir)
 	: _source_fs(source_dir)
 	, _bundle_fs(bundle_dir)
+	, _compilers(default_allocator())
 {
+	namespace pcr = physics_config_resource;
+	namespace phr = physics_resource;
+	namespace pkr = package_resource;
+	namespace sdr = sound_resource;
+	namespace mhr = mesh_resource;
+	namespace utr = unit_resource;
+	namespace txr = texture_resource;
+	namespace mtr = material_resource;
+	namespace lur = lua_resource;
+	namespace ftr = font_resource;
+	namespace lvr = level_resource;
+	namespace spr = sprite_resource;
+	namespace shr = shader_resource;
+	namespace sar = sprite_animation_resource;
+
+	register_resource_compiler(SCRIPT_TYPE,           lur::compile);
+	register_resource_compiler(TEXTURE_TYPE,          txr::compile);
+	register_resource_compiler(MESH_TYPE,             mhr::compile);
+	register_resource_compiler(SOUND_TYPE,            sdr::compile);
+	register_resource_compiler(UNIT_TYPE,             utr::compile);
+	register_resource_compiler(SPRITE_TYPE,           spr::compile);
+	register_resource_compiler(PACKAGE_TYPE,          pkr::compile);
+	register_resource_compiler(PHYSICS_TYPE,          phr::compile);
+	register_resource_compiler(MATERIAL_TYPE,         mtr::compile);
+	register_resource_compiler(PHYSICS_CONFIG_TYPE,   pcr::compile);
+	register_resource_compiler(FONT_TYPE,             ftr::compile);
+	register_resource_compiler(LEVEL_TYPE,            lvr::compile);
+	register_resource_compiler(SHADER_TYPE,           shr::compile);
+	register_resource_compiler(SPRITE_ANIMATION_TYPE, sar::compile);
+
 	DiskFilesystem temp;
 	temp.create_directory(bundle_dir);
 }
@@ -51,8 +94,10 @@ bool BundleCompiler::compile(const char* type, const char* name, const char* pla
 	CE_LOGI("%s <= %s.%s", res_name, name, type);
 
 	File* outf = _bundle_fs.open(path.c_str(), FOM_WRITE);
+
 	CompileOptions opts(_source_fs, outf, platform);
-	resource_on_compile(_type, src_path.c_str(), opts);
+	compile(_type, src_path.c_str(), opts);
+
 	_bundle_fs.close(outf);
 	return true;
 }
@@ -104,6 +149,19 @@ bool BundleCompiler::compile_all(const char* platform)
 	return true;
 }
 
+void BundleCompiler::register_resource_compiler(StringId64 type, CompileFunction compiler)
+{
+	CE_ASSERT_NOT_NULL(compiler);
+	sort_map::set(_compilers, type, compiler);
+	sort_map::sort(_compilers);
+}
+
+void BundleCompiler::compile(StringId64 type, const char* path, CompileOptions& opts)
+{
+	CE_ASSERT(sort_map::has(_compilers, type), "Compiler not found");
+	sort_map::get(_compilers, type, (CompileFunction)NULL)(path, opts);
+}
+
 void BundleCompiler::scan(const char* cur_dir, Vector<DynamicString>& files)
 {
 	Vector<DynamicString> my_files(default_allocator());

+ 10 - 0
src/compilers/bundle_compiler.h

@@ -7,6 +7,7 @@
 
 #include "disk_filesystem.h"
 #include "container_types.h"
+#include "compile_options.h"
 
 namespace crown
 {
@@ -25,10 +26,19 @@ public:
 
 	void scan(const char* cur_dir, Vector<DynamicString>& files);
 
+private:
+
+	typedef void (*CompileFunction)(const char* path, CompileOptions& opts);
+
+	void register_resource_compiler(StringId64 type, CompileFunction compiler);
+	void compile(StringId64 type, const char* path, CompileOptions& opts);
+
 private:
 
 	DiskFilesystem _source_fs;
 	DiskFilesystem _bundle_fs;
+
+	SortMap<StringId64, CompileFunction> _compilers;
 };
 
 namespace bundle_compiler

+ 0 - 8
src/resource/font_resource.cpp

@@ -80,14 +80,6 @@ namespace font_resource
 		return res;
 	}
 
-	void online(StringId64 /*id*/, ResourceManager& /*rm*/)
-	{
-	}
-
-	void offline(StringId64 /*id*/, ResourceManager& /*rm*/)
-	{
-	}
-
 	void unload(Allocator& allocator, void* resource)
 	{
 		allocator.deallocate(resource);

+ 0 - 2
src/resource/font_resource.h

@@ -39,8 +39,6 @@ namespace font_resource
 {
 	void compile(const char* path, CompileOptions& opts);
 	void* load(File& file, Allocator& a);
-	void online(StringId64 /*id*/, ResourceManager& /*rm*/);
-	void offline(StringId64 /*id*/, ResourceManager& /*rm*/);
 	void unload(Allocator& allocator, void* resource);
 
 	uint32_t num_glyphs(const FontResource* fr);

+ 0 - 8
src/resource/level_resource.cpp

@@ -98,14 +98,6 @@ namespace level_resource
 		return res;
 	}
 
-	void online(StringId64 /*id*/, ResourceManager& /*rm*/)
-	{
-	}
-
-	void offline(StringId64 /*id*/, ResourceManager& /*rm*/)
-	{
-	}
-
 	void unload(Allocator& allocator, void* resource)
 	{
 		allocator.deallocate(resource);

+ 0 - 2
src/resource/level_resource.h

@@ -46,8 +46,6 @@ namespace level_resource
 {
 	void compile(const char* path, CompileOptions& opts);
 	void* load(File& file, Allocator& a);
-	void online(StringId64 /*id*/, ResourceManager& /*rm*/);
-	void offline(StringId64 /*id*/, ResourceManager& /*rm*/);
 	void unload(Allocator& allocator, void* resource);
 
 	uint32_t num_units(const LevelResource* lr);

+ 0 - 8
src/resource/lua_resource.cpp

@@ -73,14 +73,6 @@ namespace lua_resource
 		return res;
 	}
 
-	void online(StringId64 /*id*/, ResourceManager& /*rm*/)
-	{
-	}
-
-	void offline(StringId64 /*id*/, ResourceManager& /*rm*/)
-	{
-	}
-
 	void unload(Allocator& allocator, void* resource)
 	{
 		allocator.deallocate(resource);

+ 0 - 2
src/resource/lua_resource.h

@@ -23,8 +23,6 @@ namespace lua_resource
 {
 	void compile(const char* path, CompileOptions& opts);
 	void* load(File& file, Allocator& a);
-	void online(StringId64 /*id*/, ResourceManager& /*rm*/);
-	void offline(StringId64 /*id*/, ResourceManager& /*rm*/);
 	void unload(Allocator& allocator, void* resource);
 
 	/// Returns the size in bytes of the lua program.

+ 0 - 8
src/resource/package_resource.cpp

@@ -160,14 +160,6 @@ namespace package_resource
 		return pr;
 	}
 
-	void online(StringId64 /*id*/, ResourceManager& /*rm*/)
-	{
-	}
-
-	void offline(StringId64 /*id*/, ResourceManager& /*rm*/)
-	{
-	}
-
 	void unload(Allocator& a, void* resource)
 	{
 		CE_DELETE(a, (PackageResource*)resource);

+ 0 - 2
src/resource/package_resource.h

@@ -50,8 +50,6 @@ namespace package_resource
 {
 	void compile(const char* path, CompileOptions& opts);
 	void* load(File& file, Allocator& a);
-	void online(StringId64 /*id*/, ResourceManager& /*rm*/);
-	void offline(StringId64 /*id*/, ResourceManager& /*rm*/);
 	void unload(Allocator& allocator, void* resource);
 } // namespace package_resource
 } // namespace crown

+ 0 - 16
src/resource/physics_resource.cpp

@@ -346,14 +346,6 @@ namespace physics_resource
 		return res;
 	}
 
-	void online(StringId64 /*id*/, ResourceManager& /*rm*/)
-	{
-	}
-
-	void offline(StringId64 /*id*/, ResourceManager& /*rm*/)
-	{
-	}
-
 	void unload(Allocator& allocator, void* resource)
 	{
 		allocator.deallocate(resource);
@@ -721,14 +713,6 @@ namespace physics_config_resource
 		return res;
 	}
 
-	void online(StringId64 /*id*/, ResourceManager& /*rm*/)
-	{
-	}
-
-	void offline(StringId64 /*id*/, ResourceManager& /*rm*/)
-	{
-	}
-
 	void unload(Allocator& allocator, void* resource)
 	{
 		allocator.deallocate(resource);

+ 0 - 4
src/resource/physics_resource.h

@@ -112,8 +112,6 @@ namespace physics_resource
 {
 	void compile(const char* path, CompileOptions& opts);
 	void* load(File& file, Allocator& a);
-	void online(StringId64 /*id*/, ResourceManager& /*rm*/);
-	void offline(StringId64 /*id*/, ResourceManager& /*rm*/);
 	void unload(Allocator& allocator, void* resource);
 
 	bool has_controller(const PhysicsResource* pr);
@@ -183,8 +181,6 @@ namespace physics_config_resource
 {
 	void compile(const char* path, CompileOptions& opts);
 	void* load(File& file, Allocator& a);
-	void online(StringId64 /*id*/, ResourceManager& /*rm*/);
-	void offline(StringId64 /*id*/, ResourceManager& /*rm*/);
 	void unload(Allocator& allocator, void* resource);
 
 	uint32_t num_materials(const PhysicsConfigResource* pcr);

+ 1 - 2
src/resource/resource_loader.cpp

@@ -6,7 +6,6 @@
 #include "resource_loader.h"
 #include "config.h"
 #include "memory.h"
-#include "resource_registry.h"
 #include "queue.h"
 #include "filesystem.h"
 #include "temp_allocator.h"
@@ -90,7 +89,7 @@ int32_t ResourceLoader::run()
 		path::join(CROWN_DATA_DIRECTORY, name, path);
 
 		File* file = _fs.open(path.c_str(), FOM_READ);
-		rr.data = resource_on_load(rr.type, *file, *rr.allocator);
+		rr.data = rr.load_function(*file, *rr.allocator);
 		_fs.close(file);
 
 		add_loaded(rr);

+ 3 - 0
src/resource/resource_loader.h

@@ -17,8 +17,11 @@ namespace crown
 
 struct ResourceRequest
 {
+	typedef void* (*LoadFunction)(File& file, Allocator& a);
+
 	StringId64 type;
 	StringId64 name;
+	LoadFunction load_function;
 	Allocator* allocator;
 	void* data;
 };

+ 86 - 6
src/resource/resource_manager.cpp

@@ -5,10 +5,21 @@
 
 #include "resource_manager.h"
 #include "resource_loader.h"
-#include "resource_registry.h"
 #include "temp_allocator.h"
 #include "sort_map.h"
 #include "array.h"
+#include "lua_resource.h"
+#include "texture_resource.h"
+#include "mesh_resource.h"
+#include "sound_resource.h"
+#include "sprite_resource.h"
+#include "package_resource.h"
+#include "unit_resource.h"
+#include "physics_resource.h"
+#include "material_resource.h"
+#include "font_resource.h"
+#include "level_resource.h"
+#include "shader.h"
 
 namespace crown
 {
@@ -18,9 +29,39 @@ const ResourceManager::ResourceEntry ResourceManager::ResourceEntry::NOT_FOUND =
 ResourceManager::ResourceManager(ResourceLoader& rl)
 	: _resource_heap("resource", default_allocator())
 	, _loader(&rl)
+	, _type_data(default_allocator())
 	, _rm(default_allocator())
 	, _autoload(false)
 {
+	namespace pcr = physics_config_resource;
+	namespace phr = physics_resource;
+	namespace pkr = package_resource;
+	namespace sdr = sound_resource;
+	namespace mhr = mesh_resource;
+	namespace utr = unit_resource;
+	namespace txr = texture_resource;
+	namespace mtr = material_resource;
+	namespace lur = lua_resource;
+	namespace ftr = font_resource;
+	namespace lvr = level_resource;
+	namespace spr = sprite_resource;
+	namespace shr = shader_resource;
+	namespace sar = sprite_animation_resource;
+
+	register_resource_type(SCRIPT_TYPE,           lur::load, NULL,        NULL,         lur::unload);
+	register_resource_type(TEXTURE_TYPE,          txr::load, txr::online, txr::offline, txr::unload);
+	register_resource_type(MESH_TYPE,             mhr::load, mhr::online, mhr::offline, mhr::unload);
+	register_resource_type(SOUND_TYPE,            sdr::load, NULL,        NULL,         sdr::unload);
+	register_resource_type(UNIT_TYPE,             utr::load, NULL,        NULL,         utr::unload);
+	register_resource_type(SPRITE_TYPE,           spr::load, spr::online, spr::offline, spr::unload);
+	register_resource_type(PACKAGE_TYPE,          pkr::load, NULL,        NULL,         pkr::unload);
+	register_resource_type(PHYSICS_TYPE,          phr::load, NULL,        NULL,         phr::unload);
+	register_resource_type(MATERIAL_TYPE,         mtr::load, mtr::online, mtr::offline, mtr::unload);
+	register_resource_type(PHYSICS_CONFIG_TYPE,   pcr::load, NULL,        NULL,         pcr::unload);
+	register_resource_type(FONT_TYPE,             ftr::load, NULL,        NULL,         ftr::unload);
+	register_resource_type(LEVEL_TYPE,            lvr::load, NULL,        NULL,         lvr::unload);
+	register_resource_type(SHADER_TYPE,           shr::load, shr::online, shr::offline, shr::unload);
+	register_resource_type(SPRITE_ANIMATION_TYPE, sar::load, NULL,        NULL,         sar::unload);
 }
 
 ResourceManager::~ResourceManager()
@@ -30,8 +71,10 @@ ResourceManager::~ResourceManager()
 
 	for (; begin != end; begin++)
 	{
-		resource_on_offline(begin->pair.first.type, begin->pair.first.name, *this);
-		resource_on_unload(begin->pair.first.type, _resource_heap, begin->pair.second.data);
+		const StringId64 type = begin->pair.first.type;
+		const StringId64 name = begin->pair.first.name;
+		on_offline(type, name);
+		on_unload(type, begin->pair.second.data);
 	}
 }
 
@@ -45,6 +88,7 @@ void ResourceManager::load(StringId64 type, StringId64 name)
 		ResourceRequest rr;
 		rr.type = type;
 		rr.name = name;
+		rr.load_function = sort_map::get(_type_data, type, ResourceTypeData()).load;
 		rr.allocator = &_resource_heap;
 		rr.data = NULL;
 
@@ -64,8 +108,8 @@ void ResourceManager::unload(StringId64 type, StringId64 name)
 
 	if (--entry.references == 0)
 	{
-		resource_on_offline(type, name, *this);
-		resource_on_unload(type, _resource_heap, entry.data);
+		on_offline(type, name);
+		on_unload(type, entry.data);
 
 		sort_map::remove(_rm, id);
 		sort_map::sort(_rm);
@@ -141,7 +185,43 @@ void ResourceManager::complete_request(StringId64 type, StringId64 name, void* d
 	sort_map::set(_rm, make_pair(type, name), entry);
 	sort_map::sort(_rm);
 
-	resource_on_online(type, name, *this);
+	on_online(type, name);
+}
+
+void ResourceManager::register_resource_type(StringId64 type, LoadFunction load, OnlineFunction online, OfflineFunction offline, UnloadFunction unload)
+{
+	CE_ASSERT_NOT_NULL(load);
+	CE_ASSERT_NOT_NULL(unload);
+
+	ResourceTypeData data;
+	data.load = load;
+	data.online = online;
+	data.offline = offline;
+	data.unload = unload;
+
+	sort_map::set(_type_data, type, data);
+	sort_map::sort(_type_data);
+}
+
+void ResourceManager::on_online(StringId64 type, StringId64 name)
+{
+	OnlineFunction func = sort_map::get(_type_data, type, ResourceTypeData()).online;
+
+	if (func)
+		func(name, *this);
+}
+
+void ResourceManager::on_offline(StringId64 type, StringId64 name)
+{
+	OfflineFunction func = sort_map::get(_type_data, type, ResourceTypeData()).offline;
+
+	if (func)
+		func(name, *this);
+}
+
+void ResourceManager::on_unload(StringId64 type, void* data)
+{
+	sort_map::get(_type_data, type, ResourceTypeData()).unload(_resource_heap, data);
 }
 
 } // namespace crown

+ 22 - 0
src/resource/resource_manager.h

@@ -10,6 +10,7 @@
 #include "resource_types.h"
 #include "proxy_allocator.h"
 #include "string_id.h"
+#include "filesystem_types.h"
 
 namespace crown
 {
@@ -55,6 +56,17 @@ public:
 
 private:
 
+	typedef void* (*LoadFunction)(File& file, Allocator& a);
+	typedef void (*OnlineFunction)(StringId64 name, ResourceManager& rm);
+	typedef void (*OfflineFunction)(StringId64 name, ResourceManager& rm);
+	typedef void (*UnloadFunction)(Allocator& allocator, void* resource);
+
+	void register_resource_type(StringId64 type, LoadFunction load, OnlineFunction online, OfflineFunction offline, UnloadFunction unload);
+
+	void on_online(StringId64 type, StringId64 name);
+	void on_offline(StringId64 type, StringId64 name);
+	void on_unload(StringId64 type, void* data);
+
 	void complete_request(StringId64 type, StringId64 name, void* data);
 
 private:
@@ -89,10 +101,20 @@ private:
 		static const ResourceEntry NOT_FOUND;
 	};
 
+	struct ResourceTypeData
+	{
+		LoadFunction load;
+		OnlineFunction online;
+		OfflineFunction offline;
+		UnloadFunction unload;
+	};
+
+	typedef SortMap<StringId64, ResourceTypeData> TypeMap;
 	typedef SortMap<ResourcePair, ResourceEntry> ResourceMap;
 
 	ProxyAllocator _resource_heap;
 	ResourceLoader* _loader;
+	TypeMap _type_data;
 	ResourceMap _rm;
 	bool _autoload;
 };

+ 0 - 114
src/resource/resource_registry.cpp

@@ -1,114 +0,0 @@
-/*
- * Copyright (c) 2012-2015 Daniele Bartolini and individual contributors.
- * License: https://github.com/taylor001/crown/blob/master/LICENSE
- */
-
-#include "resource_registry.h"
-#include "error.h"
-#include "lua_resource.h"
-#include "texture_resource.h"
-#include "mesh_resource.h"
-#include "sound_resource.h"
-#include "sprite_resource.h"
-#include "package_resource.h"
-#include "unit_resource.h"
-#include "physics_resource.h"
-#include "material_resource.h"
-#include "font_resource.h"
-#include "level_resource.h"
-#include "shader.h"
-
-namespace crown
-{
-
-namespace pcr = physics_config_resource;
-namespace phr = physics_resource;
-namespace pkr = package_resource;
-namespace sdr = sound_resource;
-namespace mhr = mesh_resource;
-namespace utr = unit_resource;
-namespace txr = texture_resource;
-namespace mtr = material_resource;
-namespace lur = lua_resource;
-namespace ftr = font_resource;
-namespace lvr = level_resource;
-namespace spr = sprite_resource;
-namespace shr = shader_resource;
-namespace sar = sprite_animation_resource;
-
-typedef void  (*ResourceCompileCallback)(const char* path, CompileOptions& opts);
-typedef void* (*ResourceLoadCallback)(File& file, Allocator& a);
-typedef void  (*ResourceOnlineCallback)(StringId64 id, ResourceManager& rm);
-typedef void  (*ResourceOfflineCallback)(StringId64 id, ResourceManager& rm);
-typedef void  (*ResourceUnloadCallback)(Allocator& a, void* resource);
-
-struct ResourceCallback
-{
-	StringId64 type;
-	ResourceCompileCallback on_compile;
-	ResourceLoadCallback on_load;
-	ResourceUnloadCallback on_unload;
-	ResourceOnlineCallback on_online;
-	ResourceOfflineCallback on_offline;
-};
-
-#define NULL_RESOURCE_TYPE StringId64(uint64_t(0))
-
-static const ResourceCallback RESOURCE_CALLBACK_REGISTRY[] =
-{
-	{ SCRIPT_TYPE,           lur::compile, lur::load, lur::unload, lur::online, lur::offline },
-	{ TEXTURE_TYPE,          txr::compile, txr::load, txr::unload, txr::online, txr::offline },
-	{ MESH_TYPE,             mhr::compile, mhr::load, mhr::unload, mhr::online, mhr::offline },
-	{ SOUND_TYPE,            sdr::compile, sdr::load, sdr::unload, sdr::online, sdr::offline },
-	{ UNIT_TYPE,             utr::compile, utr::load, utr::unload, utr::online, utr::offline },
-	{ SPRITE_TYPE,           spr::compile, spr::load, spr::unload, spr::online, spr::offline },
-	{ PACKAGE_TYPE,          pkr::compile, pkr::load, pkr::unload, pkr::online, pkr::offline },
-	{ PHYSICS_TYPE,          phr::compile, phr::load, phr::unload, phr::online, phr::offline },
-	{ MATERIAL_TYPE,         mtr::compile, mtr::load, mtr::unload, mtr::online, mtr::offline },
-	{ PHYSICS_CONFIG_TYPE,   pcr::compile, pcr::load, pcr::unload, pcr::online, pcr::offline },
-	{ FONT_TYPE,             ftr::compile, ftr::load, ftr::unload, ftr::online, ftr::offline },
-	{ LEVEL_TYPE,            lvr::compile, lvr::load, lvr::unload, lvr::online, lvr::offline },
-	{ SHADER_TYPE,           shr::compile, shr::load, shr::unload, shr::online, shr::offline },
-	{ SPRITE_ANIMATION_TYPE, sar::compile, sar::load, sar::unload, sar::online, sar::offline },
-	{ NULL_RESOURCE_TYPE,    NULL,         NULL,      NULL,        NULL,        NULL         }
-};
-
-static const ResourceCallback* find_callback(StringId64 type)
-{
-	const ResourceCallback* c = RESOURCE_CALLBACK_REGISTRY;
-
-	while (c->type != NULL_RESOURCE_TYPE && c->type != type)
-	{
-		c++;
-	}
-
-	CE_ASSERT(c->type != NULL_RESOURCE_TYPE, "Compiler not found");
-	return c;
-}
-
-void resource_on_compile(StringId64 type, const char* path, CompileOptions& opts)
-{
-	return find_callback(type)->on_compile(path, opts);
-}
-
-void* resource_on_load(StringId64 type, File& file, Allocator& a)
-{
-	return find_callback(type)->on_load(file, a);
-}
-
-void resource_on_unload(StringId64 type, Allocator& allocator, void* resource)
-{
-	return find_callback(type)->on_unload(allocator, resource);
-}
-
-void resource_on_online(StringId64 type, StringId64 name, ResourceManager& rm)
-{
-	return find_callback(type)->on_online(name, rm);
-}
-
-void resource_on_offline(StringId64 type, StringId64 name, ResourceManager& rm)
-{
-	return find_callback(type)->on_offline(name, rm);
-}
-
-} // namespace crown

+ 0 - 24
src/resource/resource_registry.h

@@ -1,24 +0,0 @@
-/*
- * Copyright (c) 2012-2015 Daniele Bartolini and individual contributors.
- * License: https://github.com/taylor001/crown/blob/master/LICENSE
- */
-
-#pragma once
-
-#include "types.h"
-#include "memory_types.h"
-#include "resource_types.h"
-#include "compiler_types.h"
-#include "filesystem_types.h"
-#include "string_id.h"
-
-namespace crown
-{
-
-void resource_on_compile(StringId64 type, const char* path, CompileOptions& opts);
-void* resource_on_load(StringId64 type, File& file, Allocator& a);
-void resource_on_online(StringId64 type, StringId64 name, ResourceManager& rm);
-void resource_on_offline(StringId64 type, StringId64 name, ResourceManager& rm);
-void resource_on_unload(StringId64 type, Allocator& allocator, void* resource);
-
-} // namespace crown

+ 0 - 8
src/resource/sound_resource.cpp

@@ -77,14 +77,6 @@ namespace sound_resource
 		return res;
 	}
 
-	void online(StringId64 /*id*/, ResourceManager& /*rm*/)
-	{
-	}
-
-	void offline(StringId64 /*id*/, ResourceManager& /*rm*/)
-	{
-	}
-
 	void unload(Allocator& allocator, void* resource)
 	{
 		allocator.deallocate(resource);

+ 0 - 2
src/resource/sound_resource.h

@@ -41,8 +41,6 @@ namespace sound_resource
 {
 	void compile(const char* path, CompileOptions& opts);
 	void* load(File& file, Allocator& a);
-	void online(StringId64 /*id*/, ResourceManager& /*rm*/);
-	void offline(StringId64 /*id*/, ResourceManager& /*rm*/);
 	void unload(Allocator& allocator, void* resource);
 
 	uint32_t size(const SoundResource* sr);

+ 0 - 8
src/resource/sprite_resource.cpp

@@ -242,14 +242,6 @@ namespace sprite_animation_resource
 		return res;
 	}
 
-	void online(StringId64 /*id*/, ResourceManager& /*rm*/)
-	{
-	}
-
-	void offline(StringId64 /*id*/, ResourceManager& /*rm*/)
-	{
-	}
-
 	void unload(Allocator& a, void* resource)
 	{
 		a.deallocate(resource);

+ 0 - 8
src/resource/unit_resource.cpp

@@ -364,14 +364,6 @@ namespace unit_resource
 		return res;
 	}
 
-	void online(StringId64 /*id*/, ResourceManager& /*rm*/)
-	{
-	}
-
-	void offline(StringId64 /*id*/, ResourceManager& /*rm*/)
-	{
-	}
-
 	void unload(Allocator& allocator, void* resource)
 	{
 		allocator.deallocate(resource);

+ 0 - 2
src/resource/unit_resource.h

@@ -71,8 +71,6 @@ namespace unit_resource
 {
 	void compile(const char* path, CompileOptions& opts);
 	void* load(File& file, Allocator& a);
-	void online(StringId64 /*id*/, ResourceManager& /*rm*/);
-	void offline(StringId64 /*id*/, ResourceManager& /*rm*/);
 	void unload(Allocator& allocator, void* resource);
 
 	StringId64 sprite_animation(const UnitResource* ur);