Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Commit

Permalink
Fix issue with converting uint32_t to int32_t in message params
Browse files Browse the repository at this point in the history
  • Loading branch information
Hammie committed Mar 5, 2022
1 parent 4bdc11f commit a0d53db
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/libs/battle_interface/src/log_and_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ bool ILogAndActions::Init()
}
D3DVIEWPORT9 vp;
rs->GetViewport(&vp);
core.Event("SetWindowSize", "lll", static_cast<uint32_t>(vp.Width), static_cast<uint32_t>(vp.Height), false);
core.Event("SetWindowSize", "lll", static_cast<int32_t>(vp.Width), static_cast<int32_t>(vp.Height), false);
g_ILogAndActions = GetId();
return true;
}
Expand Down
7 changes: 7 additions & 0 deletions src/libs/common/include/message.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ inline MessageParam convertMessageParam(const bool value)
return {value ? 1 : 0};
}

// Convert uint32_t to int32_t to prevent conversion issues
template<>
inline MessageParam convertMessageParam(const uint32_t value)
{
return MessageParam(static_cast<int32_t>(value));
}

} // namespace detail

} // namespace storm
Expand Down

0 comments on commit a0d53db

Please sign in to comment.