1  /********************************************************************** <BR>


2  This file is part of Crack dot Com's free source code release of


3  Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for


4  information about compiling & licensing issues visit this URL</a>


5  <PRE> If that doesn't help, contact Jonathan Clark at


6  golgotha_source@usa.net (Subject should have "GOLG" in it)


7  ***********************************************************************/


8 


9  #include "editor/commands/fill.hh"


10 


11  void g1_flood_fill_class::fill(sw32 x, sw32 y)


12  {


13  if (blocking(x,y))


14  return ;


15 


16  fill_rec *recs=0,*r;


17 


18  sw32 startx=x,starty=y;


19  sw32 clip_x1, clip_y1, clip_x2, clip_y2;


20  get_clip(clip_x1, clip_y1, clip_x2, clip_y2);


21 


22  do


23  {


24  if (recs)


25  {


26  r=recs;


27  recs=recs>last;


28  x=r>x; y=r>y;


29  delete r;


30  }


31 


32 


33  if (!blocking(x,y))


34  {


35  while (x>clip_x1 && !blocking(x,y))


36  x;


37 


38  if (blocking(x,y) && x<clip_x2)


39  x++;


40 


41 


42  if (y>clip_y1 && !blocking(x,y1))


43  recs=new fill_rec(x,y1,recs);


44 


45  if (y<clip_y2 && !blocking(x, y+1))


46  recs=new fill_rec(x,y+1,recs);


47 


48  do


49  {


50  fill_block(x, y, startx, starty);


51 


52  if (y>clip_y1 && x>clip_x1 && blocking(x1, y1) && !blocking(x, y1))


53  recs=new fill_rec(x,y1,recs);


54 


55 


56  if (y<clip_y2 && x>clip_x1 && blocking(x1, y+1) && !blocking(x, y+1))


57  recs=new fill_rec(x,y+1,recs);


58 


59  x++;


60  } while (!blocking(x,y) && x<clip_x2);


61 


62 


63  x;


64  if (y>clip_y1 && !blocking(x, y1))


65  recs=new fill_rec(x,y1,recs);


66 


67  if (y<clip_y2 && !blocking(x, y+1))


68  recs=new fill_rec(x,y+1,recs);


69  }


70  } while (recs);


71  }


72 


73 


74 

