From 45fc45a49e61c61646b9997840e92f25bb8ccde9 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Tue, 15 Nov 2011 11:02:47 +0200 Subject: Sending of textures WIP --- src/server.cpp | 165 ++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 145 insertions(+), 20 deletions(-) (limited to 'src/server.cpp') diff --git a/src/server.cpp b/src/server.cpp index 9a7f1e972..44c66447c 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -944,6 +944,35 @@ u32 PIChecksum(core::list &l) return checksum; } +struct ModSpec +{ + std::string name; + std::string path; + + ModSpec(const std::string &name_="", const std::string path_=""): + name(name_), + path(path_) + {} +}; + +static core::list getMods(core::list &modspaths) +{ + core::list mods; + for(core::list::Iterator i = modspaths.begin(); + i != modspaths.end(); i++){ + std::string modspath = *i; + std::vector dirlist = fs::GetDirListing(modspath); + for(u32 j=0; j modspaths; - modspaths.push_back(porting::path_data + DIR_DELIM + "mods"); - for(core::list::Iterator i = modspaths.begin(); - i != modspaths.end(); i++){ - std::string modspath = *i; - std::vector dirlist = fs::GetDirListing(modspath); - for(u32 j=0; j mods = getMods(m_modspaths); + for(core::list::Iterator i = mods.begin(); + i != mods.end(); i++){ + ModSpec mod = *i; + infostream<<"Server: Loading mod \""< textures; + core::list mods = getMods(m_modspaths); + for(core::list::Iterator i = mods.begin(); + i != mods.end(); i++){ + ModSpec mod = *i; + std::string texturepath = mod.path + DIR_DELIM + "textures"; + std::vector dirlist = fs::GetDirListing(texturepath); + for(u32 j=0; j::Iterator i = textures.begin(); + i != textures.end(); i++){ + os<name); + os<data); + } + + // Make data buffer + std::string s = os.str(); + infostream<<"Server::SendTextures(): number of textures: " + < data((u8*)s.c_str(), s.size()); + // Send as reliable + m_con.Send(peer_id, 0, data, true); +} + /* Something random */ -- cgit v1.2.3