Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006440Dwarf FortressArtistic Images (engravings etc)public2014-02-21 08:262014-07-23 10:28
ReporterQuietust 
Assigned ToToady One 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version0.34.11 
Target VersionFixed 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
Attached Files

- Relationships
related to 0001285acknowledgedDwarfu Figurine motifs do not influence value during trade 

-  Notes
(0024547)
Quietust (reporter)
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);
}
(0024568)
Quietust (reporter)
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

- 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 Footkerchief Tag Attached: binary patch
2014-02-25 20:16 Quietust Note Added: 0024568
2014-03-06 10:05 Footkerchief Relationship added related to 0001285
2014-03-25 13:16 Dwarfu Assigned To => Dwarfu
2014-03-25 13:16 Dwarfu 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 Dwarfu => Toady One


Copyright © 2000 - 2010 MantisBT Group
Powered by Mantis Bugtracker