// *************************************************************** // Function: LoadDynamicConfig.cpp // *************************************************************** #include "Main.h" #define Is(str) strcmp(row[0], str)==0 //************************************ // Name: LoadDbConfigEtc // // Loads the dynamic config table from the database. // // Parameters: // // Return: // true - no errors // false - errors //************************************ bool LoadDbConfigEtc() { char query[2000]; sprintf(query, "SELECT * FROM cfg_server_options"); unsigned long qid=gDatabase.Query(query, (long)strlen(query)); QUERY_RESULT* pResult=NULL; while ((pResult=gDatabase.StealResult(qid))==NULL) { gDatabase.Update(); } if (pResult->pResult==NULL) { return false; } int num_records=(int)mysql_num_rows(pResult->pResult); if (num_records==0) { return false; } MYSQL_ROW row; while ((row=mysql_fetch_row(pResult->pResult))!=NULL) { //Process the results if (Is("Character_Free_ID_Count")) { gData.freeCharacterID=atoi(row[1]); } else if (Is("Max_Level")) { gServerConfig.maxLevel=atoi(row[1]); } } gDatabase.FreeResult(qid); return true; }