- Katılım
- 6 Kas 2021
- Mesajlar
- 3,491
- Tepkime puanı
- 4,992
- Puanları
- 113
- Yaş
- 31
- Konum
- Türkiye
- Dc
- fatihbulut
Yapalı baya oldu o yüzden %100 case'i hatırlamıyorum ama event devam ederken iptal etmeye çalışıldığı için core crash yaşanıyordu, windows geliştirme ortamında yaşamıştım yanlış hatırlamıyorsam freebsd'de sorun olmayabilir:
new_switchbot.h
Arat:
Altına Ekle:
new_switchbot.cpp
Arat:
Altına Ekle:
Arat:
Altına Ekle:
Arat:
Altına Ekle:
Arat:
İf bloğunu değiştir:
Arat:
if bloğunu değiştir:
new_switchbot.h
Arat:
Kod:
void Pause();
Kod:
void ClearEvent(); // Clear event pointer (called from event handler)
Arat:
Kod:
info->pkSwitchbot->SwitchItems();
Kod:
if (!info->pkSwitchbot->HasActiveSlots())
{
info->pkSwitchbot->ClearEvent(); // Clear event pointer
return 0; // Stop event
}
Kod:
void CSwitchbot::Pause()
{
if (m_pkSwitchEvent)
{
event_cancel(&m_pkSwitchEvent);
m_pkSwitchEvent = nullptr;
}
}
Kod:
void CSwitchbot::ClearEvent()
{
m_pkSwitchEvent = nullptr;
}
Kod:
info->pkSwitchbot->SwitchItems();
Kod:
if (!info->pkSwitchbot->HasActiveSlots())
{
info->pkSwitchbot->ClearEvent(); // Clear event pointer
return 0; // Stop event
}
Kod:
if (!HasActiveSlots())
{
Kod:
memset(&m_table.active, 0, sizeof(m_table.active));
CSwitchbotManager::Instance().SendSwitchbotUpdate(m_table.player_id);
return; // Exit early - event will stop when it returns 0
Kod:
if (stop)
Kod:
if (stop)
{
// Don't call Stop() here - we're inside the event handler
// Just clear active flags and notify player
memset(&m_table.active, 0, sizeof(m_table.active));
if (SWITCHBOT_PRICE_TYPE == 1)
pkOwner->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Switchbot stopped. Out of switchers."));
else
pkOwner->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Switchbot stopped. Not enough money."));
CSwitchbotManager::Instance().SendSwitchbotUpdate(m_table.player_id);
return;
}
