Open heinezen opened 3 years ago
and in what place should this be done?
Currently you pass a function to the Database initialization (db.load()
, the filefetcher_t
), which is passed to read files. When this is implemented, nyan would get passed an object of abstract type that provides file opening/reading features. This abstract type is then made concrete in openage by implementing it (i.e. a subclass) that calls to openage's filesystem abstraction features (but that doesn't concern this issue directly of course, since we only need to provide an api class).
If we just want to replace the filefetcher_t
for now, the simplest variant is:
class nyan::Filesystem {
public:
virtual nyan::File open_file(const std::string &filename) = 0;
}
nyan should provide a file api that we can inherit from.
Then we can natively interface to the openage file abstraction and do not need to read the whole file in the engine. Basically a
class nyan::Filesystem
that is specialized by openage. Ideally, the returned file lazily accesses all data throughopenage::util::File
.