Make sure things build with playground turned on.

develop
Petr Mrázek 2011-03-21 21:29:54 +01:00
parent e8ee9b7cab
commit 34a687b95a
4 changed files with 24 additions and 27 deletions

@ -81,7 +81,7 @@ namespace DFHack
/**
* Convenience method to return a single valid Context
* @return pointer to a Context
* @return pointer to a Context. The Context isn't attached!
*/
Context * getSingleContext();

@ -45,12 +45,12 @@ DFHACK_TOOL(dfdigger2 digger2.cpp)
# findnameindexes
# Author: belal
#DFHACK_TOOL(dffindnameindexes findnameindexes.cpp)
DFHACK_TOOL(dffindnameindexes findnameindexes.cpp)
# renamer - change the custom names and professions of creatures, sends keys to
# df directly
# Author: belal
#DFHACK_TOOL(dfrenamer renamer.cpp)
# DFHACK_TOOL(dfrenamer renamer.cpp)
# copypaste
# Author: belal

@ -6,14 +6,12 @@
#include <iostream>
#include <iomanip>
#include <integers.h>
#include <vector>
#include <algorithm>
#include <sstream>
using namespace std;
#include <DFTypes.h>
#include <DFHackAPI.h>
#include <DFHack.h>
// returns a lower case version of the string
string tolower (const string & s)
@ -49,9 +47,11 @@ uint32_t endian_swap(uint32_t x)
int main (void)
{
DFHack::ContextManager DF("Memory.xml");
DFHack::Context * C;
DFHack::Translation * Tran;
try
{
DF.Attach();
C = DF.getSingleContext();
}
catch (exception& e)
{
@ -61,16 +61,21 @@ int main (void)
#endif
return 1;
}
vector< vector<string> > englishWords;
vector< vector<string> > foreignWords;
if(!DF.InitReadNameTables(englishWords,foreignWords))
Tran = C->getTranslation();
if(!Tran->Start())
{
cerr << "Could not get Names" << endl;
return 1;
}
DFHack::Dicts dicts = *(Tran->getDicts());
DFHack::DFDict & englishWords = dicts.translations;
DFHack::DFDict & foreignWords = dicts.foreign_languages;
C->Detach();
string input;
DF.ForceResume();
cout << "\nSelect Name to search or q to Quit" << endl;
getline (cin, input);
while(input != "q"){
@ -96,14 +101,11 @@ int main (void)
}
}
}
DF.Resume();
getline(cin,input);
}
DF.Detach();
DF.FinishReadNameTables();
#ifndef LINUX_BUILD
cout << "Done. Press any key to continue" << endl;
cin.ignore();
cout << "Done. Press any key to continue" << endl;
cin.ignore();
#endif
return 0;
}

@ -3,19 +3,14 @@
#include <iostream>
#include <sstream>
#include <climits>
#include <integers.h>
#include <vector>
using namespace std;
#include <DFError.h>
#include <DFTypes.h>
#include <DFHackAPI.h>
#include <DFMemInfo.h>
#include <DFProcess.h>
#include <modules/Materials.h>
#include <modules/Creatures.h>
#include <modules/Translation.h>
#include "miscutils.h"
#define DFHACK_WANT_MISCUTILS
#include <DFHack.h>
#include <dfhack/modules/Materials.h>
#include <dfhack/modules/Creatures.h>
#include <dfhack/modules/Translation.h>
vector< vector<string> > englishWords;
vector< vector<string> > foreignWords;