Fix some warnings from Kapman

Review Request #120072 - Created Sept. 5, 2014 and submitted - Latest diff uploaded

Information
Martin Walch
kapman
master
Reviewers
Kdegames

Sorry for corrupted diff for download. Reviewboard is messing up (see http://code.google.com/p/reviewboard/issues/detail?id=2812). The applied diff in "View diff" seems to be ok.

These are three commits, but for reviewboard, I merged them into one:

  • Make single parameter constructors explicit

krazy2 complained:

Check for C++ ctors that should be declared 'explicit' [explicit]...
OOPS! 7 issues found!

gameview.h: line# 40 (1)
ghostitem.h: line# 43 (1)
characteritem.h: line# 47 (1)
kapmanparser.h: line# 47 (1)
kapmanitem.h: line# 55 (1)
gamescene.h: line# 83 (1)
elementitem.h: line# 47 (1)

Fix it by making them explicit.

This is a minor change in a public API and I guess it could potentially
break code that uses those constructors implicitely, but as Kapman
compiles fine, there seems not to be any such code in Kapman itself
and I doubt that there is any other project that uses classes of Kapman.

  • Fix doxygen for void setRotationFlag(bool rotate) in kapmanitem.h

It accidentally read

@param 0 or 1

instead of

@param rotate 0 or 1

Trivial fix. Silences two warnings from doxygen log.

  • Fix gcc warning -Wunused-but-set-variable: remove bool halfTurnRequired

gcc reported this warning:
ghost.cpp: In member function 'virtual void Ghost::updateMove()':
ghost.cpp:71:7: warning: variable 'halfTurnRequired' set but not
used [-Wunused-but-set-variable]

This is due to a bool variable "halfTurnRequired" which has a value
assigned in five places, but is never read nor returned.

When looking through the commit history, this seems to have never been
in use at all. I guess in the first place it was meant to replace

if (directionsList.size() == 0) {

with

if (halfTurnRequired) {

but I do not think it is worth it. So, just remove it completely.

(Also fix a typo in a comment: turnning -> turning)

  • compiling
  • running the game
  • checking doxygen output for param "rotate" in KapmanItem class
Loading...