commencement menu + addaptatif
This commit is contained in:
@@ -23,20 +23,20 @@
|
||||
* \param N La valeur N est le nombre d'élément dans le tableau.
|
||||
* \return Le pointeur du tableau 2D carre de char (1 octet).
|
||||
*/
|
||||
char **creatArea2D (const unsigned int N)
|
||||
char **creatArea2D (const int x, const int y)
|
||||
{
|
||||
char **tab2d;
|
||||
tab2d = calloc (N, sizeof (char *));
|
||||
tab2d = calloc (x, sizeof (char *));
|
||||
if (tab2d == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool fail = false;
|
||||
unsigned int i;
|
||||
for (i = 0; i < N && !fail; ++i)
|
||||
int i;
|
||||
for (i = 0; i < x && !fail; ++i)
|
||||
{
|
||||
tab2d[i] = calloc (N, sizeof (char));
|
||||
tab2d[i] = calloc (y, sizeof (char));
|
||||
if (tab2d[i] == NULL)
|
||||
{
|
||||
fail = true;
|
||||
@@ -45,7 +45,7 @@ char **creatArea2D (const unsigned int N)
|
||||
|
||||
if (fail)
|
||||
{
|
||||
unsigned int j;
|
||||
int j;
|
||||
for (j = 0; j < i; ++j)
|
||||
{
|
||||
free (tab2d[j]);
|
||||
@@ -62,10 +62,10 @@ char **creatArea2D (const unsigned int N)
|
||||
* \param N Le nombre d'éléments.
|
||||
* \return Void.
|
||||
*/
|
||||
void free2D (char **tab, int N)
|
||||
void free2D (char **tab, int x)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < N; ++i)
|
||||
for (i = 0; i < x; ++i)
|
||||
{
|
||||
free (tab[i]);
|
||||
}
|
||||
@@ -178,7 +178,7 @@ void move (char **tab, vect *playerPos, vect direction, score *score_user)
|
||||
case 2:
|
||||
// move player and the box
|
||||
|
||||
tab[playerPos->x + direction.x][playerPos->y + direction.y] = PLAYER;
|
||||
tab[playerPos->x + direction.x][playerPos->y + direction.y] = PLAYER;
|
||||
tab[playerPos->x + direction.x * 2][playerPos->y + direction.y * 2]
|
||||
= BOX;
|
||||
score_user->move_box++;
|
||||
|
||||
Reference in New Issue
Block a user