mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08: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:
@@ -19,10 +19,19 @@
|
||||
|
||||
class PlayerbotAI;
|
||||
|
||||
typedef Strategy* (*StrategyCreator)(PlayerbotAI* botAI);
|
||||
typedef Action* (*ActionCreator)(PlayerbotAI* botAI);
|
||||
typedef Trigger* (*TriggerCreator)(PlayerbotAI* botAI);
|
||||
typedef UntypedValue* (*ValueCreator)(PlayerbotAI* botAI);
|
||||
|
||||
class AiObjectContext : public PlayerbotAIAware
|
||||
{
|
||||
public:
|
||||
AiObjectContext(PlayerbotAI* botAI);
|
||||
AiObjectContext(PlayerbotAI* botAI,
|
||||
SharedNamedObjectContextList<Strategy>& sharedStrategyContext = sharedStrategyContexts,
|
||||
SharedNamedObjectContextList<Action>& sharedActionContext = sharedActionContexts,
|
||||
SharedNamedObjectContextList<Trigger>& sharedTriggerContext = sharedTriggerContexts,
|
||||
SharedNamedObjectContextList<UntypedValue>& sharedValueContext = sharedValueContexts);
|
||||
virtual ~AiObjectContext() {}
|
||||
|
||||
virtual Strategy* GetStrategy(std::string const name);
|
||||
@@ -56,20 +65,30 @@ public:
|
||||
std::set<std::string> GetSupportedActions();
|
||||
std::string const FormatValues();
|
||||
|
||||
virtual void Update();
|
||||
virtual void Reset();
|
||||
virtual void AddShared(NamedObjectContext<UntypedValue>* sharedValues);
|
||||
|
||||
std::vector<std::string> Save();
|
||||
void Load(std::vector<std::string> data);
|
||||
|
||||
std::vector<std::string> performanceStack;
|
||||
|
||||
static void BuildAllSharedContexts();
|
||||
|
||||
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);
|
||||
|
||||
protected:
|
||||
NamedObjectContextList<Strategy> strategyContexts;
|
||||
NamedObjectContextList<Action> actionContexts;
|
||||
NamedObjectContextList<Trigger> triggerContexts;
|
||||
NamedObjectContextList<UntypedValue> valueContexts;
|
||||
|
||||
private:
|
||||
static SharedNamedObjectContextList<Strategy> sharedStrategyContexts;
|
||||
static SharedNamedObjectContextList<Action> sharedActionContexts;
|
||||
static SharedNamedObjectContextList<Trigger> sharedTriggerContexts;
|
||||
static SharedNamedObjectContextList<UntypedValue> sharedValueContexts;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user