Fix incorrect kick out of rebuilds (#1120)

This commit is contained in:
David Markowitz 2023-08-03 19:37:27 -07:00 committed by GitHub
parent 952786c166
commit 208ed02158
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -180,7 +180,7 @@ void RebuildComponent::Update(float deltaTime) {
{
Entity* builder = GetBuilder();
if (builder == nullptr) {
if (!builder) {
ResetRebuild(false);
return;
@ -198,16 +198,16 @@ void RebuildComponent::Update(float deltaTime) {
if (!destComp) break;
int newImagination = destComp->GetImagination();
if (newImagination <= 0) {
CancelRebuild(builder, eQuickBuildFailReason::OUT_OF_IMAGINATION, true);
break;
}
++m_DrainedImagination;
--newImagination;
destComp->SetImagination(newImagination);
Game::entityManager->SerializeEntity(builder);
if (newImagination <= 0) {
CancelRebuild(builder, eQuickBuildFailReason::OUT_OF_IMAGINATION, true);
break;
}
}
@ -482,7 +482,7 @@ void RebuildComponent::CompleteRebuild(Entity* user) {
if (missionComponent) missionComponent->Progress(eMissionTaskType::ACTIVITY, m_ActivityId);
}
}
} else{
} else {
auto* missionComponent = builder->GetComponent<MissionComponent>();
if (missionComponent) missionComponent->Progress(eMissionTaskType::ACTIVITY, m_ActivityId);
}