DarkflameServer/dDatabase/Tables/CDBehaviorTemplateTable.cpp
wincent 56f371216b Abstracted the CDClient tables
There is now an option to utilize shared memory for some CDClient tables by adding `CD_PROVIDER_MEMORY=1` to the CMakeVariables.txt file.

Allows masterconfig.ini to specify another run command for the world server, to allow for easier debugging through `valgrind`.
2022-08-11 16:36:03 +02:00

40 lines
1.2 KiB
C++

#include "CDBehaviorTemplateTable.h"
#include "CDProvider.h"
CDBehaviorTemplate EmptyBehaviorTemplate {0, 0, 0, 0};
CD_PROVIDER(BehaviorTemplateProvider, uint32_t, CDBehaviorTemplate);
//! Constructor
CDBehaviorTemplateTable::CDBehaviorTemplateTable(void) {
NEW_CD_PROVIDER(BehaviorTemplateProvider, "BehaviorTemplate", [](CppSQLite3Query& query) {
CDBehaviorTemplate entry;
entry.behaviorID = query.getIntField(0, -1);
entry.templateID = query.getIntField(1, -1);
entry.effectID = query.getIntField(2, -1);
entry.effectHandle = CDTable::SetString(query.getStringField(3, ""));
return std::make_pair(entry.behaviorID, entry);
}, [](int32_t size) {
return 40 * 1000 * 1000;
}, false);
}
//! Destructor
CDBehaviorTemplateTable::~CDBehaviorTemplateTable(void) { }
//! Returns the table's name
std::string CDBehaviorTemplateTable::GetName(void) const {
return "BehaviorTemplate";
}
const CDBehaviorTemplate& CDBehaviorTemplateTable::GetByBehaviorID(uint32_t behaviorID) const {
return BehaviorTemplateProvider->GetEntry(behaviorID, EmptyBehaviorTemplate);
}
void CDBehaviorTemplateTable::LoadHost() {
BehaviorTemplateProvider->LoadHost();
}