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))