- took the weapon selection logic out of the WeaponSlots data and blocked all direct access to the weapon slots internals

This seriously needs to be independent from the data store and better abstracted. More work to come to move this to its proper place.
This commit is contained in:
Christoph Oelckers 2018-11-24 22:03:56 +01:00
commit 51ee623b3b
11 changed files with 286 additions and 278 deletions

View file

@ -582,9 +582,9 @@ static int DrawAmmo(player_t *CPlayer, int x, int y)
else
{
// Order ammo by use of weapons in the weapon slots
for (k = 0; k < NUM_WEAPON_SLOTS; k++) for(j = 0; j < CPlayer->weapons.Slots[k].Size(); j++)
for (k = 0; k < NUM_WEAPON_SLOTS; k++) for(j = 0; j < CPlayer->weapons.SlotSize(k); j++)
{
PClassActor *weap = CPlayer->weapons.Slots[k].GetWeapon(j);
PClassActor *weap = CPlayer->weapons.GetWeapon(k, j);
if (weap)
{
@ -782,9 +782,9 @@ static void DrawWeapons(player_t *CPlayer, int x, int y)
}
// And now everything in the weapon slots back to front
for (k = NUM_WEAPON_SLOTS - 1; k >= 0; k--) for(j = CPlayer->weapons.Slots[k].Size() - 1; j >= 0; j--)
for (k = NUM_WEAPON_SLOTS - 1; k >= 0; k--) for(j = CPlayer->weapons.SlotSize(k) - 1; j >= 0; j--)
{
PClassActor *weap = CPlayer->weapons.Slots[k].GetWeapon(j);
PClassActor *weap = CPlayer->weapons.GetWeapon(k, j);
if (weap)
{
inv=CPlayer->mo->FindInventory(weap);