View Issue Details

IDProjectCategoryView StatusLast Update
0006440Dwarf FortressArtistic Images (engravings etc)public2014-07-23 10:28
ReporterQuietust Assigned ToToady One  
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionfixed 
Product Version0.34.11 
Fixed in Version0.40.05 
Summary0006440: Art facet modifiers not properly applied for creature images, casting wrong pointer
DescriptionWhen 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).
Additional InformationThis was found during analysis of version 0.23.130.23a and subsequently confirmed to still exist in version 0.34.11.
Tagsbinary patch

Relationships

related to 0001285 acknowledgeduser11 Figurine motifs do not influence value during trade 

Activities

Quietust

2014-02-21 08:30

reporter   ~0024547

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);
}

Quietust

2014-02-25 20:16

reporter   ~0024568

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

Issue History

Date Modified Username Field Change
2014-02-21 08:26 Quietust New Issue
2014-02-21 08:30 Quietust Note Added: 0024547
2014-02-21 10:54 user6 Tag Attached: binary patch
2014-02-25 20:16 Quietust Note Added: 0024568
2014-03-06 10:05 user6 Relationship added related to 0001285
2014-03-25 13:16 user11 Assigned To => user11
2014-03-25 13:16 user11 Status new => acknowledged
2014-07-23 10:28 Toady One Status acknowledged => resolved
2014-07-23 10:28 Toady One Fixed in Version => Next Version
2014-07-23 10:28 Toady One Resolution open => fixed
2014-07-23 10:28 Toady One Assigned To user11 => Toady One