mirror of
https://github.com/zeldaret/ss
synced 2026-05-24 07:10:53 -04:00
7400f6c66a
* Improve dAcBase_c * Fix missed polyAttr0/1 renaming * Add getters for EventManager funcs used in dAcBase * Fix include * Replace actor_properties with helper calls * Fix SoundInfo TList function (thanks robo) * Make roundAngleToNearest90 static * Fix removeSoundInfo symbol * Revert d_a_item spawnItem and spawnDrop param change * Fix d_t_reaction and improve spawnHearts a bit * Also update special_item_drop_mgr * Fix special_item_drop_mgr * Small fixes --------- Co-authored-by: robojumper <robojumper@gmail.com> Co-authored-by: elijah-thomas774 <elijahthomas774@gmail.com>
54 lines
813 B
C++
54 lines
813 B
C++
#ifndef RAII_PTR_H
|
|
#define RAII_PTR_H
|
|
|
|
#include "common.h"
|
|
|
|
// This could be std::unique_ptr, but we don't have it yet
|
|
template <typename T>
|
|
class RaiiPtr {
|
|
public:
|
|
T *mPtr;
|
|
|
|
RaiiPtr() : mPtr(nullptr) {}
|
|
~RaiiPtr() {
|
|
if (mPtr != nullptr) {
|
|
delete mPtr;
|
|
mPtr = nullptr;
|
|
}
|
|
}
|
|
|
|
void operator=(T *ptr) {
|
|
mPtr = ptr;
|
|
}
|
|
|
|
operator bool() const {
|
|
return mPtr != nullptr;
|
|
}
|
|
|
|
const T *get() const {
|
|
return mPtr;
|
|
}
|
|
|
|
T *get() {
|
|
return mPtr;
|
|
}
|
|
|
|
const T *operator->() const {
|
|
return mPtr;
|
|
}
|
|
|
|
T *operator->() {
|
|
return mPtr;
|
|
}
|
|
|
|
const T &operator*() const {
|
|
return *this->operator->();
|
|
}
|
|
|
|
T &operator*() {
|
|
return *this->operator->();
|
|
}
|
|
};
|
|
|
|
#endif
|