From d5b8821a9005f02da0b3e76588c8af0cae9c2786 Mon Sep 17 00:00:00 2001 From: simon Date: Thu, 29 Apr 2010 16:59:30 +0200 Subject: [PATCH] better names for what's in the "t_material" structure --- dfhack/include/modules/Materials.h | 6 +++--- dfhack/modules/Creatures.cpp | 6 +++--- dfhack/modules/Materials.cpp | 10 +++++----- examples/creaturedump.cpp | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/dfhack/include/modules/Materials.h b/dfhack/include/modules/Materials.h index 84afeeb2f..794d175ad 100644 --- a/dfhack/include/modules/Materials.h +++ b/dfhack/include/modules/Materials.h @@ -62,10 +62,10 @@ namespace DFHack // this structure describes what are things made of in the DF world struct t_material { - int16_t typeA; + int16_t itemType; int16_t typeB; - int16_t typeC; - int32_t typeD; + int16_t subType; + int32_t index; uint32_t flags; }; diff --git a/dfhack/modules/Creatures.cpp b/dfhack/modules/Creatures.cpp index 52948308f..7c527d8c0 100644 --- a/dfhack/modules/Creatures.cpp +++ b/dfhack/modules/Creatures.cpp @@ -373,10 +373,10 @@ bool Creatures::ReadJob(const t_creature * furball, vector & mat) mat.resize(cmats.size()); for(i=0;ireadWord(cmats[i] + minfo->getOffset("job_material_maintype")); + mat[i].itemType = p->readWord(cmats[i] + minfo->getOffset("job_material_maintype")); mat[i].typeB = p->readWord(cmats[i] + minfo->getOffset("job_material_sectype1")); - mat[i].typeC = p->readWord(cmats[i] + minfo->getOffset("job_material_sectype2")); - mat[i].typeD = p->readDWord(cmats[i] + minfo->getOffset("job_material_sectype3")); + mat[i].subType = p->readWord(cmats[i] + minfo->getOffset("job_material_sectype2")); + mat[i].index = p->readDWord(cmats[i] + minfo->getOffset("job_material_sectype3")); mat[i].flags = p->readDWord(cmats[i] + minfo->getOffset("job_material_flags")); } return true; diff --git a/dfhack/modules/Materials.cpp b/dfhack/modules/Materials.cpp index f33a41bba..ae65946ec 100644 --- a/dfhack/modules/Materials.cpp +++ b/dfhack/modules/Materials.cpp @@ -299,14 +299,14 @@ std::string Materials::getDescription(t_material & mat) { std::string out; - switch(mat.typeA) + switch(mat.itemType) { case 0: - if(mat.typeD>=0) + if(mat.index>=0) { - if(mat.typeD<=this->inorganic.size()) + if(mat.index<=this->inorganic.size()) { - out.append(this->inorganic[mat.typeD].id); + out.append(this->inorganic[mat.index].id); out.append(" bar"); } else @@ -322,7 +322,7 @@ std::string Materials::getDescription(t_material & mat) out = "block"; break; case 3: - switch(mat.typeC) + switch(mat.subType) { case 3: out = "raw green glass"; break; case 4: out = "raw clear glass"; break; diff --git a/examples/creaturedump.cpp b/examples/creaturedump.cpp index 8231787b2..d7e248332 100644 --- a/examples/creaturedump.cpp +++ b/examples/creaturedump.cpp @@ -242,7 +242,7 @@ void printCreature(DFHack::API & DF, const DFHack::t_creature & creature) { for(unsigned int i = 0; i < mymat.size(); i++) { - printf("\t%s(%d)\t%d %d %d - %.8x\n", Materials->getDescription(mymat[i]).c_str(), mymat[i].typeA, mymat[i].typeB, mymat[i].typeC, mymat[i].typeD, mymat[i].flags); + printf("\t%s(%d)\t%d %d %d - %.8x\n", Materials->getDescription(mymat[i]).c_str(), mymat[i].itemType, mymat[i].typeB, mymat[i].subType, mymat[i].index, mymat[i].flags); } } }