home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 577a.lha / TownMaze_v1.1 / src.lzh / cleanupmap.c next >
C/C++ Source or Header  |  1991-08-04  |  937b  |  43 lines

  1. /*
  2. ** cleanupmap.c  Copyright 1991 Kent Paul Dolan,
  3. **               Mountain View, CA, USA 94039-0755
  4. **
  5. ** Written to satisfy an inquiry on USENet's rec.games.programmer newsgroup.
  6. ** May be freely used or modified in any non-commercial work.  Copyrighted
  7. ** only to prevent patenting by someone else.
  8. */
  9.  
  10. #include <stdio.h>
  11. #include "townmaze.h"
  12. #include "townproto.h"
  13.  
  14. #ifdef __STDC__
  15. void cleanupmap()
  16. #else
  17. int cleanupmap()
  18. #endif
  19. {
  20.  
  21. /*
  22. ** Isolated "posts" of wall segments are left by the normal map making
  23. ** process; clean them up to make nice open courtyards.
  24. */
  25.  
  26.   int i, j;
  27.  
  28. #if PROGRESS
  29.   fprintf(stderr,"Clean up map ");
  30. #endif
  31.  
  32.   for (i = 4; i < (mazeheight - 4); i += 2)
  33.     for (j = 4; j < (mazewidth - 4); j += 2)
  34.       if (   (cmaze[i-1][j] == BLANK)
  35.           && (cmaze[i][j+1] == BLANK)
  36.           && (cmaze[i+1][j] == BLANK)
  37.           && (cmaze[i][j-1] == BLANK)
  38.          )
  39.         cmaze[i][j] = BLANK;
  40.   return;
  41.  
  42. }
  43.