Opublikowano 19 Listopada 20231 r Spoiler [OK] kompilacja: cube.cpp In file included from char.cpp:65: ./offline_shop.h:43:11: error: use of undeclared identifier 'TR1_NS' [OK] kompilacja: db.cpp typedef TR1_NS::unordered_map<LPCHARACTER, bool> GuestMapType; ^ [OK] kompilacja: desc.cpp char.cpp [OK] kompilacja: desc_client.cpp :975:9: error: no member named 'auto_ptr' in namespace 'std' std::auto_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery("SELECT sign FROM player.offline_shop_npc WHERE owner_id = %u", GetOfflineShopRealOwner())); ~~~~~^ char.cpp:975:18: error: unexpected type name 'SQLMsg': expected expression std::auto_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery("SELECT sign FROM player.offline_shop_npc WHERE owner_id = %u", GetOfflineShopRealOwner())); ^ cmd.cppchar.cpp::283975 [OK] kompilacja: desc_manager.cpp ::261:: errorerror: : use of undeclared identifier 'pMsg'unknown type name 'Ma' [OK] kompilacja: desc_p2p.cpp std::auto_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery("SELECT sign FROM player.offline_shop_npc WHERE owner_id = %u", GetOfflineShopRealOwner()));Ma to wygl?da? np. tak: ^^ cmd.cpp:char.cpp283::9766::8 : [OK] kompilacja: dev_log.cpp error: error: expected ';' after top level declaratoruse of undeclared identifier 'pMsg' if (pMsg->Get()->uiNumRows > 0) ^ char.cpp:978:37: error: use of undeclared identifier 'pMsg' MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult); ^ Ma to wygl?da? np. tak: char.cpp ^: 4269:8 ;: [OK] kompilacja: dungeon.cpp error: no member named 'auto_ptr' in namespace 'std' std::auto_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery("SELECT COUNT(*) FROM %soffline_shop_npc WHERE owner_id = %u", get_table_postfix(), GetPlayerID())); ~~~~~^ char.cpp:4269:17: error: unexpected type name 'SQLMsg': expected expression std::auto_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery("SELECT COUNT(*) FROM %soffline_shop_npc WHERE owner_id = %u", get_table_postfix(), GetPlayerID())); ^ char.cpp:4269:225: error: use of undeclared identifier 'pMsg' std::auto_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery("SELECT COUNT(*) FROM %soffline_shop_npc WHERE owner_id = %u", get_table_postfix(), GetPlayerID())); ^ char.cpp:4270:35: error: use of undeclared identifier 'pMsg' MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult); ^ char.cpp:4285:3: error: use of undeclared identifier 'pMsg' pMsg = std::make_unique<SQLMsg>(DBManager::instance().DirectQuery(szInsertQuery)); ^ errorchar.cpp:4285:69: error: use of undeclared identifier 'szInsertQuery' pMsg = std::make_unique<SQLMsg>(DBManager::instance().DirectQuery(szInsertQuery)); ^ char.cpp:4286:8: error: no member named 'auto_ptr' in namespace 'std' std::auto_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery("SELECT COUNT(*) FROM %soffline_shop_item WHERE owner_id = %u", get_table_postfix(), GetPlayerID())); ~~~~~^ char.cpp:4286:17: error: unexpected type name 'SQLMsg': expected expression std::auto_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery("SELECT COUNT(*) FROM %soffline_shop_item WHERE owner_id = %u", get_table_postfix(), GetPlayerID())); ^ schar.cpp:4286:25: error: use of undeclared identifier 'pMsg' std::auto_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery("SELECT COUNT(*) FROM %soffline_shop_item WHERE owner_id = %u", get_table_postfix(), GetPlayerID())); ^ char.cpp:4287:35: error: use of undeclared identifier 'pMsg' MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult); ^ char.cpp:4562:9: error: no member named 'auto_ptr' in namespace 'std' std::auto_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery(szInsertQuery)); ~~~~~^ char.cpp:4562:18: error: unexpected type name 'SQLMsg': expected expression std::auto_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery(szInsertQuery)); ^ generated. char.cppgmake: *** [Makefile:121: obj/cmd.o] Error 1 :gmake: *** Waiting for unfinished jobs.... 4562:26: error: use of undeclared identifier 'pMsg' std::auto_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery(szInsertQuery)); ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. gmake: *** [Makefile:120: obj/char.o] Error 1 cmd_general.cpp:2599:7: error: no member named 'auto_ptr' in namespace 'std' std::auto_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery("SELECT time, x, y, mapIndex, channel FROM %soffline_shop_npc WHERE owner_id = %u", get_table_postfix(), ch->GetPlayerID())); ~~~~~^ cmd_general.cpp:2599:16: error: unexpected type name 'SQLMsg': expected expression std::auto_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery("SELECT time, x, y, mapIndex, channel FROM %soffline_shop_npc WHERE owner_id = %u", get_table_postfix(), ch->GetPlayerID())); ^ cmd_general.cpp:2599:24: error: use of undeclared identifier 'pMsg' std::auto_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery("SELECT time, x, y, mapIndex, channel FROM %soffline_shop_npc WHERE owner_id = %u", get_table_postfix(), ch->GetPlayerID())); ^ cmd_general.cpp:2600:34: error: use of undeclared identifier 'pMsg' MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult); ^ cmd_general.cpp:2602:6: error: use of undeclared identifier 'pMsg' if (pMsg->Get()->uiNumRows) ^ 5 errors generated. gmake: *** [Makefile:120: obj/cmd_general.o] Error 1 Błąd podczas kompilacji! cmd_general Spoiler ACMD(do_offline_shop_open_panel) { // if (ch->GetLastTimePanelOpened() + 2000 > get_dword_time()) // { // ch->ChatPacket(CHAT_TYPE_INFO, "You have to wait 2 seconds before opening the pannel."); // return; // } std::auto_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery("SELECT time, x, y, mapIndex, channel FROM %soffline_shop_npc WHERE owner_id = %u", get_table_postfix(), ch->GetPlayerID())); MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult); if (pMsg->Get()->uiNumRows) { DWORD index = 0, pos_x = 0, pos_y = 0, time = 0, channel = 0; str_to_number(time, row[0]); str_to_number(pos_x, row[1]); str_to_number(pos_y, row[2]); str_to_number(index, row[3]); str_to_number(channel, row[4]); ch->ChatPacket(CHAT_TYPE_COMMAND, "OpenOfflineShopPanel %d:%d:%d:%d:%d", time, pos_x, pos_y, index, channel); } else ch->ChatPacket(CHAT_TYPE_COMMAND, "OpenOfflineShopPanel 0:0:0:0:0"); // ch->SetLastTimePanelOpened(get_dword_time()); } offline_shop.h Spoiler #pragma once #ifdef ENABLE_OFFLINE_SHOP_SYSTEM enum { OFFLINE_SHOP_MAX_DISTANCE = 1500, }; class COfflineShop { public: COfflineShop(); ~COfflineShop(); virtual void SetOfflineShopNPC(LPCHARACTER npc); virtual bool IsOfflineShopNPC(){ return m_pkOfflineShopNPC ? true : false; } virtual bool AddGuest(LPCHARACTER ch, LPCHARACTER npc); void RemoveGuest(LPCHARACTER ch); void RemoveAllGuest(); void Destroy(LPCHARACTER npc); virtual long long Buy(LPCHARACTER ch, BYTE bPos); void BroadcastUpdateItem(BYTE bPos, DWORD dwPID, bool bDestroy = false); void BroadcastUpdatePrice(BYTE bPos, long long dwPrice); void Refresh(LPCHARACTER ch); bool RemoveItem(DWORD dwVID, BYTE bPos); BYTE GetLeftItemCount(DWORD dwPID); void SetActionPulse(DWORD dwPulse) { dwActionPulse = dwPulse; } DWORD GetActionPulse() { return dwActionPulse; } protected: void Broadcast(const void * data, int bytes); private: CGrid * m_pGrid; typedef TR1_NS::unordered_map<LPCHARACTER, bool> GuestMapType; GuestMapType m_map_guest; LPCHARACTER m_pkOfflineShopNPC; DWORD dwActionPulse; }; #endif char.cpp: Spoiler { std::auto_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery("SELECT COUNT(*) FROM %soffline_shop_item WHERE owner_id = %u", get_table_postfix(), GetPlayerID())); MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult); BYTE bResult = 0; str_to_number(bResult, row[0]); if (bResult) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("SHOP_OFFLINE_BACK_ITEM")); COfflineShopManager::instance().Giveback2(this); return; } } Meczę się już pół dnia problem jest z : std::auto_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery("SELECT time, x, y, mapIndex, channel FROM %soffline_shop_npc WHERE owner_id = %u", get_table_postfix(), ch->GetPlayerID())); Nie wiem jak się za to zabrać jak zdefiniować pMsg Próbowałem tak : pMsg = std::make_unique<SQLMsg>(DBManager::instance().DirectQuery(szInsertQuery));
Opublikowano 19 Listopada 20231 r Autor 1 minutę temu, Delta napisał(a): std::auto_ptr zamień na std::unique_ptr Dzięki 🙂