CPathFindArea: Make use of std::bitmap with CPFBitSet

Same behavior, but without the need to roll the operations ourselves.
This commit is contained in:
Lioncash 2020-03-25 04:12:53 -04:00
parent 81dcc0604b
commit d0292fdc5d
1 changed files with 6 additions and 8 deletions

View File

@ -1,5 +1,6 @@
#pragma once #pragma once
#include <bitset>
#include <memory> #include <memory>
#include <vector> #include <vector>
@ -17,16 +18,13 @@ class CVParamTransfer;
class CObjectReference; class CObjectReference;
class CPFBitSet { class CPFBitSet {
u32 x0_bitmap[16] = {}; std::bitset<128> x0_bitmap;
public: public:
void Clear() { void Clear() { x0_bitmap.reset(); }
for (u32& w : x0_bitmap) void Add(s32 i) { x0_bitmap.set(i); }
w = 0; bool Test(s32 i) const { return x0_bitmap.test(i); }
} void Rmv(s32 i) { x0_bitmap.reset(i); }
void Add(s32 i) { x0_bitmap[i / 32] |= (1 << (i % 32)); }
bool Test(s32 i) const { return (x0_bitmap[i / 32] & (1 << (i % 32))) != 0; }
void Rmv(s32 i) { x0_bitmap[i / 32] &= ~(1 << (i % 32)); }
}; };
class CPFAreaOctree { class CPFAreaOctree {