Loading

Paste #pjasirl2o

  1. diff -r 95b0092b4639 src/grfstrip.cpp
  2. --- a/src/grfstrip.cpp  Tue Jul 19 20:58:18 2016 +0200
  3. +++ b/src/grfstrip.cpp  Mon Oct 23 20:16:34 2017 +0200
  4. @@ -169,7 +169,7 @@
  5.             "GRFSTRIP " VERSION " - Copyright (C) 2009 by Remko Bijker\n"
  6.             "\n"
  7.             "Usage:\n"
  8. -           "    GRFSTRIP <origin> <dest> [<depth> <zoom>]\n"
  9. +           "    GRFSTRIP <origin> <dest> (<depth> <zoom>)*\n"
  10.             "        Strip real sprites that are not in the set \"normal 8bpp and the ones\n"
  11.             "        specified at the command line\" from origin into dest.\n"
  12.             "    GRFSTRIP -v\n"
  13. @@ -185,7 +185,7 @@
  14.     }
  15.  
  16.     uint32_t allowed = 1;
  17. -   for (int i = 3; i + 1 < argc; i++) {
  18. +   for (int i = 3; i + 1 < argc; ) {
  19.         int depth_offset;
  20.         if (strcmp(argv[i], "32bpp") == 0) {
  21.             depth_offset = 16;
  22. @@ -195,19 +195,21 @@
  23.             printf("Invalid depth \"%s\"\n", argv[i]);
  24.             return 1;
  25.         }
  26. +       i++;
  27.  
  28.         static const char *zoom[] = { "normal", "zi4", "zi2", "zo2", "zo4", "zo8" };
  29.         int zoom_offset = 0xFF;
  30.         for (int j = 0; j < 6; j++) {
  31. -           if (strcmp(argv[i + 1], zoom[j]) == 0) {
  32. +           if (strcmp(argv[i], zoom[j]) == 0) {
  33.                 zoom_offset = j;
  34.                 break;
  35.             }
  36.         }
  37. -
  38.         if (zoom_offset == 0xFF) {
  39.             printf("Invalid zoom \"%s\"\n", argv[i]);
  40.         }
  41. +       i++;
  42. +
  43.         allowed |= 1 << (depth_offset + zoom_offset);
  44.     }
  45.  
  46.  

Comments