Exemplo n.º 1
0
void building::createAbilities(map<string,map<string,string>> xmlValues) {
	for ( map<string,map<string,string>>::const_iterator iter = xmlValues.begin();
		iter != xmlValues.end(); ++iter ) {
			string name = iter->first;
			map<string,string> tmp = iter->second;
			ability* ab = ability::create(iter->first,tmp["image"] + ".png",tmp);
			addAbility(ab);
	}

}
Exemplo n.º 2
0
static void addHero (ObjectData* data, UnitData* hero, int tavern)
{
  DotaHero* ptr = &heroes[numHeroes];
  ptr->index = numHeroes++;
  ptr->tavern = tavern;
  ptr->ids[0] = hero->getID ();
  ptr->numIds = 1;
  ptr->slot = atoi (hero->getStringData ("Buttonpos", 0)) +
    4 * atoi (hero->getStringData ("Buttonpos", 1));
  ptr->point = atoi (hero->getStringData ("points"));
  strcpy (ptr->name, hero->getStringData ("Name"));
  strcpy (ptr->oname, hero->getStringData ("Propernames", 0));
  _splitpath (hero->getStringData ("Art"), NULL, NULL, ptr->imgTag, NULL);
  addNewImage (hero->getStringData ("Art"), true);
  if (!strcmp (ptr->name, "Silencer"))
    int asd = 0;
  for (int i = 0; i < 5; i++)
  {
    char const* abils = hero->getStringData ("heroAbilList", i);
    if (*abils)
    {
      int slot = getValue (dir, abils);
      if (slot == 0)
      {
        UnitData* abil = data->getUnitById (abils);
        if (abil)
          slot = addAbility (abil);
        dir = addString (dir, abils, slot + 1);
      }
      else
        slot--;
      if (slot >= 0)
        ptr->abils[slot % 5] = makeID (abils);
    }
  }
}