- removed all direct access to AWeapon's members to prepare moving this class fully to the script side.

Disregarding UI-side and setup-related calls there's unfortunately still 6 places in the native game code which require direct access.
This commit is contained in:
Christoph Oelckers 2018-11-25 08:17:37 +01:00
commit b5c4ab8c47
18 changed files with 95 additions and 76 deletions

View file

@ -369,8 +369,10 @@ void DBot::WhatToGet (AActor *item)
{
if (!weapgiveammo)
return;
if ((heldWeapon->Ammo1 == NULL || heldWeapon->Ammo1->Amount >= heldWeapon->Ammo1->MaxAmount) &&
(heldWeapon->Ammo2 == NULL || heldWeapon->Ammo2->Amount >= heldWeapon->Ammo2->MaxAmount))
auto ammo1 = heldWeapon->PointerVar<AInventory>(NAME_Ammo1);
auto ammo2 = heldWeapon->PointerVar<AInventory>(NAME_Ammo2);
if ((ammo1 == NULL || ammo1->Amount >= ammo1->MaxAmount) &&
(ammo2 == NULL || ammo2->Amount >= ammo2->MaxAmount))
{
return;
}