mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-02-17 17:14:36 +00:00
Engine optimization for better performance and mem usage (#1462)
* Optimize loot * World channel talk * General improvement * Engine rebuild for performance and memory usage * Fix crash with AutoDoQuest = 0
This commit is contained in:
@@ -192,16 +192,16 @@ bool GrindTargetValue::needForQuest(Unit* target)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (CreatureTemplate const* data = sObjectMgr->GetCreatureTemplate(target->GetEntry()))
|
||||
if (CreatureTemplate const* data = sObjectMgr->GetCreatureTemplate(target->GetEntry()))
|
||||
{
|
||||
if (uint32 lootId = data->lootid)
|
||||
{
|
||||
if (LootTemplates_Creature.HaveQuestLootForPlayer(lootId, bot))
|
||||
{
|
||||
if (uint32 lootId = data->lootid)
|
||||
{
|
||||
if (LootTemplates_Creature.HaveQuestLootForPlayer(lootId, bot))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ class NearestCorpsesValue : public NearestUnitsValue
|
||||
{
|
||||
public:
|
||||
NearestCorpsesValue(PlayerbotAI* botAI, float range = sPlayerbotAIConfig->sightDistance)
|
||||
: NearestUnitsValue(botAI, "nearest corpses", range)
|
||||
: NearestUnitsValue(botAI, "nearest corpses", range, true)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -50,9 +50,12 @@ public:
|
||||
template <class T>
|
||||
Value<T>* getGlobalValue(std::string const name)
|
||||
{
|
||||
NamedObjectContextList<UntypedValue> valueContexts;
|
||||
valueContexts.Add(this);
|
||||
// should never reach here
|
||||
SharedNamedObjectContextList<UntypedValue> sValueContexts;
|
||||
sValueContexts.Add(this);
|
||||
NamedObjectContextList<UntypedValue> valueContexts(sValueContexts);
|
||||
PlayerbotAI* botAI = new PlayerbotAI();
|
||||
|
||||
UntypedValue* value = valueContexts.GetContextObject(name, botAI);
|
||||
delete botAI;
|
||||
return dynamic_cast<Value<T>*>(value);
|
||||
|
||||
Reference in New Issue
Block a user