home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / games / volume8 / unidraw / part01 / fill.c < prev    next >
C/C++ Source or Header  |  1989-12-19  |  773b  |  34 lines

  1. #ifndef LINT
  2. static char COPYRIGHT[]="\
  3.   COPYRIGHT --- COPYRIGHT --- COPYRIGHT --- COPYRIGHT \n\
  4.   This program is copyright 1989 Nils McCarthy. This \
  5.   program may be distributed if it is impossible for \
  6.   the distributor to get a more up-to-date-version of \
  7.   it. \n\
  8.   COPYRIGHT --- COPYRIGHT --- COPYRIGHT --- COPYRIGHT \n\
  9.   ";
  10. static char AUTHOR[]="Copyright 1989 Nils McCarthy";
  11. #endif /* LINT */
  12.  
  13. #include "unidraw.h"
  14.  
  15. fill(x,y)
  16. {
  17.    int xl=x,xr=x,i;
  18.    while(pad(y,xl)==' ' && xr>=0)
  19.       xl--;
  20.    while(pad(y,xr)==' ' && xr<=PADCOLS)
  21.       xr++;
  22.    xl++;
  23.    xr--;
  24.    for(i=xl;i<=xr;i++)
  25.       pad(y,i)=pench;
  26.    for(i=xl;i<=xr;i++) {
  27.       if(y>0 && pad(y-1,i)==' ')
  28.      fill(i,y-1);
  29.       if(y<PADLINES && pad(y+1,i)==' ')
  30.      fill(i,y+1);
  31.    }
  32.    refresh();
  33. }
  34.