mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-08 01:53:52 +00:00
fix(render): code quality cleanup
Magic number elimination: - Create protocol_constants.hpp, warden_constants.hpp, render_constants.hpp, ui_constants.hpp - Replace ~55 magic numbers across game_handler, warden_handler, m2_renderer_render Reduce nesting depth: - Extract 5 parseEffect* methods from handleSpellLogExecute (max indent 52 → 16 cols) - Extract resolveSpellSchool/playSpellCastSound/playSpellImpactSound from 3× duplicate audio blocks in handleSpellGo - Flatten SMSG_INVENTORY_CHANGE_FAILURE with early-return guards - Extract drawScreenEdgeVignette() for 3 duplicate vignette blocks DRY extract patterns: - Replace 12 compound expansion checks with isPreWotlk() across movement_handler (9), chat_handler (1), social_handler (1) const to constexpr: - Promote 23+ static const arrays/scalars to static constexpr across 12 source files Error handling: - Convert PIN auth from exceptions to std::optional<PinProof> - Add [[nodiscard]] to 15+ initialize/parse methods - Wrap ~20 unchecked initialize() calls with LOG_WARNING/LOG_ERROR Signed-off-by: Pavel Okhlopkov <pavel.okhlopkov@flant.com>
This commit is contained in:
parent
2e8856bacd
commit
97106bd6ae
41 changed files with 849 additions and 424 deletions
|
|
@ -265,16 +265,15 @@ void AuthHandler::sendLogonProof() {
|
|||
const std::array<uint8_t, 20>* crcHashPtr = nullptr;
|
||||
|
||||
if (securityFlags_ & kSecurityFlagPin) {
|
||||
try {
|
||||
PinProof proof = computePinProof(pendingSecurityCode_, pinGridSeed_, pinServerSalt_);
|
||||
pinClientSalt = proof.clientSalt;
|
||||
pinHash = proof.hash;
|
||||
pinClientSaltPtr = &pinClientSalt;
|
||||
pinHashPtr = &pinHash;
|
||||
} catch (const std::exception& e) {
|
||||
fail(std::string("PIN required but invalid: ") + e.what());
|
||||
auto proof = computePinProof(pendingSecurityCode_, pinGridSeed_, pinServerSalt_);
|
||||
if (!proof) {
|
||||
fail("PIN required but invalid input");
|
||||
return;
|
||||
}
|
||||
pinClientSalt = proof->clientSalt;
|
||||
pinHash = proof->hash;
|
||||
pinClientSaltPtr = &pinClientSalt;
|
||||
pinHashPtr = &pinHash;
|
||||
}
|
||||
|
||||
// Legacy client integrity hash (aka "CRC hash"). Some servers enforce this for classic builds.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue