mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
Fix real bugs found by clang-tidy
- game_handler.cpp: use-after-move on node.id after std::move(node) (save nodeId before the move) - tcp_socket.cpp, world_socket.cpp: virtual call in destructor bypasses dispatch; use qualified TCPSocket::disconnect() / WorldSocket::disconnect() to make intent explicit - wmo_renderer.cpp: float loop counters risk precision drift; replace with integer step counts and reconstruct float from index - game_screen.cpp: (float + 0.5) cast to int is incorrect rounding; use std::lround instead
This commit is contained in:
parent
ba3d569e5f
commit
eacecddfb0
5 changed files with 13 additions and 8 deletions
|
|
@ -9513,10 +9513,11 @@ void GameHandler::loadTaxiDbc() {
|
|||
node.mountDisplayIdHorde = nodesDbc->getUInt32(i, mountHordeFB);
|
||||
}
|
||||
}
|
||||
if (node.id > 0) {
|
||||
taxiNodes_[node.id] = std::move(node);
|
||||
uint32_t nodeId = node.id;
|
||||
if (nodeId > 0) {
|
||||
taxiNodes_[nodeId] = std::move(node);
|
||||
}
|
||||
if (node.id == 195) {
|
||||
if (nodeId == 195) {
|
||||
std::string fields;
|
||||
for (uint32_t f = 0; f < fieldCount; f++) {
|
||||
fields += std::to_string(f) + ":" + std::to_string(nodesDbc->getUInt32(i, f)) + " ";
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ TCPSocket::TCPSocket() {
|
|||
}
|
||||
|
||||
TCPSocket::~TCPSocket() {
|
||||
disconnect();
|
||||
TCPSocket::disconnect(); // qualified call: virtual dispatch is bypassed in destructors
|
||||
}
|
||||
|
||||
bool TCPSocket::connect(const std::string& host, uint16_t port) {
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ WorldSocket::WorldSocket() {
|
|||
}
|
||||
|
||||
WorldSocket::~WorldSocket() {
|
||||
disconnect();
|
||||
WorldSocket::disconnect(); // qualified call: virtual dispatch is bypassed in destructors
|
||||
}
|
||||
|
||||
bool WorldSocket::connect(const std::string& host, uint16_t port) {
|
||||
|
|
|
|||
|
|
@ -890,8 +890,12 @@ void WMORenderer::precomputeFloorCache() {
|
|||
float startX = std::floor(boundsMin.x / FLOOR_GRID_CELL_SIZE) * FLOOR_GRID_CELL_SIZE;
|
||||
float startY = std::floor(boundsMin.y / FLOOR_GRID_CELL_SIZE) * FLOOR_GRID_CELL_SIZE;
|
||||
|
||||
for (float x = startX; x <= boundsMax.x; x += FLOOR_GRID_CELL_SIZE) {
|
||||
for (float y = startY; y <= boundsMax.y; y += FLOOR_GRID_CELL_SIZE) {
|
||||
int stepsX = static_cast<int>((boundsMax.x - startX) / FLOOR_GRID_CELL_SIZE) + 1;
|
||||
int stepsY = static_cast<int>((boundsMax.y - startY) / FLOOR_GRID_CELL_SIZE) + 1;
|
||||
for (int ix = 0; ix < stepsX; ++ix) {
|
||||
float x = startX + ix * FLOOR_GRID_CELL_SIZE;
|
||||
for (int iy = 0; iy < stepsY; ++iy) {
|
||||
float y = startY + iy * FLOOR_GRID_CELL_SIZE;
|
||||
// Sample at grid cell center
|
||||
float sampleX = x + FLOOR_GRID_CELL_SIZE * 0.5f;
|
||||
float sampleY = y + FLOOR_GRID_CELL_SIZE * 0.5f;
|
||||
|
|
|
|||
|
|
@ -5462,7 +5462,7 @@ void GameScreen::renderSettingsWindow() {
|
|||
break;
|
||||
}
|
||||
}
|
||||
pendingUiOpacity = static_cast<int>(uiOpacity_ * 100.0f + 0.5f);
|
||||
pendingUiOpacity = static_cast<int>(std::lround(uiOpacity_ * 100.0f));
|
||||
pendingMinimapRotate = minimapRotate_;
|
||||
pendingMinimapSquare = minimapSquare_;
|
||||
if (renderer) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue