Makefile updated. Small init changes in game_engine

This commit is contained in:
Marc 2014-12-11 07:49:42 +13:00
parent 0a76b9c452
commit da0ff59971
3 changed files with 10 additions and 13 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
/2048*
*.core

View File

@ -1,14 +1,14 @@
CC ?= gcc
CFLAGS += -Wall -Wextra
LIBS = -lcurses
DEFS = -DVT100_COMPATIBLE
LIBS =
all: 2048
2048: src/2048.c src/2048.h src/highscore_file.c
$(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) src/2048.c src/highscore_file.c -o 2048
2048nc: src/2048_no_curses.c src/2048.h src/highscore_file.c
$(CC) $(CFLAGS) $(LDFLAGS) src/2048_no_curses.c src/highscore_file.c -o 2048nc
2048: src/2048_engine.c src/2048_rewrite.c
$(CC) $(DEFS) src/2048_engine.c src/2048_rewrite.c -o 2048 $(LIBS)
clean:
rm -f 2048 2048nc
rm -f 2048
.PHONY: clean

View File

@ -235,11 +235,6 @@ struct gamestate* gamestate_init(struct gameoptions *opt)
for (i = 0; i < g->gridsize; i += opt->grid_width)
*iterator++ = &grid_back[i];
/* Switch back to the two allocs, setting pointers by iterating though */
//size_t i;
//for (i = 0; i < opt->grid_height; ++i)
// g->grid[i] = calloc(opt->grid_height, sizeof(long));
g->moved = 0;
g->score = 0;
g->score_high = 0;
@ -255,6 +250,7 @@ struct gamestate* gamestate_init(struct gameoptions *opt)
return g;
grid_alloc_fail:
free(grid_back);
grid_back_alloc_fail:
free(g);
gamestate_alloc_fail: