mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Server pushing media at runtime (#9961)
This commit is contained in:
parent
982a030f33
commit
2424dfe007
16 changed files with 263 additions and 85 deletions
|
@ -670,11 +670,9 @@ void Client::step(float dtime)
|
|||
}
|
||||
}
|
||||
|
||||
bool Client::loadMedia(const std::string &data, const std::string &filename)
|
||||
bool Client::loadMedia(const std::string &data, const std::string &filename,
|
||||
bool from_media_push)
|
||||
{
|
||||
// Silly irrlicht's const-incorrectness
|
||||
Buffer<char> data_rw(data.c_str(), data.size());
|
||||
|
||||
std::string name;
|
||||
|
||||
const char *image_ext[] = {
|
||||
|
@ -690,6 +688,9 @@ bool Client::loadMedia(const std::string &data, const std::string &filename)
|
|||
io::IFileSystem *irrfs = RenderingEngine::get_filesystem();
|
||||
video::IVideoDriver *vdrv = RenderingEngine::get_video_driver();
|
||||
|
||||
// Silly irrlicht's const-incorrectness
|
||||
Buffer<char> data_rw(data.c_str(), data.size());
|
||||
|
||||
// Create an irrlicht memory file
|
||||
io::IReadFile *rfile = irrfs->createMemoryReadFile(
|
||||
*data_rw, data_rw.getSize(), "_tempreadfile");
|
||||
|
@ -727,7 +728,6 @@ bool Client::loadMedia(const std::string &data, const std::string &filename)
|
|||
".x", ".b3d", ".md2", ".obj",
|
||||
NULL
|
||||
};
|
||||
|
||||
name = removeStringEnd(filename, model_ext);
|
||||
if (!name.empty()) {
|
||||
verbosestream<<"Client: Storing model into memory: "
|
||||
|
@ -744,6 +744,8 @@ bool Client::loadMedia(const std::string &data, const std::string &filename)
|
|||
};
|
||||
name = removeStringEnd(filename, translate_ext);
|
||||
if (!name.empty()) {
|
||||
if (from_media_push)
|
||||
return false;
|
||||
TRACESTREAM(<< "Client: Loading translation: "
|
||||
<< "\"" << filename << "\"" << std::endl);
|
||||
g_client_translations->loadTranslation(data);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue