fix on linux
Some checks failed
C/C++ CI / build (push) Has been cancelled

This commit is contained in:
Jacob Janzen 2024-05-02 20:33:11 -05:00
parent 39cfe71bff
commit 3cd1ec2279
3 changed files with 14 additions and 18 deletions

View file

@ -4,8 +4,9 @@ AC_CONFIG_SRCDIR([src/main.c])
AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_AUX_DIR([build-aux])
AC_PROG_CC AC_PROG_CC
AC_CHECK_LIB([curses], [initscr]) AC_CHECK_LIB([ncurses], [initscr])
AC_CHECK_HEADERS([curses.h]) AC_CHECK_LIB([tinfo], [stdscr])
AC_CHECK_HEADERS([ncurses.h])
AM_INIT_AUTOMAKE([foreign -Wall -Werror]) AM_INIT_AUTOMAKE([foreign -Wall -Werror])

View file

@ -14,6 +14,7 @@ received a copy of the GNU General Public License along with urlg. If not, see
#include <curses.h> #include <curses.h>
#include <locale.h> #include <locale.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include "entity.h" #include "entity.h"
@ -135,19 +136,13 @@ void display_map(display_t *disp, struct map *map, ht_t *entities)
case WALL : case WALL :
if (map_i > 0 && if (map_i > 0 &&
map->map[(map_i - 1) * map->width + map_j] != WALL) { map->map[(map_i - 1) * map->width + map_j] != WALL) {
mvwprintw(disp->main, i, j, ""); mvwaddch(disp->main, i, j, ACS_BLOCK);
} else if (map_i < map->width - 1 && } else if (map_i < map->width - 1 && map->map[(map_i + 1) * map->width + map_j] != WALL) {
map->map[(map_i + 1) * map->width + map_j] != mvwaddch(disp->main, i, j, ACS_BLOCK);
WALL) { } else if (map_j > 0 && map->map[map_i * map->width + map_j - 1] != WALL) {
mvwprintw(disp->main, i, j, ""); mvwaddch(disp->main, i, j, ACS_BLOCK);
} else if (map_j > 0 && } else if (map_j < map->width - 1 && map->map[map_i * map->width + map_j + 1] != WALL) {
map->map[map_i * map->width + map_j - 1] != mvwaddch(disp->main, i, j, ACS_BLOCK);
WALL) {
mvwprintw(disp->main, i, j, "");
} else if (map_j < map->width - 1 &&
map->map[map_i * map->width + map_j + 1] !=
WALL) {
mvwprintw(disp->main, i, j, "");
} else { } else {
mvwaddch(disp->main, i, j, ' '); mvwaddch(disp->main, i, j, ' ');
} }
@ -164,9 +159,9 @@ void display_map(display_t *disp, struct map *map, ht_t *entities)
while (kvp.key) { while (kvp.key) {
struct entity *e = kvp.val; struct entity *e = kvp.val;
if (e->visible) { if (e->visible) {
mvwprintw( mvwaddch(
disp->main, e->p.y - camera->p.y + 1, e->p.x - camera->p.x + 1, disp->main, e->p.y - camera->p.y + 1, e->p.x - camera->p.x + 1,
e->disp_ch e->disp_ch[0]
); );
} }