Dwarf Fortress Bug Tracker - Dwarf Fortress
View Issue Details
0006440Dwarf FortressArtistic Images (engravings etc)public2014-02-21 08:262014-07-23 10:28
Toady One 
normalminorhave not tried
0006440: Art facet modifiers not properly applied for creature images, casting wrong pointer
When trading decorated items with caravans, items bearing images of creatures are intended to adjust their value according to certain properties (e.g. GOOD, EVIL, FANCIFUL, OWN_RACE), but this logic does not appear to work correctly.

It looks like it's trying to caste a pointer of type "art_image_elementst" to "art_image_element_creaturest", but it's using the pointer for the art_image itself rather than the element within it; as a result, the race/caste values are complete garbage (specifically, pointers inside an std::vector).
This was found during analysis of version and subsequently confirmed to still exist in version 0.34.11.
binary patch
related to 0001285acknowledged Dwarfu Figurine motifs do not influence value during trade 
Issue History
2014-02-21 08:26QuietustNew Issue
2014-02-21 08:30QuietustNote Added: 0024547
2014-02-21 10:54FootkerchiefTag Attached: binary patch
2014-02-25 20:16QuietustNote Added: 0024568
2014-03-06 10:05FootkerchiefRelationship addedrelated to 0001285
2014-03-25 13:16DwarfuAssigned To => Dwarfu
2014-03-25 13:16DwarfuStatusnew => acknowledged
2014-07-23 10:28Toady OneStatusacknowledged => resolved
2014-07-23 10:28Toady OneFixed in Version => Next Version
2014-07-23 10:28Toady OneResolutionopen => fixed
2014-07-23 10:28Toady OneAssigned ToDwarfu => Toady One

2014-02-21 08:30   
Effectively, the code appears to be as follows:

art_image *img = improvements[i]->getImage();
if (img->elements[i]->getType() == ART_IMAGE_ELEMENT_CREATURE) {
   art_image_element_creaturest *element = (art_image_element_creaturest *)img; // should be img->elements[i]
   value += getCreatureImageValue(entity, element->race, element->caste);
2014-02-25 20:16   
And now that this bug has been tagged with "binary patch", I feel obligated to actually provide one:

Win32 0.34.11 SDL:
0x01305A5 : 0F B7 4E 08 66 8B 46 0C -> 66 8B 41 0C 0F B7 49 08