diff --git a/dfhack/include/modules/Materials.h b/dfhack/include/modules/Materials.h index f4073c1ca..7f2024419 100644 --- a/dfhack/include/modules/Materials.h +++ b/dfhack/include/modules/Materials.h @@ -19,11 +19,11 @@ namespace DFHack struct t_descriptor_color { - char id[128]; // id in the raws - float r; - float v; - float b; - char name[128]; //displayed name + char id[128]; // id in the raws + float r; + float v; + float b; + char name[128]; //displayed name }; struct t_matglossPlant diff --git a/dfhack/modules/Materials.cpp b/dfhack/modules/Materials.cpp index 8f00b96c6..2a0fdb295 100644 --- a/dfhack/modules/Materials.cpp +++ b/dfhack/modules/Materials.cpp @@ -199,7 +199,24 @@ inline bool ReadNamesOnly(Process* p, uint32_t address, vector & nam bool Materials::ReadInorganicMaterials (vector & inorganic) { - return ReadNamesOnly(d->owner, d->owner->getDescriptor()->getAddress ("mat_inorganics"), inorganic ); + Process * p = d->owner; + DfVector p_matgloss (p, d->owner->getDescriptor()->getAddress ("mat_inorganics")); + uint32_t size = p_matgloss.size(); + inorganic.clear(); + inorganic.reserve (size); + for (uint32_t i = 0; i < size;i++) + { + t_matgloss mat; + + p->readSTLString (p_matgloss[i], mat.id, 128); + //p->readSTLString (p_matgloss[i] + mat_name, mat.name, 128); + mat.name[0] = 0; + mat.fore = 0; + mat.back = 0; + mat.bright = 0; + inorganic.push_back(mat); + } + return true; } bool Materials::ReadOrganicMaterials (vector & organic) diff --git a/output/stones.py b/output/stones.py index de90f8e7e..4db1b3361 100644 --- a/output/stones.py +++ b/output/stones.py @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- import pydfhack -DF = pydfhack.API("Memory.xml") +DF = pydfhack._API("Memory.xml") if DF.Attach(): - success,stones = DF.ReadStoneMatgloss() - if success: - print "Dumping all stone" - for matgloss in stones: - print "ID %s, name %s" % (matgloss.id, matgloss.name) + Mats = DF.materials + stones = Mats.Read_Inorganic_Materials() + print "Dumping all stone" + for matgloss in stones: + print "ID %s, name %s" % (matgloss.id, matgloss.name) DF.Detach()