Converted the server's managers to singletons
This commit is contained in:
@@ -23,16 +23,14 @@
|
||||
#define ACCOUNTMANAGER_HPP_
|
||||
|
||||
#include "account_data.hpp"
|
||||
#include "singleton.hpp"
|
||||
|
||||
#include "sqlite3/sqlite3.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
class AccountManager {
|
||||
class AccountManager : public Singleton<AccountManager> {
|
||||
public:
|
||||
AccountManager() = default;
|
||||
~AccountManager() { UnloadAll(); };
|
||||
|
||||
//public access methods
|
||||
int CreateAccount(std::string username, int clientIndex);
|
||||
int LoadAccount(std::string username, int clientIndex);
|
||||
@@ -50,6 +48,11 @@ public:
|
||||
sqlite3* GetDatabase();
|
||||
|
||||
private:
|
||||
friend Singleton<AccountManager>;
|
||||
|
||||
AccountManager() = default;
|
||||
~AccountManager() { UnloadAll(); };
|
||||
|
||||
std::map<int, AccountData> accountMap;
|
||||
sqlite3* database = nullptr;
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#config
|
||||
INCLUDES+=.
|
||||
INCLUDES+=. ../../common/utilities
|
||||
LIBS+=
|
||||
CXXFLAGS+=-std=c++11 $(addprefix -I,$(INCLUDES))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user