mirror of
https://github.com/Mr-X-GTA/GTAV-Classes-1.git
synced 2026-10-10 03:43:17 +08:00
add atReferenceCounter (#137)
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user