@ -9,10 +9,11 @@ using namespace std;
# include <DFTypes.h>
# include <DFHackAPI.h>
void printSettlement ( DFHack : : API & DF , const DFHack : : t_settlement & settlement , const map < string , vector < string > > & names )
void printSettlement ( DFHack : : API & DF , const DFHack : : t_settlement & settlement , const vector < vector < string > > & englishWords , const vector < vector < string > > & foreignWords )
{
string genericName = DF . TranslateName ( settlement . name , 2 , names , " GENERIC " ) ;
string dwarfName = DF . TranslateName ( settlement . name , 2 , names , " DWARF " ) ;
string genericName = DF . TranslateName ( settlement . name , englishWords , foreignWords , true ) ;
string dwarfName = DF . TranslateName ( settlement . name , englishWords , foreignWords , false ) ;
cout < < dwarfName < < " " < < genericName < < " " < < " world x: " < < settlement . world_x < < " world y: " < < settlement . world_y
< < " local_x: " < < settlement . local_x1 < < " local_y: " < < settlement . local_y1 < < " size: " < < settlement . local_x2 - settlement . local_x1 < < " by " < < settlement . local_y2 - settlement . local_y1 < < " \n " ;
}
@ -32,22 +33,23 @@ int main (int argc,const char* argv[])
cerr < < " Could not read Settlements " < < endl ;
return 1 ;
}
map < string , vector < string > > names ;
if ( ! DF . InitReadNameTables ( names ) )
vector < vector < string > > englishWords ;
vector < vector < string > > foreignWords ;
if ( ! DF . InitReadNameTables ( englishWords , foreignWords ) )
{
cerr < < " Can't get name tables " < < endl ;
return 1 ;
}
cout < < " Settlements \n " ;
for ( uint32_t i = 0 ; i < numSettlements ; i + + ) {
/*for(uint32_t i =0;i<numSettlements;i++){
DFHack : : t_settlement temp ;
DF . ReadSettlement ( i , temp ) ;
printSettlement ( DF , temp , name s) ;
}
printSettlement ( DF , temp , englishWords, foreignWord s) ;
} */
// MSVC claims this is causing the heap to be corrupted, I think it is because the currentSettlement vector only has 1 item in it
cout < < " Current Settlement \n " ;
DF . ReadCurrentSettlement ( current ) ;
printSettlement ( DF , current , name s) ;
if ( DF . ReadCurrentSettlement ( current ) )
printSettlement ( DF , current , englishWords, foreignWord s) ;
DF . FinishReadNameTables ( ) ;
DF . FinishReadSettlements ( ) ;