summaryrefslogtreecommitdiff
path: root/Creatures.cpp
diff options
context:
space:
mode:
authorJapa Illo2012-02-27 01:32:50 +0530
committerJapa Illo2012-02-27 01:32:50 +0530
commit93cc5ad961a9067a1a407b52a0cc96dbef1f7cfb (patch)
tree21fe71bc60f0bf451504c10fae34562e8e4afee6 /Creatures.cpp
parentbf1094b4d195b24acecf947770346623d3a399b5 (diff)
downloadstonesense-93cc5ad961a9067a1a407b52a0cc96dbef1f7cfb.tar.gz
stonesense-93cc5ad961a9067a1a407b52a0cc96dbef1f7cfb.tar.bz2
stonesense-93cc5ad961a9067a1a407b52a0cc96dbef1f7cfb.tar.xz
Added ability to detect that the adventurer is covered in guts.
Signed-off-by: Japa Illo <japa.mala.illo@gmail.com>
Diffstat (limited to 'Creatures.cpp')
-rw-r--r--Creatures.cpp83
1 files changed, 83 insertions, 0 deletions
diff --git a/Creatures.cpp b/Creatures.cpp
index f5f1b3d..3a0385e 100644
--- a/Creatures.cpp
+++ b/Creatures.cpp
@@ -8,6 +8,7 @@
#include "SpriteColors.h"
#include "DataDefs.h"
#include "df/world.h"
+#include "df/unit_inventory_item.h"
//vector<t_matgloss> v_creatureNames;
//vector<CreatureConfiguration> creatureTypes;
@@ -376,6 +377,88 @@ void ReadCreaturesToSegment( DFHack::Core& DF, WorldSegment* segment)
break;
}
}
+ // add the materials of what the creature's wearing.
+ b->Weapon.matt.index=INVALID_INDEX;
+ b->Weapon.matt.type=INVALID_INDEX;
+ b->Weapon.rating = 0;
+ b->Armor.matt.index=INVALID_INDEX;
+ b->Armor.matt.type=INVALID_INDEX;
+ b->Armor.rating = 0;
+ b->Shoes.matt.index=INVALID_INDEX;
+ b->Shoes.matt.type=INVALID_INDEX;
+ b->Shoes.rating = 0;
+ b->Shield.matt.index=INVALID_INDEX;
+ b->Shield.matt.type=INVALID_INDEX;
+ b->Shield.rating = 0;
+ b->Helm.matt.index=INVALID_INDEX;
+ b->Helm.matt.type=INVALID_INDEX;
+ b->Helm.rating = 0;
+ b->Gloves.matt.index=INVALID_INDEX;
+ b->Gloves.matt.type=INVALID_INDEX;
+ b->Gloves.rating = 0;
+ for (int i = 0; i < b->creature->origin->inventory.size(); i++)
+ {
+ if(b->creature->origin->inventory[i]->mode == df::unit_inventory_item::T_mode::Weapon ||
+ b->creature->origin->inventory[i]->mode == df::unit_inventory_item::T_mode::Worn)
+ {
+ item_type::item_type type = b->creature->origin->inventory[i]->item->getType();
+ int8_t armor = b->creature->origin->inventory[i]->item->getEffectiveArmorLevel();
+ if (type = item_type::WEAPON)
+ {
+ //if(armor > b->Weapon.rating)
+ //{
+ b->Weapon.rating = armor;
+ b->Weapon.matt.type = b->creature->origin->inventory[i]->item->getActualMaterial();
+ b->Weapon.matt.index = b->creature->origin->inventory[i]->item->getActualMaterialIndex();
+ //}
+ }
+ if (type = item_type::ARMOR)
+ {
+ //if(armor > b->Armor.rating)
+ //{
+ b->Armor.rating = armor;
+ b->Armor.matt.type = b->creature->origin->inventory[i]->item->getActualMaterial();
+ b->Armor.matt.index = b->creature->origin->inventory[i]->item->getActualMaterialIndex();
+ //}
+ }
+ if (type = item_type::SHOES)
+ {
+ //if(armor > b->Shoes.rating)
+ //{
+ b->Shoes.rating = armor;
+ b->Shoes.matt.type = b->creature->origin->inventory[i]->item->getActualMaterial();
+ b->Shoes.matt.index = b->creature->origin->inventory[i]->item->getActualMaterialIndex();
+ //}
+ }
+ if (type = item_type::SHIELD)
+ {
+ //if(armor > b->Shield.rating)
+ //{
+ b->Shield.rating = armor;
+ b->Shield.matt.type = b->creature->origin->inventory[i]->item->getActualMaterial();
+ b->Shield.matt.index = b->creature->origin->inventory[i]->item->getActualMaterialIndex();
+ //}
+ }
+ if (type = item_type::HELM)
+ {
+ //if(armor > b->Helm.rating)
+ //{
+ b->Helm.rating = armor;
+ b->Helm.matt.type = b->creature->origin->inventory[i]->item->getActualMaterial();
+ b->Helm.matt.index = b->creature->origin->inventory[i]->item->getActualMaterialIndex();
+ //}
+ }
+ if (type = item_type::GLOVES)
+ {
+ //if(armor > b->Weapon.rating)
+ //{
+ b->Gloves.rating = armor;
+ b->Gloves.matt.type = b->creature->origin->inventory[i]->item->getActualMaterial();
+ b->Gloves.matt.index = b->creature->origin->inventory[i]->item->getActualMaterialIndex();
+ //}
+ }
+ }
+ }
// need a new tempcreature now
// old tempcreature should be deleted when b is
tempcreature = new t_unit;