- Some cleanups for c_cmds.cpp, exported some functions as well as functions used for "print/targetinv" to their own file.

This commit is contained in:
Rachael Alexanderson 2016-12-13 18:47:56 -05:00 committed by Christoph Oelckers
commit cab1b60ffc
5 changed files with 174 additions and 44 deletions

View file

@ -21,6 +21,7 @@
#include "serializer.h"
#include "virtual.h"
#include "a_ammo.h"
#include "c_functions.h"
EXTERN_CVAR(Bool, sv_unlimited_pickup)
@ -1567,7 +1568,6 @@ bool AInventory::CanPickup (AActor *toucher)
CCMD (printinv)
{
AInventory *item;
int pnum = consoleplayer;
#ifdef _DEBUG
@ -1581,37 +1581,21 @@ CCMD (printinv)
}
}
#endif
if (players[pnum].mo == NULL)
{
return;
}
for (item = players[pnum].mo->Inventory; item != NULL; item = item->Inventory)
{
Printf ("%s #%u (%d/%d)\n", item->GetClass()->TypeName.GetChars(),
item->InventoryID,
item->Amount, item->MaxAmount);
}
C_PrintInv(players[pnum].mo);
}
CCMD (targetinv)
{
AInventory *item;
FTranslatedLineTarget t;
if (CheckCheatmode () || players[consoleplayer].mo == NULL)
return;
P_AimLineAttack(players[consoleplayer].mo,players[consoleplayer].mo->Angles.Yaw, MISSILERANGE,
&t, 0., ALF_CHECKNONSHOOTABLE|ALF_FORCENOSMART);
C_AimLine(&t, true);
if (t.linetarget)
{
for (item = t.linetarget->Inventory; item != NULL; item = item->Inventory)
{
Printf ("%s #%u (%d/%d)\n", item->GetClass()->TypeName.GetChars(),
item->InventoryID,
item->Amount, item->MaxAmount);
}
C_PrintInv(t.linetarget);
}
else Printf("No target found. Targetinv cannot find actors that have "
"the NOBLOCKMAP flag or have height/radius of 0.\n");