Hello community,

here is the log from the commit of package knavalbattle for openSUSE:Factory 
checked in at 2013-07-08 07:29:12
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/knavalbattle (Old)
 and      /work/SRC/openSUSE:Factory/.knavalbattle.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "knavalbattle"

Changes:
--------
--- /work/SRC/openSUSE:Factory/knavalbattle/knavalbattle.changes        
2013-06-11 09:32:31.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.knavalbattle.new/knavalbattle.changes   
2013-07-08 07:29:14.000000000 +0200
@@ -1,0 +2,14 @@
+Thu Jun 27 18:49:05 UTC 2013 - [email protected]
+
+- Update to 4.10.90
+   * KDE 4.11 Beta 1 release
+   * See http://www.kde.org/announcements/announce-4.11-beta2.php
+
+-------------------------------------------------------------------
+Thu Jun 13 20:50:59 UTC 2013 - [email protected]
+
+- Update to 4.10.80
+   * KDE 4.11 Beta 1 release
+   * See http://www.kde.org/announcements/announce-4.11-beta1.php
+
+-------------------------------------------------------------------

Old:
----
  knavalbattle-4.10.4.tar.xz

New:
----
  knavalbattle-4.10.90.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ knavalbattle.spec ++++++
--- /var/tmp/diff_new_pack.WBpOqE/_old  2013-07-08 07:29:15.000000000 +0200
+++ /var/tmp/diff_new_pack.WBpOqE/_new  2013-07-08 07:29:15.000000000 +0200
@@ -23,7 +23,7 @@
 License:        GPL-2.0+
 Group:          Amusements/Games/Board/Other
 Url:            http://www.kde.org
-Version:        4.10.4
+Version:        4.10.90
 Release:        0
 Source0:        knavalbattle-%{version}.tar.xz
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build

++++++ knavalbattle-4.10.4.tar.xz -> knavalbattle-4.10.90.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knavalbattle-4.10.4/data/pictures/default.desktop 
new/knavalbattle-4.10.90/data/pictures/default.desktop
--- old/knavalbattle-4.10.4/data/pictures/default.desktop       2013-05-28 
21:38:34.000000000 +0200
+++ new/knavalbattle-4.10.90/data/pictures/default.desktop      2013-06-10 
20:54:53.000000000 +0200
@@ -1,6 +1,5 @@
 [KGameTheme]
 Name=Naval Battle Default
-Name[bs]=Podrazumijevana pomorska bitka
 Name[ca]=Batalla naval per defecte
 Name[ca@valencia]=Batalla naval per defecte
 Name[da]=Standard for Naval Battle
@@ -35,7 +34,6 @@
 Name[zh_CN]=Naval Battle 默认
 Name[zh_TW]=海上戰爭預設
 Description=The default theme for Naval Battle
-Description[bs]=Podrazumijevana tema za Pomorsku bitku
 Description[ca]=Tema per defecte de la batalla naval
 Description[ca@valencia]=Tema per defecte de la batalla naval
 Description[cs]=Výchozí motiv námořní bitvy
@@ -46,7 +44,6 @@
 Description[et]=Merelahingu vaiketeema
 Description[fi]=Meritaistelun oletusteema
 Description[fr]=Le thème par défaut pour Bataille Navale
-Description[ga]=An téama réamhshocraithe le haghaidh Naval Battle
 Description[gl]=Tema predeterminado para Batalla Naval.
 Description[hu]=Alapértelmezett téma a Tengeri csatához
 Description[it]=Il tema predefinito di Battaglia navale
Files old/knavalbattle-4.10.4/doc/index.cache.bz2 and 
new/knavalbattle-4.10.90/doc/index.cache.bz2 differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knavalbattle-4.10.4/doc/index.docbook 
new/knavalbattle-4.10.90/doc/index.docbook
--- old/knavalbattle-4.10.4/doc/index.docbook   2013-05-28 21:38:34.000000000 
+0200
+++ new/knavalbattle-4.10.90/doc/index.docbook  2013-06-10 20:54:53.000000000 
+0200
@@ -52,8 +52,8 @@
 <holder>Kevin Krammer</holder>
 </copyright>
 
-<date>2012-08-06</date>
-<releaseinfo>2.0 (&kde; 4.9)</releaseinfo>
+<date>2013-05-05</date>
+<releaseinfo>2.0 (&kde; 4.11)</releaseinfo>
 
 <abstract>
 <para>
@@ -87,10 +87,10 @@
 <note><title>Objective:</title><para>Sink all of the opponent’s ships before 
the opponent sink all the ships of your own.</para></note><!--Describe the 
objective of the game.-->
 <para>
 If you want to play &kappname;, you will need two players, either play
-against the computer or in a network against another player. To play against 
your computer, first select the difficulty level on the right of the status 
bar, and then select <guibutton>Single player</guibutton> on the welcome 
screen, or directly on the <menuchoice><guimenu>Game</guimenu></menuchoice> 
menu.</para>
+against the computer or in a network against another player. To play against 
your computer, first select the difficulty level on the right of the status 
bar, and then select <guibutton>Single Player</guibutton> on the welcome 
screen, or directly on the <menuchoice><guimenu>Game</guimenu></menuchoice> 
menu.</para>
 
 <para>
-To start a network game, one player has to host the game by selecting 
<guilabel>Host network game</guilabel> on the welcome screen, or choosing 
<menuchoice><guimenu>Game</guimenu>
+To start a network game, one player has to host the game by selecting 
<guilabel>Host Network Game</guilabel> on the welcome screen, or choosing 
<menuchoice><guimenu>Game</guimenu>
 <guimenuitem>Host Game...</guimenuitem></menuchoice>.
 A dialog box opens which asks for a <guilabel>Nickname:</guilabel> and 
<guilabel>Port:</guilabel>. Normally,
 &kappname; will suggest your full name, but you can enter any string
@@ -105,7 +105,7 @@
 </note>
 
 <para>
-The other player has to choose <guilabel>Connect to network game</guilabel>, 
or click <menuchoice><guimenu>Game</guimenu>
+The other player has to choose <guilabel>Connect to Network Game</guilabel>, 
or click <menuchoice><guimenu>Game</guimenu>
 <guimenuitem>Connect to Game...</guimenuitem></menuchoice>. Again, a 
<guilabel>Nickname:</guilabel> is
 suggested, but you can choose any name you like. In the field 
<guilabel>Hostname:</guilabel> you
 have to enter the host name of the server (the machine of the player that 
initiated the game).
@@ -131,7 +131,7 @@
 <para>
 Ship placement is very easy: simply click on the field where you want to
 place your ships. You have four ships to place: the first one will have a 
length of one square, the next
-will be two squares long &etc;. Click on the field where you want to start
+will be two squares long &etc; Click on the field where you want to start
 the placement. By default, ships will be placed horizontally;
 to rotate them 90 degrees, click the &RMB; before the placement.
 <!-- &Shift; itself will flip the ship placement preview. -->
@@ -187,8 +187,8 @@
 <chapter id="menu-reference">
 <title>The Menus</title>
 
-<sect1 id="game-menu">
-<title>The <guimenu>Game</guimenu> Menu</title>
+<sect1 id="menu">
+<title>Menu Items</title>
 
 <variablelist>
 <varlistentry>
@@ -299,14 +299,7 @@
 </para>
 </listitem>
 </varlistentry>
-</variablelist>
-
-</sect1>
-
-<sect1 id="settings-menu">
-<title>The <guimenu>Settings</guimenu> Menu</title>
 
-<variablelist>
 <varlistentry>
 <term>
 <menuchoice>
@@ -340,13 +333,13 @@
 <term>
 <menuchoice>
 <guimenu>Settings</guimenu>
-<guimenuitem>Show Toolbar</guimenuitem>
+<guimenuitem>Adjacent Ships</guimenuitem>
 </menuchoice>
 </term>
 <listitem>
 <para>
-<action>Toggle on or off the display of the toolbar.</action> The
-default is on.
+<action>Toggle whether the ships can be put on a desk without one empty space 
between them.</action>
+The default is on. This setting should be defined on a host when <link 
linkend="howtoplay">playing &kappname; via network</link>.
 </para>
 </listitem>
 </varlistentry>
@@ -355,13 +348,12 @@
 <term>
 <menuchoice>
 <guimenu>Settings</guimenu>
-<guimenuitem>Show Statusbar</guimenuitem>
+<guimenuitem>Show End-of-Game Message</guimenuitem>
 </menuchoice>
 </term>
 <listitem>
-<para>
-<action>Toggle on or off the display of the statusbar.</action> The
-default is on.
+<para>If you won the game and have a new highscore, the highscore dialog will 
be shown.
+Otherwise the result is displayed in the statusbar or, if this option is 
enabled, additionally in a dialog.
 </para>
 </listitem>
 </varlistentry>
@@ -370,12 +362,13 @@
 <term>
 <menuchoice>
 <guimenu>Settings</guimenu>
-<guimenuitem>Configure Shortcuts...</guimenuitem>
+<guimenuitem>Show Left Grid</guimenuitem>
+<guimenu>Settings</guimenu>
+<guimenuitem>Show Right Grid</guimenuitem>
 </menuchoice>
 </term>
 <listitem>
-<para>
-<action>Configure the keyboard shortcuts used by &kappname;.</action>
+<para>Using the grids makes it easier to place a shot with the mouse pointer.
 </para>
 </listitem>
 </varlistentry>
@@ -384,23 +377,25 @@
 <term>
 <menuchoice>
 <guimenu>Settings</guimenu>
-<guimenuitem>Configure Toolbars...</guimenuitem>
+<guisubmenu>Difficulty</guisubmenu>
 </menuchoice>
 </term>
 <listitem>
 <para>
-<action>Configure</action> the toolbars provided by &kappname;.
-</para>
+The game difficulty setting (<guimenuitem>Easy</guimenuitem>, 
<guimenuitem>Medium</guimenuitem>, 
+<guimenuitem>Hard</guimenuitem>) has effect only in single player games 
against the computer.
+In higher levels the AI uses a smarter strategy for shooting and placing 
ships.</para>
 </listitem>
 </varlistentry>
-</variablelist>
-
-</sect1>
 
-<sect1 id="help-menu">
-<title>The <guimenu>Help</guimenu> Menu</title>
+</variablelist>
 
-&help.menu.documentation;
+<para>
+Additionally &kappname; has the common &kde; <guimenu>Settings</guimenu> and 
<guimenu>Help</guimenu>
+menu items, for more information read the sections about the <ulink 
url="help:/fundamentals/ui.html#menus-settings"
+>Settings Menu</ulink> and <ulink 
url="help:/fundamentals/ui.html#menus-help">Help Menu</ulink>
+of the &kde; Fundamentals.
+</para>
 
 </sect1>
 </chapter>
@@ -453,7 +448,7 @@
 </chapter>
 
 <chapter id="credits">
-<title>Credits and Licenses</title>
+<title>Credits and License</title>
 
 <para>&kappname; Copyright 2000-2007</para>
 
@@ -495,7 +490,7 @@
 </listitem>
 <listitem>
 <para>
-Robert Wadley <email>[email protected]</email>
+&Robert.Wadley; <email>[email protected]</email>
 </para>
 </listitem>
 <listitem>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knavalbattle-4.10.4/src/battlefield.cpp 
new/knavalbattle-4.10.90/src/battlefield.cpp
--- old/knavalbattle-4.10.4/src/battlefield.cpp 2013-05-28 21:38:34.000000000 
+0200
+++ new/knavalbattle-4.10.90/src/battlefield.cpp        2013-06-10 
20:54:53.000000000 +0200
@@ -12,6 +12,7 @@
 #include <kdebug.h>
 
 #include "sea.h"
+#include "settings.h"
 
 BattleField::BattleField(Sea* parent, const Coord& size)
 : QObject(parent)
@@ -87,16 +88,47 @@
     }
 }
 
-bool BattleField::canAddShip(const Coord& pos, unsigned int size, 
Ship::Direction direction) const
+bool BattleField::canAddShip(const Coord& pos, unsigned int size, 
Ship::Direction direction, const bool allow_adjacent_ships) const
 {
     Coord p = pos;
     Coord inc = Ship::increment(direction);
+    // Can not place a ship outside the battlefield
     for (unsigned int i = 0; i < size; i++) {
-        if (!valid(p))
-            return false;
-        if (!get(p).water())
-            return false;
-        p += inc;
+       if (!valid(p))
+          return false;
+       p += inc;
+    }
+    // nor over another ship
+    if (allow_adjacent_ships) {
+        p = pos;
+        for (unsigned int i = 0; i < size; i++) {
+            if (valid(p) && !get(p).water())
+                return false;
+            p += inc;
+        }
+    }
+    else {
+    // if not addjacent ships enabled, there must be
+    // a space between the already placed ships
+    // and the new ship
+        p=pos + Ship::decrement(direction) + 
Ship::decrementPerpendicular(direction);
+        for (unsigned int i = 0; i < size+2; i++) {
+            if (valid(p) && !get(p).water())
+                return false;
+            p += inc;
+        }
+        p=pos + Ship::decrement(direction);
+        for (unsigned int i = 0; i < size+2; i++) {
+            if (valid(p) && !get(p).water())
+                return false;
+            p += inc;
+        }
+        p=pos + Ship::decrement(direction) + 
Ship::incrementPerpendicular(direction);
+        for (unsigned int i = 0; i < size+2; i++) {
+            if (valid(p) && !get(p).water())
+                return false;
+            p += inc;
+        }
     }
     return true;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knavalbattle-4.10.4/src/battlefield.h 
new/knavalbattle-4.10.90/src/battlefield.h
--- old/knavalbattle-4.10.4/src/battlefield.h   2013-05-28 21:38:34.000000000 
+0200
+++ new/knavalbattle-4.10.90/src/battlefield.h  2013-06-10 20:54:53.000000000 
+0200
@@ -24,27 +24,27 @@
     Coord m_size;
     Board m_board;
     unsigned int m_ships;
-    
+
     inline int convert(const Coord& c) const { return c.x + m_size.x * c.y; }
 public:
     BattleField(Sea* parent, const Coord& size);
     ~BattleField();
-    
+
     bool valid(const Coord& pos) const;
     Element& get(const Coord& pos);
     const Element& get(const Coord& pos) const;
     void set(const Coord& pos, const Element& e);
-    
+
     void add(const Coord& pos, Ship* ship);
     void add(int n);
     void addBorder(const Coord& pos);
-    bool canAddShip(const Coord& pos, unsigned int size, Ship::Direction 
direction) const;
+    bool canAddShip(const Coord& pos, unsigned int size, Ship::Direction 
direction, const bool allow_adjacent_ships) const;
     HitInfo hit(const Coord& pos);
     void forceHit(const Coord& pos, const HitInfo& info);
     const Element& at(const Coord& c) const;
     Coord find(Ship* ship) const;
     bool isNearShip(const Coord& c) const;
-    
+
     inline unsigned int ships() const { return m_ships; }
 signals:
     void shipDestroyed(Ship*);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knavalbattle-4.10.4/src/controller.cpp 
new/knavalbattle-4.10.90/src/controller.cpp
--- old/knavalbattle-4.10.4/src/controller.cpp  2013-05-28 21:38:34.000000000 
+0200
+++ new/knavalbattle-4.10.90/src/controller.cpp 2013-06-10 20:54:53.000000000 
+0200
@@ -17,15 +17,16 @@
 #include "shot.h"
 #include "audioplayer.h"
 
-Controller::Controller(QObject* parent, AudioPlayer* player)
+Controller::Controller(QObject* parent, AudioPlayer* player, const bool 
allow_adjacent_ships)
 : QObject(parent)
 , m_shot(0)
 , m_ready(0)
 , m_player(player)
 , m_has_ai(false)
+, m_allow_adjacent_ships(allow_adjacent_ships)
 {
     m_ui = 0;
-    m_sea = new Sea(this, Coord(10, 10));
+    m_sea = new Sea(this, Coord(10, 10), allow_adjacent_ships);
 }
 
 PlayerEntity* Controller::createPlayer(Sea::Player player, SeaView* view,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knavalbattle-4.10.4/src/controller.h 
new/knavalbattle-4.10.90/src/controller.h
--- old/knavalbattle-4.10.4/src/controller.h    2013-05-28 21:38:34.000000000 
+0200
+++ new/knavalbattle-4.10.90/src/controller.h   2013-06-10 20:54:53.000000000 
+0200
@@ -33,23 +33,24 @@
     int m_ready;
     AudioPlayer* m_player;
     bool m_has_ai;
-    
+    bool m_allow_adjacent_ships;
+
     void notify(Sea::Player player, const Coord& c, const HitInfo& info);
     void setupEntity(Entity*);
     void finalizeShot(Sea::Player player, const Coord& c, const HitInfo& info);
     void finalizeGame(Sea::Player winner);
     bool allPlayers() const;
 
-    
+
     friend class Shot;
 public:
-    explicit Controller(QObject* parent, AudioPlayer* player = 0);
+    explicit Controller(QObject* parent, AudioPlayer* player = 0, const bool 
allow_adjacent_ships = false);
 
-    PlayerEntity* createPlayer(Sea::Player player, SeaView* view, 
+    PlayerEntity* createPlayer(Sea::Player player, SeaView* view,
                                ChatWidget* chat, const QString& nick);
     AIEntity* createAI(Sea::Player player);
     NetworkEntity* createRemotePlayer(Sea::Player player, Protocol* protocol, 
bool client);
-    
+
     bool start(SeaView* view, bool ask = false);
     Entity* findEntity(Sea::Player) const;
     Sea::Player turn() const;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knavalbattle-4.10.4/src/kbattleship.desktop 
new/knavalbattle-4.10.90/src/kbattleship.desktop
--- old/knavalbattle-4.10.4/src/kbattleship.desktop     2013-05-28 
21:38:34.000000000 +0200
+++ new/knavalbattle-4.10.90/src/kbattleship.desktop    2013-06-10 
20:54:53.000000000 +0200
@@ -41,7 +41,7 @@
 Name[x-test]=xxNaval Battlexx
 Name[zh_CN]=Naval Battle
 Name[zh_TW]=海上戰爭
-Exec=kbattleship -caption "%c" %U
+Exec=kbattleship -caption %c %U
 MimeType=inode/vnd.kde.service.kbattleship;
 Icon=kbattleship
 Type=Application
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knavalbattle-4.10.4/src/kbattleship.kcfg 
new/knavalbattle-4.10.90/src/kbattleship.kcfg
--- old/knavalbattle-4.10.4/src/kbattleship.kcfg        2013-05-28 
21:38:34.000000000 +0200
+++ new/knavalbattle-4.10.90/src/kbattleship.kcfg       2013-06-10 
20:54:53.000000000 +0200
@@ -22,5 +22,9 @@
       <label>Whether sound effects should be played.</label>
       <default>false</default>
     </entry>
+    <entry name="AdjacentShips" type="Bool">
+      <label>Allow the ships to be adjacent without one empty space between 
them.</label>
+      <default>true</default>
+    </entry>
   </group>
 </kcfg>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knavalbattle-4.10.4/src/kbattleshipui.rc 
new/knavalbattle-4.10.90/src/kbattleshipui.rc
--- old/knavalbattle-4.10.4/src/kbattleshipui.rc        2013-05-28 
21:38:34.000000000 +0200
+++ new/knavalbattle-4.10.90/src/kbattleshipui.rc       2013-06-10 
20:54:53.000000000 +0200
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <gui name="kbattleship"
-     version="3"
+     version="4"
      xmlns="http://www.kde.org/standards/kxmlgui/1.0";
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
      xsi:schemaLocation="http://www.kde.org/standards/kxmlgui/1.0
@@ -17,6 +17,7 @@
   <Menu name="settings">
     <Action name="options_nickname" />
     <Action name="options_sounds" />
+    <Action name="options_adjacent" />
     <Action name="options_show_endgame_message" />
     <Action name="options_showleftgrid" />
     <Action name="options_showrightgrid" />
@@ -36,6 +37,9 @@
     <enable>
         <Action name="game_restart"/>
     </enable>
+    <disable>
+        <Action name="options_adjacent"/>
+    </disable>
 </State>
 
 </gui>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knavalbattle-4.10.4/src/mainwindow.cpp 
new/knavalbattle-4.10.90/src/mainwindow.cpp
--- old/knavalbattle-4.10.4/src/mainwindow.cpp  2013-05-28 21:38:34.000000000 
+0200
+++ new/knavalbattle-4.10.90/src/mainwindow.cpp 2013-06-10 20:54:53.000000000 
+0200
@@ -68,12 +68,18 @@
     action = new KAction(KIcon( QLatin1String( SimpleMenu::iconClient) ), 
i18n("&Connect to Game..."), this);
     actionCollection()->addAction("game_create_client", action);
     connect(action, SIGNAL(triggered()), m_main, SLOT(createClient()));
+    // settings
     action = new KAction(i18n("Change &Nickname..."), this);
     actionCollection()->addAction("options_nickname", action);
     connect(action, SIGNAL(triggered()), m_main, SLOT(changeNick()));
     action = new KToggleAction(i18n("&Play Sounds"), this);
     actionCollection()->addAction("options_sounds", action);
     connect(action, SIGNAL(triggered(bool)), m_main, SLOT(toggleSounds(bool)));
+    // This action will be disabled when a game is being run
+    action = new KToggleAction(i18n("&Adjacent Ships"), this);
+    action->setChecked(Settings::adjacentShips());
+    actionCollection()->addAction("options_adjacent", action);
+    connect(action, SIGNAL(triggered(bool)), m_main, 
SLOT(toggleAdjacent(bool)));
     // config end of game message
     action = new KToggleAction(i18n("Show End-of-Game Message"), this);
     action->setChecked(true);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knavalbattle-4.10.4/src/message.cpp 
new/knavalbattle-4.10.90/src/message.cpp
--- old/knavalbattle-4.10.4/src/message.cpp     2013-05-28 21:38:34.000000000 
+0200
+++ new/knavalbattle-4.10.90/src/message.cpp    2013-06-10 20:54:53.000000000 
+0200
@@ -117,4 +117,13 @@
     visitor.visit(*this);
 }
 
+GameOptionsMessage::GameOptionsMessage(const QString& enableAdjacentShips, 
const QString& oneOrSeveralShips)
+: m_enabledAdjacentShipsString(enableAdjacentShips)
+, m_oneOrSeveralShipsString(oneOrSeveralShips)
+{
+}
 
+void GameOptionsMessage::accept(MessageVisitor& visitor) const
+{
+    visitor.visit(*this);
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knavalbattle-4.10.4/src/message.h 
new/knavalbattle-4.10.90/src/message.h
--- old/knavalbattle-4.10.4/src/message.h       2013-05-28 21:38:34.000000000 
+0200
+++ new/knavalbattle-4.10.90/src/message.h      2013-06-10 20:54:53.000000000 
+0200
@@ -105,26 +105,6 @@
     const Coord& stop() const { return m_stop; }
 };
 
-class ChatMessage : public Message
-{
-    QString m_nickname;
-    QString m_chat;
-public:
-    static const int MSGTYPE = 8;
-    explicit ChatMessage(const QString& nick, const QString& chat);
-    virtual void accept(MessageVisitor& visitor) const;
-    
-    const QString& chat() const { return m_chat; }
-    const QString& nickname() const { return m_nickname; }
-};
-
-class RestartMessage : public Message
-{
-public:
-    static const int MSGTYPE = 7;
-    virtual void accept(MessageVisitor& visitor) const;
-};
-
 class GameOverMessage : public Message
 {
 public:
@@ -133,7 +113,7 @@
         Coord pos;
         int size;
         Ship::Direction direction;
-        
+
         ShipInfo(const Coord& pos, int size, Ship::Direction direction)
         : pos(pos)
         , size(size)
@@ -146,13 +126,48 @@
 public:
     static const int MSGTYPE = 6;
     GameOverMessage();
-    
+
     void addShip(const Coord& pos, int size, Ship::Direction direction);
     virtual void accept(MessageVisitor& visitor) const;
-    
+
     const QList<ShipInfo>& ships() const { return m_ships; }
 };
 
+class RestartMessage : public Message
+{
+public:
+    static const int MSGTYPE = 7;
+    virtual void accept(MessageVisitor& visitor) const;
+};
+
+class ChatMessage : public Message
+{
+    QString m_nickname;
+    QString m_chat;
+public:
+    static const int MSGTYPE = 8;
+    explicit ChatMessage(const QString& nick, const QString& chat);
+    virtual void accept(MessageVisitor& visitor) const;
+
+    const QString& chat() const { return m_chat; }
+    const QString& nickname() const { return m_nickname; }
+};
+
+
+class GameOptionsMessage : public Message
+{
+private:
+    QString m_enabledAdjacentShipsString;
+    QString m_oneOrSeveralShipsString;
+public:
+    static const int MSGTYPE = 9;
+    GameOptionsMessage(const QString& enableAdjacentShips, const QString& 
oneOrSeveralShips);
+
+    const QString & enabledAdjacentShips() const { return 
m_enabledAdjacentShipsString; }
+    const QString & oneOrSeveralShips() const { return 
m_oneOrSeveralShipsString; }
+    virtual void accept(MessageVisitor& visitor) const;
+};
+
 
 class MessageVisitor
 {
@@ -167,6 +182,7 @@
     virtual void visit(const GameOverMessage& msg) = 0;
     virtual void visit(const RestartMessage& msg) = 0;
     virtual void visit(const ChatMessage& msg) = 0;
+    virtual void visit(const GameOptionsMessage& msg) = 0;
 };
 
 #endif // MESSAGE_H
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knavalbattle-4.10.4/src/networkentity.cpp 
new/knavalbattle-4.10.90/src/networkentity.cpp
--- old/knavalbattle-4.10.4/src/networkentity.cpp       2013-05-28 
21:38:34.000000000 +0200
+++ new/knavalbattle-4.10.90/src/networkentity.cpp      2013-06-10 
20:54:53.000000000 +0200
@@ -12,12 +12,16 @@
 #include "battlefield.h"
 #include "shot.h"
 #include "protocol.h"
+#include "settings.h"
 
 #include <KIcon>
+#include <klocalizedstring.h>
+#include <kdebug.h>
 
 NetworkEntity::NetworkEntity(Sea::Player player, Sea* sea, Protocol* protocol, 
bool client)
 : Entity(player)
 , m_sea(sea)
+, m_pending_shot(0)
 , m_client(client)
 {
     m_protocol = protocol;
@@ -36,6 +40,8 @@
     }
     else {
         m_protocol->send(MessagePtr(new HeaderMessage()));
+
+        m_protocol->send(MessagePtr(new 
GameOptionsMessage(QString(Settings::adjacentShips() ? "true" : "false"), /* 
TODO */"true")));
     }
 }
 
@@ -198,6 +204,20 @@
     emit chat(msg.chat());
 }
 
+void NetworkEntity::visit(const GameOptionsMessage& msg)
+{
+    bool enabledAdjacentShips = (msg.enabledAdjacentShips() == 
QString("true"));
+    m_sea->allowAdjacentShips( enabledAdjacentShips );
+
+    if (enabledAdjacentShips) {
+        emit chat(i18n("You can place ships adjacent to each other"));
+    }
+    else {
+        emit chat(i18n("You must leave a space between ships"));
+    }
+}
+
+
 KIcon NetworkEntity::icon() const
 {
     return KIcon( QLatin1String( "network-workgroup" ));
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knavalbattle-4.10.4/src/networkentity.h 
new/knavalbattle-4.10.90/src/networkentity.h
--- old/knavalbattle-4.10.4/src/networkentity.h 2013-05-28 21:38:34.000000000 
+0200
+++ new/knavalbattle-4.10.90/src/networkentity.h        2013-06-10 
20:54:53.000000000 +0200
@@ -50,6 +50,7 @@
     virtual void visit(const GameOverMessage& msg);
     virtual void visit(const RestartMessage& msg);
     virtual void visit(const ChatMessage& msg);
+    virtual void visit(const GameOptionsMessage& msg);
 signals:
     void restartRequested();
 };
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knavalbattle-4.10.4/src/playfield.cpp 
new/knavalbattle-4.10.90/src/playfield.cpp
--- old/knavalbattle-4.10.4/src/playfield.cpp   2013-05-28 21:38:34.000000000 
+0200
+++ new/knavalbattle-4.10.90/src/playfield.cpp  2013-06-10 20:54:53.000000000 
+0200
@@ -67,7 +67,7 @@
 
 Controller* PlayField::createController()
 {
-    Controller* controller = new Controller(this, m_player);
+    Controller* controller = new Controller(this, m_player, 
Settings::adjacentShips());
     connect(controller, SIGNAL(gameOver(Sea::Player)),
             this, SLOT(gameOver(Sea::Player)));
     connect(controller, SIGNAL(restartRequested()),
@@ -230,6 +230,12 @@
     m_player->setActive(enable);
 }
 
+void PlayField::toggleAdjacent(bool enable)
+{
+    Settings::setAdjacentShips(enable);
+    Settings::self()->writeConfig();
+}
+
 void PlayField::restartRequested()
 {
     int ans = KMessageBox::questionYesNo(this, i18n("Restart game"),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knavalbattle-4.10.4/src/playfield.h 
new/knavalbattle-4.10.90/src/playfield.h
--- old/knavalbattle-4.10.4/src/playfield.h     2013-05-28 21:38:34.000000000 
+0200
+++ new/knavalbattle-4.10.90/src/playfield.h    2013-06-10 20:54:53.000000000 
+0200
@@ -45,11 +45,12 @@
     void highscores();
     void gameOver(Sea::Player winner);
     void setupController();
-    
+
     void newGame();
     void restart(bool ask = true);
     void changeNick();
     void toggleSounds(bool);
+    void toggleAdjacent(bool);
     void restartRequested();
     void setCompatibility(int);
     void updateNick(int, const QString&);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knavalbattle-4.10.4/src/protocol.cpp 
new/knavalbattle-4.10.90/src/protocol.cpp
--- old/knavalbattle-4.10.4/src/protocol.cpp    2013-05-28 21:38:34.000000000 
+0200
+++ new/knavalbattle-4.10.90/src/protocol.cpp   2013-06-10 20:54:53.000000000 
+0200
@@ -42,7 +42,7 @@
         m_doc.appendChild(m_main);
     }
     
-    QDomDocument document() { return m_doc; }
+    QDomDocument document() const { return m_doc; }
 
     virtual void visit(const HeaderMessage& msg)
     {
@@ -108,6 +108,13 @@
         ADD_FIELD(msg, chat);
         ADD_FIELD(msg, nickname);
     }
+
+    virtual void visit(const GameOptionsMessage& msg)
+    {
+        setType(msg);
+        ADD_FIELD(msg, enabledAdjacentShips);
+        ADD_FIELD(msg, oneOrSeveralShips);
+    }
 };
 
 
@@ -235,6 +242,12 @@
             DEF_ELEMENT(chat);
             return MessagePtr(new ChatMessage(nickname, chat));
         }
+    case GameOptionsMessage::MSGTYPE:
+        {
+            DEF_ELEMENT(enabledAdjacentShips);
+            DEF_ELEMENT(oneOrSeveralShips);
+            return MessagePtr(new GameOptionsMessage(enabledAdjacentShips, 
oneOrSeveralShips));
+        }
     default:
         emit parseError("Unknown message type");
         return MessagePtr();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knavalbattle-4.10.4/src/sea.cpp 
new/knavalbattle-4.10.90/src/sea.cpp
--- old/knavalbattle-4.10.4/src/sea.cpp 2013-05-28 21:38:34.000000000 +0200
+++ new/knavalbattle-4.10.90/src/sea.cpp        2013-06-10 20:54:53.000000000 
+0200
@@ -1,6 +1,6 @@
 /*
   Copyright (c) 2007 Paolo Capriotti <[email protected]>
-            
+
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
@@ -10,11 +10,12 @@
 #include "sea.h"
 #include "battlefield.h"
 
-Sea::Sea(QObject* parent, const Coord& size)
+Sea::Sea(QObject* parent, const Coord& size, const bool allow_adjacent_ships)
 : QObject(parent)
 , m_size(size)
 , m_turn(PLAYER_A)
 , m_status(PLACING_SHIPS)
+, m_allow_adjacent_ships(allow_adjacent_ships)
 {
     m_fields[0] = new BattleField(this, m_size);
     m_fields[1] = new BattleField(this, m_size);
@@ -31,7 +32,7 @@
     if (m_status != PLACING_SHIPS) {
         return false;
     }
-    return m_fields[p]->canAddShip(pos, size, direction);
+    return m_fields[p]->canAddShip(pos, size, direction, 
m_allow_adjacent_ships);
 }
 
 void Sea::add(Player p, const Coord& pos, Ship* ship)
@@ -84,6 +85,11 @@
     }
 }
 
+void Sea::allowAdjacentShips(const bool allow_adjacent_ships)
+{
+    m_allow_adjacent_ships = allow_adjacent_ships;
+}
+
 const Element& Sea::at(Sea::Player player, const Coord& c) const
 {
     return m_fields[player]->at(c);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knavalbattle-4.10.4/src/sea.h 
new/knavalbattle-4.10.90/src/sea.h
--- old/knavalbattle-4.10.4/src/sea.h   2013-05-28 21:38:34.000000000 +0200
+++ new/knavalbattle-4.10.90/src/sea.h  2013-06-10 20:54:53.000000000 +0200
@@ -38,15 +38,16 @@
     Player m_turn;
     BattleField* m_fields[2];
     Status m_status;
-    
+    bool m_allow_adjacent_ships;
+
     inline BattleField* currentField() const { return m_fields[m_turn]; }
     inline BattleField* otherField() const { return 
m_fields[opponent(m_turn)]; }
-    
+
     void checkGameOver();
 public:
-    Sea(QObject* parent, const Coord& size);
+    Sea(QObject* parent, const Coord& size, const bool allow_adjacent_ships);
     ~Sea();
-    
+
     bool canAddShip(Player p, const Coord& pos, int size, Ship::Direction 
direction) const;
     void add(Player p, int n);
     void add(Player p, const Coord& pos, Ship* ship);
@@ -60,7 +61,8 @@
     bool valid(Sea::Player, const Coord& pos) const;
     void switchTurn();
     bool isNearShip(Sea::Player, const Coord& pos) const;
-    
+    void allowAdjacentShips(const bool allow_adjacent_ships);
+
     inline Status status() const { return m_status; }
     inline Player turn() const { return m_turn; }
     static Player opponent(Player p);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knavalbattle-4.10.4/src/ship.cpp 
new/knavalbattle-4.10.90/src/ship.cpp
--- old/knavalbattle-4.10.4/src/ship.cpp        2013-05-28 21:38:34.000000000 
+0200
+++ new/knavalbattle-4.10.90/src/ship.cpp       2013-06-10 20:54:53.000000000 
+0200
@@ -27,11 +27,41 @@
     return direction == TOP_DOWN ? Coord(0, 1) : Coord(1, 0);
 }
 
+Coord Ship::decrement(Direction direction)
+{
+    return direction == TOP_DOWN ? Coord(0, -1) : Coord(-1, 0);
+}
+
+Coord Ship::incrementPerpendicular(Direction direction)
+{
+    return direction == TOP_DOWN ? Coord(1, 0) : Coord(0, 1);
+}
+
+Coord Ship::decrementPerpendicular(Direction direction)
+{
+    return direction == TOP_DOWN ? Coord(-1, 0) : Coord(0, -1);
+}
+
 Coord Ship::increment() const
 {
     return increment(m_direction);
 }
 
+Coord Ship::decrement() const
+{
+    return decrement(m_direction);
+}
+
+Coord Ship::incrementPerpendicular() const
+{
+    return incrementPerpendicular(m_direction);
+}
+
+Coord Ship::decrementPerpendicular() const
+{
+    return decrementPerpendicular(m_direction);
+}
+
 void Ship::decLife()
 {
     Q_ASSERT(alive());
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knavalbattle-4.10.4/src/ship.h 
new/knavalbattle-4.10.90/src/ship.h
--- old/knavalbattle-4.10.4/src/ship.h  2013-05-28 21:38:34.000000000 +0200
+++ new/knavalbattle-4.10.90/src/ship.h 2013-06-10 20:54:53.000000000 +0200
@@ -30,7 +30,13 @@
 
     void changeDirection();
     Coord increment() const;
+    Coord decrement() const;
+    Coord incrementPerpendicular() const;
+    Coord decrementPerpendicular() const;
     static Coord increment(Direction);
+    static Coord decrement(Direction);
+    static Coord incrementPerpendicular(Direction);
+    static Coord decrementPerpendicular(Direction);
     inline unsigned int size() const { return m_size; }
     inline Direction direction() const { return m_direction; }
     void decLife();

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to