aboutsummaryrefslogtreecommitdiff
path: root/field.c
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2020-04-01 21:31:23 -0500
committerJeffrey Armstrong <jeff@approximatrix.com>2020-04-01 21:31:23 -0500
commit2c76d28bb33ac533ef7c6c943543384d73e7f449 (patch)
tree682850c477dccae8d5e3e7707b6408e43d24d1ca /field.c
parentb70bdd1804f4b993044aee99cd75bdede7a3cbd6 (diff)
downloadgemworm-2c76d28bb33ac533ef7c6c943543384d73e7f449.zip
gemworm-2c76d28bb33ac533ef7c6c943543384d73e7f449.tar.gz
Game actually resets now when game ends, especially redrawing borders.
Diffstat (limited to 'field.c')
-rw-r--r--field.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/field.c b/field.c
index 287aa95..fee076b 100644
--- a/field.c
+++ b/field.c
@@ -48,7 +48,7 @@
char field[CELLW][CELLH];
#define CELLBLANK 0
-#define CELLPLAYER 1
+#define CELLPLAYER 1
#define CELLWALL 2
#define CELLFOOD 3
@@ -65,8 +65,17 @@ void empty_field(char celltype)
{
char i,j;
- for(i=0;i<CELLW-1;i++) {
- for(j=0;j<CELLH-1;j++) {
+ for(i=0;i<CELLW;i++) {
+ field[i][0] = CELLWALL;
+ field[i][CELLH-1] = CELLWALL;
+ }
+ for(j=0;j<CELLH;j++) {
+ field[0][j] = CELLWALL;
+ field[CELLW-1][j] = CELLWALL;
+ }
+
+ for(i=1;i<CELLW-1;i++) {
+ for(j=1;j<CELLH-1;j++) {
if(field[i][j] == celltype)
field[i][j] = CELLBLANK;
}