diff --git a/Source/levels/gendung.cpp b/Source/levels/gendung.cpp index b2294cc4cfd..6faf76ef0a9 100644 --- a/Source/levels/gendung.cpp +++ b/Source/levels/gendung.cpp @@ -547,7 +547,7 @@ void LoadTransparency(const uint16_t *dunData) for (WorldTileCoord j = 0; j < size.height; j++) { for (WorldTileCoord i = 0; i < size.width; i++) { - dTransVal[16 + i][16 + j] = SDL_SwapLE16(*transparentLayer); + dTransVal[16 + i][16 + j] = static_cast(SDL_SwapLE16(*transparentLayer)); transparentLayer++; } } diff --git a/Source/options.cpp b/Source/options.cpp index 467474366db..396e06bcc32 100644 --- a/Source/options.cpp +++ b/Source/options.cpp @@ -162,7 +162,7 @@ float GetIniFloat(const char *sectionName, const char *keyName, float defaultVal return (float)GetIni().GetDoubleValue(sectionName, keyName, defaultValue); } -bool GetIniValue(std::string_view sectionName, std::string_view keyName, char *string, int stringSize, const char *defaultString = "") +bool GetIniValue(std::string_view sectionName, std::string_view keyName, char *string, size_t stringSize, const char *defaultString = "") { std::string sectionNameStr { sectionName }; std::string keyNameStr { keyName }; @@ -941,7 +941,7 @@ std::string_view OptionEntryAudioDevice::GetDeviceName(size_t index) const { #if SDL_VERSION_ATLEAST(2, 0, 0) if (index != 0) - return SDL_GetAudioDeviceName(index - 1, false); + return SDL_GetAudioDeviceName(static_cast(index) - 1, false); #endif return ""; } diff --git a/Source/panels/charpanel.cpp b/Source/panels/charpanel.cpp index e726475775d..10c3e513963 100644 --- a/Source/panels/charpanel.cpp +++ b/Source/panels/charpanel.cpp @@ -242,7 +242,7 @@ void DrawShadowString(const Surface &out, const PanelEntry &entry) // If the text is less tall than the field, we center it vertically relative to the field. // Otherwise, we draw from the top of the field. - const int textHeight = (c_count(wrapped, '\n') + 1) * GetLineHeight(wrapped, GameFont12); + const int textHeight = static_cast((c_count(wrapped, '\n') + 1) * GetLineHeight(wrapped, GameFont12)); const int labelHeight = std::max(PanelFieldHeight, textHeight); DrawString(out, text, { labelPosition + Displacement { -2, 2 }, { entry.labelLength, labelHeight } }, diff --git a/Source/panels/console.cpp b/Source/panels/console.cpp index 32b44657d2f..3d7e414f82c 100644 --- a/Source/panels/console.cpp +++ b/Source/panels/console.cpp @@ -321,7 +321,7 @@ const ConsoleLine &GetConsoleLineFromEnd(int index) void SetHistoryIndex(int index) { CurrentInputTextState = InputTextState::RestoredFromHistory; - HistoryIndex = std::ssize(ConsoleLines) - (index + 1); + HistoryIndex = static_cast(std::ssize(ConsoleLines)) - (index + 1); if (HistoryIndex == -1) { ConsoleInputState.assign(DraftInput); return; @@ -335,7 +335,7 @@ void PrevHistoryItem(tl::function_ref filter) if (HistoryIndex == -1) { DraftInput = ConsoleInputState.value(); } - const int n = std::ssize(ConsoleLines); + const int n = static_cast(std::ssize(ConsoleLines)); for (int i = HistoryIndex + 1; i < n; ++i) { const int index = n - (i + 1); if (filter(ConsoleLines[index])) { @@ -347,7 +347,7 @@ void PrevHistoryItem(tl::function_ref filter) void NextHistoryItem(tl::function_ref filter) { - const int n = std::ssize(ConsoleLines); + const int n = static_cast(std::ssize(ConsoleLines)); for (int i = n - HistoryIndex; i < n; ++i) { if (filter(ConsoleLines[i])) { SetHistoryIndex(i); diff --git a/Source/plrmsg.cpp b/Source/plrmsg.cpp index df79e0a0110..a1facb39ffb 100644 --- a/Source/plrmsg.cpp +++ b/Source/plrmsg.cpp @@ -40,7 +40,7 @@ std::array Messages; int CountLinesOfText(std::string_view text) { - return 1 + c_count(text, '\n'); + return static_cast(1 + c_count(text, '\n')); } PlayerMessage &GetNextMessage() diff --git a/Source/qol/autopickup.cpp b/Source/qol/autopickup.cpp index 4b204c267b1..f86bf60076e 100644 --- a/Source/qol/autopickup.cpp +++ b/Source/qol/autopickup.cpp @@ -103,7 +103,7 @@ void AutoPickup(const Player &player) int itemIndex = dItem[tile.x][tile.y] - 1; auto &item = Items[itemIndex]; if (DoPickup(item)) { - NetSendCmdGItem(true, CMD_REQUESTAGITEM, player.getId(), itemIndex); + NetSendCmdGItem(true, CMD_REQUESTAGITEM, static_cast(player.getId()), itemIndex); item._iRequest = true; } } diff --git a/Source/track.cpp b/Source/track.cpp index f139d577fb8..bc7403926eb 100644 --- a/Source/track.cpp +++ b/Source/track.cpp @@ -92,7 +92,7 @@ void RepeatMouseAction() break; case MouseActionType::AttackPlayerTarget: if (PlayerUnderCursor != nullptr && !myPlayer.friendlyMode) - NetSendCmdParam1(true, rangedAttack ? CMD_RATTACKPID : CMD_ATTACKPID, PlayerUnderCursor->getId()); + NetSendCmdParam1(true, rangedAttack ? CMD_RATTACKPID : CMD_ATTACKPID, static_cast(PlayerUnderCursor->getId())); break; case MouseActionType::Spell: if (ControlMode != ControlTypes::KeyboardAndMouse) {