R 1
Roksam
Bvural41 1
Bvural41
kaptanmikro1 1
kaptanmikro1
[DEV]AB 1
[DEV]AB
emirhanHCL 1
emirhanHCL
farkmt2official 1
farkmt2official
TuZaKK 1
TuZaKK
Hikaye Ekle

C++ SwitchBot Düzeltme

  • Konuyu başlatan Konuyu başlatan LangonaWork
  • Başlangıç tarihi Başlangıç tarihi
  • Cevaplar Cevaplar 27
  • Görüntüleme Görüntüleme 7K
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::P2PSendSwitchbot(DWORD player_id, WORD wTargetPort)[/CODE]

[CODE title="Değiştir:"]void CSwitchbotManager::P2PSendSwitchbot(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]
Good evening, mate, a question. This solution applies to this issue I have.
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)

1696808641004.png
 
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]
 
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)

Geri
Üst