summaryrefslogtreecommitdiff
path: root/src/KingSystem/ActorSystem/actBaseProc.cpp
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2021-02-07 00:28:21 +0100
committerLéo Lam <leo@leolam.fr>2021-02-07 00:28:21 +0100
commit76eb407fe4cc9ebc76e682765c0e557c35f413fd (patch)
tree01c5b1c1d4f7db7b5f7dc04d6fa573b1c6cfac5e /src/KingSystem/ActorSystem/actBaseProc.cpp
parent5f5c27a0782cda67115197f8fe2ca2588b6e4a22 (diff)
ksys/act: Add getJobHandler wrapper to clean up casts
Diffstat (limited to 'src/KingSystem/ActorSystem/actBaseProc.cpp')
-rw-r--r--src/KingSystem/ActorSystem/actBaseProc.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/KingSystem/ActorSystem/actBaseProc.cpp b/src/KingSystem/ActorSystem/actBaseProc.cpp
index b6fc7f16..d542d67c 100644
--- a/src/KingSystem/ActorSystem/actBaseProc.cpp
+++ b/src/KingSystem/ActorSystem/actBaseProc.cpp
@@ -231,7 +231,7 @@ bool BaseProc::canWakeUp_() {
void BaseProc::queueExtraJobPush_(JobType type) {
if (!isDeletedOrDeleting())
- BaseProcMgr::instance()->queueExtraJobPush(&mJobHandlers[int(type)]->getLink());
+ BaseProcMgr::instance()->queueExtraJobPush(&getJobHandler(type)->getLink());
}
bool BaseProc::shouldSkipJobPush(JobType type) {
@@ -262,7 +262,7 @@ void BaseProc::setJobPriority(u8 actorparam_priority, JobType type) {
if (isDeletedOrDeleting())
return;
- auto& handler = mJobHandlers[int(type)];
+ auto& handler = getJobHandler(type);
handler->getLink().setNewPriority(actorparam_priority);
if (isCalc()) {
setJobPriorityDuringCalc_(handler, type);
@@ -275,7 +275,7 @@ void BaseProc::setJobPriority2(u8 actorparam_priority, JobType type) {
if (isDeletedOrDeleting())
return;
- auto& handler = mJobHandlers[int(type)];
+ auto& handler = getJobHandler(type);
handler->getLink().setNewPriority2(actorparam_priority);
if (isCalc()) {
setJobPriorityDuringCalc_(handler, type);
@@ -285,7 +285,7 @@ void BaseProc::setJobPriority2(u8 actorparam_priority, JobType type) {
}
bool BaseProc::hasJobType_(JobType type) {
- return mJobHandlers[int(type)] != nullptr;
+ return getJobHandler(type) != nullptr;
}
void BaseProc::afterUpdateState_() {
@@ -311,11 +311,11 @@ void BaseProc::jobInvoked(JobType type) {
if (mStateFlags.isOn(StateFlags::RequestDelete)) {
if (type == JobType::Calc4)
- mJobHandlers[4]->invoke();
+ getJobHandler(JobType::Calc4)->invoke();
special = IsSpecialJobTypeResult::Yes;
} else {
special = isSpecialJobType_(type);
- auto* handler = mJobHandlers[int(type)];
+ auto* handler = getJobHandler(type);
if (special != IsSpecialJobTypeResult::No)
handler->invokeSpecial();
else
@@ -329,10 +329,10 @@ void BaseProc::jobInvoked(JobType type) {
const auto child_special = child->isSpecialJobType_(type);
if (child->mStateFlags.isOn(StateFlags::RequestDelete)) {
if (type == JobType::Calc4)
- child->mJobHandlers[4]->invoke();
+ child->getJobHandler(JobType::Calc4)->invoke();
special = IsSpecialJobTypeResult::Yes;
} else {
- auto* handler = child->mJobHandlers[int(type)];
+ auto* handler = child->getJobHandler(type);
if (special == IsSpecialJobTypeResult::Yes ||
child_special != IsSpecialJobTypeResult::No) {
handler->invokeSpecial();