Example #1
0
 int addHero(HeroProfile* h)
 {
     assert(globalHeroTable.count(h->tableId)==0 && "duplicate HeroProfile");
     globalHeroTable[h->tableId] = h;
     
     return globalHeroTable.size();
 }
Example #2
0
	int addPSkill(SkillInfo* skill)
	{
		assert(globalSkillTable.count(skill->sid)==0 && "duplicate HeroProfile");
        globalSkillTable[skill->sid] = skill;
        
        return globalSkillTable.size();
	}
Example #3
0
 std::vector<HeroProfile*> heroProfiles()
 {
     std::vector<HeroProfile*> profiles;
     profiles.reserve(globalHeroTable.size());
     
     transform(globalHeroTable.begin(), globalHeroTable.end(), back_inserter(profiles),
               [](boost::container::flat_map<int, HeroProfile*>::const_reference value){ return value.second; });
     
     std::sort(profiles.begin(), profiles.end(), [](HeroProfile* first, HeroProfile* second){
         return (first->tableId-9999.5)*(second->tableId-9999.5) < 0 ? first->tableId >= 10000 : first->tableId < second->tableId; });
     
     return profiles;
 }