Kafa 153 Posted May 19, 2022 Share Posted May 19, 2022 else if (strType == "drop") { CDropItemGroup* pkGroup; bool bNew = true; itertype(m_map_pkDropItemGroup) it = m_map_pkDropItemGroup.find (iMobVnum); if (it == m_map_pkDropItemGroup.end()) { pkGroup = M2_NEW CDropItemGroup(0, iMobVnum, stName); } else { bNew = false; CDropItemGroup* pkGroup = it->second; } for (int k = 1; k < 256; ++k) { char buf[4]; snprintf(buf, sizeof(buf), "%d", k); if (loader.GetTokenVector(buf, &pTok)) { std::string& name = pTok->at(0); DWORD dwVnum = 0; if (!GetVnumByOriginalName(name.c_str(), dwVnum)) { str_to_number(dwVnum, name.c_str()); if (!ITEM_MANAGER::instance().GetTable(dwVnum)) { sys_err("ReadDropItemGroup : there is no item %s : node %s", name.c_str(), stName.c_str()); M2_DELETE(pkGroup); return false; } } int iCount = 0; str_to_number(iCount, pTok->at(1).c_str()); if (iCount < 1) { sys_err("ReadMonsterDropItemGroup : there is no count for item %s : node %s", name.c_str(), stName.c_str()); M2_DELETE(pkGroup); return false; } float fPercent = atof(pTok->at(2).c_str()); DWORD dwPct = (DWORD)(10000.0f * fPercent); sys_log(0," name %s pct %d count %d", name.c_str(), dwPct, iCount); pkGroup->AddItem(dwVnum, dwPct, iCount); #ifdef __INGAME_WIKI__ CommonWikiData::TWikiInfoTable* tbl; if ((tbl = GetItemWikiInfo(dwVnum)) && !tbl->origin_vnum) tbl->origin_vnum = iMobVnum; auto pTableTemp = GetTable(dwVnum); DWORD currVnum = dwVnum; DWORD startRefineVnum = GetWikiItemStartRefineVnum(dwVnum); if (pTableTemp && (pTableTemp->bType == ITEM_WEAPON || pTableTemp->bType == ITEM_ARMOR) && startRefineVnum != currVnum) currVnum = (startRefineVnum != 0 ? startRefineVnum : currVnum); CommonWikiData::TWikiItemOriginInfo origin_info; origin_info.set_vnum(iMobVnum); origin_info.set_is_mob(true); m_itemOriginMap[currVnum].push_back(origin_info); CMobManager::instance().GetMobWikiInfo(iMobVnum).push_back(CommonWikiData::TWikiMobDropInfo(dwVnum, iCount)); #endif continue; } break; } if (bNew) m_map_pkDropItemGroup.insert(std::map<DWORD, CDropItemGroup*>::value_type(iMobVnum, pkGroup)); } Error:Run-Time Check Failure #3 - The variable 'pkGroup' is being used without being initialized. At C:\Users\anil_\Documents\mainline\Srcs\Server\game\src\item_manager_read_tables.cpp:863 Line 863 is: pkGroup->AddItem(dwVnum, dwPct, iCount); Would be nice if someone is helping, i dont understand this error. Link to comment Share on other sites More sharing options...
Solution UdvAtt108 101 Posted May 19, 2022 Solution Share Posted May 19, 2022 A variable (CDropItemGroup* pkGroup) is declared twice, but it is not needed. Replace it: { bNew = false; CDropItemGroup* pkGroup = it->second; } To this: { bNew = false; pkGroup = it->second; } 1 All wolves are gray in the dark. Link to comment Share on other sites More sharing options...
Premium xTryhard 12 Posted May 19, 2022 Premium Share Posted May 19, 2022 2 hours ago, UdvAtt108 said: A variable (CDropItemGroup* pkGroup) is declared twice, but it is not needed. Replace it: { bNew = false; CDropItemGroup* pkGroup = it->second; } To this: { bNew = false; pkGroup = it->second; } this error says something else CDropItemGroup* pkGroup; << Error CDropItemGroup* pkGroup = NULL; << OK CDropItemGroup* pkGroup = nullptr; << OK 1 Link to comment Share on other sites More sharing options...
Kafa 153 Posted May 19, 2022 Author Share Posted May 19, 2022 9 hours ago, UdvAtt108 said: A variable (CDropItemGroup* pkGroup) is declared twice, but it is not needed. Replace it: { bNew = false; CDropItemGroup* pkGroup = it->second; } To this: { bNew = false; pkGroup = it->second; } I understand, thank you! Link to comment Share on other sites More sharing options...
Recommended Posts