Jump to content
UPDATE 2 - External pictures are being replaced... ×
×
×
  • Create New...
  • 0

New pet system server source ERR


vandragoon

Question

  • Answers 6
  • Created
  • Last Reply

Top Posters For This Question

Popular Days

Top Posters For This Question

6 answers to this question

Recommended Posts

  • 0

Before:

std::ifstream exppet_table_open("/usr/home/game/share/exppettable.txt");

Add:

std::string temp_exp_line;
#ifdef NEW_PET_SYSTEM
	std::string temp_exp_line;
	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

Learn some basics of C++ - it doesn't hurt.

Link to comment
Share on other sites

  • 0
1 minute ago, vandragoon said:

now i have this:
main.cpp:497: error: redeclaration of 'std::string temp_exp_line'
main.cpp:474: error: 'std::string temp_exp_line' previously declared here
 

Better do it this way:

	// 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

You didn't notice you've added something with the same name of variable before. Next time remember to check.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.


Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.