Exemplo n.º 1
0
void BTSpellEditor::complete(ObjectSerializer &serial)
{
 XMLAction *rangeField = serial.find("range", NULL);
 XMLAction *effectiveRangeField = serial.find("effectiveRange", NULL);
 IShort range = *(reinterpret_cast<IShort*>(rangeField->object));
 IShort effectiveRange = *(reinterpret_cast<IShort*>(effectiveRangeField->object));
 XMLAction *manifestField = serial.find("manifest", NULL);
 XMLArray *manifestArray = (reinterpret_cast<XMLArray*>(manifestField->object));
 XMLVector<BTManifest*> *manifest = dynamic_cast<XMLVector<BTManifest*> *>(manifestArray);
 for (size_t i = 0; i < manifest->size(); ++i)
 {
  BTRangedManifest *rangedManifest = dynamic_cast<BTRangedManifest*>(manifest->get(i));
  if (rangedManifest)
  {
   rangedManifest->range = range;
   rangedManifest->effectiveRange = effectiveRange;
  }
 }
}
Exemplo n.º 2
0
int BTSpellEditor::setup(ObjectSerializer &serial, BitField &active, std::vector<BTDisplay::selectItem> &items)
{
 int current = BTSerializedEditor::setup(serial, active, items);
 XMLAction *manifestField = serial.find("manifest", NULL);
 XMLArray *manifestArray = (reinterpret_cast<XMLArray*>(manifestField->object));
 XMLVector<BTManifest*> *manifest = dynamic_cast<XMLVector<BTManifest*> *>(manifestArray);
 extra.clear();
 int extraVal = 100;
 for (size_t i = 0; i < manifest->size(); ++i)
 {
  if (current == items.size())
   items.push_back(BTDisplay::selectItem());
  BTManifest *manifestObj = dynamic_cast<BTManifest*>(manifest->get(i));
  extra.push_back(BTSpellEditor::extraItems(manifestObj, "type", -1));
  items[current].name = std::string("Effect: ") + spellTypeLookup.getName(manifestObj->type);
  items[current].value = extraVal++;
  current++;
  int manifestEntries = manifestObj->getEditFieldNumber();
  if (manifestEntries > 0)
  {
   ObjectSerializer serialSub;
   manifestObj->serialize(&serialSub);
   for (int n = 0; n < manifestEntries; ++n)
   {
    if (current == items.size())
     items.push_back(BTDisplay::selectItem());
    extra.push_back(BTSpellEditor::extraItems(manifestObj, manifestObj->getEditField(n), n));
    XMLAction *curField = serialSub.find(manifestObj->getEditField(n), NULL);
    items[current].name = std::string("  ") + std::string(manifestObj->getEditFieldDescription(n)) + ": " + curField->createString();
    items[current].value = extraVal++;
    current++;
   }
  }
 }
 if (current == items.size())
  items.push_back(BTDisplay::selectItem());
 items[current].name = std::string("<New Effect>");
 items[current].value = extraVal++;
 current++;
 return current;
}