Summary: | Number of enemy balls is always one no matter what it is set to | ||
---|---|---|---|
Product: | [Unmaintained] ksnake | Reporter: | mgutowski04 |
Component: | general | Assignee: | Andrew Chant <andrew.chant> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: | simple rewrite of Rattler::setBalls |
Description
mgutowski04
2005-09-02 02:03:56 UTC
The original bug report was inaccurate. You must exit and restart the game for the changed number of balls to take effect. This is not the case for the number of enemy snakes. Created attachment 14248 [details]
simple rewrite of Rattler::setBalls
Attached patch is just a rewrite of Rattler::setBalls to work more like
Rattler::setComputerSnakes.
I've done some minimal testing, and it seems to work fine.
Sorry, the patch is for 3.5 branch (I haven't got a KDE4 install working yet). SVN commit 499007 by aacid: Apply a patch to fix bug 111916 inspired in one by Henry Malthus. I've applied mine becasue changes the code less heaviliy. Thanks for reporting BUGS: 111916 M +7 -9 rattler.cpp --- branches/KDE/3.5/kdegames/ksnake/rattler.cpp #499006:499007 @@ -589,25 +589,23 @@ } } -void Rattler::setBalls(int numBalls) +void Rattler::setBalls(int newNumBalls) { - int count = balls->count(); + numBalls = balls->count(); - if (!gameState.testBit(Playing) || - !gameState.testBit(Demo) || - numBalls == count) + if (!(gameState.testBit(Playing) || gameState.testBit(Demo)) || numBalls == newNumBalls) return; - while ( numBalls > count) { + while ( newNumBalls > numBalls) { Ball *b = new Ball(board, pix); balls->append(b); - numBalls--; + numBalls++; } - while (numBalls < count) { + while (newNumBalls < numBalls) { Ball *b = balls->getLast(); b->zero(); balls->removeLast(); - numBalls++; + numBalls--; } } |