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 * 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(); Context * getSingleContext();

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

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

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