Author: shadowmaster
Date: Wed Mar 21 10:05:07 2012
New Revision: 53596

URL: http://svn.gna.org/viewcvs/wesnoth?rev=53596&view=rev
Log:
addon/mg: Fix undesired results when cancelling the View Mode selection dialog

This was actually caused by a broken assumption (namely, that a
cancelled dialog would return the old index instead of -1) since I
apparently fail at keeping my own Doxygen comments up to date. Because
of this, we were casting -1 into some enum value (apparently zero),
making Cancel always return to the All Add-ons view.

Modified:
    trunk/src/addon/manager_ui.cpp

Modified: trunk/src/addon/manager_ui.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/addon/manager_ui.cpp?rev=53596&r1=53595&r2=53596&view=diff
==============================================================================
--- trunk/src/addon/manager_ui.cpp (original)
+++ trunk/src/addon/manager_ui.cpp Wed Mar 21 10:05:07 2012
@@ -96,7 +96,9 @@
        dlg.set_selected_index(initial);
        dlg.show(video);
 
-       return VIEW_MODE(dlg.selected_index());
+       const int result = dlg.selected_index();
+
+       return result != -1 ? VIEW_MODE(result) : initial;
 }
 
 inline const addon_info& addon_at(const std::string& id, const addons_list& 
addons)


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

Reply via email to