Author: ai0867
Date: Mon Sep 22 12:07:48 2008
New Revision: 29637

URL: http://svn.gna.org/viewcvs/wesnoth?rev=29637&view=rev
Log:
* Removed the requirement for files in ~campaigns to have a corresponding 
directory.

Modified:
    trunk/changelog
    trunk/src/game.cpp

Modified: trunk/changelog
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=29637&r1=29636&r2=29637&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Mon Sep 22 12:07:48 2008
@@ -47,6 +47,8 @@
    * Improved performance of 'recall' user action when disallow_recall
      is set to true in scenarios.
    * Various code cleanups
+   * Removed the requirement for files in ~campaigns to have a corresponding
+     directory.
 
 Version 1.5.4:
  * Editor2:

Modified: trunk/src/game.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game.cpp?rev=29637&r1=29636&r2=29637&view=diff
==============================================================================
--- trunk/src/game.cpp (original)
+++ trunk/src/game.cpp Mon Sep 22 12:07:48 2008
@@ -1457,9 +1457,26 @@
                std::vector< std::string > error_addons;
                // Scan addon directories
                std::vector<std::string> user_addons;
-
-               
get_files_in_dir(user_campaign_dir,NULL,&user_addons,ENTIRE_FILE_PATH);
+               // Scan for standalone files
+               std::vector<std::string> user_files;
+
+               
get_files_in_dir(user_campaign_dir,&user_files,&user_addons,ENTIRE_FILE_PATH);
                std::string user_error_log;
+
+               // Append the standalone files, with '.cfg' removed, to the 
directories.
+               // They will be caught by the oldstyle_cfg so we don't need to 
duplicate logic.
+               // FIXME: rewrite this code so it does the following:
+               // -Include $user_campaign_dir/*.cfg
+               // -Include $user_campaign_dir/*/_main.cfg
+               for(std::vector<std::string>::const_iterator uc = 
user_files.begin(); uc != user_files.end(); ++uc) {
+                       std::string full_file = *uc;
+                       if(full_file.substr(full_file.size() - 4, 
full_file.size()) != ".cfg")
+                               continue;
+                       std::string file = full_file.substr(0, full_file.size() 
- 4);
+                       if(std::find(user_addons.begin(), user_addons.end(), 
file) == user_addons.end()) {
+                               user_addons.push_back(file);
+                       }
+               }
 
                // Load the addons
                for(std::vector<std::string>::const_iterator uc = 
user_addons.begin(); uc != user_addons.end(); ++uc) {


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to