refactor: remaining C-style casts, color constants, and header guard cleanup

Replace ~37 remaining C-style casts with static_cast across 16 files.
Extract named color constants (kColorRed/Green/Yellow/Gray) and dialog
window flags (kDialogFlags) in game_screen.cpp, replacing 72 inline
literals. Normalize keybinding_manager.hpp to #pragma once.
This commit is contained in:
Kelsi 2026-03-25 11:57:22 -07:00
parent 05f2bedf88
commit ba99d505dd
18 changed files with 120 additions and 114 deletions

View file

@ -536,9 +536,9 @@ bool CharacterPreview::loadCharacter(game::Race race, game::Gender gender,
modelLoaded_ = true;
LOG_INFO("CharacterPreview: loaded ", m2Path,
" skin=", (int)skin, " face=", (int)face,
" hair=", (int)hairStyle, " hairColor=", (int)hairColor,
" facial=", (int)facialHair);
" skin=", static_cast<int>(skin), " face=", static_cast<int>(face),
" hair=", static_cast<int>(hairStyle), " hairColor=", static_cast<int>(hairColor),
" facial=", static_cast<int>(facialHair));
return true;
}

View file

@ -554,8 +554,8 @@ CharacterRenderer::NormalMapResult CharacterRenderer::generateNormalHeightMapCPU
// Step 1.5: Box blur the height map to reduce noise from diffuse textures
auto wrapSample = [&](const std::vector<float>& map, int x, int y) -> float {
x = ((x % (int)width) + (int)width) % (int)width;
y = ((y % (int)height) + (int)height) % (int)height;
x = ((x % static_cast<int>(width)) + static_cast<int>(width)) % static_cast<int>(width);
y = ((y % static_cast<int>(height)) + static_cast<int>(height)) % static_cast<int>(height);
return map[y * width + x];
};
@ -576,8 +576,8 @@ CharacterRenderer::NormalMapResult CharacterRenderer::generateNormalHeightMapCPU
result.pixels.resize(totalPixels * 4);
auto sampleH = [&](int x, int y) -> float {
x = ((x % (int)width) + (int)width) % (int)width;
y = ((y % (int)height) + (int)height) % (int)height;
x = ((x % static_cast<int>(width)) + static_cast<int>(width)) % static_cast<int>(width);
y = ((y % static_cast<int>(height)) + static_cast<int>(height)) % static_cast<int>(height);
return heightMap[y * width + x];
};

View file

@ -1657,7 +1657,7 @@ VkCommandBuffer VkContext::beginFrame(uint32_t& imageIndex) {
return VK_NULL_HANDLE;
}
if (fenceResult != VK_SUCCESS) {
LOG_ERROR("beginFrame[", beginFrameCounter, "] fence wait failed: ", (int)fenceResult);
LOG_ERROR("beginFrame[", beginFrameCounter, "] fence wait failed: ", static_cast<int>(fenceResult));
if (fenceResult == VK_ERROR_DEVICE_LOST) {
deviceLost_ = true;
}
@ -1698,7 +1698,7 @@ void VkContext::endFrame(VkCommandBuffer cmd, uint32_t imageIndex) {
VkResult endResult = vkEndCommandBuffer(cmd);
if (endResult != VK_SUCCESS) {
LOG_ERROR("endFrame[", endFrameCounter, "] vkEndCommandBuffer FAILED: ", (int)endResult);
LOG_ERROR("endFrame[", endFrameCounter, "] vkEndCommandBuffer FAILED: ", static_cast<int>(endResult));
}
auto& frame = frames[currentFrame];
@ -1717,7 +1717,7 @@ void VkContext::endFrame(VkCommandBuffer cmd, uint32_t imageIndex) {
VkResult submitResult = vkQueueSubmit(graphicsQueue, 1, &submitInfo, frame.inFlightFence);
if (submitResult != VK_SUCCESS) {
LOG_ERROR("endFrame[", endFrameCounter, "] vkQueueSubmit FAILED: ", (int)submitResult);
LOG_ERROR("endFrame[", endFrameCounter, "] vkQueueSubmit FAILED: ", static_cast<int>(submitResult));
if (submitResult == VK_ERROR_DEVICE_LOST) {
deviceLost_ = true;
}

View file

@ -1002,7 +1002,7 @@ void WaterRenderer::loadFromWMO([[maybe_unused]] const pipeline::WMOLiquid& liqu
}
}
LOG_DEBUG("WMO water: origin=(", surface.origin.x, ",", surface.origin.y, ",", surface.origin.z,
") tiles=", (int)surface.width, "x", (int)surface.height,
") tiles=", static_cast<int>(surface.width), "x", static_cast<int>(surface.height),
" active=", activeTiles, "/", tileCount,
" wmoId=", wmoId, " indexCount=", surface.indexCount,
" bounds x=[", minWX, "..", maxWX, "] y=[", minWY, "..", maxWY, "]");

View file

@ -2177,8 +2177,8 @@ std::unique_ptr<VkTexture> WMORenderer::generateNormalHeightMap(
// Step 1.5: Box blur the height map to reduce noise from diffuse textures
auto wrapSample = [&](const std::vector<float>& map, int x, int y) -> float {
x = ((x % (int)width) + (int)width) % (int)width;
y = ((y % (int)height) + (int)height) % (int)height;
x = ((x % static_cast<int>(width)) + static_cast<int>(width)) % static_cast<int>(width);
y = ((y % static_cast<int>(height)) + static_cast<int>(height)) % static_cast<int>(height);
return map[y * width + x];
};
@ -2200,8 +2200,8 @@ std::unique_ptr<VkTexture> WMORenderer::generateNormalHeightMap(
std::vector<uint8_t> output(totalPixels * 4);
auto sampleH = [&](int x, int y) -> float {
x = ((x % (int)width) + (int)width) % (int)width;
y = ((y % (int)height) + (int)height) % (int)height;
x = ((x % static_cast<int>(width)) + static_cast<int>(width)) % static_cast<int>(width);
y = ((y % static_cast<int>(height)) + static_cast<int>(height)) % static_cast<int>(height);
return heightMap[y * width + x];
};