forked from nakidai/csnake
Some fixes
- Fix UB in playerCreate (it had no return) - Now Screen has field of Points, not charsmaster
parent
b402dc177c
commit
758dbf9cc2
|
@ -1,13 +1,13 @@
|
|||
#ifndef __SCREEN_H__
|
||||
#define __SCREEN_H__
|
||||
|
||||
typedef char Point;
|
||||
typedef struct screen_t
|
||||
{
|
||||
int width;
|
||||
int height;
|
||||
char *screen;
|
||||
Point *screen;
|
||||
} Screen;
|
||||
typedef char Point;
|
||||
|
||||
Screen *screenCreate(int width, int height, Point fill_value);
|
||||
void screenFree(Screen *screen);
|
||||
|
|
|
@ -15,6 +15,8 @@ Player *playerCreate(Direction direction, int x, int y, int score)
|
|||
player->head = head;
|
||||
player->score = score;
|
||||
player->direction = direction;
|
||||
|
||||
return player;
|
||||
}
|
||||
|
||||
void playerFree(Player *player)
|
||||
|
|
|
@ -44,7 +44,7 @@ void screenShow(Screen *screen)
|
|||
}
|
||||
}
|
||||
|
||||
void screenSet(Screen *screen, char fill_value)
|
||||
void screenSet(Screen *screen, Point fill_value)
|
||||
{
|
||||
memset(screen->screen, fill_value, screen->width * screen->height * sizeof(char));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue