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
#include <bitset>
#include <memory>
#include <vector>
@ -17,16 +18,13 @@ class CVParamTransfer;
class CObjectReference;
class CPFBitSet {
u32 x0_bitmap[16] = {};
std::bitset<128> x0_bitmap;
public:
void Clear() {
for (u32& w : x0_bitmap)
w = 0;
}
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)); }
void Clear() { x0_bitmap.reset(); }
void Add(s32 i) { x0_bitmap.set(i); }
bool Test(s32 i) const { return x0_bitmap.test(i); }
void Rmv(s32 i) { x0_bitmap.reset(i); }
};
class CPFAreaOctree {