Good evening, mate, a question. This solution applies to this issue I have.1-
[CODE title="Arat:"]void CSwitchbotManager::Initialize()
{
m_map_Switchbots.clear();
}[/CODE]
[CODE title="Değiştir:"]void CSwitchbotManager::Initialize()
{
for (std::map<DWORD, CSwitchbot*>::iterator it = m_map_Switchbots.begin(); it != m_map_Switchbots.end(); it++) {
CSwitchbot* pkSwitchbot = it->second;
if (pkSwitchbot != NULL) {
pkSwitchbot->~CSwitchbot();
delete pkSwitchbot;
pkSwitchbot = NULL;
}
}
m_map_Switchbots.clear();
}[/CODE]
2-
[CODE title="Arat:"]void CSwitchbotManager:2PSendSwitchbot(DWORD player_id, WORD wTargetPort)[/CODE]
[CODE title="Değiştir:"]void CSwitchbotManager:2PSendSwitchbot(DWORD player_id, WORD wTargetPort)
{
CSwitchbot* pkSwitchbot = FindSwitchbot(player_id);
if (!pkSwitchbot) {
sys_err("No switchbot found to transfer. (pid %d source_port %d target_port %d)", player_id, mother_port, wTargetPort);
return;
}
pkSwitchbot->Pause();
m_map_Switchbots.erase(player_id);
TPacketGGSwitchbot pack;
pack.wPort = wTargetPort;
pack.table = pkSwitchbot->GetTable();
P2P_MANAGER::Instance().Send(&pack, sizeof(pack));
delete pkSwitchbot;
pkSwitchbot = NULL;
}[/CODE]
SYSERR: Sep 24 17:17:03 :: P2PSendSwitchbot: No switchbot found to transfer. (pid 1 source_port 30003 target_port 30005)
SYSERR: Sep 24 17:31:31 :: P2PSendSwitchbot: No switchbot found to transfer. (pid 1 source_port 30003 target_port 30005)
SYSERR: Sep 24 17:17:03 :: P2PSendSwitchbot: No switchbot found to transfer. (pid 1 source_port 30003 target_port 30005)
SYSERR: Sep 24 17:31:31 :: P2PSendSwitchbot: No switchbot found to transfer. (pid 1 source_port 30003 target_port 30005)
SYSERR: Sep 24 17:17:03 :: P2PSendSwitchbot: No switchbot found to transfer. (pid 1 source_port 30003 target_port 30005)
SYSERR: Sep 24 17:31:31 :: P2PSendSwitchbot: No switchbot found to transfer. (pid 1 source_port 30003 target_port 30005)
SYSERR: Sep 24 17:17:03 :: P2PSendSwitchbot: No switchbot found to transfer. (pid 1 source_port 30003 target_port 30005)
SYSERR: Sep 24 17:31:31 :: P2PSendSwitchbot: No switchbot found to transfer. (pid 1 source_port 30003 target_port 30005)
hiç gerek yok bi kontrol ekle efsunbotu çalışmıyorsa paket göndermesin.
[CODE lang="cpp" title="char.cpp"]Ara ///////
CSwitchbotManager::Instance().SetIsWarping(GetPlayerID(), true);
if (p.wPort != mother_port)
{
CSwitchbotManager::Instance().P2PSendSwitchbot(GetPlayerID(), p.wPort);
}
Değiştir ////////
CSwitchbotManager::Instance().SetIsWarping(GetPlayerID(), true);
if (p.wPort != mother_port)
{
if (CSwitchbotManager::Instance().FindSwitchbot(GetPlayerID()))
CSwitchbotManager::Instance().P2PSendSwitchbot(GetPlayerID(), p.wPort);
}[/CODE]
[CODE lang="cpp" title="char.cpp"]Ara ///////
CSwitchbotManager::Instance().SetIsWarping(GetPlayerID(), true);
if (p.wPort != mother_port)
{
CSwitchbotManager::Instance().P2PSendSwitchbot(GetPlayerID(), p.wPort);
}
Değiştir ////////
CSwitchbotManager::Instance().SetIsWarping(GetPlayerID(), true);
if (p.wPort != mother_port)
{
if (CSwitchbotManager::Instance().FindSwitchbot(GetPlayerID()))
CSwitchbotManager::Instance().P2PSendSwitchbot(GetPlayerID(), p.wPort);
}[/CODE]
hiç gerek yok bi kontrol ekle efsunbotu çalışmıyorsa paket göndermesin.
[CODE lang="cpp" title="char.cpp"]Ara ///////
CSwitchbotManager::Instance().SetIsWarping(GetPlayerID(), true);
if (p.wPort != mother_port)
{
CSwitchbotManager::Instance().P2PSendSwitchbot(GetPlayerID(), p.wPort);
}
Değiştir ////////
CSwitchbotManager::Instance().SetIsWarping(GetPlayerID(), true);
if (p.wPort != mother_port)
{
if (CSwitchbotManager::Instance().FindSwitchbot(GetPlayerID()))
CSwitchbotManager::Instance().P2PSendSwitchbot(GetPlayerID(), p.wPort);
}[/CODE]
C++:
if (CSwitchbotManager::Instance().FindSwitchbot(GetPlayerID()))
{
CSwitchbotManager::Instance().P2PSendSwitchbot(GetPlayerID(), p.wPort);
}
else
{
sys_log(0, "Switchbot not found for player %u", GetPlayerID());
}
Tespit için loglamada koyulabilir
Şu an konuyu görüntüleyenler (Toplam : 0, Üye: 0, Misafir: 0)
Benzer konular
- Cevaplar
- 9
- Görüntüleme
- 862
- Kilitli
- Cevaplar
- 7
- Görüntüleme
- 2K
- Kilitli
- Cevaplar
- 1
- Görüntüleme
- 478
- Cevaplar
- 37
- Görüntüleme
- 2K

2PSendSwitchbot(DWORD player_id, WORD wTargetPort)[/CODE]