Author: alink
Date: Sun Jul 13 03:09:38 2008
New Revision: 27967
URL: http://svn.gna.org/viewcvs/wesnoth?rev=27967&view=rev
Log:
In "Create Unit" dialog, pre-select the last created unit.
Allow to quickly create an army of clones.
Modified:
trunk/changelog
trunk/src/menu_events.cpp
Modified: trunk/changelog
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=27967&r1=27966&r2=27967&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Sun Jul 13 03:09:38 2008
@@ -57,6 +57,7 @@
* new debug command ":choose_level" or ":cn" to directly go to a scenario.
* new debug command feature, ":next_level Some_Id" to directly go to
scenario having id=Some_Id.
+ * 'Create Unit' dialog pre-select the last created unit type
* multiplayer:
* Added support for multiple sides per client in MP start
* Added support for reserving slots when reloading game
Modified: trunk/src/menu_events.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/menu_events.cpp?rev=27967&r1=27966&r2=27967&view=diff
==============================================================================
--- trunk/src/menu_events.cpp (original)
+++ trunk/src/menu_events.cpp Sun Jul 13 03:09:38 2008
@@ -1454,6 +1454,7 @@
void menu_handler::create_unit(mouse_handler& mousehandler)
{
std::vector<std::string> options;
+ static int last_selection = -1;
std::vector<const unit_type*> unit_choices;
const std::string heading = std::string(1,HEADING_PREFIX) +
_("Race") + COLUMN_SEPARATOR +
@@ -1492,7 +1493,10 @@
//sort by race then by type name
umenu.get_menu().sort_by(1);
umenu.get_menu().sort_by(0);
- umenu.get_menu().reset_selection();
+ if (last_selection >= 0)
+ umenu.get_menu().move_selection(last_selection);
+ else
+ umenu.get_menu().reset_selection();
dialogs::unit_types_preview_pane unit_preview(*gui_,
&map_, unit_choices, filter, 1, dialogs::unit_types_preview_pane::SHOW_ALL);
umenu.add_pane(&unit_preview);
@@ -1503,6 +1507,7 @@
}
if (size_t(choice) < unit_choices.size()) {
+ last_selection = choice;
units_.erase(mousehandler.get_last_hex());
unit
chosen(&units_,&map_,&status_,&teams_,unit_choices[choice],1,false);
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits