Getting rid of macros and dead code:
ClosedPublic

Authored by fabiank on Mar 30 2018, 6:53 PM.

Details

Summary

fix: do a comparision in Q_ASSERT, not an assignment

Diff Detail

Repository
R410 KPatience
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
fabiank created this revision.Mar 30 2018, 6:53 PM
Restricted Application added a reviewer: KDE Games. · View Herald TranscriptMar 30 2018, 6:53 PM
Restricted Application added a subscriber: KDE Games. · View Herald Transcript
fabiank requested review of this revision.Mar 30 2018, 6:53 PM
In the same vein as #D11779, this is meant to modernize and clean up to make the code base more maintainable.
aacid added a subscriber: aacid.Apr 1 2018, 6:25 PM
aacid added inline comments.
libkcardgame/kcardscene.cpp
1253

This seems like something you would want to keep? (if it compiles)

patsolve/idiotsolver.cpp
299

Are you really sure about this? This changes the assert totally

fabiank added inline comments.Apr 1 2018, 6:33 PM
libkcardgame/kcardscene.cpp
1253

Well, it doesn't, because multRectSize doesn't exist anymore since efb0f40b7b16fb70d32cecd91dd8d4d9decd61c5. Though, restoring that function (and wrapping it in #if DEBUG_LAYOUT) is of course also an alternative.

patsolve/idiotsolver.cpp
299

Indeed it does, and for the better I'd say ;-). Before it was an assignment to Wp[i], if and only if asserts were active. The only reason why this assignment didn't cause any issues was that lhs and rhs of the assignment should be the same, as we assert now.

Wp[i] == &W[i][Wlen[i] - 1] is actually an invariant through much of the code base, except when it is temporarily broken when moving cards around (and replacing Wp, Wlen, W and related variables is one of the refactorings I've planned at a later point).

This revision is now accepted and ready to land.Apr 23 2018, 8:28 PM
This revision was automatically updated to reflect the committed changes.