Jump to content

Direct Query Game.Core


Recommended Posts

#0  0x082836e9 in mysql_real_query () at atomicity.h:51
51        { return __sync_fetch_and_add(__mem, __val); }
[New Thread 28c04300 (LWP 100099/game)]
(gdb) bt
#0  0x082836e9 in mysql_real_query () at atomicity.h:51
#1  0x0839c8e7 in CAsyncSQL::DirectQuery ()
#2  0x080da850 in __LoadExpTableFromDB () at config.cpp:328
#3  0x080dad87 in config_init (st_localeServiceName=@0xbfbfb8f4)
    at config.cpp:375
#4  0x08220418 in start (argc=1, argv=0xbfbfeed8) at main.cpp:630
#5  0x08220dfb in main (argc=1, argv=0xbfbfeed8) at main.cpp:425
(gdb)
static bool __LoadExpTableFromDB(void)
{
	std::auto_ptr<SQLMsg> pMsg(AccountDB::instance().DirectQuery("SELECT level, exp FROM exp_table"));
	if (pMsg->Get()->uiNumRows == 0)
		return false;

	static DWORD new_exp_table[PLAYER_MAX_LEVEL_CONST+1];
	if (exp_table != NULL)
		memcpy(new_exp_table, exp_table, (PLAYER_MAX_LEVEL_CONST+1)*sizeof(DWORD));

	MYSQL_ROW row = NULL;
	while ((row = mysql_fetch_row(pMsg->Get()->pSQLResult)))
	{
		DWORD level = 0;
		DWORD exp = 0;
		str_to_number(level, row[0]);
		str_to_number(exp, row[1]);
		if (level > PLAYER_MAX_LEVEL_CONST)
			continue;
		new_exp_table[level] = exp;
		// printf("new_exp_table[%u] = %u;\n", level, exp);
	}
	exp_table = new_exp_table;
	return true;
}

 

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

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.