mirror of
https://github.com/mangosfour/server.git
synced 2025-12-17 16:37:00 +00:00
Removed dynamic memory allocations in CriteriaCastSpellRequirements
This commit is contained in:
parent
2c1671ef5c
commit
871f2e181c
2 changed files with 55 additions and 65 deletions
|
|
@ -27,60 +27,55 @@
|
||||||
#include "GameEvent.h"
|
#include "GameEvent.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
|
|
||||||
const CriteriaCastSpellRequirement* AchievementMgr::criteriaCastSpellRequirements[] =
|
const CriteriaCastSpellRequirement AchievementMgr::criteriaCastSpellRequirements[CRITERIA_CAST_SPELL_REQ_COUNT] =
|
||||||
{
|
{
|
||||||
new CriteriaCastSpellRequirement(5272, 3057, 0, 0),
|
{5272, 3057, 0, 0},
|
||||||
new CriteriaCastSpellRequirement(5273, 2784, 0, 0),
|
{5273, 2784, 0, 0},
|
||||||
new CriteriaCastSpellRequirement(5752, 9099, 0, 0),
|
{5752, 9099, 0, 0},
|
||||||
new CriteriaCastSpellRequirement(5753, 8403, 0, 0),
|
{5753, 8403, 0, 0},
|
||||||
|
{5772, 0, 0, RACE_GNOME},
|
||||||
new CriteriaCastSpellRequirement(5772, 0, 0, RACE_GNOME),
|
{5774, 0, 0, RACE_BLOODELF},
|
||||||
new CriteriaCastSpellRequirement(5774, 0, 0, RACE_BLOODELF),
|
{5775, 0, 0, RACE_DRAENEI},
|
||||||
new CriteriaCastSpellRequirement(5775, 0, 0, RACE_DRAENEI),
|
{5776, 0, 0, RACE_DWARF},
|
||||||
new CriteriaCastSpellRequirement(5776, 0, 0, RACE_DWARF),
|
{5777, 0, 0, RACE_HUMAN},
|
||||||
new CriteriaCastSpellRequirement(5777, 0, 0, RACE_HUMAN),
|
{5778, 0, 0, RACE_NIGHTELF},
|
||||||
new CriteriaCastSpellRequirement(5778, 0, 0, RACE_NIGHTELF),
|
{5779, 0, 0, RACE_ORC},
|
||||||
new CriteriaCastSpellRequirement(5779, 0, 0, RACE_ORC),
|
{5780, 0, 0, RACE_TAUREN},
|
||||||
new CriteriaCastSpellRequirement(5780, 0, 0, RACE_TAUREN),
|
{5781, 0, 0, RACE_TROLL},
|
||||||
new CriteriaCastSpellRequirement(5781, 0, 0, RACE_TROLL),
|
{5782, 0, 0, RACE_UNDEAD_PLAYER},
|
||||||
new CriteriaCastSpellRequirement(5782, 0, 0, RACE_UNDEAD_PLAYER),
|
{6225, 5661, 0, 0},
|
||||||
|
{6226, 26044, 0, 0},
|
||||||
new CriteriaCastSpellRequirement(6225, 5661, 0, 0),
|
{6228, 739, 0, 0},
|
||||||
new CriteriaCastSpellRequirement(6226, 26044, 0, 0),
|
{6229, 927, 0, 0},
|
||||||
new CriteriaCastSpellRequirement(6228, 739, 0, 0),
|
{6230, 1444, 0, 0},
|
||||||
new CriteriaCastSpellRequirement(6229, 927, 0, 0),
|
{6231, 8140, 0, 0},
|
||||||
new CriteriaCastSpellRequirement(6230, 1444, 0, 0),
|
{6232, 5489, 0, 0},
|
||||||
new CriteriaCastSpellRequirement(6231, 8140, 0, 0),
|
{6233,12336, 0, 0},
|
||||||
new CriteriaCastSpellRequirement(6232, 5489, 0, 0),
|
{6234, 1351, 0, 0},
|
||||||
new CriteriaCastSpellRequirement(6233,12336, 0, 0),
|
{6235, 5484, 0, 0},
|
||||||
new CriteriaCastSpellRequirement(6234, 1351, 0, 0),
|
{6236, 1182, 0, 0},
|
||||||
new CriteriaCastSpellRequirement(6235, 5484, 0, 0),
|
{6237, 0, CLASS_DEATH_KNIGHT, RACE_ORC},
|
||||||
new CriteriaCastSpellRequirement(6236, 1182, 0, 0),
|
{6238, 0, CLASS_WARRIOR, RACE_HUMAN},
|
||||||
|
{6239, 0, CLASS_SHAMAN, RACE_TAUREN},
|
||||||
new CriteriaCastSpellRequirement(6237, 0, CLASS_DEATH_KNIGHT, RACE_ORC),
|
{6240, 0, CLASS_DRUID, RACE_NIGHTELF},
|
||||||
new CriteriaCastSpellRequirement(6238, 0, CLASS_WARRIOR, RACE_HUMAN),
|
{6241, 0, CLASS_ROGUE, RACE_UNDEAD_PLAYER},
|
||||||
new CriteriaCastSpellRequirement(6239, 0, CLASS_SHAMAN, RACE_TAUREN),
|
{6242, 0, CLASS_HUNTER, RACE_TROLL},
|
||||||
new CriteriaCastSpellRequirement(6240, 0, CLASS_DRUID, RACE_NIGHTELF),
|
{6243, 0, CLASS_MAGE, RACE_GNOME},
|
||||||
new CriteriaCastSpellRequirement(6241, 0, CLASS_ROGUE, RACE_UNDEAD_PLAYER),
|
{6244, 0, CLASS_PALADIN, RACE_DWARF},
|
||||||
new CriteriaCastSpellRequirement(6242, 0, CLASS_HUNTER, RACE_TROLL),
|
{6245, 0, CLASS_WARLOCK, RACE_BLOODELF},
|
||||||
new CriteriaCastSpellRequirement(6243, 0, CLASS_MAGE, RACE_GNOME),
|
{6246, 0, CLASS_PRIEST, RACE_DRAENEI},
|
||||||
new CriteriaCastSpellRequirement(6244, 0, CLASS_PALADIN, RACE_DWARF),
|
{6312, 0, CLASS_WARLOCK, RACE_GNOME},
|
||||||
new CriteriaCastSpellRequirement(6245, 0, CLASS_WARLOCK, RACE_BLOODELF),
|
{6313, 0, CLASS_DEATH_KNIGHT, RACE_HUMAN},
|
||||||
new CriteriaCastSpellRequirement(6246, 0, CLASS_PRIEST, RACE_DRAENEI),
|
{6314, 0, CLASS_PRIEST, RACE_NIGHTELF},
|
||||||
|
{6315, 0, CLASS_SHAMAN, RACE_ORC},
|
||||||
new CriteriaCastSpellRequirement(6312, 0, CLASS_WARLOCK, RACE_GNOME),
|
{6316, 0, CLASS_DRUID, RACE_TAUREN},
|
||||||
new CriteriaCastSpellRequirement(6313, 0, CLASS_DEATH_KNIGHT, RACE_HUMAN),
|
{6317, 0, CLASS_ROGUE, RACE_TROLL},
|
||||||
new CriteriaCastSpellRequirement(6314, 0, CLASS_PRIEST, RACE_NIGHTELF),
|
{6318, 0, CLASS_WARRIOR, RACE_UNDEAD_PLAYER},
|
||||||
new CriteriaCastSpellRequirement(6315, 0, CLASS_SHAMAN, RACE_ORC),
|
{6319, 0, CLASS_MAGE, RACE_BLOODELF},
|
||||||
new CriteriaCastSpellRequirement(6316, 0, CLASS_DRUID, RACE_TAUREN),
|
{6320, 0, CLASS_PALADIN, RACE_DRAENEI},
|
||||||
new CriteriaCastSpellRequirement(6317, 0, CLASS_ROGUE, RACE_TROLL),
|
{6321, 0, CLASS_HUNTER, RACE_DWARF},
|
||||||
new CriteriaCastSpellRequirement(6318, 0, CLASS_WARRIOR, RACE_UNDEAD_PLAYER),
|
{6662, 31261, 0, 0}
|
||||||
new CriteriaCastSpellRequirement(6319, 0, CLASS_MAGE, RACE_BLOODELF),
|
};
|
||||||
new CriteriaCastSpellRequirement(6320, 0, CLASS_PALADIN, RACE_DRAENEI),
|
|
||||||
new CriteriaCastSpellRequirement(6321, 0, CLASS_HUNTER, RACE_DWARF),
|
|
||||||
|
|
||||||
new CriteriaCastSpellRequirement(6662, 31261, 0, 0),
|
|
||||||
NULL};
|
|
||||||
|
|
||||||
AchievementMgr::AchievementMgr(Player *player)
|
AchievementMgr::AchievementMgr(Player *player)
|
||||||
{
|
{
|
||||||
|
|
@ -404,13 +399,13 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
|
||||||
if (!miscvalue1 || miscvalue1 != achievementCriteria->cast_spell.spellID)
|
if (!miscvalue1 || miscvalue1 != achievementCriteria->cast_spell.spellID)
|
||||||
continue;
|
continue;
|
||||||
// those requirements couldn't be found in the dbc
|
// those requirements couldn't be found in the dbc
|
||||||
const CriteriaCastSpellRequirement *requirement = NULL;
|
|
||||||
|
|
||||||
for (uint32 i=0; criteriaCastSpellRequirements[i]; i++)
|
const CriteriaCastSpellRequirement *requirement = NULL;
|
||||||
|
for (uint32 i=0; i<CRITERIA_CAST_SPELL_REQ_COUNT; i++)
|
||||||
{
|
{
|
||||||
if (criteriaCastSpellRequirements[i]->achievementCriteriaId == achievementCriteria->ID)
|
if (criteriaCastSpellRequirements[i].achievementCriteriaId == achievementCriteria->ID)
|
||||||
{
|
{
|
||||||
requirement = criteriaCastSpellRequirements[i];
|
requirement = &criteriaCastSpellRequirements[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,8 @@
|
||||||
#include "Database/DBCStores.h"
|
#include "Database/DBCStores.h"
|
||||||
#include "Database/DatabaseEnv.h"
|
#include "Database/DatabaseEnv.h"
|
||||||
|
|
||||||
|
#define CRITERIA_CAST_SPELL_REQ_COUNT 46
|
||||||
|
|
||||||
struct CriteriaProgress
|
struct CriteriaProgress
|
||||||
{
|
{
|
||||||
CriteriaProgress(uint32 id, uint32 counter, time_t date = time(NULL))
|
CriteriaProgress(uint32 id, uint32 counter, time_t date = time(NULL))
|
||||||
|
|
@ -38,13 +40,6 @@ struct CriteriaProgress
|
||||||
|
|
||||||
struct CriteriaCastSpellRequirement
|
struct CriteriaCastSpellRequirement
|
||||||
{
|
{
|
||||||
CriteriaCastSpellRequirement(uint32 achievementCriteriaId, uint32 creatureEntry, uint32 playerClass, uint32 playerRace)
|
|
||||||
{
|
|
||||||
this->achievementCriteriaId = achievementCriteriaId;
|
|
||||||
this->creatureEntry = creatureEntry;
|
|
||||||
this->playerClass = playerClass;
|
|
||||||
this->playerRace = playerRace;
|
|
||||||
}
|
|
||||||
uint32 achievementCriteriaId;
|
uint32 achievementCriteriaId;
|
||||||
uint32 creatureEntry;
|
uint32 creatureEntry;
|
||||||
uint8 playerClass;
|
uint8 playerClass;
|
||||||
|
|
@ -92,6 +87,6 @@ class AchievementMgr
|
||||||
Player* m_player;
|
Player* m_player;
|
||||||
CriteriaProgressMap m_criteriaProgress;
|
CriteriaProgressMap m_criteriaProgress;
|
||||||
CompletedAchievementMap m_completedAchievements;
|
CompletedAchievementMap m_completedAchievements;
|
||||||
static const CriteriaCastSpellRequirement* criteriaCastSpellRequirements[];
|
static const CriteriaCastSpellRequirement criteriaCastSpellRequirements[];
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue