mail[Wesnoth-commits] r28580 - /trunk/src/addon_management.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by koraq on August 14, 2008 - 18:56:
Author: mordante
Date: Thu Aug 14 18:20:55 2008
New Revision: 28580

URL: http://svn.gna.org/viewcvs/wesnoth?rev=28580&view=rev
Log:
Fix the addon server dialog when using --new-widgets.
Removed some C-ism.

Modified:
    trunk/src/addon_management.cpp

Modified: trunk/src/addon_management.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/addon_management.cpp?rev=28580&r1=28579&r2=28580&view=diff
==============================================================================
--- trunk/src/addon_management.cpp (original)
+++ trunk/src/addon_management.cpp Thu Aug 14 18:20:55 2008
@@ -1101,15 +1101,18 @@
                        dlg2.show();
                }
        }
+
+
+       const int addon_download  = 0;
+       const int addon_uninstall = 2;  // NOTE this value is also known by 
WML so don't change it.
+       const int addon_update    = 3;
+
 } // end unnamed namespace 4
 
-#define ADDONS_OPT_DOWNLOAD            0
-#define ADDONS_OPT_UNINSTALL   2
-#define ADDONS_OPT_UPDATE              3
-
 void manage_addons(game_display& disp)
 {
        int res;
+       bool do_refresh = false;
        std::string remote_host;
        const std::string default_host = preferences::campaign_server();
        
@@ -1137,26 +1140,26 @@
                                      gui::dialog::BUTTON_EXTRA_LEFT);
 #endif
                svr_dialog.add_button(new gui::dialog_button(disp.video(), 
_("Uninstall add-ons"),
-                                     gui::button::TYPE_PRESS, 
ADDONS_OPT_UNINSTALL),
+                                     gui::button::TYPE_PRESS, 
addon_uninstall),
                                      gui::dialog::BUTTON_EXTRA);
                res = svr_dialog.show();
                remote_host = svr_dialog.textbox_text();
-               bool do_refresh = false;
-               switch(res) {
-                       case ADDONS_OPT_UPDATE:
-                       case ADDONS_OPT_DOWNLOAD:
-                               download_addons(disp, remote_host, 
res==ADDONS_OPT_UPDATE, &do_refresh);
-                               break;
-                       case ADDONS_OPT_UNINSTALL:
-                               uninstall_local_addons(disp, &do_refresh);
-                               break;
-                       default:
-                               return;
-               }
-               // Signal game_controller to reload WML
-               if(do_refresh) {
-                       throw config_changed_exception();
-               }
+       }
+
+       switch(res) {
+               case addon_update:
+               case addon_download:
+                       download_addons(disp, remote_host, res==addon_update, 
&do_refresh);
+                       break;
+               case addon_uninstall:
+                       uninstall_local_addons(disp, &do_refresh);
+                       break;
+               default:
+                       return;
+       }
+       // Signal game_controller to reload WML
+       if(do_refresh) {
+               throw config_changed_exception();
        }
 }
 




Related Messages


Powered by MHonArc, Updated Thu Aug 14 19:42:23 2008