From 50621ffe851223fb791d4ba47959585154d59d3f Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Tue, 20 Mar 2012 01:06:44 +0200 Subject: Fix mod paths --- src/server.cpp | 22 +++++++--------------- src/subgame.cpp | 12 +++++++----- src/subgame.h | 6 +++--- 3 files changed, 17 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/server.cpp b/src/server.cpp index b95d04713..87d43dc69 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -885,25 +885,13 @@ Server::Server( infostream<<"- world: "<::const_iterator i = m_gamespec.addon_paths.begin(); - i != m_gamespec.addon_paths.end(); i++) - infostream<<"- addons: "<<(*i)<::const_iterator i = m_gamespec.addon_paths.begin(); - i != m_gamespec.addon_paths.end(); i++) - m_modspaths.push_front((*i) + DIR_DELIM + "mods"); - // Add simple user mod search path - m_modspaths.push_front(porting::path_user + DIR_DELIM + "mods" - + DIR_DELIM + m_gamespec.id); + for(std::set::const_iterator i = m_gamespec.mods_paths.begin(); + i != m_gamespec.mods_paths.end(); i++) + m_modspaths.push_front((*i)); // Print out mod search paths for(core::list::Iterator i = m_modspaths.begin(); @@ -912,6 +900,10 @@ Server::Server( infostream<<"- mods: "< addon_paths; + // Find mod directories + std::set mods_paths; + mods_paths.insert(game_path + DIR_DELIM + "mods"); if(!user_game) - addon_paths.insert(share + DIR_DELIM + "addons" + DIR_DELIM + id); - addon_paths.insert(user + DIR_DELIM + "addons" + DIR_DELIM + id); + mods_paths.insert(share + DIR_DELIM + "mods" + DIR_DELIM + id); + if(user != share || user_game) + mods_paths.insert(user + DIR_DELIM + "mods" + DIR_DELIM + id); // TODO: Read proper name from game_path/game.conf std::string game_name = id; - return SubgameSpec(id, game_path, addon_paths, game_name); + return SubgameSpec(id, game_path, mods_paths, game_name); } std::set getAvailableGameIds() diff --git a/src/subgame.h b/src/subgame.h index b201a7402..061bb4180 100644 --- a/src/subgame.h +++ b/src/subgame.h @@ -28,16 +28,16 @@ struct SubgameSpec { std::string id; // "" = game does not exist std::string path; - std::set addon_paths; + std::set mods_paths; std::string name; SubgameSpec(const std::string &id_="", const std::string &path_="", - const std::set &addon_paths_=std::set(), + const std::set &mods_paths_=std::set(), const std::string &name_=""): id(id_), path(path_), - addon_paths(addon_paths_), + mods_paths(mods_paths_), name(name_) {} -- cgit v1.2.3