add atReferenceCounter (#137)

This commit is contained in:
PliskinDev 2023-09-07 23:02:43 +03:00 committed by GitHub
parent 9069c364e4
commit 578e1cbd4b
2 changed files with 31 additions and 0 deletions

View File

@ -139,6 +139,7 @@
#include "player/CPlayerAngles.hpp" #include "player/CPlayerAngles.hpp"
#include "player/CPlayerInfo.hpp" #include "player/CPlayerInfo.hpp"
#include "rage/atArray.hpp" #include "rage/atArray.hpp"
#include "rage/atReferenceCounter.hpp"
#include "rage/atSingleton.hpp" #include "rage/atSingleton.hpp"
#include "rage/joaat.hpp" #include "rage/joaat.hpp"
#include "rage/rlGamerHandle.hpp" #include "rage/rlGamerHandle.hpp"

View File

@ -0,0 +1,30 @@
#pragma once
#include "../base/datBase.hpp"
namespace rage
{
class atReferenceCounter : public datBase
{
public:
atReferenceCounter() : m_ref_count(0) {}
void AddReference() {
m_ref_count++;
}
void ReleaseReference() {
m_ref_count--;
if(m_ref_count == 0) {
delete this;
}
}
int GetReferenceCount() const {
return m_ref_count;
}
private:
int m_ref_count; // 0x0000
};
}