Hi
Ich möchte über TXT Dateien die Player EXP und Pet exp auslesen
Code
- // START_OF_Player_EXP_TABLE_LOADING
- string temp_exp_line;
- char szExpTable[256];
- snprintf(szExpTable, sizeof(szExpTable), "%s/exp.txt", LocaleService_GetBasePath().c_str());
- ifstream exp_table_open(szExpTable);
- if (!exp_table_open.is_open()) {
- fprintf(stderr, "Failed to Load ExpTable from %s/exp.txt\n", LocaleService_GetBasePath().c_str());
- sys_err("Failed to Load ExpTable from %s/exp.txt", LocaleService_GetBasePath().c_str());
- return 0;
- }
- int exp_table_counter = 0;
- while (!exp_table_open.eof())
- {
- exp_table_open >> temp_exp_line;
- str_to_number(exp_table_common[exp_table_counter], temp_exp_line.c_str());
- exp_table_counter++;
- }
- fprintf(stderr, "EXP erfolgreich geladen von: %s\n", LocaleService_GetBasePath().c_str());
- //sys_log(0, "EXP Table Loaded succsefully from %s", LocaleService_GetBasePath().c_str());
- // END_OF_Player_EXP_TABLE_LOADING
- #ifdef NEW_PET_SYSTEM
- temp_exp_line = ""; //clearing
- std::ifstream exppet_table_open("/usr/home/game/share/exppettable.txt");
- /*if (!exp_table_open.is_open())
- return 0;*/
- int exppet_table_counter = 0;
- int tmppet_exp = 0;
- while (!exppet_table_open.eof())
- {
- exppet_table_open >> temp_exp_line;
- str_to_number(exppet_table_common[exppet_table_counter], temp_exp_line.c_str());
- if (exppet_table_common[exppet_table_counter] < 2147483647) {
- sys_log(0, "Livelli Pet caricati da exppettable.txt: %d !", exppet_table_common[exppet_table_counter]);
- exppet_table_counter++;
- }
- else {
- fprintf(stderr, "[main] Impossibile caricare la tabella exp valore non valido\n");
- break;
- }
- }
- #endif
Aber es klappt nicht so ganz und ich bekomme den Error
main.cpp: In function 'int main(int, char**)':
main.cpp:550: error: 'string' was not declared in this scope
main.cpp:550: error: expected `;' before 'temp_exp_line'
main.cpp:553: error: 'ifstream' was not declared in this scope
main.cpp:553: error: expected `;' before 'exp_table_open'
main.cpp:554: error: 'exp_table_open' was not declared in this scope
main.cpp:560: error: 'exp_table_open' was not declared in this scope
main.cpp:562: error: 'temp_exp_line' was not declared in this scope
main.cpp:571: error: 'temp_exp_line' was not declared in this scope
gmake: *** [OBJDIR/main.o] Error 1