X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;f=src%2Fclient%2Fdraw_wins.c;h=67b8caeba2f122de7d04156fc9e637348703c311;hb=c8841380b53dbd999061a8de399e71d5d8272fb0;hp=bb86bb95ffd161a999d03acf2d36ecb364ecb16c;hpb=1cb57a35a3b3cc4ec8870531ca254a655c0bdda2;p=plomrogue
diff --git a/src/client/draw_wins.c b/src/client/draw_wins.c
index bb86bb9..67b8cae 100644
--- a/src/client/draw_wins.c
+++ b/src/client/draw_wins.c
@@ -2,7 +2,7 @@
#define _POSIX_C_SOURCE 200809L /* strdup() */
#include "draw_wins.h"
-#include /* typedefs attr_t, chtype, define A_REVERSE */
+#include /* attr_t, chtype, init_pair(), A_REVERSE, COLOR_PAIR() */
#include /* NULL */
#include /* uint8_t, uint16_t, uint32_t, UINT16_MAX */
#include /* sprintf() */
@@ -182,7 +182,7 @@ static void add_line_compact(struct Win * win, char * line, attr_t attri,
uint16_t len_line = strlen(line);
char * separator = last ? "" : " / ";
uint32_t len_line_new = len_line + strlen(separator);
- char * line_new = try_malloc(len_line_new, __func__);
+ char * line_new = try_malloc(len_line_new + 1, __func__);
int test = sprintf(line_new, "%s%s", line, separator);
exit_trouble(test < 0, __func__, "sprintf");
uint16_t x = 0;
@@ -339,14 +339,40 @@ extern void draw_win_log(struct Win * win)
extern void draw_win_map(struct Win * win)
{
+ init_pair(1, COLOR_WHITE, COLOR_BLUE);
+ init_pair(2, COLOR_BLUE, COLOR_BLACK);
+ attr_t attr_fov = 0;
+ attr_t attr_mem = COLOR_PAIR(2);
+ attr_t attr_sha = COLOR_PAIR(1);
try_resize_winmap(win, world.map.length, world.map.length * 2);
- uint16_t z = 0;
- uint16_t x, y;
- for (y = 0; y < world.map.length; y++)
+ uint16_t x, y, z;
+ for (y = 0, z = 0; y < world.map.length; y++)
{
for (x = 0; x < world.map.length; x++)
{
- set_ch_on_yx(win, y, x * 2 + (y % 2), world.map.cells[z]);
+ attr_t attr_c = ' ' == world.mem_map[z] ? attr_sha : attr_mem;
+ chtype c = world.mem_map[z] | attr_c;
+ set_ch_on_yx(win, y, x * 2 + (y % 2), c);
+ if (x + (y % 2) < world.map.length)
+ {
+ set_ch_on_yx(win, y, x * 2 + (y % 2) + 1, ' ' | attr_c);
+ }
+ z++;
+ }
+ }
+ for (y = 0, z = 0; y < world.map.length; y++)
+ {
+ for (x = 0; x < world.map.length; x++)
+ {
+ if (' ' != world.map.cells[z])
+ {
+ chtype c = world.map.cells[z] | attr_fov;
+ set_ch_on_yx(win, y, x * 2 + (y % 2), c);
+ if (x + (y % 2) < world.map.length)
+ {
+ set_ch_on_yx(win, y, x * 2 + (y % 2) + 1, ' ' | attr_fov);
+ }
+ }
z++;
}
}