add atReferenceCounter (#137)
This commit is contained in:
parent
fa353bafe8
commit
dc9df31916
@ -139,6 +139,7 @@
|
||||
#include "player/CPlayerAngles.hpp"
|
||||
#include "player/CPlayerInfo.hpp"
|
||||
#include "rage/atArray.hpp"
|
||||
#include "rage/atReferenceCounter.hpp"
|
||||
#include "rage/atSingleton.hpp"
|
||||
#include "rage/joaat.hpp"
|
||||
#include "rage/rlGamerHandle.hpp"
|
||||
|
30
rage/atReferenceCounter.hpp
Normal file
30
rage/atReferenceCounter.hpp
Normal 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
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user