Use vector instead of forward_list for dpGrid

also swap contains in for find != end on an associative container since we are in c++20 now :)
This commit is contained in:
David Markowitz
2024-02-04 06:10:07 -08:00
parent 050184c558
commit f2e7d2eaac
3 changed files with 44 additions and 48 deletions

View File

@@ -1,8 +1,7 @@
#pragma once
#include <vector>
#include <list>
#include <forward_list>
#include <map>
#include <vector>
#include "dCommonVars.h"
class dpEntity;
@@ -30,7 +29,8 @@ public:
*/
void SetDeleteGrid(bool value) { this->m_DeleteGrid = value; };
std::vector<std::vector<std::forward_list<dpEntity*>>> GetCells() { return this->m_Cells; };
// Intentional copy since this is only used when we delete this class to re-create it.
std::vector<std::vector<std::vector<dpEntity*>>> GetCells() { return this->m_Cells; };
private:
void HandleEntity(dpEntity* entity, dpEntity* other);
@@ -38,7 +38,7 @@ private:
private:
//cells on X, cells on Y for that X, then another vector that contains the entities within that cell.
std::vector<std::vector<std::forward_list<dpEntity*>>> m_Cells;
std::vector<std::vector<std::vector<dpEntity*>>> m_Cells;
std::map<LWOOBJID, dpEntity*> m_GargantuanObjects;
bool m_DeleteGrid = true;
};