Modifications to make the game more generic.

Included in a new modrules.xml tags.
 <cardgui>
   <background> Stores information concerning the colors </ background>
   <renderbig> Stores information to draw the card </ renderbig>
  <rendertinycrop> Stores information to draw the card </ rendertinycrop>
 </ cardgui>

 Change the variables array for vectors
This commit is contained in:
rodrigodemoura@gmail.com
2011-10-13 12:25:58 +00:00
parent dee49728aa
commit e6b199f599
30 changed files with 919 additions and 556 deletions

View File

@@ -41,6 +41,10 @@ bool ModRules::load(string filename)
{
game.parse(element);
}
else if (strcmp(element->Value(), "cardgui") == 0)
{
cardgui.parse(element);
}
}
}
return true;
@@ -277,3 +281,82 @@ ModRulesCards::~ModRulesCards()
{
SAFE_DELETE(activateEffect);
}
ModRulesBackGroundCardGuiItem::ModRulesBackGroundCardGuiItem(string ColorId,string ColorName, string DisplayImg, string DisplayThumb,string MenuIcon)
{
mColorId = atoi(ColorId.c_str());
MColorName = ColorName;
mDisplayImg = DisplayImg;
mDisplayThumb = DisplayThumb;
mMenuIcon = atoi(MenuIcon.c_str());
}
ModRulesRenderCardGuiItem::ModRulesRenderCardGuiItem(string Name, string PosX, string PosY, string FormattedData, string Type)
{
mName = Name;
mPosX = atoi(PosX.c_str());
mPosY = atoi(PosY.c_str());
mFormattedData = FormattedData;
mType = Type;
}
void ModRulesCardGui::parse(TiXmlElement* element)
{
TiXmlNode* mainNode = element->FirstChild("background");
if (mainNode) {
for (TiXmlNode* node = mainNode->ToElement()->FirstChild("card"); node; node = node->NextSibling("card"))
{
TiXmlElement* element = node->ToElement();
{
background.push_back(NEW ModRulesBackGroundCardGuiItem(
element->Attribute("id"),
element->Attribute("color"),
element->Attribute("img"),
element->Attribute("thumb"),
element->Attribute("menuicon")));
}
}
}
mainNode = element->FirstChild("renderbig");
if (mainNode) {
for (TiXmlNode* node = mainNode->ToElement()->FirstChild("item"); node; node = node->NextSibling("item"))
{
TiXmlElement* element = node->ToElement();
{
renderbig.push_back(NEW ModRulesRenderCardGuiItem(
element->Attribute("name"),
element->Attribute("posx"),
element->Attribute("posy"),
element->Attribute("formattedtext"),
element->Attribute("type")));
}
}
}
mainNode = element->FirstChild("rendertinycrop");
if (mainNode) {
for (TiXmlNode* node = mainNode->ToElement()->FirstChild("item"); node; node = node->NextSibling("item"))
{
TiXmlElement* element = node->ToElement();
{
renderbig.push_back(NEW ModRulesRenderCardGuiItem(
element->Attribute("name"),
element->Attribute("posx"),
element->Attribute("posy"),
element->Attribute("formattedtext"),
element->Attribute("type")));
}
}
}
}
ModRulesCardGui::~ModRulesCardGui()
{
for (size_t i = 0; i < background.size(); ++i)
SAFE_DELETE(background[i]);
for (size_t i = 0; i < renderbig.size(); ++i)
SAFE_DELETE(renderbig[i]);
background.clear();
renderbig.clear();
}