diff options
| author | theo3 <arisstephenson2@gmail.com> | 2020-08-24 18:59:54 -0700 |
|---|---|---|
| committer | theo3 <arisstephenson2@gmail.com> | 2020-08-27 14:10:17 -0700 |
| commit | 71ac906495afae2f5b4259bf47982b434a179a49 (patch) | |
| tree | 8bcb84b9e8d7082f34db03a51e9d95c3f547b70c /src/KingSystem/ActorSystem/actBaseProcUnit.cpp | |
| parent | 1ee4ff43d081f85662f79c2a2a3d1a2ef9239ea8 (diff) | |
defined baseProcHandle, baseProcUnit nonmatchings
Diffstat (limited to 'src/KingSystem/ActorSystem/actBaseProcUnit.cpp')
| -rw-r--r-- | src/KingSystem/ActorSystem/actBaseProcUnit.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/KingSystem/ActorSystem/actBaseProcUnit.cpp b/src/KingSystem/ActorSystem/actBaseProcUnit.cpp index e69de29b..8f8b3919 100644 --- a/src/KingSystem/ActorSystem/actBaseProcUnit.cpp +++ b/src/KingSystem/ActorSystem/actBaseProcUnit.cpp @@ -0,0 +1,57 @@ +#include "KingSystem/ActorSystem/actBaseProcUnit.h" +#include <prim/seadSafeString.h> +#include <prim/seadScopedLock.h> +#include "KingSystem/ActorSystem/actActorLinkConstDataAccess.h" +#include "KingSystem/ActorSystem/actBaseProc.h" +#include "KingSystem/Utils/Debug.h" +namespace ksys::act { + +// NON_MATCHING: Equivalent but branches are off. +bool BaseProcUnit::setProc(BaseProc* proc) { + bool ret; + static constexpr const char* sStateNames[] = {"Init", "Calc", "Sleep", "Delete"}; + + auto lock = sead::makeScopedLock(mCS); + if (mProc) + mProc = nullptr; + + if (mHandle == &BaseProcHandle::sDummyBaseProcHandle) + return false; + + if (mHandle) { + if (mFlags != 1) { + sead::FixedSafeString<64> message; + + if (proc) + message.format("%s, %d, %d, %s, ( %p:%p )", proc->getName().cstr(), mFlags, + proc->isInitialized(), sStateNames[u8(proc->getState())], this, + mHandle.load()); + else + message.format("なし, %d, ?, ?, ( %p:%p )", mFlags, this, mHandle.load()); + + util::PrintDebug(message); + } + mProc = proc; + mFlags = 2; + ret = true; + } else { + sead::FixedSafeString<64> message; + + if (proc) + message.format("%s, %d, %d, %s, ( %p:%p )", proc->getName().cstr(), mFlags, + proc->isInitialized(), sStateNames[u8(proc->getState())], this, + mHandle.load()); + else + message.format("なし, %d, ?, ?, ( %p:%p )", mFlags, this, mHandle.load()); + + util::PrintDebug(message); + ret = false; + } + return ret; +} + +bool BaseProcUnit::isParentHandleDefault() const { + return mHandle == &BaseProcHandle::sDummyBaseProcHandle; +} + +} // namespace ksys::act
\ No newline at end of file |
