本文整理汇总了C++中KGLogPrintf函数的典型用法代码示例。如果您正苦于以下问题:C++ KGLogPrintf函数的具体用法?C++ KGLogPrintf怎么用?C++ KGLogPrintf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了KGLogPrintf函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RegisterActionFunctions
BOOL KAIManager::Init()
{
BOOL bResult = false;
BOOL bRetCode = false;
IIniFile* piIniFile = NULL;
RegisterActionFunctions();
KGLogPrintf(KGLOG_INFO, "[AI] loading ... ...");
bRetCode = LoadAITabFile();
KGLOG_PROCESS_ERROR(bRetCode);
KGLogPrintf(KGLOG_INFO, "[AI] %u AI loaded !", m_AITable.size());
memset(m_ActionRunTimeStatisticsArray, 0, sizeof(m_ActionRunTimeStatisticsArray));
m_NpcAIRunTimeStatisticsMap.clear();
m_bLogAIRuntimeStat = 0;
piIniFile = g_OpenIniFile(GS_SETTINGS_FILENAME);
KGLOG_PROCESS_ERROR(piIniFile);
bRetCode = piIniFile->GetInteger("AI", "LogAIRuntimeStat", 0, &m_bLogAIRuntimeStat);
//KGLOG_PROCESS_ERROR(bRetCode);
bResult = true;
Exit0:
KG_COM_RELEASE(piIniFile);
return bResult;
}
示例2: ASSERT
int KG_GameDatabase::_GetRoleEquipmentPoint(const KG_RoleInfo &crRoleInfo, float *pfRetLevel)
{
int nResult = false;
int nRetCode = false;
int nEmptyFlag = false;
int nTypeID = 0;
int nItemID = 0;
KG_EQUIPMENT_TYPE_MAP::iterator itType;
KG_EQUIPMENT_POINT_MAP *pEquipmentPointMap = NULL;
KG_EQUIPMENT_POINT_MAP::iterator itPoint;
const int ARMED_BOX_ID = 0;
const int EQUIPMENT_ID_ARRAY[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 22};
// 装备身上所对应的BoxID为0
// 统计身上的装备: 近战武器 远程武器 上装 帽子 项链 左手戒指 右手戒指 腰带 腰坠 下装 鞋子 护手 暗器
// 对应的Position ID:0 1 2 3 4 5 6 7 8 9 10 11 22
ASSERT(pfRetLevel);
*pfRetLevel = 0;
for (int i = 0; i < sizeof(EQUIPMENT_ID_ARRAY) / sizeof(EQUIPMENT_ID_ARRAY[0]); i++)
{
nRetCode = crRoleInfo.GetItemInfo(
ARMED_BOX_ID, EQUIPMENT_ID_ARRAY[i], &nEmptyFlag, &nTypeID, &nItemID
);
KGLOG_PROCESS_ERROR(nRetCode && "crRoleInfo.GetItemInfo()");
if (nEmptyFlag)
continue;
itType = m_EquipmentTypeMap.find(nTypeID);
if (itType == m_EquipmentTypeMap.end())
{
printf("Failed to find the item, Type ID: %d, Item ID: %d\n", nTypeID, nItemID);
KGLogPrintf(
KGLOG_DEBUG, "Failed to find the item, Type ID: %d, Item ID: %d", nTypeID, nItemID
);
continue;
}
pEquipmentPointMap = &(itType->second);
itPoint = pEquipmentPointMap->find(nItemID);
if (itPoint == pEquipmentPointMap->end())
{
printf("Failed to find the item, Type ID: %d, Item ID: %d\n", nTypeID, nItemID);
KGLogPrintf(
KGLOG_DEBUG, "Failed to find the item, Type ID: %d, Item ID: %d", nTypeID, nItemID
);
continue;
}
*pfRetLevel += itPoint->second;
}
nResult = true;
Exit0:
return nResult;
}
示例3: snprintf
BOOL KScriptManager::LoadScripts(ILuaScriptEx* piScript, const char cszDir[])
{
BOOL bResult = false;
BOOL bRetCode = false;
HANDLE hFind = INVALID_HANDLE_VALUE;
WIN32_FIND_DATA FindFileData;
char szPath[MAX_PATH];
snprintf(szPath, sizeof(szPath), "%s\\*", cszDir);
szPath[sizeof(szPath) - 1] = '\0';
hFind = FindFirstFile(szPath, &FindFileData);
KGLOG_PROCESS_ERROR(hFind != INVALID_HANDLE_VALUE);
if (hFind == INVALID_HANDLE_VALUE)
{
KGLogPrintf(KGLOG_ERR, "[Lua] Failed to file file: %s\n", szPath);
}
do
{
if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
if (strcmp(FindFileData.cFileName, ".") != 0 && strcmp(FindFileData.cFileName, "..") != 0)
{
snprintf(szPath, sizeof(szPath), "%s\\%s", cszDir, FindFileData.cFileName);
szPath[sizeof(szPath) - 1] = '\0';
LoadScripts(piScript, szPath);
}
}
else
{
snprintf(szPath, sizeof(szPath), "%s\\%s", cszDir, FindFileData.cFileName);
szPath[sizeof(szPath) - 1] = '\0';
bRetCode = IsLuaScriptFile(szPath);
if (bRetCode)
{
bRetCode = piScript->LoadFromFile(szPath);
if (!bRetCode)
{
KGLogPrintf(KGLOG_ERR, "[Lua] Failed to load file: %s\n", szPath);
}
}
}
} while (FindNextFile(hFind, &FindFileData));
bResult = true;
Exit0:
if (hFind != INVALID_HANDLE_VALUE)
{
FindClose(hFind);
hFind = INVALID_HANDLE_VALUE;
}
return bResult;
}
示例4: main
int main(int argc, char* argv[])
{
int nResult = false;
int nRetCode = false;
int nLogInitFlag = false;
int nRdbFlag = false;
KGLOG_PARAM LogParam;
KSO3RoleDBUpdater* pKSO3RoleDBUpdater = NULL;
#ifdef WIN32
SetConsoleInfo();
#endif
setlocale(LC_ALL, "");
g_SetRootPath(NULL);
strncpy(LogParam.szPath, "logs", sizeof(LogParam.szPath));
LogParam.szPath[sizeof(LogParam.szPath) - 1] = '\0';
strncpy(LogParam.szIdent, "SO3RoleDBUpdaterTest", sizeof(LogParam.szIdent));
LogParam.szIdent[sizeof(LogParam.szIdent) - 1] = '\0';
LogParam.Options = (KGLOG_OPTIONS)(KGLOG_OPTION_FILE | KGLOG_OPTION_CONSOLE);
LogParam.nMaxLineEachFile = 160000;
nRetCode = KGLogInit(LogParam, NULL);
KGLOG_PROCESS_ERROR(nRetCode);
nLogInitFlag = true;
pKSO3RoleDBUpdater = new KSO3RoleDBUpdater();
KGLOG_PROCESS_ERROR(pKSO3RoleDBUpdater);
nRetCode = pKSO3RoleDBUpdater->Init();
KGLOG_PROCESS_ERROR(nRetCode);
nRdbFlag = true;
KGLogPrintf(KGLOG_INFO, "SO3RoleDBUpdaterTest had started up ... ...");
nRetCode = pKSO3RoleDBUpdater->Run();
KGLOG_PROCESS_ERROR(nRetCode);
KGLogPrintf(KGLOG_INFO, "SO3RoleDB UpdateTest Complete...");
nResult = true;
Exit0:
if (nRdbFlag)
{
pKSO3RoleDBUpdater->UnInit();
nRdbFlag = false;
}
KG_DELETE(pKSO3RoleDBUpdater);
if (nLogInitFlag)
{
KGLogUnInit(NULL);
nLogInitFlag = false;
}
return nResult ? 0 : 1;
}
示例5: g_OpenFile
int KGFileManager::CompareFileByDataStream(const char cszFileName_1[], const char cszFileName_2[])
{
int nResult = false;
int nRetCode = false;
IFile* pFile_1 = NULL;
IFile* pFile_2 = NULL;
BYTE byData_1[SIZE_READ_BUFFER] = {0};
BYTE byData_2[SIZE_READ_BUFFER] = {0};
char szResult[2 * MAX_PATH] = {0};
pFile_1 = g_OpenFile(cszFileName_1);
KGLOG_PROCESS_ERROR(pFile_1);
pFile_2 = g_OpenFile(cszFileName_2);
KGLOG_PROCESS_ERROR(pFile_2);
if (pFile_1->Size() != pFile_2->Size())
{
nRetCode = _snprintf_s(
szResult,
sizeof(szResult),
sizeof(szResult) - 1,
"Size Differ. File_1=%s File_2=%s",
cszFileName_1,
cszFileName_2
);
KGLOG_PROCESS_ERROR(nRetCode > 0);
KGLogPrintf(KGLOG_ERR, szResult);
KGLOG_PROCESS_ERROR(false);
}
for (ULONG i = 0; i < pFile_1->Size(); i += SIZE_READ_BUFFER)
{
pFile_1->Read(byData_1, SIZE_READ_BUFFER);
pFile_2->Read(byData_2, SIZE_READ_BUFFER);
nRetCode = memcmp(byData_1, byData_2, SIZE_READ_BUFFER);
if (nRetCode != 0)
{
nRetCode = _snprintf_s(
szResult,
sizeof(szResult),
sizeof(szResult) - 1,
"File Data Differ. File_1=%s File_2=%s",
cszFileName_1,
cszFileName_2
);
KGLOG_PROCESS_ERROR(nRetCode > 0);
KGLogPrintf(KGLOG_ERR, szResult);
KGLOG_PROCESS_ERROR(false);
}
}
nResult = true;
Exit0:
KG_COM_RELEASE(pFile_1);
KG_COM_RELEASE(pFile_2);
return nResult;
}
示例6: GetFileInfo
int KHttpFile::Download()
{
int nRetCode = false;
int nResult = false;
int nRetryCount = 0;
nRetCode = GetFileInfo();
KGLOG_PROCESS_ERROR(nRetCode);
while (nRetryCount <= 5)
{
if (m_nFileSize == m_nDownloadedSize)
{
m_nErrorCode = dec_err_success;
goto Exit1;
}
nRetCode = m_Downloader.Download(m_strUrl.c_str(), m_strFile.c_str());
switch(nRetCode)
{
case HTTP_RESULT_SUCCESS:
case HTTP_RESULT_SAMEAS:
m_nErrorCode = dec_err_success;
goto Exit1;
break;
case HTTP_RESULT_STOP:
m_nErrorCode = dec_err_stop;
goto Exit0;
break;
case HTTP_RESULT_FAIL:
m_nErrorCode = dec_err_disconnection;
KGLogPrintf(KGLOG_INFO, "disconnection retry %d", nRetryCount++);
Sleep(5000);
break;
case HTTP_RESULT_REDIRECT_FTP:
case HTTP_RESULT_REDIRECT_HTTP:
m_nErrorCode = dec_err_cannotconnect;
KGLogPrintf(KGLOG_INFO, "cannotconnect retry %d", nRetryCount++);
Sleep(5000);
break;
default:
m_nErrorCode = dec_err_cannotconnect;
KGLOG_PROCESS_ERROR(false && "unknow result");
break;
}
}
Exit1:
nResult = true;
Exit0:
KGLogPrintf(KGLOG_INFO, "download result= %d, filename = %s", m_nErrorCode, m_strFile.c_str());
return nResult;
}
示例7: Lua_GetTopIndex
int KAILogic::LuaNewAction(Lua_State* L)
{
int nResult = 0;
int nRetCode = 0;
int nActionID = KAI_ACTION_ID_NONE;
int nActionKey = eakInvalid;
KAIAction* pActionData = NULL;
std::pair<KAI_ACTION_TABLE::iterator, bool> RetPair;
nRetCode = Lua_GetTopIndex(L);
KGLOG_PROCESS_ERROR(nRetCode == 2);
nActionID = (int)Lua_ValueToNumber(L, 1);
KGLOG_PROCESS_ERROR(nActionID > KAI_ACTION_ID_NONE);
nActionKey = (int)Lua_ValueToNumber(L, 2);
KGLOG_PROCESS_ERROR(nActionKey > eakInvalid);
if (nActionKey < KAI_USER_ACTION)
{
KAI_ACTION_FUNC PAction = NULL;
PAction = g_pSO3World->m_AIManager.GetActionFunction(nActionKey);
if (PAction == NULL)
{
KGLogPrintf(KGLOG_ERR, "[AI] Unregistered sys action(ID: %d, Key: %d) in ai %d\n", nActionID, nActionKey, m_nAIType);
goto Exit0;
}
}
else
{
KUSER_ACTION_TABLE::iterator it = m_UserActionTable.find(nActionKey);
if (it == m_UserActionTable.end())
{
KGLogPrintf(KGLOG_ERR, "[AI] Unregistered lua actionID: %d, Key: %d) in ai %d\n", nActionID, nActionKey, m_nAIType);
goto Exit0;
}
}
RetPair = m_ActionTable.insert(std::make_pair(nActionID, KAIAction()));
if (!RetPair.second)
{
KGLogPrintf(KGLOG_ERR, "[AI] Duplicated AI action(%d) in ai %d\n", nActionID, m_nAIType);
goto Exit0;
}
pActionData = &(RetPair.first->second);
pActionData->m_nKey = nActionKey;
nResult = pActionData->LuaGetObj(L);
Exit0:
return nResult;
}
示例8: _tWinMain
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
int nResult = false;
int nRetCode = false;
int nKGLogInitFlag = false;
KGLOG_PARAM KGLogParm = {"logs", "GameUpdater", KGLOG_OPTION_FILE, 1000 * 10};
int nGameUpdaterInitFlag = false;
KGU_GameUpdater GameUpdater;
TCHAR szApplicationName[MAX_PATH];
TCHAR szCurrentDir[MAX_PATH];
nRetCode = _SetCurrentDirectory();
KG_PROCESS_ERROR(nRetCode);
nRetCode = KGLogInit(KGLogParm, NULL);
KG_PROCESS_ERROR(nRetCode);
nKGLogInitFlag = true;
// Log the build time which is useful for debugging.
KGLogPrintf(KGLOG_INFO, "The gameupdater.exe is built at "__DATE__" "__TIME__"\n");
// Log the application name, which could be distinguished the client is main version or child version.
nRetCode = GetModuleFileName(NULL, szApplicationName, _countof(szApplicationName));
KGLOG_PROCESS_ERROR(nRetCode > 0);
KGLOG_PROCESS_ERROR(nRetCode < _countof(szApplicationName));
KGLogPrintf(KGLOG_INFO, "The full file name is `%s`", szApplicationName);
// Log the current working path, which is useful for debugging.
nRetCode = GetCurrentDirectory(_countof(szCurrentDir), szCurrentDir);
KGLOG_PROCESS_ERROR(nRetCode > 0);
KGLOG_PROCESS_ERROR(nRetCode < _countof(szCurrentDir));
KGLogPrintf(KGLOG_INFO, "The current working path is `%s`", szCurrentDir);
nRetCode = GameUpdater.Init(lpCmdLine, NULL);
KGLOG_PROCESS_ERROR(nRetCode && "Init()");
nGameUpdaterInitFlag = true;
nRetCode = GameUpdater.Run();
KGLOG_PROCESS_ERROR(nRetCode && "Run()");
nResult = true;
Exit0:
if (nGameUpdaterInitFlag)
{
GameUpdater.UnInit(NULL);
nGameUpdaterInitFlag = false;
}
if (nKGLogInitFlag)
{
KGLogUnInit(NULL);
nKGLogInitFlag = false;
}
return nResult ? 0 : 1;
}
示例9: assert
void KAIVM::DebugAICurrentStateInfo()
{
assert(m_pState);
KGLogPrintf(KGLOG_DEBUG, "[AI] DebugAI : AIType is %d, Current StateID is %d, ActionID is %d.\n", m_nAIType, m_nStateID, m_nActionID);
KGLogPrintf(KGLOG_DEBUG, "[AI] DebugAI : nGameLoop is %lu\n", g_pSO3World->m_nGameLoop);
KGLogPrintf(KGLOG_DEBUG, "[AI] DebugAI : PrimaryTimer is %lu\n", m_nPrimaryTimerFrame);
KGLogPrintf(KGLOG_DEBUG, "[AI] DebugAI : SecondaryTimer is %lu\n", m_nSecondaryTimerFrame);
KGLogPrintf(KGLOG_DEBUG, "[AI] DebugAI : TertiaryTimer is %lu\n", m_nTertiaryTimerFrame);
m_pState->DebugStateInfo();
return;
}
示例10: _ASSERTE
void KGTestLoadMaterial::TestLoadOneMtlFile(const char cszFileName[])
{
HRESULT hrRetCode = E_FAIL;
KG3DMaterial* pMaterial = NULL;
_ASSERTE(cszFileName);
KGLogPrintf(KGLOG_INFO, "Test Load Mtl: %s", cszFileName);
hrRetCode = m_pMtlTable->LoadResourceFromFile(cszFileName, 0, 0, (IKG3DResourceBase**)&pMaterial);
if (FAILED(hrRetCode) || pMaterial == NULL)
{
m_vecLoadFailedMtl.push_back(cszFileName);
}
else
{
KG3DMaterial::KG3DMaterialSubset* pSubset = NULL;
bool bNoAnyTex = false;
for (size_t i = 0; i < pMaterial->m_dwNumMaterials; i++)
{
pMaterial->GetSubMaterial((DWORD)i, (PVOID*)&pSubset);
if (pSubset->m_dwNumUsedTexture != 0)
{
bNoAnyTex = true;
}
}
if (!bNoAnyTex)
{
TextureInfoMap TexNames;
m_mapErrorMtlFileInfo.insert(make_pair(cszFileName, TexNames));
m_mapErrorMtlFileInfo[cszFileName].insert(make_pair("", NO_ANY_TEX));
}
}
if (pMaterial)
{
//这里要注意加参数RELEASE_ATONCE,以便立即释放资源,默认是放入释放队列(RELEASE_INQUEUE)
//否则内存中会一直占用释一定数量的资源,数量等于释放资源队列的大小
hrRetCode = m_pMtlTable->ReleaseResource((KG3DMaterial*)pMaterial, RELEASE_ATONCE);
if (FAILED(hrRetCode))
{
KGLogPrintf(KGLOG_ERR, "Release Mtl Failed!");
}
else
{
pMaterial = NULL;
}
}
KGLogPrintf(KGLOG_INFO, "End Load Test");
}
示例11: snprintf
BOOL KSO3RoleDBTools::CheckMailTable()
{
BOOL bResult = false;
BOOL bRetCode = 0;
int nStrLen = 0;
nStrLen = snprintf(m_szSQL, sizeof(m_szSQL),
"create table if not exists %s( "
" ID bigint not null, "
" BaseTime datetime not null, "
" MailBoxInfo mediumblob not null, "
" primary key (ID), index (ID, BaseTime) "
"); ",
MAIL_TABLE_NAME
);
KGLOG_PROCESS_ERROR(nStrLen > 0 && nStrLen < (int)sizeof(m_szSQL));
bRetCode = DoQuery(m_szSQL);
if (!bRetCode)
{
KGLogPrintf(
KGLOG_ERR,
"DB ERROR when try to create table \'%s\'\n",
MAIL_TABLE_NAME
);
goto Exit0;
}
bResult = true;
Exit0:
return bResult;
}
示例12: GetTemplate
BOOL KDoodadTemplateList::LoadFromTemplate(DWORD dwTemplateID, KDoodad* pDoodad)
{
BOOL bResult = false;
BOOL bRetCode = false;
KDoodadTemplate* pTemplate = NULL;
pTemplate = GetTemplate(dwTemplateID);
if (pTemplate == NULL)
{
KGLogPrintf(KGLOG_ERR, "Invalid doodad template: %u\n", dwTemplateID);
pTemplate = GetTemplate(0);
KGLOG_PROCESS_ERROR(pTemplate);
}
pDoodad->m_dwTemplateID = dwTemplateID;
pDoodad->m_eKind = pTemplate->m_eKind;
pDoodad->m_nOpenFrames = pTemplate->m_dwOpenPrepareFrame;
pDoodad->m_dwRepresentID = pTemplate->m_dwRepresentID;
pDoodad->m_pTemplate = pTemplate;
if (pTemplate->szScript[0] != '\0')
{
pDoodad->m_dwScriptID = g_FileNameHash(pTemplate->szScript);
}
strncpy(pDoodad->m_szName, pTemplate->m_szName, _NAME_LEN);
pDoodad->m_szName[_NAME_LEN - 1] = 0;
bResult = true;
Exit0:
return bResult;
}
示例13: switch
HRESULT KG3DGraphicsEngine::CheckDevice()
{
HRESULT hr = S_OK;
if (m_bDeviceLost)
{
hr = g_pd3dDevice->TestCooperativeLevel();
switch (hr)
{
case D3D_OK:
break;
case D3DERR_DEVICELOST:
Sleep(50);
break;
case D3DERR_DEVICENOTRESET:
hr = Reset();
KG_COM_PROCESS_ERROR(hr);
break;
case D3DERR_DRIVERINTERNALERROR:
KGLogPrintf(KGLOG_ERR, "D3DERR_DRIVERINTERNALERROR\n");
break;
}
}
Exit0:
if (hr == D3DERR_DEVICELOST)
m_bDeviceLost = true;
else
KGLOG_COM_CHECK_ERROR(hr);
return hr;
}
示例14: KG_RemoveOldRewardData
int KG_RemoveOldRewardData(MYSQL *pMySQL, int nActivityID)
{
int nResult = false;
int nRetCode = false;
char szQuery[256];
KGLOG_PROCESS_ERROR(pMySQL);
nRetCode = snprintf(szQuery, sizeof(szQuery), "delete from `Activity` where Type = %d", nActivityID);
KGLOG_PROCESS_ERROR(nRetCode > 0);
KGLOG_PROCESS_ERROR(nRetCode < sizeof(szQuery));
nRetCode = mysql_real_query(pMySQL, szQuery, (unsigned long)strlen(szQuery));
KGD_MYSQL_PROCESS_ERROR(nRetCode == 0, pMySQL, szQuery);
nRetCode = (int)mysql_affected_rows(pMySQL);
if (nRetCode > 0)
{
printf("! There are %d rows of activity %d been removed\n", nRetCode, nActivityID);
KGLogPrintf(KGLOG_INFO, "There are %d rows of activity %d been removed\n", nRetCode, nActivityID);
}
nResult = true;
Exit0:
return nResult;
}
示例15: KGLogPrintf
int KGPostRenderTestingMgr::Run()
{
HRESULT hrRetCode = E_FAIL;
int nRetCode = false;
int nResult = false;
for (size_t i = 0; i < m_vecTestCases.size(); i++)
{
KGTestEffect* pTestEffect = NULL;
pTestEffect = m_vecTestCases[i];
if (pTestEffect)
{
nRetCode = pTestEffect->Run();
if (!nRetCode)
{
KGLogPrintf(KGLOG_ERR, "%s Testing run failed.", pTestEffect->GetCaseName().c_str());
}
pTestEffect->UnInit();
SAFE_DELETE(pTestEffect);
hrRetCode = m_pEngineMgr->SetEngineOption(&m_EngineOption);
KGLOG_COM_PROCESS_ERROR(hrRetCode);
}
}
m_vecTestCases.clear();
nResult = true;
Exit0:
return nResult;
}