int KRLMissile::Start() { int nRetCode = false; int nResult = false; double fTime = 0.0; KG_ASSERT_EXIT(m_pRLScene); nRetCode = m_RepresentMissile.Start(g_pRL->m_fTime); KGLOG_PROCESS_ERROR(nRetCode); nResult = true; Exit0: if (!nResult) { } return nResult; }
HRESULT KG3DTerrainDetailMaterialMgr::LoadFromInformationBuffer(DWORD dwLength,KG3DMemoryFile* pFile)//modify by huangjinshou 2008-6-11 { UnInit(); //pFile->Reset(); DWORD dwVersion = 0; pFile->read(&dwVersion,sizeof(DWORD)); BYTE byNum = 0; pFile->read(&byNum,sizeof(BYTE));//m_byteCurrentTextureIndex pFile->read(&m_byteCurrentMaterialIndex,sizeof(BYTE)); for (BYTE i=0;i<byNum;i++) { BYTE mask = 0; pFile->read(&mask,sizeof(BYTE)); if(mask) { KG3DTerrainDetailTexture* pTexture = new KG3DTerrainDetailTexture();//m_szDetailTexture[i] = pTexture->LoadFromInformationBuffer(pFile); m_mapDetailTexture.insert(pair<BYTE,KG3DTerrainDetailTexture*>(pTexture->m_byteIndex,pTexture)); } } for (int i=0;i<256;i++) { BYTE mask = 1; pFile->read(&mask,sizeof(BYTE)); if(mask) { KG3DTerrainDetailMaterial* pMtl = m_szDetailMaterial[i] = new KG3DTerrainDetailMaterial(); pMtl->LoadFromInformationBuffer(pFile); } } KGLOG_PROCESS_ERROR( dwLength == pFile->GetPos()); return S_OK; Exit0: return E_FAIL; }
int KItem::LuaGetTemporaryEnchantAttrib(Lua_State* L) { int nFirst = true; int nResult = 0; int nIndex = 1; KGLOG_PROCESS_ERROR(Lua_GetTopIndex(L) == 0); KG_PROCESS_ERROR(m_pTemporaryEnchant); KG_PROCESS_ERROR(m_pTemporaryEnchant->pAttribute); for (KAttribute* pAttribute = m_pTemporaryEnchant->pAttribute; pAttribute; pAttribute = pAttribute->pNext) { if (pAttribute->nKey != atInvalid) { if (nFirst) { Lua_NewTable(L); nFirst = false; } Lua_PushNumber(L, nIndex); nIndex++; Lua_NewTable(L); Lua_PushString(L, "nID"); Lua_PushNumber(L, pAttribute->nKey); Lua_SetTable(L, -3); Lua_PushString(L, "nValue1"); Lua_PushNumber(L, pAttribute->nValue1); Lua_SetTable(L, -3); Lua_PushString(L, "nValue2"); Lua_PushNumber(L, pAttribute->nValue2); Lua_SetTable(L, -3); Lua_SetTable(L, -3); } } if (!nFirst) nResult = 1; Exit0: return nResult; }
int LuaResetMap(Lua_State* L) { int nResult = 0; BOOL bRetCode = false; int nTopIndex = 0; DWORD dwPlayerID = ERROR_ID; DWORD dwMapID = 0; int nCopySN = 0; int i = 1; std::vector<DWORD> vecFailedMap; nTopIndex = Lua_GetTopIndex(L); KGLOG_PROCESS_ERROR(nTopIndex == 3); dwPlayerID = (DWORD)Lua_ValueToNumber(L, 1); dwMapID = (DWORD)Lua_ValueToNumber(L, 2); nCopySN = (int)Lua_ValueToNumber(L, 3); if (dwMapID == 0) { g_pSO3GameCenter->m_MapManager.ResetAllMap(dwPlayerID, vecFailedMap); } else { bRetCode = g_pSO3GameCenter->m_MapManager.ResetMap(dwPlayerID, dwMapID, nCopySN); if (!bRetCode) { vecFailedMap.push_back(dwMapID); } } Lua_NewTable(L); for (std::vector<DWORD>::iterator it = vecFailedMap.begin(); it != vecFailedMap.end(); ++it, ++i) { Lua_PushNumber(L, i); Lua_PushNumber(L, *it); Lua_SetTable(L, -3); } nResult = 1; Exit0: return nResult; }
void KTestGenerateList::TestGenerateFail() { int nResult = false; int nRetCode = false; int nCompareResult = 0; errno_t nErr = 0; KZipFileInfo** ppZipFileList = NULL; KVersionParser Parser; TCHAR szTestRes[MAX_PATH]; nRetCode = KTestCommon::PrepareTestResoure(AUTOUPDATE_ENTRY_1); KGLOG_PROCESS_ERROR(nRetCode != -1); //输入更新列表和不在列表范围内的版本号,无法生成下载列表 nRetCode = _sntprintf(szTestRes, MAX_PATH, _T("%s\\%s"), g_szTestingSpaceDir, AUTOUPDATE_ENTRY_1); KGLOG_PROCESS_ERROR(nRetCode != -1); szTestRes[MAX_PATH - 1] = _T('\0'); nRetCode = Parser.Parse(szTestRes, WRONG_VERSION);//1.0.8.1200 KGLOG_PROCESS_ERROR(nRetCode == false); KGLogPrintf(KGLOG_INFO, "成功验证\"无法生成下载列表\""); ppZipFileList = Parser.GetPackList(); KGLOG_PROCESS_ERROR(ppZipFileList[0] == NULL); //验证其它数据 KGLOG_PROCESS_ERROR(Parser.NeedUpdate() == TRUE); KGLOG_PROCESS_ERROR(Parser.CanDownloadPack() == FALSE); nCompareResult = _tcsncmp(Parser.GetBeginVersion().c_str(), WRONG_VERSION, MAX_PATH);//1.0.8.1200 KGLOG_PROCESS_ERROR(nCompareResult == 0); nCompareResult = _tcsncmp(Parser.GetLatestVersion().c_str(), LATEST_VERSION, MAX_PATH);//1.0.8.1353 KGLOG_PROCESS_ERROR(nCompareResult == 0); nErr = ::_taccess_s(szTestRes, 0); KGLOG_PROCESS_ERROR(nErr == ENOENT); nResult = true; Exit0: Parser.CleanUp(); CPPUNIT_ASSERT(nResult); }
int KTeamClient::LuaSetTeamDistributeMan(Lua_State* L) { int nResult = 0; int nTopIndex = 0; DWORD dwNewDistributeMan = ERROR_ID; nTopIndex = Lua_GetTopIndex(L); KGLOG_PROCESS_ERROR(nTopIndex == 1); dwNewDistributeMan = (DWORD)Lua_ValueToNumber(L, 1); KG_PROCESS_ERROR(m_dwAuthority[tatDistribute] != dwNewDistributeMan); g_PlayerClient.DoTeamChangeAuthorityRequest(tatDistribute, dwNewDistributeMan); nResult = 0; Exit0: return nResult; }
BOOL KLogClient::LogPlayerJoinTeam(KPlayer* pPlayer, KTeam* pTeam) { BOOL bResult = false; int nRetCode = 0; size_t uMemberListSize = 0; char szMemberList[_NAME_LEN * MAX_TEAM_GROUP_NUM * MAX_PLAYER_PER_GROUP]; // 能包含所有成员的名字。 assert(pPlayer); assert(pTeam); szMemberList[0] = '\0'; for (int i = 0; i < pTeam->nGroupNum; i++) { for ( KTEAM_MEMBER_LIST::iterator it = pTeam->MemberGroup[i].MemberList.begin(); it != pTeam->MemberGroup[i].MemberList.end(); ++it ) { if (it->dwMemberID == pPlayer->m_dwID) continue; nRetCode = snprintf(szMemberList + uMemberListSize, sizeof(szMemberList), "%s,", it->szRoleName); KGLOG_PROCESS_ERROR(nRetCode > 0 && nRetCode <= sizeof(szMemberList)); uMemberListSize += strlen(it->szRoleName) + sizeof(','); } } if (uMemberListSize > 0) { szMemberList[uMemberListSize - 1] = '\0'; // 去掉最后一个',' } nRetCode = LogPlayerAction( PLAYER_ACTION_JOIN_TEAM, 100, "JOIN_TEAM", pPlayer->m_szAccount, pPlayer->m_szName, uMemberListSize, (BYTE*)szMemberList ); KG_PROCESS_ERROR(nRetCode); bResult = true; Exit0: return bResult; }
KItemInfo* KItemManager::GetItemInfo(int nVersion, DWORD dwTabType, DWORD dwIndex) { KItemInfo* pRetItemInfo = NULL; KGLOG_PROCESS_ERROR(nVersion >= 0 && nVersion <= CURRENT_ITEM_VERSION); pRetItemInfo = m_pItemLib[nVersion].GetItemInfo(dwTabType, dwIndex); Exit0: if (pRetItemInfo == NULL) { KGLogPrintf( KGLOG_ERR, "Get ItemInfo failed! nVersion : %d, dwTabType : %d, dwTabIndex : %d\n", nVersion, dwTabType, dwIndex ); } return pRetItemInfo; }
BOOL KBattleFieldManager::JoinBattleTeam(DWORD dwRoleID, DWORD dwTeamID) { BOOL bResult = false; KRole* pRole = NULL; pRole = g_pSO3GameCenter->m_RoleManager.GetRole(dwRoleID); KGLOG_PROCESS_ERROR(pRole); if (pRole->m_dwSystemTeamID != ERROR_ID) { g_pSO3GameCenter->m_TeamCenter.DelMember(pRole->m_dwSystemTeamID, pRole->m_dwPlayerID); } g_pSO3GameCenter->m_TeamCenter.AddMember(dwTeamID, dwRoleID); bResult = true; Exit0: return bResult; }
// 直接设置某项统计数据的值,慎用 BOOL KStatDataManager::SetDataValue(const char cszName[], int64_t nValue) { BOOL bResult = false; int nRetCode = 0; int nNameID = 0; uint64_t uNewDataID = 0; nNameID = GetNameID(cszName); KGLOG_PROCESS_ERROR(nNameID != 0); m_StatValues[nNameID - 1] = nValue; if (nNameID > m_nMaxUsedID) m_nMaxUsedID = nNameID; bResult = true; Exit0: return bResult; }
int KDBTools::Init(char szConnectIP[], char DBAcc[], char szDBPsw[], char szDBName[]) { int nResult = false; BOOL bRetCode = false; bRetCode = Connect( szConnectIP, szDBName, DBAcc, szDBPsw ); KGLOG_PROCESS_ERROR(bRetCode); memset(m_szSQL, '\0', sizeof(m_szSQL)); nResult = true; Exit0: return nResult; }
BOOL KIDCache::SaveToBuffer(char* pData, DWORD dwSize) { KIDCacheNode* pNode = (KIDCacheNode*)m_CacheList.GetHead(); while (pNode) { DWORD dwNodeSize = sizeof(KIDCacheNode) + pNode->m_dwSize; KGLOG_PROCESS_ERROR(dwSize >= dwNodeSize); memcpy(pData, pNode, dwNodeSize); pData += dwNodeSize; dwSize -= dwNodeSize; pNode = (KIDCacheNode*)pNode->GetNext(); } return TRUE; Exit0: return FALSE; }
LRESULT KGObjectEditerProjectListDlg::OnListItemUpdate(WPARAM wParam, LPARAM lParam) { LPKGLISTITEM pListItem = (LPKGLISTITEM)wParam; USER_ITEM_DATA itemData; KGLOG_PROCESS_ERROR(pListItem); pListItem->GetStructData(&itemData, sizeof(itemData)); if (!strcmp(itemData.szPropertyName, _T("RepresentID"))) { UpdateProperty_R(atoi(itemData.szPropertyValue), true); ::SendMessage(m_pParentWindow->m_hWnd, WM_LIST_UPDATE_SCENE, wParam, lParam); } Exit0: ::SendMessage(m_pParentWindow->m_hWnd, WM_NOTIFY_ITEM_VALUE_UPDATE, wParam, lParam); return true; }
int KTimelineMissileProcessor::Init(DWORD dwMissileParamID, KCompositeMissileProcessor* pCompositeMissileProcessor) { int nRetCode = false; int nResult = false; KRLMissileTimelineParam const* pParam = NULL; pParam = g_pRL->m_TableList.GetMissileTimelineParam(dwMissileParamID); KGLOG_PROCESS_ERROR(pParam); memcpy(&m_Param, pParam, sizeof(m_Param)); nResult = true; Exit0: if (!nResult) { memset(&m_Param, 0, sizeof(m_Param)); } return nResult; }
HRESULT KG3DShadowMapLevel::Init(DWORD dwSize) { HRESULT hr = S_OK; m_dwShadowmapSize = dwSize; nIndex = 0; SAFE_RELEASE(m_lpSMColorSurface); SAFE_RELEASE(m_lpSMColorMap); SAFE_RELEASE(m_lpSMShadowMapSurface); SAFE_RELEASE(m_lpSMShadowMap); hr = OnResetDevice(); KGLOG_COM_PROCESS_ERROR(hr); KGLOG_PROCESS_ERROR(m_lpSMShadowMapSurface); return S_OK; Exit0: return E_FAIL; }
BOOL KAIBase::SetAIInterval(double fRate) { BOOL bRetCode = FALSE; KGLOG_PROCESS_ERROR(fRate > 0.0 && fRate <= 1.0); m_nAIInterval = (int)(g_pSO3World->m_Settings.m_ConstList.nAIInterval * fRate); if (m_nAIInterval < 1) m_nAIInterval = 1; if (g_pSO3World->m_nGameLoop + m_nAIInterval < m_nNextActiveFrame) { m_nNextActiveFrame = g_pSO3World->m_nGameLoop + m_nAIInterval; } bRetCode = TRUE; Exit0: return bRetCode; }
void KAIBase::OnWait(void) { BOOL bRetCode = FALSE; KGLOG_PROCESS_ERROR(m_pSelf); bRetCode = CheckAttacked(); KG_PROCESS_SUCCESS(bRetCode); bRetCode = CheckTargetInAlertRange(); KG_PROCESS_SUCCESS(bRetCode); bRetCode = CheckTargetInAttackRange(); KG_PROCESS_SUCCESS(bRetCode); // 检测小队状态,个体Npc一般没有必要进入wait if (m_pNpcTeam && m_pNpcTeam->m_pLeader == m_pSelf) { bRetCode = m_pNpcTeam->CheckNpcWorkDone(); if (bRetCode) { int nIndex = 0; int nMemberCount = m_pNpcTeam->GetMemberCount(); SetAIState(m_eAIMainState); //所有小队成员的工作已经完成,根据之前的状态恢复工作 for (nIndex = 0; nIndex < nMemberCount; nIndex++) { KNpc* pNpc = m_pNpcTeam->GetMember(nIndex); if (pNpc && pNpc != m_pSelf) { KAI_STATE eAiMainState = pNpc->m_AIController.GetMainState(); SetAIState(eAiMainState); } } } } Exit1: return; Exit0: return; }
KAILogic* KAIManager::GetAILogic(int nAIType) { KAILogic* pLogic = NULL; KAIInfo* pInfo = NULL; KAI_TABLE::iterator it = m_AITable.find(nAIType); KGLOG_PROCESS_ERROR(it != m_AITable.end()); pInfo = &it->second; if (!pInfo->pLogic) { pInfo->pLogic = CreateAI(nAIType, pInfo->dwScriptID); } pLogic = pInfo->pLogic; Exit0: return pLogic; }
int KScene::LuaSetGravity(Lua_State* L) { int nTopIndex = 0; int nNewGravity = 0; nTopIndex = Lua_GetTopIndex(L); KGLOG_PROCESS_ERROR(nTopIndex == 1); nNewGravity = (int)Lua_ValueToNumber(L, 1); m_nGlobalGravity = nNewGravity; g_PlayerServer.DoSyncSceneGravity(this); LogInfo("Set scene Gravity to %d", nNewGravity); Exit0: return 0; }
void KGatewaytest::TestUserLoginGatewayLockTheAccount() // caseID:5126 { int nResult = false; int nRetCode = false; char szTestCaseDscribe[] = "// caseID:5126,账号登陆,Paysys验证通过,但该帐户在另外的地方正在登陆,Client玩家收到账号已锁定"; KG_RETURN_RESULT Result; KGLogPrintf(KGLOG_INFO, "caseID:5126\n"); FillTestUserLoginInfo(KG_USER_LOGIN, ACTION_SUCCESS, AccountUserLoginInfo, PASSPODMODE_UNBIND, ACTION_SUCCESS, false, true, USER_ACCOUNT_LOCKED, false); nRetCode = InitTestEnvironment(true, true, true, 2, m_GatewayTestConfig.ForecastConfig.nTestPoint); KGLOG_PROCESS_ERROR(nRetCode); nRetCode = m_pClientController->ModifyClientUserName(1,"0"); KGLOG_PROCESS_ERROR(nRetCode); nRetCode = m_pClientController->FillOperate( 3, onConnectToGateway, onHandShake, onAccountVerify ); KGLOG_PROCESS_ERROR(nRetCode); nRetCode = m_pClientController->Run(); KGLOG_PROCESS_ERROR(nRetCode); nRetCode = m_pClientController->GetReturnResult(1, &Result); KGLOG_PROCESS_ERROR(nRetCode); nRetCode = memcmp(&Result, &(m_GatewayTestConfig.ForecastConfig), sizeof(Result)); KGLOG_PROCESS_ERROR(!nRetCode); nResult = true; Exit0: UnInitTestEnvironment(); #ifdef WIN32 { KG_CASE_INFO(szTestCaseDscribe, ""); KG_CPPUNIT_ASSERT(nResult); } #else { //InsertInfo(CASEPURPOSE, (szTestCaseDscribe)); //InsertInfo(PRECONDITION, ("")); CPPUNIT_ASSERT(nResult); } #endif }
BOOL KBall::SkillShoot(KHero* pShooter, KBasketSocket* pSocket) { BOOL bResult = false; BOOL bRetCode = false; int nVelocity = CELL_LENGTH; KSkillShootPath cPath((GetCurrentGravity())); KPOSITION cSocketPos; KPOSITION cSrc; KPOSITION cDst; KPOSITION cCtrl; KGLOG_PROCESS_ERROR(pShooter && pSocket); bRetCode = CanBeShootBy(pShooter); KG_PROCESS_ERROR(bRetCode); cSocketPos = pSocket->GetPosition(); cSrc = GetShootStartPos(pShooter); cDst = cSocketPos; cDst.nZ += CELL_LENGTH * 3; cCtrl.nX = (pSocket->m_eDir == csdLeft) ? cSocketPos.nX - (CELL_LENGTH * 12) : cSocketPos.nX + (CELL_LENGTH * 12); cCtrl.nY = cSocketPos.nY; cCtrl.nZ = CELL_LENGTH * 4; cPath.SetCtrlParams(cSrc, cDst, cCtrl, nVelocity); cPath.Start(g_pSO3World->m_nGameLoop); DoTrackMove(&cPath); m_bAttackState = true; m_dwShooterID = pShooter->m_dwID; m_dwThrowerID = ERROR_ID; m_pTargetSocket = pSocket; m_bRestAfterTrackMove = true; bResult = true; Exit0: return bResult; }
BOOL KTongClient::UpdateRules(BYTE* pbyData, size_t uDataLen) { BOOL bResult = false; KTONG_TEXT_INFO* pTextInfo = (KTONG_TEXT_INFO*)pbyData; assert(pTextInfo); KGLOG_PROCESS_ERROR(uDataLen == sizeof(KTONG_TEXT_INFO) + pTextInfo->uDataLen); strncpy(m_szRules, (char*)pTextInfo->byContent, sizeof(m_szRules)); m_szRules[sizeof(m_szRules) - 1] = '\0'; if (g_pGameWorldUIHandler) { g_pGameWorldUIHandler->OnUpdateTongInfo(); } bResult = true; Exit0: return bResult; }
int KRLRemoteCharacter::UpdateDirection(BOOL bForceUpdate) { int nRetCode = false; int nResult = false; BOOL bMoving = FALSE; CHARACTER_MOVE_STATE nMoveState = cmsInvalid; nMoveState = m_FrameData.m_Current.nMoveState; bMoving = nMoveState != cmsOnStand; m_nTurning = GetTurning(m_nTurning, bMoving, m_fFaceYaw, m_fFootYaw, m_fPreviousFaceYaw, m_fPreviousFootYaw); nRetCode = UpdateFaceFootDirection(m_nTurning, bForceUpdate); KGLOG_PROCESS_ERROR(nRetCode); nResult = true; Exit0: return nResult; }
BOOL KRegion::ClientLoad() { BOOL bResult = false; BOOL bRetCode = false; KClientObjAlloctor ObjAlloctor; char szFileName[MAX_PATH]; snprintf( szFileName, sizeof(szFileName), "%s/%s/v_%03d/%03d_Region_C.%s", MAP_DIR, m_pScene->m_szName, m_nRegionY, m_nRegionX, MAP_FILE_EXT ); szFileName[sizeof(szFileName) - 1] = '\0'; bRetCode = LoadTerrainData(szFileName, ObjAlloctor); KGLOG_PROCESS_ERROR(bRetCode); bResult = true; Exit0: return bResult; }
HRESULT KG3DAnimationWarper::AddComposer() { HRESULT hrResult = E_FAIL; WaperInfo New; INT nNumBones = 0; KG_PROCESS_ERROR(m_pModel); New.Composer = new KG3DAnimationComposer; KGLOG_PROCESS_ERROR(New.Composer); New.Composer->Init(&m_Skeleton, m_pModel); m_pModel->GetNumBones(&nNumBones); New.BoneWeight.resize(nNumBones, TRUE); m_Data.push_back(New); New.Composer->m_pSkeleton = &m_Skeleton; hrResult = S_OK; Exit0: return hrResult; }
BOOL KAIBase::SetAIState(KAI_STATE eNewState) { BOOL bRetCode = FALSE; KGLOG_PROCESS_ERROR(eNewState >= aisInvalid); #ifdef _SERVER if (m_pSelf && m_eAIState == aisReturn) { //清除无敌标记 m_pSelf->m_bSystemShield = false; } #endif //_SERVER m_eAIState = eNewState; bRetCode = TRUE; Exit0: return bRetCode; }
void KGym::OnUpgradeQueueFinished(KUPGRADE_TYPE eType, uint32_t uHeroTemplateID) { BOOL bRetCode = false; KGYM_TYPE eGymType = g_GetGymType(eType); for (KVEC_EQUIP_INFO::iterator it = m_vecEquipInfo.begin(); it != m_vecEquipInfo.end(); ++it) { if (it->eType == eGymType && it->dwHeroTemplateID == uHeroTemplateID) { bRetCode = HeroUseEquipFinished(it->dwHeroTemplateID, eGymType, it->nCount); KGLOG_PROCESS_ERROR(bRetCode); m_vecEquipInfo.erase(it); break; } } Exit0: return; }
void KMovableObject::DoTrackMove(const IPath* pPath) { int nTotalFrame = 0; assert(pPath); nTotalFrame = pPath->GetTotalFrame(); KGLOG_PROCESS_ERROR(nTotalFrame > 0); TurnToMoveType(mosTrackMove); m_pPath = pPath->GetClone(); SetPosition(m_pPath->GetStartPos()); m_pPath->GetStartVelocity(m_nVelocityX, m_nVelocityY, m_nVelocityZ); m_eTrackMoveState = tmsMoving; Exit0: return; }
int KScene::LuaRemoveTimer(Lua_State* L) { BOOL bResult = false; BOOL bRetCode = false; int nParamCount = 0; DWORD dwTimerID = 0; nParamCount = Lua_GetTopIndex(L); KGLOG_PROCESS_ERROR(nParamCount == 1); dwTimerID = (DWORD)Lua_ValueToNumber(L, 1); bRetCode = m_ScriptTimerList.RemoveTimer(dwTimerID); KG_PROCESS_ERROR(bRetCode); bResult = true; Exit0: Lua_PushBoolean(L, bResult); return 1; }
int LuaDeleteGlobalMail(Lua_State* L) { BOOL bResult = false; BOOL bRetCode = false; int nTopIndex = 0; DWORD dwMailID = 0; nTopIndex = Lua_GetTopIndex(L); KGLOG_PROCESS_ERROR(nTopIndex == 1); dwMailID = (DWORD)Lua_ValueToNumber(L, 1); bRetCode = g_pSO3GameCenter->m_MailManager.DeleteGlobalMail(dwMailID); KG_PROCESS_ERROR(bRetCode); bResult = true; Exit0: Lua_PushBoolean(L, bResult); return 1; }