better names for what's in the "t_material" structure

develop
simon 2010-04-29 16:59:30 +02:00
parent 3cab327704
commit d5b8821a90
4 changed files with 12 additions and 12 deletions

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

@ -373,10 +373,10 @@ bool Creatures::ReadJob(const t_creature * furball, vector<t_material> & mat)
mat.resize(cmats.size());
for(i=0;i<cmats.size();i++)
{
mat[i].typeA = p->readWord(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;

@ -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;

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