commit knavalbattle for openSUSE:Factory
Hello community,
here is the log from the commit of package knavalbattle for openSUSE:Factory checked in at 2014-01-27 11:18:04
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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-12-19 13:19:02.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.knavalbattle.new/knavalbattle.changes 2014-01-27 11:18:05.000000000 +0100
@@ -1,0 +2,7 @@
+Sat Jan 11 16:01:44 UTC 2014 - tittiatcoke@gmail.com
+
+- Update to 4.12.1
+ * KDE 4.12.1 release
+ * See http://www.kde.org/announcements/announce-4.12.1.php
+
+-------------------------------------------------------------------
Old:
----
knavalbattle-4.12.0.tar.xz
New:
----
knavalbattle-4.12.1.tar.xz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ knavalbattle.spec ++++++
--- /var/tmp/diff_new_pack.CBMxcl/_old 2014-01-27 11:18:06.000000000 +0100
+++ /var/tmp/diff_new_pack.CBMxcl/_new 2014-01-27 11:18:06.000000000 +0100
@@ -1,7 +1,7 @@
#
# spec file for package knavalbattle
#
-# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -23,7 +23,7 @@
License: GPL-2.0+
Group: Amusements/Games/Board/Other
Url: http://www.kde.org
-Version: 4.12.0
+Version: 4.12.1
Release: 0
Source0: knavalbattle-%{version}.tar.xz
BuildRoot: %{_tmppath}/%{name}-%{version}-build
++++++ knavalbattle-4.12.0.tar.xz -> knavalbattle-4.12.1.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knavalbattle-4.12.0/src/ai/dummyai.cpp new/knavalbattle-4.12.1/src/ai/dummyai.cpp
--- old/knavalbattle-4.12.0/src/ai/dummyai.cpp 2013-11-28 20:12:01.000000000 +0100
+++ new/knavalbattle-4.12.1/src/ai/dummyai.cpp 2014-01-08 14:13:24.000000000 +0100
@@ -44,8 +44,8 @@
Coord c(rand() % m_sea->size().x, rand() % m_sea->size().y);
Ship::Direction dir = rand() % 2 == 0 ? Ship::LEFT_TO_RIGHT : Ship::TOP_DOWN;
if (m_sea->canAddShip(m_player, c, i, dir)) {
- ship = new Ship(i, dir);
- m_sea->add(m_player, c, ship);
+ ship = new Ship(i, dir, c);
+ m_sea->add(m_player, ship);
}
}
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knavalbattle-4.12.0/src/ai/smartai.cpp new/knavalbattle-4.12.1/src/ai/smartai.cpp
--- old/knavalbattle-4.12.0/src/ai/smartai.cpp 2013-11-28 20:12:01.000000000 +0100
+++ new/knavalbattle-4.12.1/src/ai/smartai.cpp 2014-01-08 14:13:24.000000000 +0100
@@ -331,8 +331,8 @@
Coord c(rand() % m_sea->size().x, rand() % m_sea->size().y);
Ship::Direction dir = rand() % 2 == 0 ? Ship::LEFT_TO_RIGHT : Ship::TOP_DOWN;
if (m_sea->canAddShip(m_player, c, i, dir)) {
- ship = new Ship(i, dir);
- m_sea->add(m_player, c, ship);
+ ship = new Ship(i, dir, c);
+ m_sea->add(m_player, ship);
}
}
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knavalbattle-4.12.0/src/aientity.cpp new/knavalbattle-4.12.1/src/aientity.cpp
--- old/knavalbattle-4.12.0/src/aientity.cpp 2013-11-28 20:12:01.000000000 +0100
+++ new/knavalbattle-4.12.1/src/aientity.cpp 2014-01-08 14:13:24.000000000 +0100
@@ -11,13 +11,14 @@
#include "ai/smartai.h"
#include "ai/dummyai.h"
#include "shot.h"
+#include "seaview.h"
#include <KgDifficulty>
#include <KIcon>
-AIEntity::AIEntity(Sea::Player player, Sea* sea)
-: Entity(player)
+AIEntity::AIEntity(Sea::Player player, Sea* sea, SeaView *seaview)
+: Entity(player, seaview)
, m_sea(sea)
{
switch (Kg::difficultyLevel()) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knavalbattle-4.12.0/src/aientity.h new/knavalbattle-4.12.1/src/aientity.h
--- old/knavalbattle-4.12.0/src/aientity.h 2013-11-28 20:12:01.000000000 +0100
+++ new/knavalbattle-4.12.1/src/aientity.h 2014-01-08 14:13:24.000000000 +0100
@@ -19,12 +19,12 @@
Q_OBJECT
AI* m_ai;
Sea* m_sea;
-
+
void getShoot();
-
+
friend class DelayedShot;
public:
- AIEntity(Sea::Player player, Sea* sea);
+ AIEntity(Sea::Player player, Sea* sea, SeaView *seaview);
virtual ~AIEntity();
virtual void notify(Sea::Player player, const Coord& c, const HitInfo& info);
@@ -33,7 +33,7 @@
virtual void start(bool);
virtual void startPlaying();
virtual void hit(Shot* shot);
-
+
virtual KIcon icon() const;
public slots:
virtual void notifyAbort() { }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knavalbattle-4.12.0/src/animation.cpp new/knavalbattle-4.12.1/src/animation.cpp
--- old/knavalbattle-4.12.0/src/animation.cpp 2013-11-28 20:12:01.000000000 +0100
+++ new/knavalbattle-4.12.1/src/animation.cpp 2014-01-08 14:13:24.000000000 +0100
@@ -68,6 +68,7 @@
, m_from(from)
, m_to(to)
, m_time(time)
+, m_start(0)
{
}
@@ -100,6 +101,7 @@
, m_from(from)
, m_to(to)
, m_time(time)
+, m_start(0)
{
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knavalbattle-4.12.0/src/battlefield.cpp new/knavalbattle-4.12.1/src/battlefield.cpp
--- old/knavalbattle-4.12.0/src/battlefield.cpp 2013-11-28 20:12:01.000000000 +0100
+++ new/knavalbattle-4.12.1/src/battlefield.cpp 2014-01-08 14:13:24.000000000 +0100
@@ -61,9 +61,9 @@
m_ships += n;
}
-void BattleField::add(const Coord& pos, Ship* ship)
+void BattleField::add(Ship* ship)
{
- Coord p = pos;
+ Coord p = ship->position();
for (unsigned int i = 0; i < ship->size(); i++) {
set(p, Element(ship));
p = p + ship->increment();
@@ -88,7 +88,7 @@
}
}
-bool BattleField::canAddShip(const Coord& pos, unsigned int size, Ship::Direction direction, const bool allow_adjacent_ships) const
+bool BattleField::canAddShip(const Coord& pos, unsigned int size, Ship::Direction direction) const
{
Coord p = pos;
Coord inc = Ship::increment(direction);
@@ -99,7 +99,7 @@
p += inc;
}
// nor over another ship
- if (allow_adjacent_ships) {
+ if (m_allow_adjacent_ships) {
p = pos;
for (unsigned int i = 0; i < size; i++) {
if (valid(p) && !get(p).water())
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knavalbattle-4.12.0/src/battlefield.h new/knavalbattle-4.12.1/src/battlefield.h
--- old/knavalbattle-4.12.0/src/battlefield.h 2013-11-28 20:12:01.000000000 +0100
+++ new/knavalbattle-4.12.1/src/battlefield.h 2014-01-08 14:13:24.000000000 +0100
@@ -23,6 +23,7 @@
typedef Grid<Element> Board;
Coord m_size;
Board m_board;
+ bool m_allow_adjacent_ships;
unsigned int m_ships;
inline int convert(const Coord& c) const { return c.x + m_size.x * c.y; }
@@ -35,10 +36,10 @@
const Element& get(const Coord& pos) const;
void set(const Coord& pos, const Element& e);
- void add(const Coord& pos, Ship* ship);
+ void add(Ship* ship);
void add(int n);
void addBorder(const Coord& pos);
- bool canAddShip(const Coord& pos, unsigned int size, Ship::Direction direction, const bool allow_adjacent_ships) const;
+ bool canAddShip(const Coord& pos, unsigned int size, Ship::Direction direction) const;
HitInfo hit(const Coord& pos);
void forceHit(const Coord& pos, const HitInfo& info);
const Element& at(const Coord& c) const;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knavalbattle-4.12.0/src/battlefieldview.cpp new/knavalbattle-4.12.1/src/battlefieldview.cpp
--- old/knavalbattle-4.12.0/src/battlefieldview.cpp 2013-11-28 20:12:01.000000000 +0100
+++ new/knavalbattle-4.12.1/src/battlefieldview.cpp 2014-01-08 14:13:24.000000000 +0100
@@ -177,18 +177,18 @@
sprite->setPos(m_renderer->toReal(c));
scene()->addItem(sprite);
- sprite->stackBefore(m_screen);
}
-void BattleFieldView::add(const Coord& c, Ship* ship)
+void BattleFieldView::add(Ship* ship)
{
Sprite* sprite = m_factory.createShip(ship);
- addSprite(c, sprite);
+ addSprite(ship->position(), sprite);
// fading preview in
+ Animation* a = new FadeAnimation(sprite, PREVIEW_OPACITY, 1, 1000);
+ Animator::instance()->add(a);
+
if (ship == m_preview.ship) {
- Animation* a = new FadeAnimation(sprite, PREVIEW_OPACITY, 1, 1000);
- Animator::instance()->add(a);
cancelPreview();
}
else if (!ship->alive()) {
@@ -197,12 +197,12 @@
}
}
-void BattleFieldView::sink(const Coord& c, Ship* ship)
+void BattleFieldView::sink(Ship* ship)
{
m_last_hit = 0;
Sprite* ship_sprite = 0;
- Coord p = c;
+ Coord p = ship->position();
for (unsigned int i = 0;
i < ship->size();
i++, p += ship->increment()) {
@@ -213,7 +213,7 @@
else if (s->spriteKey().startsWith("hit")) {
s->setSpriteKey("hit-end");
s->refresh(m_renderer);
- s->stackBefore(m_screen);
+ s->setZValue(BACKGROUND);
s->setOpacity(0.5);
}
}
@@ -227,6 +227,7 @@
{
removeImpact();
m_last_hit = m_factory.createHit();
+ m_last_hit->setZValue(BACKGROUND);
addSprite(c, m_last_hit);
}
@@ -234,6 +235,7 @@
{
removeImpact();
m_impact = m_factory.createImpact();
+ m_impact->setZValue(BACKGROUND);
addSprite(c, m_impact);
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knavalbattle-4.12.0/src/battlefieldview.h new/knavalbattle-4.12.1/src/battlefieldview.h
--- old/knavalbattle-4.12.0/src/battlefieldview.h 2013-11-28 20:12:01.000000000 +0100
+++ new/knavalbattle-4.12.1/src/battlefieldview.h 2014-01-08 14:13:24.000000000 +0100
@@ -38,6 +38,11 @@
QGraphicsLineItem *hlines[11];
QGraphicsLineItem *vlines[11];
+ enum Planes {
+ BACKGROUND = 1,
+ FOREGROUND = 2
+ };
+
WelcomeScreen* m_screen;
KBSRenderer* m_renderer;
SpriteFactory m_factory;
@@ -74,17 +79,18 @@
void setPreview(const QPointF& pos, Ship* ship);
void cancelPreview();
- void add(const Coord& c, Ship* ship);
+ void add(Ship* ship);
void hit(const Coord& c);
void miss(const Coord& c);
void removeImpact();
- void sink(const Coord& c, Ship* ship);
+ void sink(Ship* ship);
void clear();
void setDelegate(Delegate *c);
void setPlayer(Sea::Player player);
-
+
WelcomeScreen* screen() const;
+
protected:
void drawGrid();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knavalbattle-4.12.0/src/button.h new/knavalbattle-4.12.1/src/button.h
--- old/knavalbattle-4.12.0/src/button.h 2013-11-28 20:12:01.000000000 +0100
+++ new/knavalbattle-4.12.1/src/button.h 2014-01-08 14:13:24.000000000 +0100
@@ -78,7 +78,6 @@
Button* m_button;
int m_brightness;
static double m_speed;
- double m_current;
int m_last;
public:
ButtonAnimation(Button* button, int brightness);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knavalbattle-4.12.0/src/controller.cpp new/knavalbattle-4.12.1/src/controller.cpp
--- old/knavalbattle-4.12.0/src/controller.cpp 2013-11-28 20:12:01.000000000 +0100
+++ new/knavalbattle-4.12.1/src/controller.cpp 2014-01-08 14:13:24.000000000 +0100
@@ -43,26 +43,25 @@
return entity;
}
-AIEntity* Controller::createAI(Sea::Player player)
+AIEntity* Controller::createAI(Sea::Player player, SeaView* view)
{
kDebug() << "created ai entity";
m_has_ai = true;
- AIEntity* e = new AIEntity(player, m_sea);
+ AIEntity* e = new AIEntity(player, m_sea, view);
e->setNick(i18n("Computer"));
setupEntity(e);
-
+
return e;
}
-NetworkEntity* Controller::createRemotePlayer(Sea::Player player, Protocol* protocol, bool client)
+NetworkEntity* Controller::createRemotePlayer(Sea::Player player, SeaView* view, Protocol* protocol, bool client)
{
- NetworkEntity* e = new NetworkEntity(player, m_sea, protocol, client);
+ NetworkEntity* e = new NetworkEntity(player, m_sea, view, protocol, client);
setupEntity(e);
connect(e, SIGNAL(restartRequested()), this, SIGNAL(restartRequested()));
if (client) {
m_sea->switchTurn();
}
-
return e;
}
@@ -80,19 +79,19 @@
this, SLOT(nick(int,QString)));
connect(entity, SIGNAL(compatibility(int)),
this, SIGNAL(compatibility(int)));
-
+
foreach (Entity* e, m_entities) {
connect(e, SIGNAL(compatibility(int)),
entity, SLOT(setCompatibilityLevel(int)));
connect(entity, SIGNAL(compatibility(int)),
e, SLOT(setCompatibilityLevel(int)));
-
+
connect(e, SIGNAL(abortGame()),
entity, SLOT(notifyAbort()));
connect(entity, SIGNAL(abortGame()),
e, SLOT(notifyAbort()));
}
-
+
m_entities.append(entity);
}
@@ -216,11 +215,16 @@
void Controller::finalizeGame(Sea::Player winner)
{
+ // first, every entity will notify the other entity its ships
+ foreach (Entity* entity, m_entities) {
+ entity->notifyShips(winner);
+ }
+ // then, it will notify the end of the game
foreach (Entity* entity, m_entities) {
entity->notifyGameOver(winner);
}
emit gameOver(winner);
-}
+ }
Entity* Controller::findEntity(Sea::Player player) const
{
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knavalbattle-4.12.0/src/controller.h new/knavalbattle-4.12.1/src/controller.h
--- old/knavalbattle-4.12.0/src/controller.h 2013-11-28 20:12:01.000000000 +0100
+++ new/knavalbattle-4.12.1/src/controller.h 2014-01-08 14:13:24.000000000 +0100
@@ -44,17 +44,18 @@
friend class Shot;
public:
- explicit Controller(QObject* parent, AudioPlayer* player = 0, const bool allow_adjacent_ships = false);
+ explicit Controller(QObject* parent, AudioPlayer* audioPlayer = 0, const bool allow_adjacent_ships = false);
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);
+ AIEntity* createAI(Sea::Player player, SeaView* view);
+ NetworkEntity* createRemotePlayer(Sea::Player player, SeaView* view, Protocol* protocol, bool client);
bool start(SeaView* view, bool ask = false);
Entity* findEntity(Sea::Player) const;
Sea::Player turn() const;
bool hasAI() const;
+ inline Sea* getSea() const { return m_sea; }
public slots:
void shoot(int player, const Coord& c);
void ready(int player);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knavalbattle-4.12.0/src/coord.h new/knavalbattle-4.12.1/src/coord.h
--- old/knavalbattle-4.12.0/src/coord.h 2013-11-28 20:12:01.000000000 +0100
+++ new/knavalbattle-4.12.1/src/coord.h 2014-01-08 14:13:24.000000000 +0100
@@ -20,7 +20,7 @@
int y;
Coord(int x, int y);
- Coord() { }
+ Coord():x(0),y(0) { }
Coord operator+(const Coord& other) const;
Coord operator-(const Coord& other) const;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knavalbattle-4.12.0/src/entity.cpp new/knavalbattle-4.12.1/src/entity.cpp
--- old/knavalbattle-4.12.0/src/entity.cpp 2013-11-28 20:12:01.000000000 +0100
+++ new/knavalbattle-4.12.1/src/entity.cpp 2014-01-08 14:13:24.000000000 +0100
@@ -10,8 +10,9 @@
#include "entity.h"
-Entity::Entity(Sea::Player player)
+Entity::Entity(Sea::Player player, SeaView* seaview)
: m_player(player)
+, m_seaview(seaview)
, m_level(COMPAT_KBS4)
{
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knavalbattle-4.12.0/src/entity.h new/knavalbattle-4.12.1/src/entity.h
--- old/knavalbattle-4.12.0/src/entity.h 2013-11-28 20:12:01.000000000 +0100
+++ new/knavalbattle-4.12.1/src/entity.h 2014-01-08 14:13:24.000000000 +0100
@@ -12,6 +12,7 @@
#include <QObject>
#include "sea.h"
+#include "seaview.h"
#include "stats.h"
class Shot;
@@ -28,11 +29,13 @@
};
protected:
Sea::Player m_player;
+ SeaView* m_seaview;
QString m_nick;
CompatibilityLevel m_level;
Stats m_stats;
+
public:
- Entity(Sea::Player player);
+ Entity(Sea::Player player, SeaView* seaview);
virtual ~Entity();
virtual void notify(Sea::Player player, const Coord& c, const HitInfo& info) = 0;
virtual void notifyChat(const Entity* entity, const QString& text) = 0;
@@ -41,6 +44,7 @@
virtual void start(bool) = 0;
virtual void startPlaying() { }
virtual void notifyReady(Sea::Player) { }
+ virtual void notifyShips(Sea::Player) { }
virtual void notifyGameOver(Sea::Player) { }
Stats* stats();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knavalbattle-4.12.0/src/networkentity.cpp new/knavalbattle-4.12.1/src/networkentity.cpp
--- old/knavalbattle-4.12.0/src/networkentity.cpp 2013-11-28 20:12:01.000000000 +0100
+++ new/knavalbattle-4.12.1/src/networkentity.cpp 2014-01-08 14:13:24.000000000 +0100
@@ -13,18 +13,20 @@
#include "shot.h"
#include "protocol.h"
#include "settings.h"
+#include "seaview.h"
#include <KIcon>
#include
participants (1)
-
root@hilbert.suse.de