Original Post
I can't really test this code yet because the engine isn't very compileable yet so I'd like to know if the "This might not work correctly" part will work or not as expected. As you can expect the Reserve function is supposed to do the same thing as the STL container function reserve(). Rect is an user defined struct with a working copy constructor.
struct AlertBox
{
bool CurrentlyDisplayed;
Rect CloseButton; // Also acts as the No Button.
Rect YesButton;
Rect TextArea;
bool Moveable;
int DefaultXpos, DefaultYpos;
int Xpos, Ypos;
string Text;
string Font;
string ImageName;
string Name;
};
void MGE_AlertBoxes::Reserve(unsigned int theAlertBoxCount)
{
if(AlertBoxCount < theAlertBoxCount)
{
if(AlertBoxes)
{
AlertBox *TempAlertBoxes;
for(int i = 0; i < AlertBoxCount; ++i) TempAlertBoxes = new AlertBox(AlertBoxes); // This might not work correctly
delete[] AlertBoxes;
AlertBoxes = TempAlertBoxes;
}
AlertBoxes = new AlertBox[theAlertBoxCount];
AlertBoxCount = theAlertBoxCount;
}
}