Hello community, here is the log from the commit of package knetwalk for openSUSE:Factory checked in at 2013-05-16 17:35:52 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/knetwalk (Old) and /work/SRC/openSUSE:Factory/.knetwalk.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "knetwalk" Changes: -------- --- /work/SRC/openSUSE:Factory/knetwalk/knetwalk.changes 2013-04-18 10:30:57.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.knetwalk.new/knetwalk.changes 2013-05-16 17:35:54.000000000 +0200 @@ -1,0 +2,8 @@ +Sat May 4 17:25:45 UTC 2013 - tittiatc...@gmail.com + +- Update to 4.10.3 + * Bugfix release + * See http://www.kde.org/announcements/announce-4.10.3.php + * resolves bnc#818500 + +------------------------------------------------------------------- Old: ---- knetwalk-4.10.2.tar.xz New: ---- knetwalk-4.10.3.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ knetwalk.spec ++++++ --- /var/tmp/diff_new_pack.omCiFT/_old 2013-05-16 17:35:55.000000000 +0200 +++ /var/tmp/diff_new_pack.omCiFT/_new 2013-05-16 17:35:55.000000000 +0200 @@ -23,7 +23,7 @@ License: GPL-2.0+ Group: Amusements/Games/Board/Puzzle Url: http://www.kde.org -Version: 4.10.2 +Version: 4.10.3 Release: 0 Source0: knetwalk-%{version}.tar.xz BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ knetwalk-4.10.2.tar.xz -> knetwalk-4.10.3.tar.xz ++++++ Files old/knetwalk-4.10.2/doc/index.cache.bz2 and new/knetwalk-4.10.3/doc/index.cache.bz2 differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knetwalk-4.10.2/src/abstractgrid.cpp new/knetwalk-4.10.3/src/abstractgrid.cpp --- old/knetwalk-4.10.2/src/abstractgrid.cpp 2013-03-01 08:14:21.000000000 +0100 +++ new/knetwalk-4.10.3/src/abstractgrid.cpp 2013-05-03 06:39:37.000000000 +0200 @@ -154,20 +154,45 @@ } m_minimumMoves = 0; - // shuffle all cells - for (uint i = 0; i < width*height; ++i) { - AbstractCell *cell = m_cells[i]; - Directions oldCables = cell->cables(); - - int rotation = rand() % 4; // 0..3 - for (int j = 0; j < rotation; ++j) { - // ratate every cable clockwise + const int shuffleLimit = cellCount() * minCellRatio; + QList<int> notShuffledCells; + for (int i = 0; i < cellCount(); ++i) + notShuffledCells.append(i); + + // select a random cell that is not yet shuffled + // rotate such that initial and final states are not same + // repeat above two steps until minimum moves equal to shuffle limit + while(m_minimumMoves < shuffleLimit) + { + // selecting a random index + int index = rand() % notShuffledCells.count(); + int cellNo = notShuffledCells[index]; + // removing the selected index so that it must not be used again + notShuffledCells.removeAt(index); + AbstractCell *cell = m_cells[cellNo]; + Directions dir = cell->cables(); + + // excludes None(Empty cell) + if (dir == None) { + continue; + } + // if straight line rotate once + // cant rotate twice(it will be back on its initial state) + else if ((dir == (Up | Down)) || (dir == (Left | Right))) { + m_minimumMoves += 1; cell->rotateClockwise(); } - - // excludes None and straight lines - if (oldCables != cell->cables()) { + // for every other case rotate 1..3 times + else { + int rotation = rand() % 3 + 1; // 1..3 + // cant rotate twice when m_minimumMoves == shuffleLimit - 1 + if (m_minimumMoves == shuffleLimit - 1 && rotation == 2){ + rotation = (rand() % 2)? 1 : 3; // 1 or 3 + } m_minimumMoves += (rotation == 3) ? 1 : rotation; + while(rotation--) { + cell->rotateClockwise(); + } } } @@ -210,10 +235,9 @@ // number of cells that aren't free int notFreeCells = 0; - // TODO:use a global constant instead of 10 / 8 - const int MinimumNumCells = cellCount() * 8 / 10; + const int minimumNumCells = cellCount() * minCellRatio; // retries until the minimum number of cells is big enough - while (notFreeCells < MinimumNumCells) { + while (notFreeCells < minimumNumCells) { QList<uint> list; list.append(server_index); if (rand() % 2) addRandomCable(list); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knetwalk-4.10.2/src/globals.h new/knetwalk-4.10.3/src/globals.h --- old/knetwalk-4.10.2/src/globals.h 2013-03-01 08:14:21.000000000 +0100 +++ new/knetwalk-4.10.3/src/globals.h 2013-05-03 06:39:37.000000000 +0200 @@ -31,6 +31,9 @@ const qreal BoardBorder = 0.04; const qreal OverlayBorder = 0.02; +// ratio of minimum filled cells to total cells +const qreal minCellRatio = 0.8; + // border of the computer and server sprites inside the cells const qreal CellForegroundBorder = 0.1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knetwalk-4.10.2/src/knetwalk.notifyrc new/knetwalk-4.10.3/src/knetwalk.notifyrc --- old/knetwalk-4.10.2/src/knetwalk.notifyrc 2013-03-01 08:14:21.000000000 +0100 +++ new/knetwalk-4.10.3/src/knetwalk.notifyrc 2013-05-03 06:39:35.000000000 +0200 @@ -20,6 +20,7 @@ Comment[kk]=KNetWalk ойыны Comment[km]=ល្បែង KNetWalk Comment[lv]=KNetWalk spēle +Comment[mr]=के-नेट-वॉक खेळ Comment[nb]=KNetWalk-spillet Comment[nds]=KNetWalk-Speel Comment[nl]=KNetWalk-spel -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org