From ea2e9dc5618ff9fbf2a9bf772f40118e8ab1defd Mon Sep 17 00:00:00 2001 From: Japa Illo Date: Thu, 5 Apr 2012 09:20:23 +0200 Subject: Fixed item subtypes, made creature happiness only show on dwarves. Signed-off-by: Japa Illo --- Block.cpp | 6 +++--- Creatures.cpp | 5 ++++- ItemConfiguration.cpp | 9 +++++---- ItemConfiguration.h | 2 -- resources/items/greiger items.zip | Bin 0 -> 962 bytes resources/items/greiger items/Grei_items.png | Bin 0 -> 592 bytes resources/items/greiger items/Grei_items.xml | 5 +++++ resources/items/index.txt | 1 + 8 files changed, 18 insertions(+), 10 deletions(-) create mode 100644 resources/items/greiger items.zip create mode 100644 resources/items/greiger items/Grei_items.png create mode 100644 resources/items/greiger items/Grei_items.xml diff --git a/Block.cpp b/Block.cpp index dd1f2b7..76a5822 100644 --- a/Block.cpp +++ b/Block.cpp @@ -292,10 +292,10 @@ void Block::Draw() { if( contentLoader->itemConfigs[Item.item.type] && - (Item.item.type < contentLoader->itemConfigs[Item.item.type]->subItems.size()) && - contentLoader->itemConfigs[Item.item.type]->subItems[Item.item.type]) + (Item.item.index < contentLoader->itemConfigs[Item.item.type]->subItems.size()) && + contentLoader->itemConfigs[Item.item.type]->subItems[Item.item.index]) { - contentLoader->itemConfigs[Item.item.type]->subItems[Item.item.type]->sprite.draw_world(x, y, z, this); + contentLoader->itemConfigs[Item.item.type]->subItems[Item.item.index]->sprite.draw_world(x, y, z, this); } else if ( contentLoader->itemConfigs[Item.item.type] && diff --git a/Creatures.cpp b/Creatures.cpp index ba19970..82eb801 100644 --- a/Creatures.cpp +++ b/Creatures.cpp @@ -15,6 +15,9 @@ #include "df/profession.h" +#include "df/creature_raw.h" +#include "df/caste_raw.h" + //vector v_creatureNames; //vector creatureTypes; @@ -235,7 +238,7 @@ void DrawCreature(int drawx, int drawy, t_unit* creature, Block * b){ vector statusIcons; //if(config.show_creature_happiness) - if(config.show_creature_moods) + if(config.show_creature_moods && df::creature_raw::find(creature->race)->caste[creature->caste]->flags.is_set(caste_raw_flags::CAN_SPEAK)) { if(creature->happiness == 0) statusIcons.push_back(6); diff --git a/ItemConfiguration.cpp b/ItemConfiguration.cpp index ebdeedb..fbab27d 100644 --- a/ItemConfiguration.cpp +++ b/ItemConfiguration.cpp @@ -68,8 +68,9 @@ bool parseItemElement( TiXmlElement* elemRoot, int basefile) { // get subtype string, if available string sub; - if(strGameSub) - sub = strGameSub; + sub += strGameID; + sub += ":"; + sub += strGameSub; //process subtypes ItemTypeInfo itemdef; @@ -101,9 +102,9 @@ bool parseItemElement( TiXmlElement* elemRoot, int basefile) { if(contentLoader->itemConfigs[main_type]->subItems.size() <= subtype) contentLoader->itemConfigs[main_type]->subItems.resize(subtype+1, NULL); - if(!contentLoader->itemConfigs[main_type]->subItems[subtype]->configured) + if(!contentLoader->itemConfigs[main_type]->subItems[subtype]) { - contentLoader->itemConfigs[main_type]->subItems[subtype]->configured = true; + contentLoader->itemConfigs[main_type]->subItems[subtype] = new ItemSubConfiguration; contentLoader->itemConfigs[main_type]->subItems[subtype]->sprite = sprite; } } diff --git a/ItemConfiguration.h b/ItemConfiguration.h index 92ea46b..f66d518 100644 --- a/ItemConfiguration.h +++ b/ItemConfiguration.h @@ -6,8 +6,6 @@ class ItemSubConfiguration { public: c_sprite sprite; - - bool configured; }; class ItemConfiguration diff --git a/resources/items/greiger items.zip b/resources/items/greiger items.zip new file mode 100644 index 0000000..dd5486d Binary files /dev/null and b/resources/items/greiger items.zip differ diff --git a/resources/items/greiger items/Grei_items.png b/resources/items/greiger items/Grei_items.png new file mode 100644 index 0000000..454f8b2 Binary files /dev/null and b/resources/items/greiger items/Grei_items.png differ diff --git a/resources/items/greiger items/Grei_items.xml b/resources/items/greiger items/Grei_items.xml new file mode 100644 index 0000000..b197955 --- /dev/null +++ b/resources/items/greiger items/Grei_items.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/resources/items/index.txt b/resources/items/index.txt index 2d1ed4a..c8e0f13 100644 --- a/resources/items/index.txt +++ b/resources/items/index.txt @@ -1 +1,2 @@ +greiger items/Grei_items.xml items.xml -- cgit v1.2.1