From 5de91ef5fdcd79ec278da4a5dc87121b88bd821b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Wed, 19 Aug 2020 18:15:36 +0200 Subject: [PATCH] ksys/act: Fix BaseProc::isSpecialJobType_ return type BaseProc::isSpecialJobType_ returns 0, 1 or 2 This fixes the matching issue! --- src/KingSystem/ActorSystem/actBaseProc.cpp | 8 +++++--- src/KingSystem/ActorSystem/actBaseProc.h | 8 +++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/KingSystem/ActorSystem/actBaseProc.cpp b/src/KingSystem/ActorSystem/actBaseProc.cpp index 01ccc5d4..ed50eef2 100644 --- a/src/KingSystem/ActorSystem/actBaseProc.cpp +++ b/src/KingSystem/ActorSystem/actBaseProc.cpp @@ -156,9 +156,11 @@ void BaseProc::preDelete2_(bool*) {} void BaseProc::preDelete1_() {} -// NON_MATCHING: branching -bool BaseProc::isSpecialJobType_(JobType type) { - return BaseProcMgr::instance()->isSpecialJobType(type) || isSpecialJobTypeForThisActor_(type); +BaseProc::IsSpecialJobTypeResult BaseProc::isSpecialJobType_(JobType type) { + if (BaseProcMgr::instance()->isSpecialJobType(type) || isSpecialJobTypeForThisActor_(type)) + return IsSpecialJobTypeResult::Yes; + + return IsSpecialJobTypeResult::No; } bool BaseProc::canWakeUp_() { diff --git a/src/KingSystem/ActorSystem/actBaseProc.h b/src/KingSystem/ActorSystem/actBaseProc.h index 4155c683..325e8dac 100644 --- a/src/KingSystem/ActorSystem/actBaseProc.h +++ b/src/KingSystem/ActorSystem/actBaseProc.h @@ -185,6 +185,12 @@ protected: Done = 1, }; + enum class IsSpecialJobTypeResult { + No = 0, + Yes = 1, + _2 = 2, + }; + struct InitContext { InitResult result; bool sleep_after_init; @@ -241,7 +247,7 @@ protected: /// Called to actually pre-delete (first callback). virtual void preDelete1_(); - virtual bool isSpecialJobType_(JobType type); + virtual IsSpecialJobTypeResult isSpecialJobType_(JobType type); virtual bool canWakeUp_(); virtual void queueExtraJobPush_(JobType type); virtual bool hasJobType_(JobType type);