Fixed issue where client crashes when collecting item while offline
This commit is contained in:
@@ -278,6 +278,10 @@ void ArchipelagoClient::QueueExternalCheck(const int64_t apLocation) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool ArchipelagoClient::IsConnected() {
|
bool ArchipelagoClient::IsConnected() {
|
||||||
|
if(apClient == nullptr) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return apClient->get_state() == APClient::State::SLOT_CONNECTED;
|
return apClient->get_state() == APClient::State::SLOT_CONNECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -287,6 +291,10 @@ void ArchipelagoClient::CheckLocation(RandomizerCheck sohCheckId) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!IsConnected()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
std::string apName = Rando::StaticData::GetLocation(sohCheckId)->GetName();
|
std::string apName = Rando::StaticData::GetLocation(sohCheckId)->GetName();
|
||||||
if (apName.empty()) {
|
if (apName.empty()) {
|
||||||
return;
|
return;
|
||||||
@@ -296,9 +304,6 @@ void ArchipelagoClient::CheckLocation(RandomizerCheck sohCheckId) {
|
|||||||
std::string logMessage = "[LOG] Checked: " + apName + "(" + std::to_string(apItemId) + "), sending to AP server";
|
std::string logMessage = "[LOG] Checked: " + apName + "(" + std::to_string(apItemId) + "), sending to AP server";
|
||||||
ArchipelagoConsole_SendMessage(logMessage.c_str(), true);
|
ArchipelagoConsole_SendMessage(logMessage.c_str(), true);
|
||||||
|
|
||||||
if(!IsConnected()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
apClient->LocationChecks({ apItemId });
|
apClient->LocationChecks({ apItemId });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user