Cleanowned doesn't need Materials, but it does need Translation in order to print names

develop
Quietust 2012-01-27 22:02:25 -06:00
parent 69b8f168cc
commit a36e7f4298
1 changed files with 5 additions and 5 deletions

@ -16,7 +16,6 @@ using namespace std;
#include <string> #include <string>
#include "modules/Items.h" #include "modules/Items.h"
#include "modules/Units.h" #include "modules/Units.h"
#include "modules/Materials.h"
#include "modules/Translation.h" #include "modules/Translation.h"
#include "DataDefs.h" #include "DataDefs.h"
#include "df/world.h" #include "df/world.h"
@ -96,9 +95,11 @@ DFhackCExport command_result df_cleanowned (Core * c, vector <string> & paramete
CoreSuspender suspend(c); CoreSuspender suspend(c);
DFHack::Materials *Materials = c->getMaterials(); if (!Translation::IsValid())
{
bool ok = Materials->ReadAllMaterials(); c->con.printerr("Translation data unavailable!\n");
return CR_FAILURE;
}
c->con.print("Found total %d items.\n", world->items.all.size()); c->con.print("Found total %d items.\n", world->items.all.size());
@ -181,7 +182,6 @@ DFhackCExport command_result df_cleanowned (Core * c, vector <string> & paramete
); );
df::unit *owner = Items::getItemOwner(item); df::unit *owner = Items::getItemOwner(item);
std::string info;
if (owner) if (owner)
c->con.print(", owner %s", Translation::TranslateName(&owner->name,false).c_str()); c->con.print(", owner %s", Translation::TranslateName(&owner->name,false).c_str());