Skip to content

Commit

Permalink
Pass for some warning fixes (HarbourMasters#4501)
Browse files Browse the repository at this point in the history
  • Loading branch information
Archez authored Oct 31, 2024
1 parent 98fa566 commit ec1f03e
Show file tree
Hide file tree
Showing 16 changed files with 270 additions and 250 deletions.
1 change: 0 additions & 1 deletion soh/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ __pycache__/
.vscode/
.vs/
.idea/
CMakeLists.txt
cmake-build-debug
venv/

Expand Down
2 changes: 2 additions & 0 deletions soh/soh/Enhancements/cheat_hook_handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ void CheatsOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_list
}
break;
}
default:
break;
}
}

Expand Down
6 changes: 3 additions & 3 deletions soh/soh/Enhancements/controls/SohInputEditorWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ void SohInputEditorWindow::DrawButtonLineEditMappingButton(uint8_t port, N64Butt
ImGui::OpenPopup(popupId.c_str());
}
if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal | ImGuiHoveredFlags_NoSharedDelay)) {
ImGui::SetTooltip(mapping->GetPhysicalDeviceName().c_str());
ImGui::SetTooltip("%s", mapping->GetPhysicalDeviceName().c_str());
}
ImGui::PopStyleColor();
ImGui::PopStyleColor();
Expand Down Expand Up @@ -571,7 +571,7 @@ void SohInputEditorWindow::DrawStickDirectionLineEditMappingButton(uint8_t port,
ImGui::OpenPopup(popupId.c_str());
}
if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal | ImGuiHoveredFlags_NoSharedDelay)) {
ImGui::SetTooltip(mapping->GetPhysicalDeviceName().c_str());
ImGui::SetTooltip("%s", mapping->GetPhysicalDeviceName().c_str());
}
ImGui::PopStyleColor();
ImGui::PopStyleColor();
Expand Down Expand Up @@ -1178,7 +1178,7 @@ void SohInputEditorWindow::DrawGyroSection(uint8_t port) {
auto id = mapping->GetGyroMappingId();
ImGui::AlignTextToFramePadding();
ImGui::SetNextItemOpen(true, ImGuiCond_Once);
ImGui::BulletText(mapping->GetPhysicalDeviceName().c_str());
ImGui::BulletText("%s", mapping->GetPhysicalDeviceName().c_str());
DrawRemoveGyroMappingButton(port, id);

static float sPitch, sYaw = 0.0f;
Expand Down
2 changes: 1 addition & 1 deletion soh/soh/Enhancements/custom-message/CustomMessageManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ class MessageNotFoundException : public std::exception {
: messageTableId(std::move(messageTableId_)), textId(textId_) {
}
virtual const char* what() const noexcept {
char* message;
static char message[500];
sprintf(message, "Message from table %s with textId %u was not found", messageTableId.c_str(), textId);
return message;
}
Expand Down
4 changes: 4 additions & 0 deletions soh/soh/Enhancements/debugconsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,8 @@ static bool SaveStateHandler(std::shared_ptr<Ship::Console> Console, const std::
case SaveStateReturn::FAIL_WRONG_GAMESTATE:
ERROR_MESSAGE("[SOH] Can not save a state outside of \"GamePlay\"");
return 1;
default:
return 1;
}
}

Expand All @@ -538,6 +540,8 @@ static bool LoadStateHandler(std::shared_ptr<Ship::Console> Console, const std::
case SaveStateReturn::FAIL_WRONG_GAMESTATE:
ERROR_MESSAGE("[SOH] Can not load a state outside of \"GamePlay\"");
return 1;
default:
return 1;
}

}
Expand Down
11 changes: 8 additions & 3 deletions soh/soh/Enhancements/mods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ void RegisterPermanentHeartLoss() {

void RegisterDeleteFileOnDeath() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
if (!CVarGetInteger(CVAR_ENHANCEMENT("DeleteFileOnDeath"), 0) || !GameInteractor::IsSaveLoaded() || &gPlayState->gameOverCtx == NULL || &gPlayState->pauseCtx == NULL) return;
if (!CVarGetInteger(CVAR_ENHANCEMENT("DeleteFileOnDeath"), 0) || !GameInteractor::IsSaveLoaded() || gPlayState == NULL) return;

if (gPlayState->gameOverCtx.state == GAMEOVER_DEATH_MENU && gPlayState->pauseCtx.state == 9) {
SaveManager::Instance->DeleteZeldaFile(gSaveContext.fileNum);
Expand Down Expand Up @@ -1095,7 +1095,7 @@ void RegisterAltTrapTypes() {
break;
case ADD_VOID_TRAP:
Audio_PlaySoundGeneral(NA_SE_EN_GANON_LAUGH, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
eventTimer = 3;
eventTimer = 3;
break;
case ADD_AMMO_TRAP:
eventTimer = 3;
Expand All @@ -1107,6 +1107,8 @@ void RegisterAltTrapTypes() {
case ADD_TELEPORT_TRAP:
eventTimer = 3;
break;
default:
break;
}
});
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnPlayerUpdate>([]() {
Expand Down Expand Up @@ -1134,7 +1136,7 @@ void RegisterAltTrapTypes() {
AMMO(ITEM_BOMBCHU) = AMMO(ITEM_BOMBCHU) * 0.5;
Audio_PlaySoundGeneral(NA_SE_VO_FR_SMILE_0, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
break;
case ADD_TELEPORT_TRAP:
case ADD_TELEPORT_TRAP: {
int entrance;
int index = 1 + rand() % 10;
switch (index) {
Expand Down Expand Up @@ -1162,6 +1164,9 @@ void RegisterAltTrapTypes() {
}
GameInteractor::RawAction::TeleportPlayer(entrance);
break;
}
default:
break;
}
}
statusTimer--;
Expand Down
4 changes: 2 additions & 2 deletions soh/soh/Enhancements/nametag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ extern "C" void NameTag_RegisterForActorWithOptions(Actor* actor, const char* te
processedText.erase(std::remove_if(processedText.begin(), processedText.end(), [](const char& c) {
// 172 is max supported texture for the in-game font system,
// and filter anything less than a space but not the newline or nul characters
return c > 172 || (c < ' ' && c != '\n' && c != '\0');
return c > (s8)172 || (c < ' ' && c != '\n' && c != '\0');
}), processedText.end());

int16_t numChar = processedText.length();
Expand All @@ -213,7 +213,7 @@ extern "C" void NameTag_RegisterForActorWithOptions(Actor* actor, const char* te
Vtx* vertices = (Vtx*)calloc(sizeof(Vtx[4]), numChar + 1);

// Set all the char vtx first to get the total size for the textbox
for (size_t i = 0; i < numChar; i++) {
for (int16_t i = 0; i < numChar; i++) {
if (processedText[i] == '\n') {
offsetX = 0;
numLines++;
Expand Down
4 changes: 4 additions & 0 deletions soh/soh/Enhancements/randomizer/logic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1473,6 +1473,8 @@ namespace Rando {
case RG_BOMBCHU_20:
SetInventory(ITEM_BOMBCHU, (!state ? ITEM_NONE : ITEM_BOMBCHU));
break;
default:
break;
}
}
break;
Expand Down Expand Up @@ -1571,6 +1573,8 @@ namespace Rando {
case RG_BOMBCHU_20:
SetInventory(ITEM_BOMBCHU, (!state ? ITEM_NONE : ITEM_BOMBCHU));
break;
default:
break;
}
} break;
}
Expand Down
6 changes: 5 additions & 1 deletion soh/soh/Enhancements/randomizer/randomizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3147,6 +3147,8 @@ extern "C" u16 Randomizer_Item_Give(PlayState* play, GetItemEntry giEntry) {
case RG_BOTTLE_WITH_BIG_POE:
bottleItem = ITEM_BIG_POE;
break;
default:
break;
}

gSaveContext.inventory.items[SLOT_BOTTLE_1 + i] = bottleItem;
Expand Down Expand Up @@ -3247,6 +3249,8 @@ extern "C" u16 Randomizer_Item_Give(PlayState* play, GetItemEntry giEntry) {
mapIndex = SCENE_INSIDE_GANONS_CASTLE;
numOfKeysOnKeyring = GANONS_CASTLE_SMALL_KEY_MAX;
break;
default:
break;
}

if ((item >= RG_FOREST_TEMPLE_SMALL_KEY) && (item <= RG_GANONS_CASTLE_SMALL_KEY)) {
Expand Down Expand Up @@ -3370,4 +3374,4 @@ extern "C" u16 Randomizer_Item_Give(PlayState* play, GetItemEntry giEntry) {
}

return Return_Item_Entry(giEntry, RG_NONE);
}
}
4 changes: 2 additions & 2 deletions soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -598,11 +598,11 @@ void DrawItemCount(ItemTrackerItem item, bool hideMax) {
ImGui::SetCursorScreenPos(
ImVec2(p.x + (iconSize / 2) - (ImGui::CalcTextSize((currentString + maxString).c_str()).x / 2), p.y - 14));
ImGui::PushStyleColor(ImGuiCol_Text, currentColor);
ImGui::Text(currentString.c_str());
ImGui::Text("%s", currentString.c_str());
ImGui::PopStyleColor();
ImGui::SameLine(0, 0.0f);
ImGui::PushStyleColor(ImGuiCol_Text, maxColor);
ImGui::Text(maxString.c_str());
ImGui::Text("%s", maxString.c_str());
ImGui::PopStyleColor();
} else {
ImGui::SetCursorScreenPos(ImVec2(p.x, p.y - 14));
Expand Down
6 changes: 3 additions & 3 deletions soh/soh/Enhancements/randomizer/savefile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void StartingItemGive(GetItemEntry getItemEntry) {
// Item_Give in z_parameter, we'll need to update Item_Give to ensure
// nothing breaks when calling it without a valid play first
void GiveLinkRupees(int numOfRupees) {
int maxRupeeCount;
int maxRupeeCount = 0;
if (CUR_UPG_VALUE(UPG_WALLET) == 0) {
maxRupeeCount = 99;
} else if (CUR_UPG_VALUE(UPG_WALLET) == 1) {
Expand All @@ -52,7 +52,7 @@ void GiveLinkRupees(int numOfRupees) {
}

void GiveLinkDekuSticks(int howManySticks) {
int maxStickCount;
int maxStickCount = 0;
if (CUR_UPG_VALUE(UPG_STICKS) == 0) {
INV_CONTENT(ITEM_STICK) = ITEM_STICK;
Inventory_ChangeUpgrade(UPG_STICKS, 1);
Expand All @@ -73,7 +73,7 @@ void GiveLinkDekuSticks(int howManySticks) {
}

void GiveLinkDekuNuts(int howManyNuts) {
int maxNutCount;
int maxNutCount = 0;
if (CUR_UPG_VALUE(UPG_NUTS) == 0) {
INV_CONTENT(ITEM_NUT) = ITEM_NUT;
Inventory_ChangeUpgrade(UPG_NUTS, 1);
Expand Down
2 changes: 2 additions & 0 deletions soh/soh/Enhancements/timesaver_hook_handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,8 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_li
}
break;
}
default:
break;
}

va_end(args);
Expand Down
Loading

0 comments on commit ec1f03e

Please sign in to comment.