[Kde-games-devel] new KDE game: dominoes
Josef Spillner
kde-games-devel@mail.kde.org
Thu, 7 Nov 2002 10:16:11 +0100
--Boundary-00=_b9iy9ECuNIcPbBq
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Hi,
On Thursday 07 November 2002 06:58, Jay Glascoe wrote:
> it does almost everything I want it to do, doesn't leak memory, and won't
>
> segfault. Now I need some advice on how to convert a vanilla Qt app to a
> KDE
>
> app. In particular, I'd like the "Help/About" to have that standard KDE
> about look.
You can get either the full Help menu (recommended) by using either KXMLGUI,
or (less intrusive) by including KMainWindow::helpMenu() into your menuBar().
It is generally advisable to replace some Q* widgets with K* ones so the game
will integrate properly with the players' desktops.
> I'm also wondering, what is the KDE way of saving "persistent" data? By
> that I
>
> mean, I want to save the config options and running statistics to some file
>
> somewhere.
Have a look at the documentation of KConfig and KConfigBase.
> I also need some brief advice about how to put the code up on
>
> sourceforge. If anyone is interested in looking at the game, I'd really
> appreciate
>
> that as well.
If you intend to make your game part of KDE, you should let it mature in the
kdenonbeta CVS module.
(Otherwise, founding an SF project is not hard, just register yourself as a
user there, then apply for a new project, and finally upload the source to
incoming.sf.net, using the SF release manager.)
Some tips:
- I've attached a patch which lets your game compile with gcc3.
- You should subscribe to this mailing list (see
http://mail.kde.org/mailman/listinfo/kde-games-devel)
- please don't send HTML, plain text is sufficent.
Josef
--
Free operating systems. Free software. Free games.
--Boundary-00=_b9iy9ECuNIcPbBq
Content-Type: text/x-diff;
charset="iso-8859-1";
name="kdominoes.gcc3.diff"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="kdominoes.gcc3.diff"
diff -Nur KDOMINOES.orig/ai_01/aidomino.cpp KDOMINOES/ai_01/aidomino.cpp
=2D-- KDOMINOES.orig/ai_01/aidomino.cpp 2002-11-01 14:17:05.000000000 +0100
+++ KDOMINOES/ai_01/aidomino.cpp 2002-11-07 10:02:23.000000000 +0100
@@ -1,4 +1,4 @@
=2D#include <iostream.h>
+#include <iostream>
#include <qglobal.h>
#include "aitypes.h"
#include "aidomino.h"
diff -Nur KDOMINOES.orig/ai_01/aigame.cpp KDOMINOES/ai_01/aigame.cpp
=2D-- KDOMINOES.orig/ai_01/aigame.cpp 2002-11-06 22:55:05.000000000 +0100
+++ KDOMINOES/ai_01/aigame.cpp 2002-11-07 10:04:06.000000000 +0100
@@ -5,9 +5,13 @@
#include "note.h"
#include "aiplayable.h"
=20
+#include <iostream>
+
+using namespace std;
+
AIGame::AIGame( QPtrList<AIDomino> hand0, QPtrList<AIDomino> hand1,
QPtrList<AIDomino> boneyard, bool empty_skeleton,
=2D int s_left=3D-1, int s_right=3D-1 )
+ int s_left, int s_right )
{
hands[0] =3D hand0;
hands[1] =3D hand1;
@@ -89,7 +93,7 @@
draw( hand_idx );
}
=20
=2DAIDomino *AIGame::draw_to_next_playable( int hand_idx, int value=3D-1 )
+AIDomino *AIGame::draw_to_next_playable( int hand_idx, int value )
{
if ( value !=3D -1 )
{
@@ -175,7 +179,7 @@
}
=20
// QPtrList<AnnotatedGame> *AIGame::all_possible_plays( int hand_idx, Note=
*note=3D0 )
=2DQPtrList<AnnotatedGame> *AIGame::all_possible_plays( int hand_idx,bool d=
raw_for_value=3Dfalse )
+QPtrList<AnnotatedGame> *AIGame::all_possible_plays( int hand_idx,bool dra=
w_for_value )
{
QPtrList<AIPlayable> *playables =3D skeleton.get_playables( &(hands[ha=
nd_idx]) );
if ( playables->isEmpty() )
@@ -439,7 +443,7 @@
QPtrList<AnnotatedPoint> *AIGame::build_pts(
int depth, int hand_idx,
int *maxptr, int *minptr,
=2D bool critical_event=3Dfalse, bool begin=3Dfalse )
+ bool critical_event, bool begin )
{
if ( !critical_event )
{
@@ -802,7 +806,7 @@
return points;
}
inline void rememberValues( bool vals[], QPtrList<AIDomino> *ds,
=2D bool no_doubles=3Dfalse )
+ bool no_doubles )
{
for ( AIDomino *d=3Dds->first(); d; d=3Dds->next() )
{
diff -Nur KDOMINOES.orig/ai_01/aiskeleton.cpp KDOMINOES/ai_01/aiskeleton.cpp
=2D-- KDOMINOES.orig/ai_01/aiskeleton.cpp 2002-11-05 22:26:25.000000000 +01=
00
+++ KDOMINOES/ai_01/aiskeleton.cpp 2002-11-07 10:04:25.000000000 +0100
@@ -1,4 +1,4 @@
=2D#include <iostream.h>
+#include <iostream>
#include "aiskeleton.h"
#include "aidomino.h"
#include "aiplayable.h"
Bin=E4rdateien KDOMINOES.orig/aidomino.o and KDOMINOES/aidomino.o sind vers=
chieden.
Bin=E4rdateien KDOMINOES.orig/aifacman.o and KDOMINOES/aifacman.o sind vers=
chieden.
Bin=E4rdateien KDOMINOES.orig/aifactory_01.o and KDOMINOES/aifactory_01.o s=
ind verschieden.
Bin=E4rdateien KDOMINOES.orig/aigame.o and KDOMINOES/aigame.o sind verschie=
den.
Bin=E4rdateien KDOMINOES.orig/aiinter_01.o and KDOMINOES/aiinter_01.o sind =
verschieden.
Bin=E4rdateien KDOMINOES.orig/aiplayable.o and KDOMINOES/aiplayable.o sind =
verschieden.
Bin=E4rdateien KDOMINOES.orig/aiskeleton.o and KDOMINOES/aiskeleton.o sind =
verschieden.
Bin=E4rdateien KDOMINOES.orig/board.o and KDOMINOES/board.o sind verschiede=
n.
Bin=E4rdateien KDOMINOES.orig/callback.o and KDOMINOES/callback.o sind vers=
chieden.
diff -Nur KDOMINOES.orig/domino.cpp KDOMINOES/domino.cpp
=2D-- KDOMINOES.orig/domino.cpp 2002-11-01 20:10:37.000000000 +0100
+++ KDOMINOES/domino.cpp 2002-11-07 09:57:46.000000000 +0100
@@ -356,7 +356,7 @@
{
this->played =3D played;
}
=2Dvoid Domino::reallyMove( int x, int y, bool animate=3Dfalse )
+void Domino::reallyMove( int x, int y, bool animate )
{
if ( !placed )
{
@@ -447,13 +447,13 @@
{
return hi =3D=3D lo;
}
=2Dvoid Domino::reallyMoveBy( int dx, int dy, bool animate=3Dfalse )
+void Domino::reallyMoveBy( int dx, int dy, bool animate )
{
Q_ASSERT( placed ); // until placed, have no idea where I am
myRect.moveBy( dx, dy );
moveImages( myRect.x(), myRect.y(), animate );
}
=2Dvoid Domino::newMoveBy( int dx, int dy, QPoint *moving_start=3D0 )
+void Domino::newMoveBy( int dx, int dy, QPoint *moving_start )
{
// printf("newMoveBy(%d,%d)\n", dx,dy);
int x,y,w,h;
@@ -792,7 +792,7 @@
}
=20
void Domino::moveAddToOpenEnd(
=2D OpenEnd *end, Skeleton *skeleton, bool animate=3Dfalse )
+ OpenEnd *end, Skeleton *skeleton, bool animate )
{
// end =3D=3D 0 signals adding to empty skeleton
if ( player )
Bin=E4rdateien KDOMINOES.orig/domino.o and KDOMINOES/domino.o sind verschie=
den.
Bin=E4rdateien KDOMINOES.orig/figeditor.o and KDOMINOES/figeditor.o sind ve=
rschieden.
diff -Nur KDOMINOES.orig/game.cpp KDOMINOES/game.cpp
=2D-- KDOMINOES.orig/game.cpp 2002-11-03 19:29:51.000000000 +0100
+++ KDOMINOES/game.cpp 2002-11-07 09:58:55.000000000 +0100
@@ -1,6 +1,8 @@
#include <qmessagebox.h>
#include <qstatusbar.h>=20
=20
+#include <iostream>
+
#include "game.h"
#include "player.h"
#include "kdominoes.h"
@@ -10,6 +12,8 @@
#include "dsizes.h"
#include "iitem.h"
=20
+using namespace std;
+
DominoGame::DominoGame( Main *main, DominoSize *dsize )
{
this->main =3D main;
@@ -251,7 +255,7 @@
}
return false;
}
=2Dvoid DominoGame::setCurrentPlayer( Player *player,bool doFlip=3Dtrue )
+void DominoGame::setCurrentPlayer( Player *player,bool doFlip )
{
// printLists();
if ( player =3D=3D northPlayer )
@@ -361,7 +365,7 @@
return false;
return true;
}
=2DDomino *DominoGame::getDominoAtPoint( const QPoint p, bool onlyUnplayed=
=3Dtrue )
+Domino *DominoGame::getDominoAtPoint( const QPoint p, bool onlyUnplayed )
{
Domino *domino;
Player *player =3D getCurrentPlayer();
@@ -390,7 +394,7 @@
else
return domino;
}
=2DDomino *DominoGame::getDominoAtPointFace( const QPoint p, bool onlyUnpla=
yed=3Dtrue )
+Domino *DominoGame::getDominoAtPointFace( const QPoint p, bool onlyUnplaye=
d )
{
QPoint q =3D QPoint( p.x()-dsize->irelief,p.y()+dsize->irelief );
return getDominoAtPoint( q,onlyUnplayed );
Bin=E4rdateien KDOMINOES.orig/game.o and KDOMINOES/game.o sind verschieden.
diff -Nur KDOMINOES.orig/iitem.cpp KDOMINOES/iitem.cpp
=2D-- KDOMINOES.orig/iitem.cpp 2002-11-03 05:41:42.000000000 +0100
+++ KDOMINOES/iitem.cpp 2002-11-07 09:59:15.000000000 +0100
@@ -56,7 +56,7 @@
waiting =3D 0;
setAnimated( false );
}
=2Dvoid AnimatedImageItem::enqueueCallQueue( Callback *callback, bool wait=
=3Dtrue )
+void AnimatedImageItem::enqueueCallQueue( Callback *callback, bool wait )
{
callQueue.enqueue( callback );
if ( wait )
Bin=E4rdateien KDOMINOES.orig/iitem.o and KDOMINOES/iitem.o sind verschiede=
n.
Bin=E4rdateien KDOMINOES.orig/kdominoes and KDOMINOES/kdominoes sind versch=
ieden.
diff -Nur KDOMINOES.orig/kdominoes.cpp KDOMINOES/kdominoes.cpp
=2D-- KDOMINOES.orig/kdominoes.cpp 2002-11-07 00:18:30.000000000 +0100
+++ KDOMINOES/kdominoes.cpp 2002-11-07 10:00:08.000000000 +0100
@@ -15,6 +15,7 @@
#include <qcolor.h>
#include <qcolordialog.h>
#include <stdlib.h>
+#include <time.h>
=20
#include "kdominoes.h"
#include "domino.h"
@@ -53,7 +54,7 @@
=20
// static uint mainCount =3D 0;
=20
=2DMain::Main(DominoSize *dsize, DominoGame *a_game=3D0, QWidget* parent, c=
onst char* name, WFlags f) :
+Main::Main(DominoSize *dsize, DominoGame *a_game, QWidget* parent, const c=
har* name, WFlags f) :
QMainWindow(parent,name,f)
{
// this->dsize =3D a_dsize;
Bin=E4rdateien KDOMINOES.orig/kdominoes.o and KDOMINOES/kdominoes.o sind ve=
rschieden.
Bin=E4rdateien KDOMINOES.orig/main.o and KDOMINOES/main.o sind verschieden.
Bin=E4rdateien KDOMINOES.orig/moc_kdominoes.o and KDOMINOES/moc_kdominoes.o=
sind verschieden.
Bin=E4rdateien KDOMINOES.orig/note.o and KDOMINOES/note.o sind verschieden.
Bin=E4rdateien KDOMINOES.orig/oend.o and KDOMINOES/oend.o sind verschieden.
diff -Nur KDOMINOES.orig/player.cpp KDOMINOES/player.cpp
=2D-- KDOMINOES.orig/player.cpp 2002-11-07 00:12:04.000000000 +0100
+++ KDOMINOES/player.cpp 2002-11-07 10:01:20.000000000 +0100
@@ -1,4 +1,7 @@
#include <unistd.h>
+#include <stdlib.h>
+#include <iostream>
+
#include <qdatetime.h>
// #include <qtimer.h>
=20
@@ -15,6 +18,8 @@
#include "dvalue.h"
#include "kdominoes.h"
=20
+using namespace std;
+
// PLAYER
Player::Player( DominoGame *game )
{
@@ -120,7 +125,7 @@
domino->reallyMove( spaceRect->x(),spaceRect->y(),true );
delete spaceRect;
}
=2Dvoid Player::computerPlay( bool doBeStupid=3Dtrue )
+void Player::computerPlay( bool doBeStupid )
{
// you'll notice that being stupid is, by default, true
if ( !canPlay() && game->boneyardIsEmpty() )
Bin=E4rdateien KDOMINOES.orig/player.o and KDOMINOES/player.o sind verschie=
den.
diff -Nur KDOMINOES.orig/skeleton.cpp KDOMINOES/skeleton.cpp
=2D-- KDOMINOES.orig/skeleton.cpp 2002-10-16 18:02:58.000000000 +0200
+++ KDOMINOES/skeleton.cpp 2002-11-07 10:01:38.000000000 +0100
@@ -1,3 +1,4 @@
+#include <stdlib.h>
#include <qmessagebox.h>
#include "skeleton.h"
#include "oend.h"
Bin=E4rdateien KDOMINOES.orig/skeleton.o and KDOMINOES/skeleton.o sind vers=
chieden.
Bin=E4rdateien KDOMINOES.orig/util.o and KDOMINOES/util.o sind verschieden.
--Boundary-00=_b9iy9ECuNIcPbBq--