Moved effects to a vector since we dont need the random access by slot

This commit is contained in:
KimLS 2015-06-09 22:46:53 -07:00
parent 963eb91669
commit 8422ce6f25
3 changed files with 9 additions and 8 deletions

View File

@ -2120,10 +2120,10 @@ void Client::SendAlternateAdvancementRank(int aa_id, int level) {
outapp->SetWritePosition(sizeof(AARankInfo_Struct)); outapp->SetWritePosition(sizeof(AARankInfo_Struct));
for(auto effect : rank->effects) { for(auto effect : rank->effects) {
outapp->WriteSInt32(effect.second.effect_id); outapp->WriteSInt32(effect.effect_id);
outapp->WriteSInt32(effect.second.base1); outapp->WriteSInt32(effect.base1);
outapp->WriteSInt32(effect.second.base2); outapp->WriteSInt32(effect.base2);
outapp->WriteSInt32(effect.first); outapp->WriteSInt32(effect.slot);
} }
for(auto prereq : rank->prereqs) { for(auto prereq : rank->prereqs) {
@ -2361,17 +2361,17 @@ bool ZoneDatabase::LoadAlternateAdvancementAbilities(std::unordered_map<int, std
for(auto row = results.begin(); row != results.end(); ++row) { for(auto row = results.begin(); row != results.end(); ++row) {
AA::RankEffect effect; AA::RankEffect effect;
int rank_id = atoi(row[0]); int rank_id = atoi(row[0]);
int slot = atoi(row[1]); effect.slot = atoi(row[1]);
effect.effect_id = atoi(row[2]); effect.effect_id = atoi(row[2]);
effect.base1 = atoi(row[3]); effect.base1 = atoi(row[3]);
effect.base2 = atoi(row[4]); effect.base2 = atoi(row[4]);
if(slot < 1 || slot > 12) if(effect.slot < 1 || effect.slot > 12)
continue; continue;
if(ranks.count(rank_id) > 0) { if(ranks.count(rank_id) > 0) {
AA::Rank *rank = ranks[rank_id].get(); AA::Rank *rank = ranks[rank_id].get();
rank->effects[slot] = effect; rank->effects.push_back(effect);
} }
} }
} else { } else {

View File

@ -47,7 +47,7 @@ public:
uint32 account_time_required; uint32 account_time_required;
int total_cost; int total_cost;
Ability *base_ability; Ability *base_ability;
std::unordered_map<int, RankEffect> effects; std::vector<RankEffect> effects;
std::vector<RankPrereq> prereqs; std::vector<RankPrereq> prereqs;
}; };

View File

@ -27,6 +27,7 @@ namespace AA
struct RankEffect struct RankEffect
{ {
int slot;
int effect_id; int effect_id;
int base1; int base1;
int base2; int base2;