- added 'player.flechettetype' property so that the appropriate flechette type can be set per player class.

- bumped savegame version for flechette type changes.

SVN r3085 (trunk)
This commit is contained in:
Christoph Oelckers 2011-01-01 11:16:46 +00:00
commit e90b86acce
9 changed files with 56 additions and 41 deletions

View file

@ -455,6 +455,8 @@ CCMD (drop)
}
}
const PClass *GetFlechetteType(AActor *other);
CCMD (useflechette)
{ // Select from one of arti_poisonbag1-3, whichever the player has
static const ENamedName bagnames[3] =
@ -463,22 +465,26 @@ CCMD (useflechette)
NAME_ArtiPoisonBag2,
NAME_ArtiPoisonBag3
};
int i, j;
if (who == NULL)
return;
if (who->IsKindOf (PClass::FindClass (NAME_ClericPlayer)))
i = 0;
else if (who->IsKindOf (PClass::FindClass (NAME_MagePlayer)))
i = 1;
else
i = 2;
for (j = 0; j < 3; ++j)
const PClass *type = GetFlechetteType(who);
if (type != NULL)
{
AInventory *item;
if ( (item = who->FindInventory (bagnames[(i+j)%3])) )
if ( (item = who->FindInventory (type) ))
{
SendItemUse = item;
return;
}
}
// The default flechette could not be found. Try all 3 types then.
for (int j = 0; j < 3; ++j)
{
AInventory *item;
if ( (item = who->FindInventory (bagnames[j])) )
{
SendItemUse = item;
break;