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:
Yunfan Li
2025-07-25 18:11:03 +08:00
committed by GitHub
parent 4a00c954ed
commit feda619066
36 changed files with 831 additions and 237 deletions

View File

@@ -5,6 +5,7 @@
#include "RogueAiObjectContext.h"
#include "AiObjectContext.h"
#include "AssassinationRogueStrategy.h"
#include "DpsRogueStrategy.h"
#include "GenericRogueNonCombatStrategy.h"
@@ -185,10 +186,45 @@ private:
static Action* killing_spree(PlayerbotAI* ai) { return new CastKillingSpreeAction(ai); }
};
RogueAiObjectContext::RogueAiObjectContext(PlayerbotAI* botAI) : AiObjectContext(botAI)
SharedNamedObjectContextList<Strategy> RogueAiObjectContext::sharedStrategyContexts;
SharedNamedObjectContextList<Action> RogueAiObjectContext::sharedActionContexts;
SharedNamedObjectContextList<Trigger> RogueAiObjectContext::sharedTriggerContexts;
SharedNamedObjectContextList<UntypedValue> RogueAiObjectContext::sharedValueContexts;
RogueAiObjectContext::RogueAiObjectContext(PlayerbotAI* botAI)
: AiObjectContext(botAI, sharedStrategyContexts, sharedActionContexts,
sharedTriggerContexts, sharedValueContexts)
{
}
void RogueAiObjectContext::BuildSharedContexts()
{
BuildSharedStrategyContexts(sharedStrategyContexts);
BuildSharedActionContexts(sharedActionContexts);
BuildSharedTriggerContexts(sharedTriggerContexts);
BuildSharedValueContexts(sharedValueContexts);
}
void RogueAiObjectContext::BuildSharedStrategyContexts(SharedNamedObjectContextList<Strategy>& strategyContexts)
{
AiObjectContext::BuildSharedStrategyContexts(strategyContexts);
strategyContexts.Add(new RogueStrategyFactoryInternal());
strategyContexts.Add(new RogueCombatStrategyFactoryInternal());
}
void RogueAiObjectContext::BuildSharedActionContexts(SharedNamedObjectContextList<Action>& actionContexts)
{
AiObjectContext::BuildSharedActionContexts(actionContexts);
actionContexts.Add(new RogueAiObjectContextInternal());
}
void RogueAiObjectContext::BuildSharedTriggerContexts(SharedNamedObjectContextList<Trigger>& triggerContexts)
{
AiObjectContext::BuildSharedTriggerContexts(triggerContexts);
triggerContexts.Add(new RogueTriggerFactoryInternal());
}
void RogueAiObjectContext::BuildSharedValueContexts(SharedNamedObjectContextList<UntypedValue>& valueContexts)
{
AiObjectContext::BuildSharedValueContexts(valueContexts);
}

View File

@@ -7,6 +7,7 @@
#define _PLAYERBOT_ROGUEAIOBJECTCONTEXT_H
#include "AiObjectContext.h"
#include "Strategy.h"
class PlayerbotAI;
@@ -14,6 +15,17 @@ class RogueAiObjectContext : public AiObjectContext
{
public:
RogueAiObjectContext(PlayerbotAI* botAI);
static void BuildSharedContexts();
static void BuildSharedStrategyContexts(SharedNamedObjectContextList<Strategy>& strategyContexts);
static void BuildSharedActionContexts(SharedNamedObjectContextList<Action>& actionContexts);
static void BuildSharedTriggerContexts(SharedNamedObjectContextList<Trigger>& triggerContexts);
static void BuildSharedValueContexts(SharedNamedObjectContextList<UntypedValue>& valueContexts);
static SharedNamedObjectContextList<Strategy> sharedStrategyContexts;
static SharedNamedObjectContextList<Action> sharedActionContexts;
static SharedNamedObjectContextList<Trigger> sharedTriggerContexts;
static SharedNamedObjectContextList<UntypedValue> sharedValueContexts;
};
#endif