Files
botw/src/KingSystem/ActorSystem/actActorLinkConstDataAccess.cpp
T
Léo Lam 7226150ed7 ksys/act: Add ActorLinkConstDataAccess (incomplete)
Also moves from functions from ActorLinkConstDataAccess (the base class
for BaseProc) into the Actor-specific ActorConstDataAccess
2020-09-17 17:42:35 +02:00

50 lines
1.3 KiB
C++

#include "KingSystem/ActorSystem/actActorLinkConstDataAccess.h"
#include "KingSystem/ActorSystem/actBaseProc.h"
#include "KingSystem/ActorSystem/actBaseProcMgr.h"
#include "KingSystem/Utils/Debug.h"
namespace ksys::act {
ActorLinkConstDataAccess::~ActorLinkConstDataAccess() {
if (mAcquired && mProc)
mProc->release();
mAcquired = false;
mProc = nullptr;
}
bool ActorLinkConstDataAccess::acquire(BaseProc* proc) {
if (mProc) {
if (mAcquired)
mProc->release();
mAcquired = false;
mProc = nullptr;
}
return proc && proc->acquire(*this);
}
bool acquireProc(ActorLinkConstDataAccess* accessor, BaseProc* proc, const sead::SafeString& from,
s32) {
bool acquired = false;
if (accessor) {
acquired = accessor->acquire(proc);
if (!acquired)
return false;
}
if (acquired || BaseProcMgr::instance()->isHighPriorityThread())
return true;
sead::FixedSafeString<256> message;
// (%s)Acquiring from a low priority thread. Please change via ActorLinkConstDataAccess
message.format("(%s)低スレッドからの取得です。ActorLinkConstDataAccess経由に変更お願いします",
from.cstr());
util::PrintDebug(message);
return false;
}
} // namespace ksys::act