re-arranged buttons to select network player in request dialog
[rocksndiamonds.git] / src / tools.c
index 24fecfb31d478829d2f89bf2e59fa93a93a8e812..19965d47a3c9ab9f08a41928f16ce316f48223c5 100644 (file)
@@ -4215,7 +4215,29 @@ static int RequestHandleEvents(unsigned int req_state)
            }
 
            if (req_state & REQ_PLAYER)
-             result = 0;
+           {
+             int old_player_nr = setup.network_player_nr;
+
+             if (result != -1)
+               result = old_player_nr + 1;
+
+             switch (key)
+             {
+               case KSYM_space:
+                 result = old_player_nr + 1;
+                 break;
+
+               case KSYM_1:
+               case KSYM_2:
+               case KSYM_3:
+               case KSYM_4:
+                 result = key - KSYM_1 + 1;
+                 break;
+
+               default:
+                 break;
+             }
+           }
 
            break;
          }
@@ -5329,33 +5351,30 @@ void CreateToolButtons()
       if (x < 0 || x + gfx->width  > request.width ||
          y < 0 || y + gfx->height > request.height)
       {
-       // use left padding of "yes" button as default border padding
-       int padding = toolbutton_info[TOOL_CTRL_ID_YES].pos->x;
-
        if (id == TOOL_CTRL_ID_YES)
        {
-         x = padding;
-         y = request.height - 2 * request.border_size - gfx->height - padding;
+         x = 0;
+         y = request.height - 2 * request.border_size - gfx->height;
        }
        else if (id == TOOL_CTRL_ID_NO)
        {
-         x = request.width  - 2 * request.border_size - gfx->width  - padding;
-         y = request.height - 2 * request.border_size - gfx->height - padding;
+         x = request.width  - 2 * request.border_size - gfx->width;
+         y = request.height - 2 * request.border_size - gfx->height;
        }
        else if (id == TOOL_CTRL_ID_CONFIRM)
        {
          x = (request.width - 2 * request.border_size - gfx->width) / 2;
-         y = request.height - 2 * request.border_size - gfx->height - padding;
+         y = request.height - 2 * request.border_size - gfx->height;
        }
        else if (id >= TOOL_CTRL_ID_PLAYER_1 && id <= TOOL_CTRL_ID_PLAYER_4)
        {
          int player_nr = id - TOOL_CTRL_ID_PLAYER_1;
 
          x = (request.width - 2 * request.border_size - gfx->width) / 2;
-         y = request.height - 2 * request.border_size - gfx->height - padding;
+         y = request.height - 2 * request.border_size - gfx->height * 2;
 
-         x += (player_nr % 2 ? +1 : -1) * gfx->width / 2;
-         y += (player_nr / 2 ?  0 : -1) * gfx->height;
+         x += (player_nr == 3 ? -1 : player_nr == 1 ? +1 : 0) * gfx->width;
+         y += (player_nr == 0 ? -1 : player_nr == 2 ? +1 : 0) * gfx->height;
        }
       }
     }