PHP Code:
function bucketfill(fx,fy,ft) {
// fill x, fill y, fill tile
temp.rt = tiles[fx,fy];
tiles[fx,fy] = ft;
updateboard(fx,fy,1,1);
for (temp.i=0; temp.i<4; temp.i++) {
temp.tx = fx+vecx(temp.i);
temp.ty = fy+vecy(temp.i);
if (tiles[temp.tx,temp.ty] == temp.rt)
bucketfill(temp.tx,temp.ty,ft);
}
return;
}
I can change this to flood a pattern if you wish, I just need some more details about it (a random tile of several or a pattern?, etc.).