mail[Wesnoth-commits] r44277 - /trunk/src/mouse_events.cpp


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

Header


Content

Posted by guillaume . melquiond on July 18, 2010 - 09:00:
Author: silene
Date: Sun Jul 18 09:00:49 2010
New Revision: 44277

URL: http://svn.gna.org/viewcvs/wesnoth?rev=44277&view=rev
Log:
Avoided displaying an empty menu and therefore choosing a random weapon, when 
there is none. (Fix for bug #16235.)

Modified:
    trunk/src/mouse_events.cpp

Modified: trunk/src/mouse_events.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/mouse_events.cpp?rev=44277&r1=44276&r2=44277&view=diff
==============================================================================
--- trunk/src/mouse_events.cpp (original)
+++ trunk/src/mouse_events.cpp Sun Jul 18 09:00:49 2010
@@ -754,6 +754,21 @@
        std::vector<battle_context> bc_vector;
        int best = fill_weapon_choices(bc_vector, attacker, defender);
 
+       if (bc_vector.empty())
+       {
+               dialogs::units_list_preview_pane attacker_preview(*attacker, 
dialogs::unit_preview_pane::SHOW_BASIC, true);
+               dialogs::units_list_preview_pane defender_preview(*defender, 
dialogs::unit_preview_pane::SHOW_BASIC, false);
+               std::vector<gui::preview_pane*> preview_panes;
+               preview_panes.push_back(&attacker_preview);
+               preview_panes.push_back(&defender_preview);
+
+               gui::show_dialog(gui(), NULL, _("Attack Enemy"),
+                       _("No usable weapon"), gui::CANCEL_ONLY, NULL,
+                       &preview_panes, "", NULL, -1, NULL, -1, -1, NULL, 
NULL);
+               return -1;
+       }
+
+
        std::vector<std::string> items;
 
        for (unsigned int i = 0; i < bc_vector.size(); i++) {




Related Messages


Powered by MHonArc, Updated Sun Jul 18 09:20:12 2010