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(); Entity* builder = GetBuilder();
if (builder == nullptr) { if (!builder) {
ResetRebuild(false); ResetRebuild(false);
return; return;
@ -198,16 +198,16 @@ void RebuildComponent::Update(float deltaTime) {
if (!destComp) break; if (!destComp) break;
int newImagination = destComp->GetImagination(); int newImagination = destComp->GetImagination();
if (newImagination <= 0) {
CancelRebuild(builder, eQuickBuildFailReason::OUT_OF_IMAGINATION, true);
break;
}
++m_DrainedImagination; ++m_DrainedImagination;
--newImagination; --newImagination;
destComp->SetImagination(newImagination); destComp->SetImagination(newImagination);
Game::entityManager->SerializeEntity(builder); Game::entityManager->SerializeEntity(builder);
if (newImagination <= 0) {
CancelRebuild(builder, eQuickBuildFailReason::OUT_OF_IMAGINATION, true);
break;
}
} }