Hey everyone, I'm working on a game right now.
Oz: Hey, can you make a copy of this online game in C++ so I can carry it on a floppy?
Me: Uh, I'm busy with my big project...
Oz: So what? You always do the side quests in Final Fantasy...
Me: Well, if you wanna put it that way
So I'm plagiarizing this game (http://ww3.freearcade.com/Fillit.jav/Fillit.html), but I can't think of an algorithm that will split any shape (that only has right-angles) into a series of rectangles. This is what I have so far (for the "filled area" code):

-a Line struct, containing 2 points
-a Boundary object which has a std::vector<Line>
-a Obstacle object which contains a Boundary object and a std::vector<RECT>

The vector<RECT> is used to calculate the currently "filled" area, and the Boundary is to do collision detection (i.e. rebound the weird bird things). My plan is for a ship to trail a Boundary object, and then create a new Obstacle when the Boundary is closed. My problem is trying to calculate the vector of RECT's that would be needed. Could somebody help me with this?