From eff8e885d5956fb871df8f7b131ccb19d8b23eb4 Mon Sep 17 00:00:00 2001 From: tomangelo2 Date: Sun, 30 Jan 2022 20:40:04 +0100 Subject: [PATCH] Fix assert fail after PR#1444 --- src/object/auto/autopowercaptor.cpp | 2 +- src/object/auto/autopowerstation.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/object/auto/autopowercaptor.cpp b/src/object/auto/autopowercaptor.cpp index a292b82f..36db524c 100644 --- a/src/object/auto/autopowercaptor.cpp +++ b/src/object/auto/autopowercaptor.cpp @@ -269,7 +269,7 @@ void CAutoPowerCaptor::ChargeObject(float rTime) if (obj->Implements(ObjectInterfaceType::Slotted)) { CSlottedObject* slotted = dynamic_cast(obj); - for (int slot = slotted->GetNumSlots(); slot >= 0; slot--) + for (int slot = slotted->GetNumSlots() - 1; slot >= 0; slot--) { CObject *held = slotted->GetSlotContainedObject(slot); if (held != nullptr && held->Implements(ObjectInterfaceType::PowerContainer)) diff --git a/src/object/auto/autopowerstation.cpp b/src/object/auto/autopowerstation.cpp index c479f589..793f3572 100644 --- a/src/object/auto/autopowerstation.cpp +++ b/src/object/auto/autopowerstation.cpp @@ -134,7 +134,7 @@ bool CAutoPowerStation::EventProcess(const Event &event) if (vehicle != nullptr && vehicle->Implements(ObjectInterfaceType::Slotted)) { CSlottedObject* slotted = dynamic_cast(vehicle); - for (int slot = slotted->GetNumSlots(); slot >= 0; slot--) + for (int slot = slotted->GetNumSlots() - 1; slot >= 0; slot--) { CObject *power = slotted->GetSlotContainedObject(slot); if (power != nullptr && power->Implements(ObjectInterfaceType::PowerContainer))