]> Untitled Git - axy/ft/a-maze-ing.git/commitdiff
Failing open on tile too big
authorAxy <gilliardmarthey.axel@gmail.com>
Sun, 29 Mar 2026 03:18:43 +0000 (05:18 +0200)
committerAxy <gilliardmarthey.axel@gmail.com>
Sun, 29 Mar 2026 03:18:43 +0000 (05:18 +0200)
mazegen/config/config_parser.py
mazegen/config/parser_combinator.py
mazegen/display/tty.py

index dc505e58a74eeaddc4f605b2874e288a3fa4560e..ac3730de0f81633ebea30739ae01eda69fa309f4 100644 (file)
@@ -273,7 +273,7 @@ def DefaultedStrField[T, U](
             for s in default_strs:
                 res = parser_complete(self.parse)(s)
                 if isinstance(res, ParseError):
-                    raise ConfigException(
+                    raise Exception(
                         "Failed to construct defaulted field " + self.name()
                     )
                 acc.append(res[0])
@@ -442,9 +442,6 @@ class Config:
     prompt: list[ColoredLine]
     maze_pattern: list[str]
 
-    def __init__(self) -> None:
-        pass
-
     @staticmethod
     def parse(s: str) -> "Config":
         from mazegen.maze import Pattern
index a47843f97d40e90cd2db113c70a557fbd6285ca3..8bc2f3fdf3d6a72454689004341ab8c2b7d9df1a 100644 (file)
@@ -1,6 +1,7 @@
 from collections.abc import Callable
 from typing import Any
 import textwrap
+from dataclasses import dataclass
 
 from mazegen.utils.ivec2 import IVec2
 
index bb0f6d4c8200b2d824fce0bece1283b10d2a38b9..add114713f00ade9a96b85b38ebd57b91564d217 100644 (file)
@@ -131,14 +131,9 @@ class Tile(ITile):
             except curses.error:
                 pass  # dumb exception when writing bottom right corner
 
-        if (
-            len(pixels) > dims.y
-            or max(
-                map(lambda line: sum(map(lambda s: len(s[0]), line)), pixels)
-            )
-            > dims.x
-        ):
-            raise BackendException("Tile too big to fit in set dimensions")
+        pixels = [
+            [pixel for pixel in line[: dims.y]] for line in pixels[: dims.y]
+        ]
 
         super().__init__(curses.newpad(*dims.yx()))