Some const correctness, re-enabled job printing in the creature dump tool.

develop
Petr Mrázek 2011-04-12 13:59:07 +02:00
parent 212500ee00
commit f5911a14a6
4 changed files with 7 additions and 14 deletions

@ -174,8 +174,8 @@ namespace DFHack
void ReadAllMaterials(void); void ReadAllMaterials(void);
std::string getType(t_material & mat); std::string getType(const t_material & mat);
std::string getDescription(t_material & mat); std::string getDescription(const t_material & mat);
private: private:
class Private; class Private;
Private* d; Private* d;

@ -485,12 +485,7 @@ std::string Items::getItemClass(int32_t index)
std::string Items::getItemDescription(const dfh_item & item, Materials * Materials) std::string Items::getItemDescription(const dfh_item & item, Materials * Materials)
{ {
/*
DFHack::t_item item;
std::string out; std::string out;
if(!this->getItemData(itemptr, item))
return "??";
switch(item.quality) switch(item.quality)
{ {
case 0: break; case 0: break;
@ -504,7 +499,5 @@ std::string Items::getItemDescription(const dfh_item & item, Materials * Materia
out.append(Materials->getDescription(item.matdesc)); out.append(Materials->getDescription(item.matdesc));
out.append(" "); out.append(" ");
out.append(this->getItemClass(item.matdesc.itemType)); out.append(this->getItemClass(item.matdesc.itemType));
*/ return out;
//return out;
return getItemClass(item.matdesc.itemType);
} }

@ -479,7 +479,7 @@ void Materials::ReadAllMaterials(void)
this->ReadOthers(); this->ReadOthers();
} }
std::string Materials::getDescription(t_material & mat) std::string Materials::getDescription(const t_material & mat)
{ {
std::string out; std::string out;
int32_t typeC; int32_t typeC;
@ -542,7 +542,7 @@ std::string Materials::getDescription(t_material & mat)
} }
//type of material only so we know which vector to retrieve //type of material only so we know which vector to retrieve
std::string Materials::getType(t_material & mat) std::string Materials::getType(const t_material & mat)
{ {
if((mat.subIndex<419) || (mat.subIndex>618)) if((mat.subIndex<419) || (mat.subIndex>618))
{ {

@ -197,12 +197,12 @@ void printCreature(DFHack::Context * DF, const DFHack::t_creature & creature)
{ {
cout << ", custom profession: " << creature.custom_profession; cout << ", custom profession: " << creature.custom_profession;
} }
/*
if(creature.current_job.active) if(creature.current_job.active)
{ {
cout << ", current job: " << mem->getJob(creature.current_job.jobId); cout << ", current job: " << mem->getJob(creature.current_job.jobId);
} }
*/
cout << endl; cout << endl;
dayoflife = creature.birth_year*12*28 + creature.birth_time/1200; dayoflife = creature.birth_year*12*28 + creature.birth_time/1200;
cout << "Born on the year " << creature.birth_year << ", month " << (creature.birth_time/1200/28) << ", day " << ((creature.birth_time/1200) % 28 + 1) << ", " << dayoflife << " days lived." << endl; cout << "Born on the year " << creature.birth_year << ", month " << (creature.birth_time/1200/28) << ", day " << ((creature.birth_time/1200) % 28 + 1) << ", " << dayoflife << " days lived." << endl;