git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3132 c06c8d41-db1a-0410-9941-cceddc491573
GNF4E3QZL4L24PB5KIRO5JJAZYIAIQLGH6PEJB3ONWMIIYDKTY6AC
F7Q5PX44SLPANIZXCY67TG2W5JTRVJMHGQW54VJLGB4XRH7R6JBQC
IXLNOTBJGHKESBCTME6QAR6XVWFNCHYGMS62V62ZJEA7VLQHXO2QC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC
HDJSYPW6GTSBM43QYCJQBEBDAUWWHFHUR6DC4ILGF6LJVL26CZPAC
SDLKLUNFGVKDS55DDJZCBAVIB7NL3RRYPTACAY65SCUQKV6APFSAC
KHHAE5ZK7ITEZVMMUKYROKECLE2RU5ZU5OQ4Z4XSRQXE2R65O67AC
MLZSEZWNNZMSIDQNAAIOJJR4K7VSVJICL5SAGHD3ROM7SYDVZABAC
77H4BWWPPGLM3PLZH4QTAJRXIZTSDVNCOKZE223I437FN2UJ34RQC
if (you.inv[bu].base_type == OBJ_CORPSES)
{
if (you.inv[bu].sub_type == CORPSE_BODY)
you.burden += mons_weight(you.inv[bu].plus);
else if (you.inv[bu].sub_type == CORPSE_SKELETON)
you.burden += mons_weight(you.inv[bu].plus) / 2;
}
else
{
you.burden += item_mass( you.inv[bu] ) * you.inv[bu].quantity;
}
you.burden += item_mass( you.inv[bu] ) * you.inv[bu].quantity;
}
void destroy_item( int dest, bool never_created )
{
// Don't destroy non-items, but this function may be called upon
// to remove items reduced to zero quantity, so we allow "invalid"
// objects in.
if (dest == NON_ITEM || !is_valid_item( mitm[dest] ))
return;
unlink_item( dest );
destroy_item( mitm[dest], never_created );
}
}
}
}
static void rot_inventory_food(long time_delta)
{
// Update all of the corpses and food chunks in the player's
// inventory {should be moved elsewhere - dlb}
bool burden_changed_by_rot = false;
bool new_rotting_item = false;
for (int i = 0; i < ENDOFPACK; i++)
{
if (you.inv[i].quantity < 1)
continue;
if (you.inv[i].base_type != OBJ_CORPSES && you.inv[i].base_type != OBJ_FOOD)
continue;
if (you.inv[i].base_type == OBJ_CORPSES
&& you.inv[i].sub_type > CORPSE_SKELETON)
{
continue;
}
if (you.inv[i].base_type == OBJ_FOOD && you.inv[i].sub_type != FOOD_CHUNK)
continue;
if ((time_delta / 20) >= you.inv[i].special)
{
if (you.inv[i].base_type == OBJ_FOOD)
{
if (you.equip[EQ_WEAPON] == i)
unwield_item();
destroy_item(you.inv[i]);
burden_changed_by_rot = true;
continue;
}
if (you.inv[i].sub_type == CORPSE_SKELETON)
continue; // carried skeletons are not destroyed
if (!mons_skeleton( you.inv[i].plus ))
{
if (you.equip[EQ_WEAPON] == i)
unwield_item();
destroy_item(you.inv[i]);
burden_changed_by_rot = true;
continue;
}
you.inv[i].sub_type = CORPSE_SKELETON;
you.inv[i].special = 0;
you.inv[i].colour = LIGHTGREY;
you.wield_change = true;
burden_changed_by_rot = true;
continue;
}
you.inv[i].special -= (time_delta / 20);
if (you.inv[i].special < 100 && (you.inv[i].special + (time_delta / 20)>=100))
{
new_rotting_item = true;
}
}
//mv: messages when chunks/corpses become rotten
if (new_rotting_item)
{
// XXX: should probably still notice?
// Races that can't smell don't care, and trolls are stupid and
// don't care.
if (player_can_smell() && you.species != SP_TROLL)
{
int temp_rand = 0; // Grr.
switch (you.mutation[MUT_SAPROVOROUS])
{
// level 1 and level 2 saprovores aren't so touchy
case 1:
case 2:
temp_rand = random2(8);
mpr( ((temp_rand < 5) ? "You smell something rotten." :
(temp_rand == 5) ? "You smell rotting flesh." :
(temp_rand == 6) ? "You smell decay."
: "There is something rotten in your inventory."),
MSGCH_ROTTEN_MEAT );
break;
// level 3 saprovores like it
case 3:
temp_rand = random2(8);
mpr( ((temp_rand < 5) ? "You smell something rotten." :
(temp_rand == 5) ? "The smell of rotting flesh makes you hungry." :
(temp_rand == 6) ? "You smell decay. Yum-yum."
: "Wow! There is something tasty in your inventory."),
MSGCH_ROTTEN_MEAT );
break;
default:
temp_rand = random2(8);
mpr( ((temp_rand < 5) ? "You smell something rotten." :
(temp_rand == 5) ? "The smell of rotting flesh makes you sick." :
(temp_rand == 6) ? "You smell decay. Yuck!"
: "Ugh! There is something really disgusting in your inventory."),
MSGCH_ROTTEN_MEAT );
break;
int temp_rand; // probability determination {dlb}
unsigned char i; // loop variable {dlb}
bool new_rotting_item = false; //mv: becomes true when some new item becomes rotting
// Update all of the corpses and food chunks in the player's
// inventory {should be moved elsewhere - dlb}
for (i = 0; i < ENDOFPACK; i++)
{
if (you.inv[i].quantity < 1)
continue;
if (you.inv[i].base_type != OBJ_CORPSES && you.inv[i].base_type != OBJ_FOOD)
continue;
if (you.inv[i].base_type == OBJ_CORPSES
&& you.inv[i].sub_type > CORPSE_SKELETON)
{
continue;
}
if (you.inv[i].base_type == OBJ_FOOD && you.inv[i].sub_type != FOOD_CHUNK)
continue;
if ((time_delta / 20) >= you.inv[i].special)
{
if (you.inv[i].base_type == OBJ_FOOD)
{
if (you.equip[EQ_WEAPON] == i)
unwield_item();
mpr("Your equipment suddenly weighs less.", MSGCH_ROTTEN_MEAT);
// FIXME should replace with a destroy_item call
you.inv[i].quantity = 0;
burden_change();
continue;
}
if (you.inv[i].sub_type == CORPSE_SKELETON)
continue; // carried skeletons are not destroyed
if (!mons_skeleton( you.inv[i].plus ))
{
if (you.equip[EQ_WEAPON] == i)
unwield_item();
// FIXME should replace with a destroy_item call
you.inv[i].quantity = 0;
burden_change();
continue;
}
you.inv[i].sub_type = 1;
you.inv[i].special = 0;
you.inv[i].colour = LIGHTGREY;
you.wield_change = true;
continue;
}
you.inv[i].special -= (time_delta / 20);
//mv: messages when chunks/corpses become rotten
if (new_rotting_item)
{
// XXX: should probably still notice?
// Races that can't smell don't care, and trolls are stupid and
// don't care.
if (player_can_smell() && you.species != SP_TROLL)
{
switch (you.mutation[MUT_SAPROVOROUS])
{
// level 1 and level 2 saprovores aren't so touchy
case 1:
case 2:
temp_rand = random2(8);
mpr( ((temp_rand < 5) ? "You smell something rotten." :
(temp_rand == 5) ? "You smell rotting flesh." :
(temp_rand == 6) ? "You smell decay."
: "There is something rotten in your inventory."),
MSGCH_ROTTEN_MEAT );
break;
// level 3 saprovores like it
case 3:
temp_rand = random2(8);
mpr( ((temp_rand < 5) ? "You smell something rotten." :
(temp_rand == 5) ? "The smell of rotting flesh makes you hungry." :
(temp_rand == 6) ? "You smell decay. Yum-yum."
: "Wow! There is something tasty in your inventory."),
MSGCH_ROTTEN_MEAT );
break;
default:
temp_rand = random2(8);
mpr( ((temp_rand < 5) ? "You smell something rotten." :
(temp_rand == 5) ? "The smell of rotting flesh makes you sick." :
(temp_rand == 6) ? "You smell decay. Yuck!"
: "Ugh! There is something really disgusting in your inventory."),
MSGCH_ROTTEN_MEAT );
break;
}
}
learned_something_new(TUT_ROTTEN_FOOD);
}