// Attach test // attachtest - 100x attach/detach, 100x reads, 100x writes #include #include #include #include #include using namespace std; #include #include int main (void) { DFHackAPI *pDF = CreateDFHackAPI("Memory.xml"); DFHackAPI &DF = *pDF; if(!DF.Attach()) { cerr << "DF not found" << endl; return 1; } vector Plants; DF.ReadPlantMatgloss(Plants); vector Metals; DF.ReadMetalMatgloss(Metals); vector Stones; DF.ReadStoneMatgloss(Stones); vector CreatureTypes; DF.ReadCreatureMatgloss(CreatureTypes); cout << "Plant: " << Plants[0].id << endl; cout << "Metal: " << Metals[0].id << endl; cout << "Stone: " << Stones[0].id << endl; cout << "Creature: " << CreatureTypes[0].id << endl; DF.Detach(); delete pDF; #ifndef LINUX_BUILD cout << "Done. Press any key to continue" << endl; cin.ignore(); #endif return 0; }