[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/pacmacs c571f5874c 272/472: Extract wall bits normalizatio
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/pacmacs c571f5874c 272/472: Extract wall bits normalization |
Date: |
Thu, 6 Jan 2022 21:59:31 -0500 (EST) |
branch: elpa/pacmacs
commit c571f5874caa71c90ed1a7438c8c4cab18add27e
Author: rexim <reximkut@gmail.com>
Commit: rexim <reximkut@gmail.com>
Extract wall bits normalization
---
pacmacs-image.el | 34 ++++++++++++++++------------------
test/pacmacs-image-test.el | 8 ++++++++
2 files changed, 24 insertions(+), 18 deletions(-)
diff --git a/pacmacs-image.el b/pacmacs-image.el
index 323946fcd0..c0e904276b 100644
--- a/pacmacs-image.el
+++ b/pacmacs-image.el
@@ -82,32 +82,30 @@
",\n")
"\n};"))
-(defun pacmacs--create-wall-tile (width height
+(defun pacmacs--normalize-wall-bits (wall-bits)
+ (-let (((bottom right top left left-upper right-upper left-bottom
right-bottom)
+ wall-bits))
+ (list bottom right top left
+ (and left-upper (not left) (not top))
+ (and right-upper (not right) (not top))
+ (and left-bottom (not left) (not bottom))
+ (and right-bottom (not right) (not bottom)))))
+(defun pacmacs--create-wall-tile (width height
bottom right
top left
left-upper right-upper
left-bottom right-bottom)
- (let ((cache-index
- (pacmacs--bit-list-to-integer
- (list bottom right top left
- (and left-upper
- (not left)
- (not top))
- (and right-upper
- (not right)
- (not top))
- (and left-bottom
- (not left)
- (not bottom))
- (and right-bottom
- (not right)
- (not bottom))))))
+ (let* ((wall-bits (list bottom right top left
+ left-upper right-upper
+ left-bottom right-bottom))
+ (cache-index (-> wall-bits
+ (pacmacs--normalize-wall-bits)
+ (pacmacs--bit-list-to-integer))))
(-if-let (cached-tile (gethash cache-index pacmacs--wall-blocks))
cached-tile
(puthash cache-index
- (let ((wall-block (make-vector
- width nil))
+ (let ((wall-block (make-vector width nil))
(weight 3))
(dotimes (i width)
diff --git a/test/pacmacs-image-test.el b/test/pacmacs-image-test.el
index a7bcd9d3a3..e96b7ed392 100644
--- a/test/pacmacs-image-test.el
+++ b/test/pacmacs-image-test.el
@@ -86,3 +86,11 @@
(pacmacs--bits-to-xpm [[t t]
[nil nil]]
2 2))))
+
+(ert-deftest pacmacs--normalize-wall-bits-test ()
+ (should (equal '(nil nil nil nil t nil t nil)
+ (pacmacs--normalize-wall-bits
+ '(nil nil nil nil t nil t nil))))
+ (should (equal '(t t t t nil nil nil nil)
+ (pacmacs--normalize-wall-bits
+ '(t t t t nil t nil t)))))
- [nongnu] elpa/pacmacs d128a6f057 183/472: Enable lexical binding, (continued)
- [nongnu] elpa/pacmacs d128a6f057 183/472: Enable lexical binding, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 9f9a514129 165/472: Add MELPA badge. Close #93, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 02c5a40cd3 193/472: Rename cell get/set as wrapped operations (#105), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs bddb837ffd 200/472: Rename object vars according to convension (#126), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs a3b2a5ce44 216/472: Replace pacmacs--file-content with f-read-text (#122), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 8f9b38b16e 233/472: Revert all the refactoring in the scope of #81, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 52fec0d180 241/472: Normalize wall generating bits (#131), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs e06beacb11 242/472: Assign wall tiles on load map (#131), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 9e7685b818 248/472: Drop XBM support for wall tiles (#141), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 5ec5ce8e67 267/472: Remove that pacmacs--object-at-p already!, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs c571f5874c 272/472: Extract wall bits normalization,
ELPA Syncer <=
- [nongnu] elpa/pacmacs 9a9ecb6679 283/472: Implement direction switching callbacks (#153), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs e710f00f69 295/472: Remove pacmacs--unterrify-all-ghosts (#153), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs e1ae35d526 316/472: Minimal version of 24.4 as the package requirement, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 73fcaa8a91 324/472: Remove pacmacs--vector+ (#159), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs e228a3c95d 334/472: Add 5th big pill level (#162), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 4924601822 341/472: UT for unterrify-ghost function (#171), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 0990672a5b 348/472: Fix stupid typos and mistakes -_-, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 9cb0cbab39 352/472: Merge pull request #172 from codingteam/unterrified-original-possition-171, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 61c37f08b1 355/472: Update URL in the headers (#178), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs fad3786449 361/472: Use push instead of add-to-list (#173), ELPA Syncer, 2022/01/06