forked from snapshot112/minigame-menu
SNAKEEEEEEEEEEEE
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "rooster.h"
|
||||
|
||||
#include <ncurses.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
@@ -14,11 +15,12 @@ typedef struct rooster_data {
|
||||
toestand state;
|
||||
} rooster;
|
||||
|
||||
rooster *rooster_maak(const char* input) {
|
||||
rooster *grid_from_string(const char* input) {
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
const size_t len = strlen(input) / sizeof(char);
|
||||
if (input == NULL || len == 0) {
|
||||
printf("invalid input\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -30,6 +32,7 @@ rooster *rooster_maak(const char* input) {
|
||||
|
||||
for (int i = 0; i < height; i = i + width + 1) {
|
||||
if ((int)strcspn(&input[i], "\n") != width) {
|
||||
printf("line %d was not %d wide\n", i, width);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -92,7 +95,7 @@ static int get_grid_sizes(FILE *fh, rooster *rost) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
rooster *rooster_lees(FILE *fh) {
|
||||
rooster *grid_from_file(FILE *fh) {
|
||||
if (fh == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user