Rinor 59 Report post Posted May 24, 2022 Hello, I noticed an error when trying to use NPCInfo and MonsterList Info from original src code shared by vector to another src, both uses vs 2003 and somehow it works fine on the original one but throws some errors when copying it to another src. Heres the 2 errors from visual studio 2003:https://imgur.com/a/F7Pf6bs Here the codes of both codes, first error Npc CRawDataInfo: NPCHelper* NPCHelper::_Instance = NULL; BOOL NPCHelper::_ReadRawDataInfo(CRawDataInfo *pRawDataInfo, vector<basic_string> &ParamList) { if(ParamList.size()==0) return FALSE; NPCData *pInfo = (NPCData*)pRawDataInfo; int m = 0, n = 0; string strList[8]; string strLine; // npc显示名称 _tcsncpy(pInfo->szName, pInfo->szDataName, NPC_MAXSIZE_NAME); pInfo->szName[NPC_MAXSIZE_NAME - 1] = _TEXT('\0'); _tcsncpy(pInfo->szArea, ParamList[m++].c_str(), NPC_MAXSIZE_NAME); pInfo->szMapName[NPC_MAXSIZE_NAME - 1] = _TEXT('\0'); // npc位置信息 Util_ResolveTextLine( ParamList[m++].c_str(), strList, 8, ',' ); pInfo->dwxPos0 = Str2Int(strList[0]); pInfo->dwyPos0 = Str2Int(strList[1]); // npc所在地图显示名称 _tcsncpy(pInfo->szMapName, ParamList[m++].c_str(), NPC_MAXSIZE_NAME); pInfo->szMapName[NPC_MAXSIZE_NAME - 1] = _TEXT('\0'); return TRUE; } class NPCData : public CRawDataInfo { public: char szName[NPC_MAXSIZE_NAME]; // 地图中显示npc名称 char szArea[NPC_MAXSIZE_NAME]; // 位置或者等级 DWORD dwxPos0, dwyPos0; // npc位置信息 char szMapName[NPC_MAXSIZE_NAME]; // npc所在地图名称 }; class NPCHelper : public CRawDataSet { public: static NPCHelper* I() { return _Instance; } NPCHelper(int nIDStart, int nIDCnt, int nCol = 128) : CRawDataSet(nIDStart, nIDCnt, nCol) { _Instance = this; _Init(); } protected: static NPCHelper* _Instance; // 相当于单键, 把自己记住 virtual CRawDataInfo* _CreateRawDataArray(int nCnt) { return new NPCData[nCnt]; } virtual void _DeleteRawDataArray() { delete[] (NPCData*)_RawDataArray; } virtual int _GetRawDataInfoSize() { return sizeof(NPCData); } virtual void* _CreateNewRawData(CRawDataInfo *pInfo) { return NULL; } virtual void _DeleteRawData(CRawDataInfo *pInfo) { SAFE_DELETE(pInfo->pData); } virtual BOOL _ReadRawDataInfo(CRawDataInfo *pRawDataInfo, vector<string> &ParamList); }; inline NPCData* GetNPCDataInfo( int nTypeID ) { return (NPCData*)NPCHelper::I()->GetRawDataInfo(nTypeID); } and this is the 2nd code error, ShowRadar: void CMiniMapMgr::ShowRadar() { const char * szX = edtX->GetCaption(); const char * szY = edtY->GetCaption(); if (CHECK_FAILED(CheckCoordinateEdit(szX))) { g_pGameApp->MsgBox(g_oLangRec.GetString(720)); edtX->SetCaption(""); edtX->SetActive(edtX); return; } if (CHECK_FAILED(CheckCoordinateEdit(szY))) { g_pGameApp->MsgBox(g_oLangRec.GetString(720)); edtY->SetCaption(""); edtY->SetActive(edtY); return; } // 坐标; int x = atoi(szX), y = atoi(szY); D3DXVECTOR3 target((float)x, (float)y, 0); // 地点 const char* szAddress = cboAddr->GetText(); CWorldScene* pScene = dynamic_cast<CWorldScene*>(CGameApp::GetCurScene()); if( !pScene ) return; CNavigationBar::g_cNaviBar.SetTarget((char*)szAddress, target); CNavigationBar::g_cNaviBar.Show(true); frmRadar->Hide(); } void ShowRadar(const char * szX,const char * szY);//add by alfred.shi 20080710 static void ShowRadar(); void CStartMgr::_evtNPCListChange(CGuiData *pSender) { CListItems* pItems = g_stUIStart.lstCurrList->GetItems(); int nIndex = pItems->GetIndex(g_stUIStart.lstCurrList->GetSelectItem()); CItemRow* itemrow = g_stUIStart.lstCurrList->GetSelectItem(); CItemObj* itemobj = itemrow->GetBegin(); std::string itemstring(itemobj->GetString()); int pos = (int)itemstring.find(">") + 1; int pos1 = (int)itemstring.find("<",pos); int pos2 = (int)itemstring.find(",",pos); int pos3 = (int)itemstring.find(">",pos); if(pos1 >= 0 && pos2 > pos1 && pos3 > pos2 && pos3 <= (int)itemstring.length()) { string xStr = itemstring.substr(pos1 + 1,pos2 - pos1 - 1); string yStr = itemstring.substr(pos2 + 1,pos3 - pos2 - 1); g_stUIMap.ShowRadar(xStr.c_str(),yStr.c_str()); } g_stUIStart.ShowNPCHelper(g_stUIStart.GetCurrMapName(),false); } If anyone can give me a hand here, thank you! Quote Share this post Link to post Share on other sites
V3ct0r 2,117 Report post Posted May 24, 2022 Hello @Rinor, Repalce BOOL NPCHelper::_ReadRawDataInfo(CRawDataInfo *pRawDataInfo, vector<basic_string> &ParamList) to BOOL NPCHelper::_ReadRawDataInfo(CRawDataInfo *pRawDataInfo, vector<string> &ParamList) Where is the implementation for this method? void ShowRadar(const char * szX, const char * szY); Quote Some useful links / Полезные ссылки Tips for making a topic in 'Questions & Help' / Рекомендации по созданию тем в разделе "Помощь" Server Advertising Section Rules / Правила раздела "Реклама серверов" Available e-mail domains for registration / Допустимые e-mail домены для регистрации User groups / Группы пользователей User ranks / Звания пользователей "Broken" pictures on the forum / "Битые" изображения на форуме Beware of scammers! / Осторожно, мошенники! My developments / Мои разработки Mods for client and server / Моды для клиента и сервера PKOdev.NET website for Tales of Pirates Server / PKOdev.NET веб-обвязка для сервера Пиратии I do not provide any help in private messages and outside the forum. Use 'Questions & Help' section please. Thank you for understanding! Я не оказываю какую-либо помощь в личных сообщениях и вне форума. Пожалуйста, используйте раздел "Пиратия: Помощь". Благодарю за понимание! Share this post Link to post Share on other sites
Rinor 59 Report post Posted May 24, 2022 Just now, V3ct0r said: Where is the implementation for this method? void ShowRadar(const char * szX, const char * szY); UiMinimapForm.h: namespace GUI { // 小地图 class CMiniMapMgr : public CUIInterface { public: CMiniMapMgr() : frmMinimap(0), MinimatRect(0), labMapPos(0), labMapName(0), frmBigmap(0){} // 用于小地图更新时得到Form大小 CCompent* GetMinimapRect() { return MinimatRect; } void RefreshChaPos( int x, int y ); void RefreshMapName (const char * name ); C3DCompent* GetBigmapRect() { return d3dBigmap; } bool IsShowBigmap(); CForm* GetBigmapForm() { return frmBigmap; } void ClearRadar(); void CloseRadar(); const char* GetMapName() { return labMapName->GetCaption(); } bool IsPKSilver(); bool IsGuildWar(); void ShowRadar(const char * szX,const char * szY);//add by alfred.shi 20080710 CLabelEx* GetLabMapPos(){return labMapPos;} protected: virtual bool Init(); virtual void End(); virtual void SwitchMap(); private: static void _MiniFormMouseEvent(CCompent *pSender, int nMsgType, int x, int y, DWORD dwKey); static void _RadarFormEvent(CCompent *pSender, int nMsgType, int x, int y, DWORD dwKey); static void _RenderBigmapEvent(C3DCompent *pSender, int x, int y); static void _evtShowbigmap(CGuiData *pSender); static void _evtHidebigmap(CGuiData *pSender); //雷达界面的enter事件 static void _evtRadarEnter(CGuiData *pSender); static void _RadarFormBeforeShowEvent(CForm* pForm, bool& IsShow); static void _evtShowNPCList(CGuiData *pSender,int x,int y ,DWORD key); static void _evtShowQueen(CGuiData *pSender,int x,int y ,DWORD key); static void _evtShowQQ(CGuiData *pSender,int x, int y, DWORD key ); static void _evtSearchQueen( CGuiData *pSender, int x, int y, DWORD key ); static void ShowRadar(); // 检查坐标输入框是否有非法字符(只支持整数) 正确返回0,其他的暂定为-1 static int CheckCoordinateEdit(const char* input); // 绘制大地图提示 void _RenderBigMapHint(void);//Add by sunny.sun 20080903 //小地图表单 CForm* frmMinimap; CCompent* MinimatRect; enum { MAP_POS_MAX = 10, }; //小地图控件 CLabelEx *labMapPosRand[MAP_POS_MAX]; CLabelEx *labMapPos; CLabelEx *labMapName; CTextButton *btnQueen; CTextButton *btnQQ; CTextButton *btnPosSearch; CTextButton *btnSeach; // 搜索女神 CCheckBox* chkID; CForm* frmBigmap; C3DCompent* d3dBigmap; static CForm* frmRadar; static CEdit* edtX; static CEdit* edtY; static CCombo* cboAddr; //CMPFont g_CFont; }; } Quote Share this post Link to post Share on other sites
Rinor 59 Report post Posted May 24, 2022 18 minutes ago, V3ct0r said: Hello @Rinor, Repalce BOOL NPCHelper::_ReadRawDataInfo(CRawDataInfo *pRawDataInfo, vector<basic_string> &ParamList) to BOOL NPCHelper::_ReadRawDataInfo(CRawDataInfo *pRawDataInfo, vector<string> &ParamList) Also this still throwing same errors:https://imgur.com/a/kKO3xJa Quote Share this post Link to post Share on other sites
V3ct0r 2,117 Report post Posted May 25, 2022 @Rinor, these errors occur when the linker can't find the implementation of these methods. Make sure all required files are included and declarations with methods definitions are in the same namespace. Quote Some useful links / Полезные ссылки Tips for making a topic in 'Questions & Help' / Рекомендации по созданию тем в разделе "Помощь" Server Advertising Section Rules / Правила раздела "Реклама серверов" Available e-mail domains for registration / Допустимые e-mail домены для регистрации User groups / Группы пользователей User ranks / Звания пользователей "Broken" pictures on the forum / "Битые" изображения на форуме Beware of scammers! / Осторожно, мошенники! My developments / Мои разработки Mods for client and server / Моды для клиента и сервера PKOdev.NET website for Tales of Pirates Server / PKOdev.NET веб-обвязка для сервера Пиратии I do not provide any help in private messages and outside the forum. Use 'Questions & Help' section please. Thank you for understanding! Я не оказываю какую-либо помощь в личных сообщениях и вне форума. Пожалуйста, используйте раздел "Пиратия: Помощь". Благодарю за понимание! Share this post Link to post Share on other sites