home *** CD-ROM | disk | FTP | other *** search
- /*
- ** freespace.c Copyright 1991 Kent Paul Dolan,
- ** Mountain View, CA, USA 94039-0755
- **
- ** Written to satisfy an inquiry on USENet's rec.games.programmer newsgroup.
- ** May be freely used or modified in any non-commercial work. Copyrighted
- ** only to prevent patenting by someone else.
- */
-
- #include <stdio.h>
- #include "townmaze.h"
- #include "townproto.h"
-
- #ifdef __STDC__
- void freespace()
- #else
- int freespace()
- #endif
- {
- int i;
-
- #ifdef __STDC__
- for (i = 0; i < mazeheight; i++)
- if (free(cmaze[i]) == -1)
- {
- fprintf(stderr,"error freeing cmaze row; quitting freespace early\n");
- exit(1);
- }
- if (free(cmaze) == -1)
- {
- fprintf(stderr,"error freeing cmaze body; quitting freespace early\n");
- exit(1);
- }
- if (free(statlist) == -1)
- {
- fprintf(stderr,"error freeing statlist; quitting freespace early\n");
- exit(1);
- }
- #else
- for (i = 0; i < mazeheight; i++) free(cmaze[i]);
- free(cmaze);
- free(statlist);
- #endif
- return;
- }
-