Discovered I need to do something
This commit is contained in:
@@ -19,33 +19,33 @@
|
||||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
*/
|
||||
#include "battle.hpp"
|
||||
#include "battle_data.hpp"
|
||||
|
||||
Battle::Battle() {
|
||||
BattleData::BattleData() {
|
||||
//
|
||||
}
|
||||
|
||||
Battle::~Battle() {
|
||||
BattleData::~BattleData() {
|
||||
//
|
||||
}
|
||||
|
||||
void Battle::Update() {
|
||||
void BattleData::Update() {
|
||||
//
|
||||
}
|
||||
|
||||
//accessors and mutators
|
||||
void Battle::PushCharacter(CharacterData* const characterData) {
|
||||
void BattleData::PushCharacter(CharacterData* const characterData) {
|
||||
//
|
||||
}
|
||||
|
||||
void Battle::PopCharacter(CharacterData* const characterData) {
|
||||
void BattleData::PopCharacter(CharacterData* const characterData) {
|
||||
//
|
||||
}
|
||||
|
||||
void Battle::PushCreature(CreatureData* const creatureData) {
|
||||
void BattleData::PushCreature(CreatureData* const creatureData) {
|
||||
//
|
||||
}
|
||||
|
||||
void Battle::PopCreature(CreatureData* const creatureData) {
|
||||
void BattleData::PopCreature(CreatureData* const creatureData) {
|
||||
//
|
||||
}
|
||||
@@ -26,10 +26,10 @@
|
||||
|
||||
#include <functional>
|
||||
|
||||
class Battle {
|
||||
class BattleData {
|
||||
public:
|
||||
Battle();
|
||||
~Battle();
|
||||
BattleData();
|
||||
~BattleData();
|
||||
|
||||
void Update();
|
||||
|
||||
@@ -38,7 +38,7 @@ void BattleManager::Update() {
|
||||
|
||||
int BattleManager::Create() {
|
||||
//implicitly create the new object
|
||||
elementMap.emplace( std::pair<int, Battle>(counter, Battle()) );
|
||||
elementMap.emplace( std::pair<int, BattleData>(counter, BattleData()) );
|
||||
|
||||
//TODO: do various things like saving to the database
|
||||
return counter++;
|
||||
@@ -54,8 +54,8 @@ void BattleManager::UnloadAll() {
|
||||
elementMap.clear();
|
||||
}
|
||||
|
||||
void BattleManager::UnloadIf(std::function<bool(std::pair<const int, Battle const&>)> fn) {
|
||||
std::map<int, Battle>::iterator it = elementMap.begin();
|
||||
void BattleManager::UnloadIf(std::function<bool(std::pair<const int, BattleData const&>)> fn) {
|
||||
std::map<int, BattleData>::iterator it = elementMap.begin();
|
||||
while (it != elementMap.end()) {
|
||||
if (fn(*it)) {
|
||||
it = elementMap.erase(it);
|
||||
@@ -66,8 +66,8 @@ void BattleManager::UnloadIf(std::function<bool(std::pair<const int, Battle cons
|
||||
}
|
||||
}
|
||||
|
||||
Battle* BattleManager::Find(int uid) {
|
||||
std::map<int, Battle>::iterator it = elementMap.find(uid);
|
||||
BattleData* BattleManager::Find(int uid) {
|
||||
std::map<int, BattleData>::iterator it = elementMap.find(uid);
|
||||
|
||||
if (it == elementMap.end()) {
|
||||
return nullptr;
|
||||
@@ -80,7 +80,7 @@ int BattleManager::GetLoadedCount() {
|
||||
return elementMap.size();
|
||||
}
|
||||
|
||||
std::map<int, Battle>* BattleManager::GetContainer() {
|
||||
std::map<int, BattleData>* BattleManager::GetContainer() {
|
||||
return &elementMap;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "battle.hpp"
|
||||
#include "battle_data.hpp"
|
||||
|
||||
#include "lua.hpp"
|
||||
#include "sqlite3.h"
|
||||
@@ -41,12 +41,12 @@ public:
|
||||
void Unload(int uid);
|
||||
|
||||
void UnloadAll();
|
||||
void UnloadIf(std::function<bool(std::pair<const int, Battle const&>)> fn);
|
||||
void UnloadIf(std::function<bool(std::pair<const int, BattleData const&>)> fn);
|
||||
|
||||
//accessors & mutators
|
||||
Battle* Find(int uid);
|
||||
BattleData* Find(int uid);
|
||||
int GetLoadedCount();
|
||||
std::map<int, Battle>* GetContainer();
|
||||
std::map<int, BattleData>* GetContainer();
|
||||
|
||||
//hooks
|
||||
lua_State* SetLuaState(lua_State* L);
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
|
||||
private:
|
||||
//members
|
||||
std::map<int, Battle> elementMap;
|
||||
std::map<int, BattleData> elementMap;
|
||||
int counter = 0;
|
||||
lua_State* lua = nullptr;
|
||||
sqlite3* database = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user