Fixes #2456, controllermap's undo does not work correctly (by Bogdan Marinov)
authorGabriel Jacobo <gabomdq@gmail.com>
Mon, 24 Mar 2014 11:42:09 -0300
changeset 8677ce3c968f7340
parent 8676 e217c66375e5
child 8678 7149b02f106b
Fixes #2456, controllermap's undo does not work correctly (by Bogdan Marinov)
test/controllermap.c
     1.1 --- a/test/controllermap.c	Mon Mar 24 11:04:42 2014 -0300
     1.2 +++ b/test/controllermap.c	Mon Mar 24 11:42:09 2014 -0300
     1.3 @@ -111,7 +111,7 @@
     1.4      Uint8 alpha=200, alpha_step = -1;
     1.5      Uint32 alpha_ticks;
     1.6      char mapping[4096], temp[4096];
     1.7 -    MappingStep *step;
     1.8 +    MappingStep *step, *prev_step;
     1.9      MappingStep steps[] = {
    1.10          {342, 132,  0.0,  MARKER_BUTTON, "x", -1, -1, -1, -1, ""},
    1.11          {387, 167,  0.0,  MARKER_BUTTON, "a", -1, -1, -1, -1, ""},
    1.12 @@ -296,8 +296,8 @@
    1.13                      if (event.key.keysym.sym == SDLK_BACKSPACE || event.key.keysym.sym == SDLK_AC_BACK) {
    1.14                          /* Undo! */
    1.15                          if (s > 0) {
    1.16 -                            SDL_strlcpy(mapping, step->mapping, SDL_arraysize(step->mapping));
    1.17 -                            s--;
    1.18 +                            prev_step = &steps[--s];
    1.19 +                            SDL_strlcpy(mapping, prev_step->mapping, SDL_arraysize(prev_step->mapping));
    1.20                              next = SDL_TRUE;
    1.21                          }
    1.22                          break;