mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-26 23:47:21 +00:00
b7497a47e4
* Added caching for table Added caching for table Add more caching Update MasterServer.cpp grds Update CDBehaviorParameterTable.cpp Update CDBehaviorParameterTable.h Update CDBehaviorTemplateTable.cpp Update Behavior.cpp Update Behavior.cpp change to map Remove redundant query * Remove include * change to enum * Update Behavior.cpp * Use already cached table * Update Behavior.cpp * Reduce memory usage Reduces the memory usage for the BehaviorParameter table by 10MB in memory. * Update CDBehaviorTemplateTable.cpp
43 lines
1.2 KiB
C++
43 lines
1.2 KiB
C++
#pragma once
|
|
|
|
// Custom Classes
|
|
#include "CDTable.h"
|
|
#include <unordered_map>
|
|
#include <unordered_set>
|
|
|
|
/*!
|
|
\file CDBehaviorParameterTable.hpp
|
|
\brief Contains data for the BehaviorParameter table
|
|
*/
|
|
|
|
//! BehaviorParameter Entry Struct
|
|
struct CDBehaviorParameter {
|
|
unsigned int behaviorID; //!< The Behavior ID
|
|
std::unordered_set<std::string>::iterator parameterID; //!< The Parameter ID
|
|
float value; //!< The value of the behavior template
|
|
};
|
|
|
|
//! BehaviorParameter table
|
|
class CDBehaviorParameterTable : public CDTable {
|
|
private:
|
|
std::unordered_map<size_t, CDBehaviorParameter> m_Entries;
|
|
std::unordered_set<std::string> m_ParametersList;
|
|
public:
|
|
|
|
//! Constructor
|
|
CDBehaviorParameterTable(void);
|
|
|
|
//! Destructor
|
|
~CDBehaviorParameterTable(void);
|
|
|
|
//! Returns the table's name
|
|
/*!
|
|
\return The table name
|
|
*/
|
|
std::string GetName(void) const override;
|
|
|
|
CDBehaviorParameter GetEntry(const uint32_t behaviorID, const std::string& name, const float defaultValue = 0);
|
|
|
|
std::map<std::string, float> GetParametersByBehaviorID(uint32_t behaviorID);
|
|
};
|