MX 2 lat temu
rodzic
commit
4f7aa14f36

+ 1 - 1
non_catalog_apps/sokoban/application.fam

@@ -8,7 +8,7 @@ App(
     order=50,
     fap_description="Sokoban on Flipper Zero. Solve your path to victory!",
     fap_category="Games",
-    fap_version="1.0",
+    fap_version="1.1",
     fap_author="Racso",
     fap_weburl="https://games.by.rac.so/flipper-zero",
     fap_icon="sokoban.png",

+ 6 - 20
non_catalog_apps/sokoban/scripts/scene_game.c

@@ -135,6 +135,9 @@ bool level_reader_parse_symbol(char ch, CellType* cellType)
     case '@':
         *cellType = CellType_Player;
         return true;
+    case '+':
+        *cellType = CellType_PlayerOnTarget;
+        return true;
     case '$':
         *cellType = CellType_Box;
         return true;
@@ -211,26 +214,9 @@ void level_reader_load_level(Level* ret_level, FileLinesReader* reader, int leve
 
             for (int j = 0; j < lineLen; j++)
             {
-                switch (line[j])
-                {
-                case '#':
-                    ret_level->board[i][j] = CellType_Wall;
-                    break;
-                case '*':
-                    ret_level->board[i][j] = CellType_BoxOnTarget;
-                    break;
-                case '.':
-                    ret_level->board[i][j] = CellType_Target;
-                    break;
-                case '@':
-                    ret_level->board[i][j] = CellType_Player;
-                    break;
-                case '$':
-                    ret_level->board[i][j] = CellType_Box;
-                    break;
-                default:
-                    ret_level->board[i][j] = CellType_Empty;
-                }
+                CellType cellType;
+                if (level_reader_parse_symbol(line[j], &cellType))
+                    ret_level->board[i][j] = cellType;
             }
         }