Author: ilor
Date: Sun Aug 17 21:39:57 2008
New Revision: 28688

URL: http://svn.gna.org/viewcvs/wesnoth?rev=28688&view=rev
Log:
editor2: alt+# scrolls to staring position # when starting position tool is 
active

Modified:
    trunk/data/core/editor2-tool-hints.cfg
    trunk/src/editor2/mouse_action.cpp

Modified: trunk/data/core/editor2-tool-hints.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/core/editor2-tool-hints.cfg?rev=28688&r1=28687&r2=28688&view=diff
==============================================================================
--- trunk/data/core/editor2-tool-hints.cfg (original)
+++ trunk/data/core/editor2-tool-hints.cfg Sun Aug 17 21:39:57 2008
@@ -18,5 +18,5 @@
 
 [editor2_tool_hint]
        id="editor-tool-starting-position"
-       text= _ "Left mouse button displays player selection, right clears. 
Keys 1-9 set respectove starting position under cursor and delete clears"
+       text= _ "Left mouse button displays player selection, right clears. 
Keys 1-9 set respectove starting position under cursor and delete clears, 
alt+key scrolls to the starting position."
 [/editor2_tool_hint]

Modified: trunk/src/editor2/mouse_action.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/mouse_action.cpp?rev=28688&r1=28687&r2=28688&view=diff
==============================================================================
--- trunk/src/editor2/mouse_action.cpp (original)
+++ trunk/src/editor2/mouse_action.cpp Sun Aug 17 21:39:57 2008
@@ -268,10 +268,20 @@
 
 editor_action* mouse_action_starting_position::key_event(editor_display& disp, 
const SDL_Event& event)
 {
+       if (has_alt_modifier() && (event.key.keysym.sym >= '1' && 
event.key.keysym.sym <= '9')) {
+               int side = event.key.keysym.sym - '0';
+               if (side >= 1 && side <= gamemap::MAX_PLAYERS) {
+                       gamemap::location pos = 
disp.get_map().starting_position(side);
+                       if (pos.valid()) {
+                               disp.scroll_to_tile(pos, display::WARP);
+                       }
+               }
+               return NULL;
+       }
+       if (!disp.map().on_board(previous_move_hex_) || event.type != 
SDL_KEYUP) {
+               return NULL;
+       }
        editor_action* a = NULL;
-       if (!disp.map().on_board(previous_move_hex_) || event.type != 
SDL_KEYUP) {
-               return NULL;
-       }
        if ((event.key.keysym.sym >= '1' && event.key.keysym.sym <= '9') || 
event.key.keysym.sym == SDLK_DELETE) {
                int res = event.key.keysym.sym - '0';
                if (res > gamemap::MAX_PLAYERS || event.key.keysym.sym == 
SDLK_DELETE) res = 0;


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

Reply via email to