Skip to content

Commit

Permalink
Fix out-of-bounds player name in ncurses mode, #15
Browse files Browse the repository at this point in the history
  • Loading branch information
fpetras committed May 2, 2018
1 parent a3bc987 commit 87801c6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/ft_vm/vm_draw/draw_player_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: jyeo <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/04/28 01:02:28 by jyeo #+# #+# */
/* Updated: 2018/04/28 01:02:30 by jyeo ### ########.fr */
/* Updated: 2018/05/02 20:42:58 by fpetras ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -43,7 +43,11 @@ void draw_player_info(t_vm *vm, t_win w)
mvwprintw(w.info, 24 + i + row, 3, "* Lives in current period : %d",
vm->champ[i].live_nbr);
wattron(w.info, COLOR_PAIR(color));
mvwprintw(w.info, 23 + i + row, 15, "%s",
if (ft_strlen(vm->champ[i].header.prog_name) < 38)
mvwprintw(w.info, 23 + i + row, 15, "%s",
vm->champ[i].header.prog_name);
else
mvwprintw(w.info, 23 + i + row, 15, "%.38s...",
vm->champ[i].header.prog_name);
wattroff(w.info, COLOR_PAIR(color));
row += 3;
Expand Down

0 comments on commit 87801c6

Please sign in to comment.