mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
Upgrade to C++20 and fix all compilation warnings
- Upgrade from C++17 to C++20 - Remove unused helper functions (selectSpawnPreset, parseVec3Csv, parseYawPitchCsv) - Mark unused parameters with [[maybe_unused]] attribute - Remove unused variables (nameColor, currentRace, steppingUp, steppingDown, awayFromWallMotion) - Fix all -Wunused-* warnings Build now completes with zero warnings.
This commit is contained in:
parent
352d179aaa
commit
545cfbbc0e
10 changed files with 7 additions and 72 deletions
|
|
@ -1,7 +1,7 @@
|
|||
cmake_minimum_required(VERSION 3.15)
|
||||
project(wowee VERSION 1.0.0 LANGUAGES CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ std::vector<uint8_t> BigNum::toArray(bool littleEndian, int minSize) const {
|
|||
}
|
||||
|
||||
std::vector<uint8_t> bytes(size, 0);
|
||||
int actualSize = BN_bn2bin(bn, bytes.data() + (size - BN_num_bytes(bn)));
|
||||
[[maybe_unused]] int actualSize = BN_bn2bin(bn, bytes.data() + (size - BN_num_bytes(bn)));
|
||||
|
||||
if (littleEndian) {
|
||||
std::reverse(bytes.begin(), bytes.end());
|
||||
|
|
|
|||
|
|
@ -46,29 +46,6 @@
|
|||
namespace wowee {
|
||||
namespace core {
|
||||
|
||||
namespace {
|
||||
|
||||
const SpawnPreset* selectSpawnPreset(const char* envValue) {
|
||||
// Return nullptr if no preset specified - use saved character position
|
||||
if (!envValue || !*envValue) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::string key = envValue;
|
||||
std::transform(key.begin(), key.end(), key.begin(), [](unsigned char c) {
|
||||
return static_cast<char>(std::tolower(c));
|
||||
});
|
||||
|
||||
for (int i = 0; i < SPAWN_PRESET_COUNT; i++) {
|
||||
if (key == SPAWN_PRESETS[i].key) return &SPAWN_PRESETS[i];
|
||||
}
|
||||
|
||||
LOG_WARNING("Unknown WOW_SPAWN='", key, "', falling back to goldshire");
|
||||
LOG_INFO("Available WOW_SPAWN presets: goldshire, stormwind, sw_plaza, ironforge, westfall");
|
||||
return &SPAWN_PRESETS[0];
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
const char* Application::mapIdToName(uint32_t mapId) {
|
||||
switch (mapId) {
|
||||
|
|
@ -84,37 +61,6 @@ std::string Application::getPlayerModelPath() const {
|
|||
return game::getPlayerModelPath(playerRace_, playerGender_);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
std::optional<glm::vec3> parseVec3Csv(const char* raw) {
|
||||
if (!raw || !*raw) return std::nullopt;
|
||||
std::stringstream ss(raw);
|
||||
std::string part;
|
||||
float vals[3];
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (!std::getline(ss, part, ',')) return std::nullopt;
|
||||
try {
|
||||
vals[i] = std::stof(part);
|
||||
} catch (...) {
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
return glm::vec3(vals[0], vals[1], vals[2]);
|
||||
}
|
||||
|
||||
std::optional<std::pair<float, float>> parseYawPitchCsv(const char* raw) {
|
||||
if (!raw || !*raw) return std::nullopt;
|
||||
std::stringstream ss(raw);
|
||||
std::string part;
|
||||
float yaw = 0.0f, pitch = 0.0f;
|
||||
if (!std::getline(ss, part, ',')) return std::nullopt;
|
||||
try { yaw = std::stof(part); } catch (...) { return std::nullopt; }
|
||||
if (!std::getline(ss, part, ',')) return std::nullopt;
|
||||
try { pitch = std::stof(part); } catch (...) { return std::nullopt; }
|
||||
return std::make_pair(yaw, pitch);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Application* Application::instance = nullptr;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
namespace wowee {
|
||||
namespace game {
|
||||
|
||||
void World::update(float deltaTime) {
|
||||
void World::update([[maybe_unused]] float deltaTime) {
|
||||
// TODO: Update world state
|
||||
}
|
||||
|
||||
void World::loadMap(uint32_t mapId) {
|
||||
void World::loadMap([[maybe_unused]] uint32_t mapId) {
|
||||
// TODO: Load map data
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include "core/logger.hpp"
|
||||
#include <exception>
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
int main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[]) {
|
||||
try {
|
||||
wowee::core::Logger::getInstance().setLogLevel(wowee::core::LogLevel::DEBUG);
|
||||
LOG_INFO("=== Wowee Native Client ===");
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ ChunkMesh TerrainMeshGenerator::generateChunkMesh(const MapChunk& chunk, int chu
|
|||
return mesh;
|
||||
}
|
||||
|
||||
std::vector<TerrainVertex> TerrainMeshGenerator::generateVertices(const MapChunk& chunk, int chunkX, int chunkY, int tileX, int tileY) {
|
||||
std::vector<TerrainVertex> TerrainMeshGenerator::generateVertices(const MapChunk& chunk, [[maybe_unused]] int chunkX, [[maybe_unused]] int chunkY, [[maybe_unused]] int tileX, [[maybe_unused]] int tileY) {
|
||||
std::vector<TerrainVertex> vertices;
|
||||
vertices.reserve(145); // 145 vertices total
|
||||
|
||||
|
|
|
|||
|
|
@ -1552,11 +1552,6 @@ bool WMORenderer::checkWallCollision(const glm::vec3& from, const glm::vec3& to,
|
|||
glm::vec3 localFrom = glm::vec3(instance.invModelMatrix * glm::vec4(from, 1.0f));
|
||||
glm::vec3 localTo = glm::vec3(instance.invModelMatrix * glm::vec4(to, 1.0f));
|
||||
float localFeetZ = localTo.z;
|
||||
// Use a tiny Z threshold so ramp-side logic still triggers with
|
||||
// smoothed ground snapping and small per-step vertical deltas.
|
||||
bool steppingUp = (localTo.z > localFrom.z + 0.005f);
|
||||
bool steppingDown = (localTo.z < localFrom.z - 0.005f);
|
||||
|
||||
for (const auto& group : model.groups) {
|
||||
// Quick bounding box check
|
||||
float margin = PLAYER_RADIUS + 2.0f;
|
||||
|
|
@ -1592,7 +1587,6 @@ bool WMORenderer::checkWallCollision(const glm::vec3& from, const glm::vec3& to,
|
|||
float fromDist = glm::dot(localFrom - v0, normal);
|
||||
float toDist = glm::dot(localTo - v0, normal);
|
||||
bool towardWallMotion = (std::abs(toDist) + 1e-4f < std::abs(fromDist));
|
||||
bool awayFromWallMotion = !towardWallMotion;
|
||||
|
||||
// Only collide with walls in player's vertical range
|
||||
if (triMaxZ < localFeetZ + 0.3f) continue;
|
||||
|
|
|
|||
|
|
@ -369,7 +369,6 @@ void CharacterCreateScreen::render(game::GameHandler& /*gameHandler*/) {
|
|||
|
||||
// Appearance sliders
|
||||
updateAppearanceRanges();
|
||||
game::Race currentRace = allRaces[raceIndex];
|
||||
game::Gender currentGender = static_cast<game::Gender>(genderIndex);
|
||||
|
||||
ImGui::Text("Appearance");
|
||||
|
|
|
|||
|
|
@ -1834,10 +1834,6 @@ void GameScreen::renderPartyFrames(game::GameHandler& gameHandler) {
|
|||
for (const auto& member : partyData.members) {
|
||||
ImGui::PushID(static_cast<int>(member.guid));
|
||||
|
||||
ImVec4 nameColor = member.isOnline ?
|
||||
ImVec4(0.3f, 0.8f, 1.0f, 1.0f) :
|
||||
ImVec4(0.5f, 0.5f, 0.5f, 1.0f);
|
||||
|
||||
// Clickable name to target
|
||||
if (ImGui::Selectable(member.name.c_str(), gameHandler.getTargetGuid() == member.guid)) {
|
||||
gameHandler.setTarget(member.guid);
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ void UIManager::shutdown() {
|
|||
LOG_INFO("UI manager shutdown");
|
||||
}
|
||||
|
||||
void UIManager::update(float deltaTime) {
|
||||
void UIManager::update([[maybe_unused]] float deltaTime) {
|
||||
if (!imguiInitialized) return;
|
||||
|
||||
// Start ImGui frame
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue