clang format

This commit is contained in:
aMannus
2025-07-31 10:44:47 +02:00
parent e53d29e12d
commit 00a70eae87
7 changed files with 114 additions and 111 deletions
@@ -111,13 +111,13 @@ std::array<std::string, LANGUAGE_MAX> ArchipelagoSettingsMenuText[ASM_MAX]{
"Todo",
"Todo",
},
//ASM_CHAR_START_TO_CONNECT
// ASM_CHAR_START_TO_CONNECT
{
"Start to automatically connect to this slot",
"Todo",
"Todo",
},
//ASM_CHAR_SELECT_CONNECTED_TO_OTHER_SLOT
// ASM_CHAR_SELECT_CONNECTED_TO_OTHER_SLOT
{
"Connected to a different slot",
"Todo",
+15 -17
View File
@@ -53,9 +53,7 @@ bool ArchipelagoClient::StartClient() {
uri = CVarGetString(CVAR_REMOTE_ARCHIPELAGO("ServerAddress"), "localhost:38281");
password = CVarGetString(CVAR_REMOTE_ARCHIPELAGO("Password"), "");
apClient = std::unique_ptr<APClient>(
new APClient(uuid, AP_Client_consts::AP_GAME_NAME,
uri, "cacert.pem"));
apClient = std::unique_ptr<APClient>(new APClient(uuid, AP_Client_consts::AP_GAME_NAME, uri, "cacert.pem"));
CVarSetInteger(CVAR_REMOTE_ARCHIPELAGO("ConnectionStatus"), 1); // Connecting
@@ -67,7 +65,7 @@ bool ArchipelagoClient::StartClient() {
CVarSetInteger(CVAR_REMOTE_ARCHIPELAGO("ConnectionStatus"), 2); // Connection error
disconnecting = true;
if(GameInteractor::IsSaveLoaded) {
if (GameInteractor::IsSaveLoaded) {
SohGui::ShowArchipelagoSettingsMenu();
}
return;
@@ -80,8 +78,7 @@ bool ArchipelagoClient::StartClient() {
if (CVarGetInteger(CVAR_REMOTE_ARCHIPELAGO("DeathLink"), 0)) {
tags.push_back("DeathLink");
}
apClient->ConnectSlot(CVarGetString(CVAR_REMOTE_ARCHIPELAGO("SlotName"), ""),
password, 0b001, tags);
apClient->ConnectSlot(CVarGetString(CVAR_REMOTE_ARCHIPELAGO("SlotName"), ""), password, 0b001, tags);
});
apClient->set_slot_connected_handler([&](const nlohmann::json data) {
@@ -234,19 +231,20 @@ bool ArchipelagoClient::StartClient() {
});
apClient->set_bounced_handler([&](const nlohmann::json data) {
if(data.contains("tags")) {
if (data.contains("tags")) {
std::list<std::string> tags = data["tags"];
bool deathLink = (std::find(tags.begin(), tags.end(), "DeathLink") != tags.end());
if (deathLink && data["data"]["source"] != apClient->get_slot()) {
if (GameInteractor::IsSaveLoaded()) {
gSaveContext.health = 0;
std::string prefixText = std::string(data["data"]["source"]) + " died.";
Notification::Emit({ .prefix = prefixText, .message = "Cause:", .suffix = data["data"]["cause"] });
std::string deathLinkMessage = "[LOG] Received death link from " + std::string(data["data"]["source"]) +
std::string deathLinkMessage = "[LOG] Received death link from " +
std::string(data["data"]["source"]) +
". Cause: " + std::string(data["data"]["cause"]);
ArchipelagoConsole_SendMessage(deathLinkMessage.c_str());
isDeathLinkedDeath = true;
}
}
@@ -262,7 +260,7 @@ bool ArchipelagoClient::StopClient() {
}
void ArchipelagoClient::GameLoaded() {
// Load textures for the archipelago items that're shown in the notifications
static bool sArchipelagoTexturesLoaded = false;
if (!sArchipelagoTexturesLoaded) {
@@ -277,7 +275,7 @@ void ArchipelagoClient::GameLoaded() {
}
if (apClient == nullptr) {
if(IS_ARCHIPELAGO) {
if (IS_ARCHIPELAGO) {
CVarSetString(CVAR_REMOTE_ARCHIPELAGO("ServerAddress"), gSaveContext.ship.quest.data.archipelago.archiUri);
CVarSetString(CVAR_REMOTE_ARCHIPELAGO("SlotName"), gSaveContext.ship.quest.data.archipelago.slotName);
CVarSetString(CVAR_REMOTE_ARCHIPELAGO("Password"), gSaveContext.ship.quest.data.archipelago.roomPass);
@@ -423,7 +421,7 @@ void ArchipelagoClient::QueueItem(const ApItem item) {
}
void ArchipelagoClient::SendGameWon() {
if(apClient == nullptr) {
if (apClient == nullptr) {
return;
}
@@ -473,10 +471,10 @@ void ArchipelagoClient::Poll() {
apClient->poll();
}
void ArchipelagoClient::ResetQueue(){
void ArchipelagoClient::ResetQueue() {
itemQueued = false;
std::queue<ApItem> empty;
std::swap( receiveQueue, empty );
std::swap(receiveQueue, empty);
}
bool ArchipelagoClient::slotMatch(const std::string& slotName, const std::string& roomHash) {
@@ -484,7 +482,7 @@ bool ArchipelagoClient::slotMatch(const std::string& slotName, const std::string
return false;
}
if(disconnecting) {
if (disconnecting) {
return false;
}
@@ -624,7 +622,7 @@ void LoadArchipelagoData() {
ARRAY_COUNT(gSaveContext.ship.quest.data.archipelago.slotName));
SaveManager::Instance->LoadCharArray("archiUri", gSaveContext.ship.quest.data.archipelago.archiUri,
ARRAY_COUNT(gSaveContext.ship.quest.data.archipelago.archiUri));
SaveManager::Instance->LoadCharArray("roomPass", gSaveContext.ship.quest.data.archipelago.roomPass,
SaveManager::Instance->LoadCharArray("roomPass", gSaveContext.ship.quest.data.archipelago.roomPass,
ARRAY_COUNT(gSaveContext.ship.quest.data.archipelago.roomPass));
SaveManager::Instance->LoadArray(
@@ -100,9 +100,9 @@ void ArchipelagoConsoleWindow::DrawElement() {
ImGui::PopStyleVar(4);
};
ImVec4 ArchipelagoConsoleWindow::getColorVal(const AP_Text::TextColor color) {
using apt = AP_Text::TextColor;
switch(color) {
ImVec4 ArchipelagoConsoleWindow::getColorVal(const AP_Text::TextColor color) {
using apt = AP_Text::TextColor;
switch (color) {
case apt::COLOR_ERROR:
return ImVec4(1.0f, 0.4f, 0.4f, 1.0f);
case apt::COLOR_LOG:
@@ -137,4 +137,3 @@ ImVec4 ArchipelagoConsoleWindow::getColorVal(const AP_Text::TextColor color) {
return ImVec4(0.93f, 0.93f, 0.93f, 1.00f);
};
}
+23 -23
View File
@@ -2,29 +2,29 @@
#ifdef __cplusplus
namespace AP_Text {
enum class TextColor : char {
COLOR_DEFAULT = 0,
COLOR_ERROR,
COLOR_LOG,
COLOR_BLACK,
COLOR_RED,
COLOR_GREEN,
COLOR_YELLOW,
COLOR_BLUE,
COLOR_CYAN,
COLOR_MAGENTA,
COLOR_SLATEBLUE,
COLOR_PLUM,
COLOR_SALMON,
COLOR_WHITE,
COLOR_ORANGE,
COLOR_GRAY
};
enum class TextColor : char {
COLOR_DEFAULT = 0,
COLOR_ERROR,
COLOR_LOG,
COLOR_BLACK,
COLOR_RED,
COLOR_GREEN,
COLOR_YELLOW,
COLOR_BLUE,
COLOR_CYAN,
COLOR_MAGENTA,
COLOR_SLATEBLUE,
COLOR_PLUM,
COLOR_SALMON,
COLOR_WHITE,
COLOR_ORANGE,
COLOR_GRAY
};
struct ColoredTextNode {
std::string text;
AP_Text::TextColor color;
};
}
struct ColoredTextNode {
std::string text;
AP_Text::TextColor color;
};
} // namespace AP_Text
#endif
+2 -1
View File
@@ -517,7 +517,8 @@ void SaveManager::InitMeta(int fileNum) {
ARRAY_COUNT(fileMetaInfo[fileNum].archiUri));
SohUtils::CopyStringToCharArray(fileMetaInfo[fileNum].slotName, gSaveContext.ship.quest.data.archipelago.slotName,
ARRAY_COUNT(fileMetaInfo[fileNum].slotName));
SohUtils::CopyStringToCharArray(fileMetaInfo[fileNum].archiRoomSeed, gSaveContext.ship.quest.data.archipelago.roomHash,
SohUtils::CopyStringToCharArray(fileMetaInfo[fileNum].archiRoomSeed,
gSaveContext.ship.quest.data.archipelago.roomHash,
ARRAY_COUNT(fileMetaInfo[fileNum].archiRoomSeed));
}