Added Error messages when attempting to send messages while disconnected and when attempting to use local commands
This commit is contained in:
@@ -342,12 +342,19 @@ void ArchipelagoClient::SendGameWon() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArchipelagoClient::SendMessage(const char* message) {
|
void ArchipelagoClient::SendMessage(const std::string message) {
|
||||||
if(apClient == nullptr) {
|
// local commands not implemented yet
|
||||||
|
if(message.starts_with("/")) {
|
||||||
|
ArchipelagoConsole_SendMessage("Ship of Harkinian does not have any local commands yet.\nUse !help\" to see server commands instead", false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
apClient->Say(std::string(message));
|
if(apClient == nullptr) {
|
||||||
|
ArchipelagoConsole_SendMessage("[ERROR] Could not send message. Please Connect to your slot.", false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
apClient->Say(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArchipelagoClient::Poll() {
|
void ArchipelagoClient::Poll() {
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ class ArchipelagoClient{
|
|||||||
void QueueExternalCheck(int64_t apLocation);
|
void QueueExternalCheck(int64_t apLocation);
|
||||||
|
|
||||||
void SendGameWon();
|
void SendGameWon();
|
||||||
void SendMessage(const char* message);
|
void SendMessage(const std::string message);
|
||||||
void Poll();
|
void Poll();
|
||||||
|
|
||||||
std::unique_ptr<APClient> apClient;
|
std::unique_ptr<APClient> apClient;
|
||||||
|
|||||||
@@ -75,14 +75,14 @@ void ArchipelagoConsoleWindow::DrawElement() {
|
|||||||
keepFocus = false;
|
keepFocus = false;
|
||||||
}
|
}
|
||||||
if(ImGui::InputText("##AP_MessageField", textEntryBuf, 1023, ImGuiInputTextFlags_EnterReturnsTrue)) {
|
if(ImGui::InputText("##AP_MessageField", textEntryBuf, 1023, ImGuiInputTextFlags_EnterReturnsTrue)) {
|
||||||
ArchipelagoClient::GetInstance().SendMessage(textEntryBuf);
|
ArchipelagoClient::GetInstance().SendMessage(std::string(textEntryBuf));
|
||||||
textEntryBuf[0] = '\0';
|
textEntryBuf[0] = '\0';
|
||||||
keepFocus = true;
|
keepFocus = true;
|
||||||
}
|
}
|
||||||
//keepFocus = ImGui::IsItemActive();
|
//keepFocus = ImGui::IsItemActive();
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if(ImGui::Button("Send")) {
|
if(ImGui::Button("Send")) {
|
||||||
ArchipelagoClient::GetInstance().SendMessage(textEntryBuf);
|
ArchipelagoClient::GetInstance().SendMessage(std::string(textEntryBuf));
|
||||||
textEntryBuf[0] = '\0';
|
textEntryBuf[0] = '\0';
|
||||||
keepFocus = true;
|
keepFocus = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user