From d210a1a7d2e15f9d7d38953944be998ca137a612 Mon Sep 17 00:00:00 2001 From: Laurent Mazet Date: Thu, 17 Oct 2024 08:47:38 +0200 Subject: [PATCH] remove unused codes --- block.c | 187 ------------------------------------------------------ block.h | 45 ------------- display.c | 6 +- 3 files changed, 4 insertions(+), 234 deletions(-) delete mode 100644 block.c delete mode 100644 block.h diff --git a/block.c b/block.c deleted file mode 100644 index 9c9fca8..0000000 --- a/block.c +++ /dev/null @@ -1,187 +0,0 @@ -#include - -#include "block.h" - -typedef enum { - _black = 0, - _blue, - _green, - _cyan, - _red, - _magenta, - _yellow, - _white -} _color_t; - -static int _color_num (int fg, int bg) -{ - return (1 << 6) | ((7 & bg) << 3) | (7 & fg); -} -static int _color_trans (_color_t c) -{ - int color; - switch (7 & c) { - case _black: - color = COLOR_BLACK; - break; - case _blue: - color = COLOR_BLUE; - break; - case _green: - color = COLOR_GREEN; - break; - case _cyan: - color = COLOR_CYAN; - break; - case _red: - color = COLOR_RED; - break; - case _magenta: - color = COLOR_MAGENTA; - break; - case _yellow: - color = COLOR_YELLOW; - break; - case _white: - color = COLOR_WHITE; - break; - } - return color; -} - -static void _init_color_pairs () { - int fg, bg; - for (bg = 0; bg < 8; bg++) { - for (fg = 0; fg < 8; fg ++) { - init_pair (_color_num (fg, bg), _color_trans (fg), _color_trans (bg)); - } - } -} - -void mvaddcb (int y, int x, cblock_t color) -{ - int init = 1; - if (init) { - _init_color_pairs (); - init = 0; - } - - int symb = ACS_CKBOARD; - switch (color) { - case black: - case gray: - case blue: - case green: - case cyan: - case red: - case magenta: - case brown: - symb = ' '; - break; - default: - symb = ACS_CKBOARD; - } - - int num; - switch (color) { - case black: - case darkgray: - num = _color_num (_white, _black); - break; - case gray: - case white: - num = _color_num (_white, _white); - break; - case darkerblue: - case darkblue: - num = _color_num (_blue, _black); - break; - case darkergreen: - case darkgreen: - num = _color_num (_green, _black); - break; - case darkercyan: - case darkcyan: - num = _color_num (_cyan, _black); - break; - case darkerred: - case darkred: - num = _color_num (_red, _black); - break; - case darkermagenta: - case darkmagenta: - num = _color_num (_magenta, _black); - break; - case darkbrown: - case darkeryellow: - num = _color_num (_yellow, _black); - break; - case blue: - case lightblue: - case lighterblue: - num = _color_num (_blue, _white); - break; - case green: - case lightgreen: - case lightergreen: - num = _color_num (_green, _white); - break; - case cyan: - case lightcyan: - case lightercyan: - num = _color_num (_cyan, _white); - break; - case red: - case lightred: - case lighterred: - num = _color_num (_red, _white); - break; - case magenta: - case lightmagenta: - case lightermagenta: - num = _color_num (_magenta, _white); - break; - case brown: - case darkyellow: - case yellow: - num = _color_num (_yellow, _white); - break; - //default: - // num = _color_num (_white, _black); - } - - int state; - switch (color) { - case blue: - case green: - case cyan: - case red: - case magenta: - case brown: - state = A_REVERSE; - break; - case white: - case darkblue: - case darkgreen: - case darkcyan: - case darkred: - case darkmagenta: - case darkeryellow: - case lighterblue: - case lightergreen: - case lightercyan: - case lighterred: - case lightermagenta: - case yellow: - state = A_BOLD; - break; - default: - state = A_NORMAL; - } - - attron (COLOR_PAIR (num) | state); - mvaddch (y, x, symb); - attroff (COLOR_PAIR (num) | state); -} - -/* vim: set ts=4 sw=4 et: */ diff --git a/block.h b/block.h deleted file mode 100644 index 481bcc5..0000000 --- a/block.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef __BLOCK_H__ -#define __BLOCK_H__ - -typedef enum { - black, - darkgray, - gray, - white, - darkerblue, - darkblue, - blue, - lightblue, - lighterblue, - darkergreen, - darkgreen, - green, - lightgreen, - lightergreen, - darkercyan, - darkcyan, - cyan, - lightcyan, - lightercyan, - darkerred, - darkred, - red, - lightred, - lighterred, - darkermagenta, - darkmagenta, - magenta, - lightmagenta, - lightermagenta, - darkbrown, - brown, - darkeryellow, - darkyellow, - yellow, -} cblock_t; - -void mvaddcb (int y, int x, cblock_t color); - -#endif /* __BLOCK_H__ */ - -/* vim: set ts=4 sw=4 et: */ diff --git a/display.c b/display.c index 4cef03a..2f02c43 100644 --- a/display.c +++ b/display.c @@ -3,7 +3,6 @@ #include #include -#include "block.h" #include "color.h" #include "debug.h" #include "function.h" @@ -158,8 +157,11 @@ void displayelement (board_t *board, int x, int y) break; case '.': setcolor (yellow_black); - //element = ACS_BULLET; +#ifdef PDCURSES element = '.'; +#else + element = ACS_BULLET; +#endif break; case '*': setcolor (yellow_black); -- 2.30.2