Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2003:
[Freeciv-Dev] Re: (PR#2608) replace key_move_xxx with key_unit_move
Home

[Freeciv-Dev] Re: (PR#2608) replace key_move_xxx with key_unit_move

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#2608) replace key_move_xxx with key_unit_move
From: "Jason Short via RT" <rt@xxxxxxxxxxxxxx>
Date: Thu, 23 Jan 2003 09:38:41 -0800
Reply-to: rt@xxxxxxxxxxxxxx

rwetmore@xxxxxxxxxxxx via RT wrote:
> At 11:38 PM 02/12/18 -0800, Jason Short via RT wrote:
> 
>>This patch replaces key_move_xxx functions with a single function
>>key_unit_move.  This new function takes a dir8 parameter giving the
>>_GUI_ direction of the unit's movement.  This GUI direction is converted
>>into a _map_ direction by the backend.

Here is a new version of the patch.

Now gui_to_map_dir and map_to_gui_dir are both provided, in 
mapview_common.  Eventually they may move into climap.[ch] (once these 
fies exist).

They stay as functions, not macros - although if other people would also 
rather have them as macros then so be it.

>>This provides three advantages:
>>
>>- It gets rid of lots of unnecessary code.
>>
>>- It provides native support for isometric, non-isometric, and (I think)
>>any future view modes we may come up with.  (Ross, if you think this is
>>an insufficient design please propose a better one.)
> 
> 
> I like the sentiment, but haven't drunk enough of the code yet to get
> over the initial bad taste.
> 
> First, the conversion is from enum direction8 to the same enum. I'm
> happy enough to associate the DIR8_XXX enums with GUI directions, but
> think one needs to split map and GUI by creating a corresponding set
> of map enums that are clearly different. I'd do this now to make it
> clear that is what is happening.

As I said before, i don't think it's advantageous to provide different 
enums for each different set of directions.  map, native, and index 
positions all use the same type (int or int*int), so why shouldn't gui, 
map, and native directions?  The alternative IMO is to do something like

enum gui_direction {
   DIRGUI_UP,
   ...
   DIRGUI_DOWNLEFT
};

enum map_direction {
   DIRMAP_UP,
   ...
   DIRMAP_DOWNLEFT
};

enum nat_direction {
   DIRNAT_NORTH,
   ...
   DIRNAT_SOUTHWEST
};

since neither GUI nor map directions correspond to "world" directions. 
(Consider an non-iso-view GUI with an iso map - now 
DIRGUI_UP==DIRMAP_UP==DIRNAT_NORTHEAST, which is the true 'northeast' 
direction.  So only the native directions are true.)

Does anyone else have an opinion?

> I'm also not completely happy with assigning directions like "NORTH"
> to *any* coordinate axes, because as with the rotation of the iso, 
> DIR8_NORTH is now DIRMAP_NORTHWEST, and the compass direction is 
> becoming a very fuzzy concept. I can relate to GUI NORTH as "up"
> on a cartesian screen (i.e. (0,-1)) but this is because of standard
> map convention. Standard/internal map NORTH which may be NORTHWEST or 
> who knows what depending on the topology and other factors such as
> how best to represent it in a cartesian grid, is where I start to 
> lose it. 

IMO "NORTH" is more clear than "UP" although it can lead to confusion.

> I definitely think the gui_to_map_dir() and map_to_gui_dir() 
> transformations should end up in a "GUI_map".h (currently tilespec.h
> is the dumping ground for gui coordinate stuff, at least it has the
> DIR4_XXX and if DIR8_XXX are GUI they should move out of map.h to a
> GUI location - the corecleanups really abused tilespec.h. but CVS 
> can get it right if it starts early).

IMO we should have two new file groups:

   drawing.[ch] contains drawing code; this includes code currently
   in tilespec, mapview_common, and mapview.

   climap.[ch] contains map code; this includes code currently in
   tilespec and mapview_common (and maybe mapview).

but this should be its own cleanup, not a part of a separate patch.

jason

Index: client//control.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/control.c,v
retrieving revision 1.91
diff -u -r1.91 control.c
--- client//control.c   2003/01/16 21:04:25     1.91
+++ client//control.c   2003/01/23 17:34:47
@@ -1407,75 +1407,15 @@
 }
 
 /**************************************************************************
-...
+  Move the focus unit in the given direction.  Here directions are
+  defined according to the GUI, so that north is "up" in the interface.
 **************************************************************************/
-void key_move_north(void)
+void key_unit_move(enum direction8 gui_dir)
 {
-  if(get_unit_in_focus())
-    request_move_unit_direction(punit_focus, DIR8_NORTH);
-}
-
-/**************************************************************************
-...
-**************************************************************************/
-void key_move_north_east(void)
-{
-  if(get_unit_in_focus())
-    request_move_unit_direction(punit_focus, DIR8_NORTHEAST);
-}
-
-/**************************************************************************
-...
-**************************************************************************/
-void key_move_east(void)
-{
-  if(get_unit_in_focus())
-    request_move_unit_direction(punit_focus, DIR8_EAST);
-}
-
-/**************************************************************************
-...
-**************************************************************************/
-void key_move_south_east(void)
-{
-  if(get_unit_in_focus())
-     request_move_unit_direction(punit_focus, DIR8_SOUTHEAST);
-}
-
-/**************************************************************************
-...
-**************************************************************************/
-void key_move_south(void)
-{
-  if(get_unit_in_focus())
-     request_move_unit_direction(punit_focus, DIR8_SOUTH);
-}
-
-/**************************************************************************
-...
-**************************************************************************/
-void key_move_south_west(void)
-{
-  if(get_unit_in_focus())
-     request_move_unit_direction(punit_focus, DIR8_SOUTHWEST);
-}
-
-/**************************************************************************
-...
-**************************************************************************/
-void key_move_west(void)
-{
-  if(get_unit_in_focus())
-    request_move_unit_direction(punit_focus, DIR8_WEST);
-}
-
-/**************************************************************************
-...
-**************************************************************************/
-void key_move_north_west(void)
-{
-  if(get_unit_in_focus())
-     request_move_unit_direction(punit_focus, DIR8_NORTHWEST);
+  if (get_unit_in_focus()) {
+    enum direction8 map_dir = gui_to_map_dir(gui_dir);
+    request_move_unit_direction(get_unit_in_focus(), map_dir);
+  }
 }
 
 /**************************************************************************
Index: client//control.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/control.h,v
retrieving revision 1.30
diff -u -r1.30 control.h
--- client//control.h   2002/11/22 18:52:12     1.30
+++ client//control.h   2003/01/23 17:34:47
@@ -116,14 +116,7 @@
 void key_fog_of_war_toggle(void);
 void key_end_turn(void);
 void key_map_grid_toggle(void);
-void key_move_north(void);
-void key_move_north_east(void);
-void key_move_east(void);
-void key_move_south_east(void);
-void key_move_south(void);
-void key_move_south_west(void);
-void key_move_west(void);
-void key_move_north_west(void);
+void key_unit_move(enum direction8 gui_dir);
 void key_unit_airbase(void);
 void key_unit_auto_attack(void);
 void key_unit_auto_explore(void);
Index: client//mapview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.c,v
retrieving revision 1.24
diff -u -r1.24 mapview_common.c
--- client//mapview_common.c    2003/01/17 20:20:56     1.24
+++ client//mapview_common.c    2003/01/23 17:34:48
@@ -30,6 +30,40 @@
 #include "tilespec.h"
 
 /**************************************************************************
+  Convert the given GUI direction into a map direction.
+
+  GUI directions correspond to the current viewing interface, so that
+  DIR8_NORTH is up on the mapview.  map directions correspond to the
+  underlying map tiles, so that DIR8_NORTH means moving with a vector of
+  (0,-1).  Neither necessarily corresponds to "north" on the underlying
+  world (once iso-maps are possible).
+
+  See also map_to_gui_dir().
+**************************************************************************/
+enum direction8 gui_to_map_dir(enum direction8 gui_dir)
+{
+  if (is_isometric) {
+    return dir_ccw(gui_dir);
+  } else {
+    return gui_dir;
+  }
+}
+
+/**************************************************************************
+  Convert the given GUI direction into a map direction.
+
+  See also gui_to_map_dir().
+**************************************************************************/
+enum direction8 map_to_gui_dir(enum direction8 map_dir)
+{
+  if (is_isometric) {
+    return dir_cw(map_dir);
+  } else {
+    return map_dir;
+  }
+}
+
+/**************************************************************************
  Refreshes a single tile on the map canvas.
 **************************************************************************/
 void refresh_tile_mapcanvas(int x, int y, bool write_to_screen)
Index: client//mapview_common.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.h,v
retrieving revision 1.19
diff -u -r1.19 mapview_common.h
--- client//mapview_common.h    2003/01/17 20:20:56     1.19
+++ client//mapview_common.h    2003/01/23 17:34:48
@@ -14,6 +14,7 @@
 #ifndef FC__MAPVIEW_COMMON_H
 #define FC__MAPVIEW_COMMON_H
 
+#include "map.h"               /* enum direction8 */
 #include "shared.h"            /* bool type */
 
 #include "colors_g.h"
@@ -115,6 +116,9 @@
   D_M_LR = D_M_L | D_M_R,
   D_MB_LR = D_M_L | D_M_R | D_B_L | D_B_R
 };
+
+enum direction8 gui_to_map_dir(enum direction8 gui_dir);
+enum direction8 map_to_gui_dir(enum direction8 map_dir);
 
 void refresh_tile_mapcanvas(int x, int y, bool write_to_screen);
 enum color_std get_grid_color(int x1, int y1, int x2, int y2);
Index: client//gui-gtk/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/gui_main.c,v
retrieving revision 1.124
diff -u -r1.124 gui_main.c
--- client//gui-gtk/gui_main.c  2003/01/01 11:51:33     1.124
+++ client//gui-gtk/gui_main.c  2003/01/23 17:34:49
@@ -248,111 +248,63 @@
     return keypress;
   }
 
-  if (is_isometric && !client_is_observer()) {
+  if (!client_is_observer()) {
     switch (ev->keyval) {
       case GDK_Up:
       case GDK_KP_Up:
       case GDK_8:
-      case GDK_KP_8:           key_move_north_west();  break;
+      case GDK_KP_8:
+       key_unit_move(DIR8_NORTH);
+       break;
 
       case GDK_Page_Up:
       case GDK_KP_Page_Up:
       case GDK_9:
-      case GDK_KP_9:           key_move_north();       break;
+      case GDK_KP_9:
+       key_unit_move(DIR8_NORTHEAST);
+       break;
 
       case GDK_Right:
       case GDK_KP_Right:
       case GDK_6:
-      case GDK_KP_6:           key_move_north_east();  break;
+      case GDK_KP_6:
+       key_unit_move(DIR8_EAST);
+       break;
 
       case GDK_Page_Down:
       case GDK_KP_Page_Down:
       case GDK_3:
-      case GDK_KP_3:           key_move_east();        break;
+      case GDK_KP_3:
+       key_unit_move(DIR8_SOUTHEAST);
+       break;
 
       case GDK_Down:
       case GDK_KP_Down:
       case GDK_2:
-      case GDK_KP_2:           key_move_south_east();  break;
+      case GDK_KP_2:
+       key_unit_move(DIR8_SOUTH);
+       break;
 
       case GDK_End:
       case GDK_KP_End:
       case GDK_1:
-      case GDK_KP_1:           key_move_south();       break;
+      case GDK_KP_1:
+       key_unit_move(DIR8_SOUTHWEST);
+       break;
 
       case GDK_Left:
       case GDK_KP_Left:
       case GDK_4:
-      case GDK_KP_4:           key_move_south_west();  break;
+      case GDK_KP_4:
+       key_unit_move(DIR8_WEST);
+       break;
 
       case GDK_Home:
-      case GDK_KP_Home:
-      case GDK_7:
-      case GDK_KP_7:           key_move_west();        break;
- 
-      case GDK_KP_Begin:
-      case GDK_5:
-      case GDK_KP_5:
-        focus_to_next_unit();
-        break;
-  
-      case GDK_Return:
-      case GDK_KP_Enter:
-        key_end_turn();
-        break;
-  
-      case GDK_Escape:
-        key_cancel_action();
-        break;
-  
-      case GDK_t:
-        key_city_workers(w, ev);
-        break;
-
-      default:
-        return FALSE;
-    }
-  } else if (!client_is_observer()) {
-    switch (ev->keyval) {
-      case GDK_Up:
-      case GDK_KP_Up:
-      case GDK_8:
-      case GDK_KP_8:           key_move_north();       break;
-
-      case GDK_Page_Up:
-      case GDK_KP_Page_Up:
-      case GDK_9:
-      case GDK_KP_9:           key_move_north_east();  break;
-
-      case GDK_Right:
-      case GDK_KP_Right:
-      case GDK_6:
-      case GDK_KP_6:           key_move_east();        break;
-
-      case GDK_Page_Down:
-      case GDK_KP_Page_Down:
-      case GDK_3:
-      case GDK_KP_3:           key_move_south_east();  break;
-
-      case GDK_Down:
-      case GDK_KP_Down:
-      case GDK_2:
-      case GDK_KP_2:           key_move_south();       break;
-
-      case GDK_End:
-      case GDK_KP_End:
-      case GDK_1:
-      case GDK_KP_1:           key_move_south_west();  break;
-
-      case GDK_Left:
-      case GDK_KP_Left:
-      case GDK_4:
-      case GDK_KP_4:           key_move_west();        break;
-
-      case GDK_Home:
       case GDK_KP_Home:                
       case GDK_7:
-      case GDK_KP_7:           key_move_north_west();  break;
+      case GDK_KP_7:
+       key_unit_move(DIR8_NORTHWEST);
+       break;
 
       case GDK_KP_Begin:
       case GDK_Return:
Index: client//gui-gtk-2.0/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/gui_main.c,v
retrieving revision 1.37
diff -u -r1.37 gui_main.c
--- client//gui-gtk-2.0/gui_main.c      2003/01/01 21:16:44     1.37
+++ client//gui-gtk-2.0/gui_main.c      2003/01/23 17:34:49
@@ -340,111 +340,63 @@
     return keypress;
   }
 
-  if (is_isometric && !client_is_observer()) {
+  if (!client_is_observer()) {
     switch (ev->keyval) {
       case GDK_Up:
       case GDK_KP_Up:
       case GDK_8:
-      case GDK_KP_8:           key_move_north_west();  break;
+      case GDK_KP_8:
+       key_unit_move(DIR8_NORTH);
+       break;
 
       case GDK_Page_Up:
       case GDK_KP_Page_Up:
       case GDK_9:
-      case GDK_KP_9:           key_move_north();       break;
+      case GDK_KP_9:
+       key_unit_move(DIR8_NORTHEAST);
+       break;
 
       case GDK_Right:
       case GDK_KP_Right:
       case GDK_6:
-      case GDK_KP_6:           key_move_north_east();  break;
+      case GDK_KP_6:
+       key_unit_move(DIR8_EAST);
+       break;
 
       case GDK_Page_Down:
       case GDK_KP_Page_Down:
       case GDK_3:
-      case GDK_KP_3:           key_move_east();        break;
+      case GDK_KP_3:
+       key_unit_move(DIR8_SOUTHEAST);
+       break;
 
       case GDK_Down:
       case GDK_KP_Down:
       case GDK_2:
-      case GDK_KP_2:           key_move_south_east();  break;
+      case GDK_KP_2:
+       key_unit_move(DIR8_SOUTH);
+       break;
 
       case GDK_End:
       case GDK_KP_End:
       case GDK_1:
-      case GDK_KP_1:           key_move_south();       break;
+      case GDK_KP_1:
+       key_unit_move(DIR8_SOUTHWEST);
+       break;
 
       case GDK_Left:
       case GDK_KP_Left:
       case GDK_4:
-      case GDK_KP_4:           key_move_south_west();  break;
+      case GDK_KP_4:
+       key_unit_move(DIR8_WEST);
+       break;
 
       case GDK_Home:
-      case GDK_KP_Home:
-      case GDK_7:
-      case GDK_KP_7:           key_move_west();        break;
- 
-      case GDK_KP_Begin:
-      case GDK_5:
-      case GDK_KP_5:
-        focus_to_next_unit();
-        break;
-  
-      case GDK_Return:
-      case GDK_KP_Enter:
-        key_end_turn();
-        break;
-  
-      case GDK_Escape:
-        key_cancel_action();
-        break;
-  
-      case GDK_t:
-        key_city_workers(w, ev);
-        break;
-
-      default:
-        return FALSE;
-    }
-  } else if (!client_is_observer()) {
-    switch (ev->keyval) {
-      case GDK_Up:
-      case GDK_KP_Up:
-      case GDK_8:
-      case GDK_KP_8:           key_move_north();       break;
-
-      case GDK_Page_Up:
-      case GDK_KP_Page_Up:
-      case GDK_9:
-      case GDK_KP_9:           key_move_north_east();  break;
-
-      case GDK_Right:
-      case GDK_KP_Right:
-      case GDK_6:
-      case GDK_KP_6:           key_move_east();        break;
-
-      case GDK_Page_Down:
-      case GDK_KP_Page_Down:
-      case GDK_3:
-      case GDK_KP_3:           key_move_south_east();  break;
-
-      case GDK_Down:
-      case GDK_KP_Down:
-      case GDK_2:
-      case GDK_KP_2:           key_move_south();       break;
-
-      case GDK_End:
-      case GDK_KP_End:
-      case GDK_1:
-      case GDK_KP_1:           key_move_south_west();  break;
-
-      case GDK_Left:
-      case GDK_KP_Left:
-      case GDK_4:
-      case GDK_KP_4:           key_move_west();        break;
-
-      case GDK_Home:
       case GDK_KP_Home:                
       case GDK_7:
-      case GDK_KP_7:           key_move_north_west();  break;
+      case GDK_KP_7:
+       key_unit_move(DIR8_NORTHWEST);
+       break;
 
       case GDK_KP_Begin:
       case GDK_Return:
Index: client//gui-mui/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/gui_main.c,v
retrieving revision 1.69
diff -u -r1.69 gui_main.c
--- client//gui-mui/gui_main.c  2003/01/01 11:51:33     1.69
+++ client//gui-mui/gui_main.c  2003/01/23 17:34:50
@@ -343,36 +343,31 @@
 {
   if (*value)
   {
-    if (is_isometric)
-    {
-      switch (*value)
-      {
-       case UNIT_NORTH: key_move_north_west(); break;
-       case UNIT_SOUTH: key_move_south_east(); break;
-       case UNIT_EAST: key_move_north_east(); break;
-       case UNIT_WEST: key_move_south_west(); break;
-       case UNIT_NORTH_EAST: key_move_north(); break;
-       case UNIT_NORTH_WEST: key_move_west(); break;
-       case UNIT_SOUTH_EAST: key_move_east(); break;
-       case UNIT_SOUTH_WEST: key_move_south();break;
-      }
-    } else
-    {
-      switch (*value)
-      {
-       case UNIT_NORTH: key_move_north(); break;
-       case UNIT_SOUTH: key_move_south(); break;
-       case UNIT_EAST: key_move_east(); break;
-       case UNIT_WEST: key_move_west(); break;
-       case UNIT_NORTH_EAST: key_move_north_east(); break;
-       case UNIT_NORTH_WEST: key_move_north_west(); break;
-       case UNIT_SOUTH_EAST: key_move_south_east(); break;
-       case UNIT_SOUTH_WEST: key_move_south_west();break;
-      }
-    }
-
-    switch (*value)
-    {
+    switch (*value) {
+    case UNIT_NORTH:
+      key_unit_move(DIR8_NORTH);
+      break;
+    case UNIT_SOUTH:
+      key_unit_move(DIR8_SOUTH);
+      break;
+    case UNIT_EAST:
+      key_unit_move(DIR8_EAST);
+      break;
+    case UNIT_WEST:
+      key_unit_move(DIR8_WEST);
+      break;
+    case UNIT_NORTH_EAST:
+      key_unit_move(DIR8_NORTHEAST);
+      break;
+    case UNIT_NORTH_WEST:
+      key_unit_move(DIR8_NORTHWEST);
+      break;
+    case UNIT_SOUTH_EAST:
+      key_unit_move(DIR8_SOUTHEAST);
+      break;
+    case UNIT_SOUTH_WEST:
+      key_unit_move(DIR8_SOUTHWEST);
+      break;
     case UNIT_POPUP_CITY:
       {
        struct unit *punit;
Index: client//gui-sdl/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/gui_main.c,v
retrieving revision 1.8
diff -u -r1.8 gui_main.c
--- client//gui-sdl/gui_main.c  2003/01/19 20:05:54     1.8
+++ client//gui-sdl/gui_main.c  2003/01/23 17:34:50
@@ -239,42 +239,42 @@
            break;
          case SDLK_UP:
          case SDLK_KP8:
-           key_move_north_west();
+           key_unit_move(DIR8_NORTH);
            break;
 
          case SDLK_PAGEUP:
          case SDLK_KP9:
-           key_move_north();
+           key_unit_move(DIR8_NORTHEAST);
            break;
 
          case SDLK_RIGHT:
          case SDLK_KP6:
-           key_move_north_east();
+           key_unit_move(DIR8_EAST);
            break;
 
          case SDLK_PAGEDOWN:
          case SDLK_KP3:
-           key_move_east();
+           key_unit_move(DIR8_SOUTHEAST);
            break;
 
          case SDLK_DOWN:
          case SDLK_KP2:
-           key_move_south_east();
+           key_unit_move(DIR8_SOUTH);
            break;
 
          case SDLK_END:
          case SDLK_KP1:
-           key_move_south();
+           key_unit_move(DIR8_SOUTHWEST);
            break;
 
          case SDLK_LEFT:
          case SDLK_KP4:
-           key_move_south_west();
+           key_unit_move(DIR8_WEST);
            break;
 
          case SDLK_HOME:
          case SDLK_KP7:
-           key_move_west();
+           key_unit_move(DIR8_NORTHWEST);
            break;
 
          case SDLK_KP5:
Index: client//gui-win32/menu.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/menu.c,v
retrieving revision 1.13
diff -u -r1.13 menu.c
--- client//gui-win32/menu.c    2003/01/01 11:51:34     1.13
+++ client//gui-win32/menu.c    2003/01/23 17:34:51
@@ -469,32 +469,34 @@
 **************************************************************************/
 void handle_numpad(int code)
 {
-  if (is_isometric) {
-    switch (code)
-      {
-      case IDM_NUMPAD_BASE+1: key_move_south(); break;
-      case IDM_NUMPAD_BASE+2: key_move_south_east(); break;
-      case IDM_NUMPAD_BASE+3: key_move_east(); break;
-      case IDM_NUMPAD_BASE+4: key_move_south_west(); break;
-      case IDM_NUMPAD_BASE+5: focus_to_next_unit(); break;
-      case IDM_NUMPAD_BASE+6: key_move_north_east(); break;
-      case IDM_NUMPAD_BASE+7: key_move_west(); break;
-      case IDM_NUMPAD_BASE+8: key_move_north_west(); break;
-      case IDM_NUMPAD_BASE+9: key_move_north(); break;
-      }
-  } else {
-    switch (code) 
-      { 
-      case IDM_NUMPAD_BASE+1: key_move_south_west(); break;
-      case IDM_NUMPAD_BASE+2: key_move_south(); break;
-      case IDM_NUMPAD_BASE+3: key_move_south_east(); break;
-      case IDM_NUMPAD_BASE+4: key_move_west(); break;
-      case IDM_NUMPAD_BASE+5: focus_to_next_unit(); break;
-      case IDM_NUMPAD_BASE+6: key_move_east(); break;
-      case IDM_NUMPAD_BASE+7: key_move_north_west(); break;
-      case IDM_NUMPAD_BASE+8: key_move_north(); break;
-      case IDM_NUMPAD_BASE+9: key_move_north_east(); break;
-      }
+  switch (code) { 
+  case IDM_NUMPAD_BASE + 1:
+    key_unit_move(DIR8_SOUTHWEST);
+    break;
+  case IDM_NUMPAD_BASE + 2:
+    key_unit_move(DIR8_SOUTH);
+    break;
+  case IDM_NUMPAD_BASE + 3:
+    key_unit_move(DIR8_SOUTHEAST);
+    break;
+  case IDM_NUMPAD_BASE + 4:
+    key_unit_move(DIR8_WEST);
+    break;
+  case IDM_NUMPAD_BASE + 5:
+    focus_to_next_unit();
+    break;
+  case IDM_NUMPAD_BASE + 6:
+    key_unit_move(DIR8_EAST);
+    break;
+  case IDM_NUMPAD_BASE + 7:
+    key_unit_move(DIR8_NORTHWEST);
+    break;
+  case IDM_NUMPAD_BASE + 8:
+    key_unit_move(DIR8_NORTH);
+    break;
+  case IDM_NUMPAD_BASE + 9:
+    key_unit_move(DIR8_NORTHEAST);
+    break;
   }
 }
 
Index: client//gui-xaw/actions.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/actions.c,v
retrieving revision 1.13
diff -u -r1.13 actions.c
--- client//gui-xaw/actions.c   2003/01/01 11:51:34     1.13
+++ client//gui-xaw/actions.c   2003/01/23 17:34:51
@@ -153,42 +153,42 @@
 
 static void xaw_key_move_north(Widget w, XEvent *event, String *argv, Cardinal 
*argc)
 {
-  key_move_north();
+  key_unit_move(DIR8_NORTH);
 }
 
 static void xaw_key_move_north_east(Widget w, XEvent *event, String *argv, 
Cardinal *argc)
 {
-  key_move_north_east();
+  key_unit_move(DIR8_NORTHEAST);
 }
 
 static void xaw_key_move_east(Widget w, XEvent *event, String *argv, Cardinal 
*argc)
 {
-  key_move_east();
+  key_unit_move(DIR8_EAST);
 }
 
 static void xaw_key_move_south_east(Widget w, XEvent *event, String *argv, 
Cardinal *argc)
 {
-  key_move_south_east();
+  key_unit_move(DIR8_SOUTHEAST);
 }
 
 static void xaw_key_move_south(Widget w, XEvent *event, String *argv, Cardinal 
*argc)
 {
-  key_move_south();
+  key_unit_move(DIR8_SOUTH);
 }
 
 static void xaw_key_move_south_west(Widget w, XEvent *event, String *argv, 
Cardinal *argc)
 {
-  key_move_south_west();
+  key_unit_move(DIR8_SOUTHWEST);
 }
 
 static void xaw_key_move_west(Widget w, XEvent *event, String *argv, Cardinal 
*argc)
 {
-  key_move_west();
+  key_unit_move(DIR8_WEST);
 }
 
 static void xaw_key_move_north_west(Widget w, XEvent *event, String *argv, 
Cardinal *argc)
 {
-  key_move_north_west();
+  key_unit_move(DIR8_NORTHWEST);
 }
 
 static void xaw_key_open_city_report(Widget w, XEvent *event, String *argv, 
Cardinal *argc)

[Prev in Thread] Current Thread [Next in Thread]