Bug 35319

Summary: unable to click bottom right corner
Product: [Applications] knavalbattle Reporter: Graf Zahl <graf.zahl>
Component: generalAssignee: Nikolas Zimmermann <wildfox>
Status: RESOLVED FIXED    
Severity: normal CC: maksim
Priority: NOR    
Version: 1.0   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Graf Zahl 2001-11-24 19:47:21 UTC
(*** This bug was imported into bugs.kde.org ***)

Package:           kbattleship
Version:           1.0 (using KDE 2.2.1 )
Severity:          normal
Installed from:    SuSE RPMs
Compiler:          gcc version 2.95.3 20010315 (SuSE)
OS:                Linux
OS/Compiler notes: kbattleship came precompiled with SuSE distribution

When playing kbattleship (single or multiplayer) I *sometimes* can't click (i.e. shoot) the bottom right corner of the enemy's battlefield. I wasn't able to make out when it works and when it doesn't. It seems to work if the very first shot in a game is placed in the bottom right. If it's the second or later shot it works sometimes other times nothing at all happens or the "shot" appears in the bottom left or top right corner.

(Submitted via bugs.kde.org)
Comment 1 Jim Bob 2003-04-05 02:39:20 UTC
I have a similar problem with the KBattleship included in Debian/KDE 3.1
(packaged by kde.org) on both x86 and PowerPC. Sometimes clicks aren't
acknowledged (ie, no shot is made). As far as I can tell, battleship always
works properly if the pointer stays within the grid as you move it to its
destination (ie the place where you shoot). If the pointer moves from outside
the grid and directly onto the destination, then it might not work. The cell in
the lower-right corner is the most onerous.
Comment 2 Maksim Orlovich 2003-06-13 06:05:55 UTC
Subject: kdegames/kbattleship/kbattleship

CVS commit by orlovich: 

Fix nonsense field geometry calculations that worked by a miracle and caused the
end of the last row and column to be excluded from event handling (#35319)
CCMAIL:35319-done@bugs.kde.org


  M +2 -2      kbattlefield.cpp   1.52


--- kdegames/kbattleship/kbattleship/kbattlefield.cpp  #1.51:1.52
@@ -227,9 +227,9 @@ int KBattleField::rectX()
 QRect KBattleField::ownRect()
 {
-        return QRect(ownXPosition(), ownYPosition(), ownXPosition() + ((m_ownfieldx - 1) * gridSize()), ownYPosition() + ((m_ownfieldy - 1) * gridSize()));
+        return QRect(ownXPosition(), ownYPosition(), m_ownfieldx * gridSize(), m_ownfieldy * gridSize());
 }
 
 QRect KBattleField::enemyRect()
 {
-        return QRect(enemyXPosition(), enemyYPosition(), rectX() + ((m_enemyfieldx - 1) * gridSize()), enemyYPosition() + ((m_enemyfieldy - 1) * gridSize()));
+        return QRect(enemyXPosition(), enemyYPosition(), m_enemyfieldx * gridSize(), m_enemyfieldy * gridSize());
 }