mirror of
https://github.com/Mr-X-GTA/GTAV-Classes-1.git
synced 2024-12-22 14:37:31 +08:00
add atReferenceCounter (#137)
This commit is contained in:
parent
9069c364e4
commit
578e1cbd4b
@ -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"
|
||||||
|
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