Dice: Prevent a divide by 0
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23842 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
7a5eb3d08e
commit
fce66cb835
1 changed files with 3 additions and 0 deletions
|
@ -141,6 +141,9 @@ void dice_print(struct dices* dice, struct screen* display){
|
||||||
int display_nb_col=display->getwidth()/char_width;
|
int display_nb_col=display->getwidth()/char_width;
|
||||||
|
|
||||||
int nb_dices_per_line=display_nb_col/4;/* 4 char per dice displayed*/
|
int nb_dices_per_line=display_nb_col/4;/* 4 char per dice displayed*/
|
||||||
|
if(!nb_dices_per_line)
|
||||||
|
nb_dices_per_line++;
|
||||||
|
|
||||||
int nb_lines_required=dice->nb_dices/nb_dices_per_line;
|
int nb_lines_required=dice->nb_dices/nb_dices_per_line;
|
||||||
int current_row=0;
|
int current_row=0;
|
||||||
if(dice->nb_dices%nb_dices_per_line!=0)
|
if(dice->nb_dices%nb_dices_per_line!=0)
|
||||||
|
|
Loading…
Reference in a new issue