void Misc::quickReload(UserCmd* cmd) noexcept
{
if (config->misc.quickReload) {
static Entity* reloadedWeapon{ nullptr };
if (reloadedWeapon) {
for (auto weaponHandle : localPlayer->weapons()) {
if (weaponHandle == -1)
break;
if (interfaces->entityList->getEntityFromHandle(weaponHandle) == reloadedWeapon) {
cmd->weaponselect = reloadedWeapon->index();
cmd->weaponsubtype = reloadedWeapon->getWeaponSubType();
break;
}
}
reloadedWeapon = nullptr;
}
if (auto activeWeapon{ localPlayer->getActiveWeapon() }; activeWeapon && activeWeapon->isInReload() && activeWeapon->clip() == activeWeapon->getWeaponData()->maxClip) {
reloadedWeapon = activeWeapon;
for (auto weaponHandle : localPlayer->weapons()) {
if (weaponHandle == -1)
break;
if (auto weapon{ interfaces->entityList->getEntityFromHandle(weaponHandle) }; weapon && weapon != reloadedWeapon) {
cmd->weaponselect = weapon->index();
cmd->weaponsubtype = weapon->getWeaponSubType();
break;
}
}
}
}
}