Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Games
lskat
Commits
a9f2de1d
Commit
a9f2de1d
authored
Oct 24, 2005
by
Stephan Kulow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bring it a bit further to compile - just to notice it's a bit of a mess
;( svn path=/trunk/KDE/kdegames/lskat/; revision=473659
parent
69acc030
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
165 additions
and
130 deletions
+165
-130
lskat/KChildConnect.cpp
lskat/KChildConnect.cpp
+5
-3
lskat/KChildConnect.h
lskat/KChildConnect.h
+2
-2
lskat/KEInput.h
lskat/KEInput.h
+6
-6
lskat/KEMessage.cpp
lskat/KEMessage.cpp
+9
-6
lskat/KEMessage.h
lskat/KEMessage.h
+9
-9
lskat/KProcessConnect.cpp
lskat/KProcessConnect.cpp
+5
-3
lskat/KRemoteConnect.cpp
lskat/KRemoteConnect.cpp
+12
-10
lskat/lskat.cpp
lskat/lskat.cpp
+59
-57
lskat/lskat.h
lskat/lskat.h
+2
-2
lskat/lskatdoc.cpp
lskat/lskatdoc.cpp
+6
-3
lskat/lskatdoc.h
lskat/lskatdoc.h
+4
-2
lskat/lskatview.cpp
lskat/lskatview.cpp
+10
-6
lskat/lskatview.h
lskat/lskatview.h
+3
-0
lskat/msgdlg.cpp
lskat/msgdlg.cpp
+7
-5
lskat/msgdlg.h
lskat/msgdlg.h
+2
-2
lskat/namedlg.cpp
lskat/namedlg.cpp
+9
-6
lskat/namedlg.h
lskat/namedlg.h
+8
-3
lskat/networkdlg.cpp
lskat/networkdlg.cpp
+7
-5
No files found.
lskat/KChildConnect.cpp
View file @
a9f2de1d
...
...
@@ -18,6 +18,8 @@
#include "KChildConnect.h"
#include "KChildConnect.moc"
//Added by qt3to4:
#include <Q3CString>
KChildConnect
::
KChildConnect
()
:
QObject
(
0
,
0
)
...
...
@@ -40,12 +42,12 @@ bool KChildConnect::SendMsg(KEMessage *msg)
{
QString
sendstring
=
msg
->
ToString
();
// Debug only
if
(
msg
->
HasKey
(
QCString
(
"KLogSendMsg"
)))
if
(
msg
->
HasKey
(
Q
3
CString
(
"KLogSendMsg"
)))
{
char
*
p
;
int
size
;
FILE
*
fp
;
msg
->
GetData
(
QCString
(
"KLogSendMsg"
),
p
,
size
);
msg
->
GetData
(
Q
3
CString
(
"KLogSendMsg"
),
p
,
size
);
if
(
p
&&
(
fp
=
fopen
(
p
,
"a"
))
)
{
fprintf
(
fp
,
"------------------------------------
\n
"
);
...
...
@@ -104,7 +106,7 @@ void KChildConnect::Receive(QString input)
char
*
it
;
for
(
it
=
inputcache
.
first
();
it
!=
0
;
it
=
inputcache
.
next
())
{
msg
->
AddString
(
QCString
(
it
));
msg
->
AddString
(
Q
3
CString
(
it
));
}
// printf("+- CHILDprocess:: GOT MESSAGE::Emmiting slotReceiveMsg\n");
...
...
lskat/KChildConnect.h
View file @
a9f2de1d
...
...
@@ -18,7 +18,7 @@
#define _KCHILDCONNECT_H_
#include <qobject.h>
#include <qstrlist.h>
#include <q
3
strlist.h>
#include "KEMessage.h"
...
...
@@ -27,7 +27,7 @@ class KChildConnect: public QObject
Q_OBJECT
protected:
QStrList
inputcache
;
Q
3
StrList
inputcache
;
bool
input_pending
;
QString
inputbuffer
;
int
ID
;
...
...
lskat/KEInput.h
View file @
a9f2de1d
...
...
@@ -17,10 +17,10 @@
#ifndef _KEINPUT_H_
#define _KEINPUT_H_
#include <qptrlist.h>
#include <q
3
ptrlist.h>
#include <qobject.h>
#include <qtimer.h>
#include <qmemarray.h>
#include <q
3
memarray.h>
#include "KConnectEntry.h"
#include "KRemoteConnect.h"
#include "KProcessConnect.h"
...
...
@@ -40,10 +40,10 @@ class KEInput : public QObject
// KEMessage *mMsg;
QTimer
*
cTimer
;
QPtrList
<
KRemoteConnect
>
remoteList
;
QPtrList
<
KProcessConnect
>
computerList
;
QPtrList
<
KInteractiveConnect
>
interactiveList
;
QMemArray
<
KConnectEntry
>
playerArray
;
Q
3
PtrList
<
KRemoteConnect
>
remoteList
;
Q
3
PtrList
<
KProcessConnect
>
computerList
;
Q
3
PtrList
<
KInteractiveConnect
>
interactiveList
;
Q
3
MemArray
<
KConnectEntry
>
playerArray
;
public:
KEInput
(
QObject
*
parent
=
0
);
...
...
lskat/KEMessage.cpp
View file @
a9f2de1d
...
...
@@ -18,6 +18,9 @@
#include <stdio.h>
#include <stdlib.h>
#include "KEMessage.h"
//Added by qt3to4:
#include <Q3StrList>
#include <Q3CString>
void
KEMessage
::
AddEntry
(
QString
key
,
KMessageEntry
*
entry
)
{
...
...
@@ -129,7 +132,7 @@ QString KEMessage::EntryToString(char *key,KMessageEntry *entry)
int
size
,
i
;
KGM_TYPE
type
;
char
*
data
;
s
=
QCString
(
""
);
s
=
Q
3
CString
(
""
);
if
(
!
entry
)
return
s
;
size
=
entry
->
QuerySize
();
type
=
entry
->
QueryType
();
...
...
@@ -142,7 +145,7 @@ QString KEMessage::EntryToString(char *key,KMessageEntry *entry)
size,KEMESSAGE_SEP,
(int)type,KEMESSAGE_SEP);
*/
tmp
=
QCString
(
key
);
tmp
=
Q
3
CString
(
key
);
s
+=
tmp
;
s
+=
KEMESSAGE_SEP
;
tmp
.
sprintf
(
"%d"
,
size
);
...
...
@@ -226,7 +229,7 @@ QString KEMessage::ToString()
s
=
KEMESSAGE_HEAD
+
KEMESSAGE_CR
;
for
(
it
=
keys
.
first
();
it
!=
0
;
it
=
keys
.
next
())
{
entry
=
dict
.
find
(
QCString
(
it
));
entry
=
dict
.
find
(
Q
3
CString
(
it
));
s
+=
EntryToString
(
it
,
entry
);
}
s
+=
KEMESSAGE_TAIL
+
KEMESSAGE_CR
;
...
...
@@ -287,7 +290,7 @@ uint KEMessage::QueryNumberOfKeys()
{
return
keys
.
count
();
}
QStrList
*
KEMessage
::
QueryKeys
()
Q
3
StrList
*
KEMessage
::
QueryKeys
()
{
return
&
keys
;
}
...
...
@@ -315,10 +318,10 @@ KEMessage &KEMessage::operator=(KEMessage &msg)
// printf("Assigning = KEMessage from %p to %p\n",&msg,this);
for
(
it
=
msg
.
keys
.
first
();
it
!=
0
;
it
=
msg
.
keys
.
next
())
{
entry
=
msg
.
dict
.
find
(
QCString
(
it
));
entry
=
msg
.
dict
.
find
(
Q
3
CString
(
it
));
newentry
=
new
KMessageEntry
;
*
newentry
=*
entry
;
AddEntry
(
QCString
(
it
),
newentry
);
AddEntry
(
Q
3
CString
(
it
),
newentry
);
}
// return *newmsg;
...
...
lskat/KEMessage.h
View file @
a9f2de1d
...
...
@@ -19,25 +19,25 @@
#include <string.h>
#include <qstring.h>
#include <qstrlist.h>
#include <qdict.h>
#include <q
3
strlist.h>
#include <q
3
dict.h>
#include "KMessageEntry.h"
#define KEMESSAGE_HEAD QString(QCString("BEGIN_V1000"))
#define KEMESSAGE_TAIL QString(QCString("END_V1000"))
#define KEMESSAGE_CR QString(QCString("\n"))
#define KEMESSAGE_SEP QString(QCString(":::"))
#define KEMESSAGE_HEAD QString(Q
3
CString("BEGIN_V1000"))
#define KEMESSAGE_TAIL QString(Q
3
CString("END_V1000"))
#define KEMESSAGE_CR QString(Q
3
CString("\n"))
#define KEMESSAGE_SEP QString(Q
3
CString(":::"))
class
KEMessage
{
private:
QStrList
keys
;
QDict
<
KMessageEntry
>
dict
;
Q
3
StrList
keys
;
Q
3
Dict
<
KMessageEntry
>
dict
;
protected:
void
AddEntry
(
QString
key
,
KMessageEntry
*
entry
);
public:
QStrList
*
QueryKeys
();
Q
3
StrList
*
QueryKeys
();
uint
QueryNumberOfKeys
();
void
AddDataType
(
QString
key
,
int
size
,
const
char
*
data
,
KGM_TYPE
type
);
void
AddData
(
QString
key
,
short
data
);
...
...
lskat/KProcessConnect.cpp
View file @
a9f2de1d
...
...
@@ -34,6 +34,8 @@
#include "KProcessConnect.h"
#include "KProcessConnect.moc"
//Added by qt3to4:
#include <Q3CString>
KProcessConnect
::
KProcessConnect
()
:
KChildConnect
()
...
...
@@ -57,13 +59,13 @@ bool KProcessConnect::Init(int id,KEMessage *msg)
SetID
(
id
);
if
(
msg
)
{
if
(
!
msg
->
GetData
(
QCString
(
"ProcessName"
),
p
,
size
))
return
false
;
// no process name
if
(
!
msg
->
GetData
(
Q
3
CString
(
"ProcessName"
),
p
,
size
))
return
false
;
// no process name
processname
=
p
;
/*
printf("Found processname '%s' size %d size=%u\n",
p,size,msg->QueryNumberOfKeys());
*/
msg
->
Remove
(
QCString
(
"ProcessName"
));
msg
->
Remove
(
Q
3
CString
(
"ProcessName"
));
}
if
(
processname
.
length
()
<
1
)
return
false
;
...
...
@@ -179,7 +181,7 @@ bool KProcessConnect::Send(QString str)
bool
result
;
// printf("****** PROCESS:SEND\n");
if
(
!
running
||
!
process
)
return
false
;
if
(
!
str
||
str
.
length
()
<
1
)
return
true
;
// no need to send crap
if
(
str
.
isEmpty
()
)
return
true
;
// no need to send crap
// TODO ..why?
QString
s
;
s
=
KEMESSAGE_CR
+
KEMESSAGE_CR
;
...
...
lskat/KRemoteConnect.cpp
View file @
a9f2de1d
...
...
@@ -38,6 +38,8 @@
#include "KRemoteConnect.h"
#include "KRemoteConnect.moc"
//Added by qt3to4:
#include <Q3CString>
const
char
*
LSKAT_SERVICE
=
"_lskat._tcp"
;
...
...
@@ -78,20 +80,20 @@ bool tryserver;
SetID
(
id
);
if
(
msg
)
{
if
(
msg
->
GetData
(
QCString
(
"Port"
),
prt
))
if
(
msg
->
GetData
(
Q
3
CString
(
"Port"
),
prt
))
{
port
=
(
unsigned
int
)
prt
;
msg
->
Remove
(
QCString
(
"Port"
));
msg
->
Remove
(
Q
3
CString
(
"Port"
));
}
if
(
msg
->
GetData
(
QCString
(
"IP"
),
p
,
size
))
if
(
msg
->
GetData
(
Q
3
CString
(
"IP"
),
p
,
size
))
{
IP
=
QCString
(
p
);
msg
->
Remove
(
QCString
(
"IP"
));
IP
=
Q
3
CString
(
p
);
msg
->
Remove
(
Q
3
CString
(
"IP"
));
}
if
(
msg
->
GetData
(
QCString
(
"Name"
),
p
,
size
))
if
(
msg
->
GetData
(
Q
3
CString
(
"Name"
),
p
,
size
))
{
Name
=
QString
::
fromUtf8
(
p
);
msg
->
Remove
(
QCString
(
"Name"
));
msg
->
Remove
(
Q
3
CString
(
"Name"
));
}
}
/*
...
...
@@ -127,7 +129,7 @@ bool tryserver;
// Send msg if any
if
(
msg
->
QueryNumberOfKeys
()
>
0
)
{
msg
->
AddData
(
QCString
(
"Server"
),(
short
)
QueryID
());
msg
->
AddData
(
Q
3
CString
(
"Server"
),(
short
)
QueryID
());
SendMsg
(
msg
);
}
...
...
@@ -220,7 +222,7 @@ void KRemoteConnect::socketRequest(KSocket *sock)
if
(
bufferMsg
)
{
// Delayed sending of init msg
bufferMsg
->
AddData
(
QCString
(
"Client"
),(
short
)
QueryID
());
bufferMsg
->
AddData
(
Q
3
CString
(
"Client"
),(
short
)
QueryID
());
SendMsg
(
bufferMsg
);
delete
bufferMsg
;
bufferMsg
=
0
;
...
...
@@ -234,7 +236,7 @@ void KRemoteConnect::socketClosed(KSocket *sock)
kSocket
=
0
;
socketStatus
=
KR_INVALID
;
KEMessage
*
msg
=
new
KEMessage
;
msg
->
AddData
(
QCString
(
"ConnectionLost"
),(
short
)
QueryID
());
msg
->
AddData
(
Q
3
CString
(
"ConnectionLost"
),(
short
)
QueryID
());
emit
signalReceiveMsg
(
msg
,
QueryID
());
delete
msg
;
}
...
...
lskat/lskat.cpp
View file @
a9f2de1d
...
...
@@ -16,7 +16,9 @@
***************************************************************************/
// include files for QT
#include <qprogressdialog.h>
#include <q3progressdialog.h>
//Added by qt3to4:
#include <Q3CString>
// include files for KDE
#include <kstandarddirs.h>
...
...
@@ -52,8 +54,8 @@ LSkatApp::LSkatApp() : KMainWindow(0)
// localise data file
QString
file
=
QString
::
fromLatin1
(
"lskat/grafix/t1.png"
);
mGrafix
=
kapp
->
dirs
()
->
findResourceDir
(
"data"
,
file
);
if
(
mGrafix
.
isNull
())
mGrafix
=
QCString
(
"grafix/"
);
else
mGrafix
+=
QCString
(
"lskat/grafix/"
);
if
(
mGrafix
.
isNull
())
mGrafix
=
Q
3
CString
(
"grafix/"
);
else
mGrafix
+=
Q
3
CString
(
"lskat/grafix/"
);
if
(
global_debug
>
3
)
printf
(
"Localised datafile=%s
\n
"
,
mGrafix
.
latin1
());
...
...
@@ -370,18 +372,18 @@ void LSkatApp::slotFileMessage()
{
int
res
;
MsgDlg
*
dlg
=
new
MsgDlg
(
this
,
QCString
(
"Send message..."
));
MsgDlg
*
dlg
=
new
MsgDlg
(
this
,
Q
3
CString
(
"Send message..."
));
res
=
dlg
->
exec
();
if
(
res
==
QDialog
::
Accepted
)
{
QString
s
;
s
=
dlg
->
GetMsg
();
if
(
!
s
||
s
.
length
()
<
1
)
s
=
QCString
(
"..."
);
if
(
!
s
||
s
.
length
()
<
1
)
s
=
Q
3
CString
(
"..."
);
KEMessage
*
msg
=
new
KEMessage
;
// printf("Msg: %s\n",(char *)msg);
msg
->
AddData
(
QCString
(
"Message"
),(
char
*
)(
s
.
latin1
()));
msg
->
AddData
(
Q
3
CString
(
"Message"
),(
char
*
)(
s
.
latin1
()));
if
(
mInput
->
QueryType
(
0
)
==
KG_INPUTTYPE_REMOTE
)
mInput
->
SendMsg
(
msg
,
0
);
if
(
mInput
->
QueryType
(
1
)
==
KG_INPUTTYPE_REMOTE
)
...
...
@@ -403,14 +405,14 @@ void LSkatApp::slotFileEnd()
slotStatusMsg
(
i18n
(
"Game ended...start a new one..."
));
KEMessage
*
msg
=
new
KEMessage
;
msg
->
AddData
(
QCString
(
"EndGame"
),(
short
)
1
);
msg
->
AddData
(
Q
3
CString
(
"EndGame"
),(
short
)
1
);
if
(
mInput
->
QueryType
(
0
)
==
KG_INPUTTYPE_REMOTE
)
mInput
->
SendMsg
(
msg
,
0
);
if
(
mInput
->
QueryType
(
1
)
==
KG_INPUTTYPE_REMOTE
)
mInput
->
SendMsg
(
msg
,
1
);
msg
->
RemoveAll
();
msg
->
AddData
(
QCString
(
"Terminate"
),(
short
)
1
);
msg
->
AddData
(
Q
3
CString
(
"Terminate"
),(
short
)
1
);
if
(
mInput
->
QueryType
(
0
)
==
KG_INPUTTYPE_PROCESS
)
mInput
->
SendMsg
(
msg
,
0
);
if
(
mInput
->
QueryType
(
1
)
==
KG_INPUTTYPE_PROCESS
)
...
...
@@ -503,7 +505,7 @@ void LSkatApp::slotPlayer2(KG_INPUTTYPE i)
void
LSkatApp
::
slotOptionsNames
()
{
NameDlg
*
dlg
=
new
NameDlg
(
this
,
QCString
(
"Enter your name..."
));
NameDlg
*
dlg
=
new
NameDlg
(
this
,
Q
3
CString
(
"Enter your name..."
));
dlg
->
SetNames
(
doc
->
GetName
(
0
),
doc
->
GetName
(
1
));
if
(
dlg
->
exec
()
==
QDialog
::
Accepted
)
{
...
...
@@ -665,13 +667,13 @@ bool LSkatApp::MakeInputDevice(int no)
port
=
doc
->
QueryPort
();
host
=
doc
->
QueryHost
();
Name
=
doc
->
QueryName
();
msg
->
AddData
(
QCString
(
"Port"
),(
short
)
port
);
msg
->
AddData
(
QCString
(
"IP"
),(
char
*
)(
host
.
latin1
()));
msg
->
AddData
(
QCString
(
"Name"
),(
const
char
*
)(
Name
.
utf8
()));
msg
->
AddData
(
Q
3
CString
(
"Port"
),(
short
)
port
);
msg
->
AddData
(
Q
3
CString
(
"IP"
),(
char
*
)(
host
.
latin1
()));
msg
->
AddData
(
Q
3
CString
(
"Name"
),(
const
char
*
)(
Name
.
utf8
()));
res
=
mInput
->
SetInputDevice
(
no
,
type
,
msg
);
if
(
!
res
)
{
QProgressDialog
*
progress
;
Q
3
ProgressDialog
*
progress
;
QString
s
;
int
tim
,
j
;
tim
=
10000
;
...
...
@@ -683,7 +685,7 @@ bool LSkatApp::MakeInputDevice(int no)
{
s
=
i18n
(
"Offering remote connection on port %1..."
).
arg
(
port
);
}
progress
=
new
QProgressDialog
(
s
,
i18n
(
"Abort"
),
tim
,
this
,
0
,
true
);
progress
=
new
Q
3
ProgressDialog
(
s
,
i18n
(
"Abort"
),
tim
,
this
,
0
,
true
);
progress
->
setCaption
(
i18n
(
"Lieutenant Skat"
));
for
(
j
=
0
;
j
<
tim
;
j
++
)
{
...
...
@@ -704,7 +706,7 @@ bool LSkatApp::MakeInputDevice(int no)
{
if
(
global_debug
>
10
)
printf
(
"We want theother one to be client
\n
"
);
msg
->
AddData
(
QCString
(
"Client"
),(
short
)
-
1
);
// force client
msg
->
AddData
(
Q
3
CString
(
"Client"
),(
short
)
-
1
);
// force client
mInput
->
SendMsg
(
msg
,
no
);
}
// resp server
...
...
@@ -712,7 +714,7 @@ bool LSkatApp::MakeInputDevice(int no)
{
if
(
global_debug
>
10
)
printf
(
"We want theother one to be server
\n
"
);
msg
->
AddData
(
QCString
(
"Server"
),(
short
)
-
1
);
// force server
msg
->
AddData
(
Q
3
CString
(
"Server"
),(
short
)
-
1
);
// force server
mInput
->
SendMsg
(
msg
,
no
);
}
}
...
...
@@ -737,7 +739,7 @@ bool LSkatApp::MakeInputDevice(int no)
}
if
(
path
.
isNull
())
return
false
;
msg
=
new
KEMessage
;
msg
->
AddData
(
QCString
(
"ProcessName"
),(
char
*
)(
path
.
latin1
()));
msg
->
AddData
(
Q
3
CString
(
"ProcessName"
),(
char
*
)(
path
.
latin1
()));
// msg->AddData("ProcessName",doc->QueryProcessName());
res
=
mInput
->
SetInputDevice
(
no
,
KG_INPUTTYPE_PROCESS
,
msg
);
delete
msg
;
...
...
@@ -751,7 +753,7 @@ void LSkatApp::OptionsNetwork()
{
int
res
;
NetworkDlg
*
dlg
=
new
NetworkDlg
(
this
,
QCString
(
"Configure a network game..."
));
NetworkDlg
*
dlg
=
new
NetworkDlg
(
this
,
Q
3
CString
(
"Configure a network game..."
));
dlg
->
SetPort
(
doc
->
QueryPort
());
dlg
->
SetHost
(
doc
->
QueryHost
());
dlg
->
SetName
(
doc
->
QueryName
());
...
...
@@ -768,13 +770,13 @@ void LSkatApp::slotPrepareProcessMove(KEMessage *msg)
printf
(
"+++ main should prepare process move
\n
"
);
slotStatusMsg
(
i18n
(
"Waiting for the computer to move..."
));
msg
->
AddData
(
QCString
(
"Hint"
),(
short
)
0
);
msg
->
AddData
(
QCString
(
"Move"
),(
short
)
1
);
msg
->
AddData
(
Q
3
CString
(
"Hint"
),(
short
)
0
);
msg
->
AddData
(
Q
3
CString
(
"Move"
),(
short
)
1
);
if
(
global_debug
>
3
)
printf
(
"PREPARE GAME in processmove
\n
"
);
if
(
global_debug
>
1
)
msg
->
AddData
(
QCString
(
"KLogSendMsg"
),
"process.log"
);
msg
->
AddData
(
Q
3
CString
(
"KLogSendMsg"
),
"process.log"
);
PrepareGame
(
msg
);
}
...
...
@@ -812,15 +814,15 @@ void LSkatApp::slotReceiveInput(KEMessage *msg,int )
bool
remotesend
;
int
size
;
if
(
msg
->
HasKey
(
QCString
(
"Debug"
)))
if
(
msg
->
HasKey
(
Q
3
CString
(
"Debug"
)))
{
char
*
debug
;
msg
->
GetData
(
QCString
(
"Debug"
),
debug
,
size
);
msg
->
GetData
(
Q
3
CString
(
"Debug"
),
debug
,
size
);
printf
(
"Received Debug: %d <%s>
\n
"
,
size
,
debug
);
}
if
(
msg
->
HasKey
(
QCString
(
"ConnectionLost"
)))
if
(
msg
->
HasKey
(
Q
3
CString
(
"ConnectionLost"
)))
{
if
(
msg
->
GetData
(
QCString
(
"ConnectionLost"
),
move
))
if
(
msg
->
GetData
(
Q
3
CString
(
"ConnectionLost"
),
move
))
{
if
(
move
==
0
)
{
...
...
@@ -838,10 +840,10 @@ void LSkatApp::slotReceiveInput(KEMessage *msg,int )
}
}
}
if
(
msg
->
HasKey
(
QCString
(
"Message"
)))
if
(
msg
->
HasKey
(
Q
3
CString
(
"Message"
)))
{
char
*
p
;
if
(
msg
->
GetData
(
QCString
(
"Message"
),
p
,
size
))
if
(
msg
->
GetData
(
Q
3
CString
(
"Message"
),
p
,
size
))
{
message
=
i18n
(
"Message from remote player:
\n
"
)
+
p
;
KMessageBox
::
information
(
this
,
message
);
...
...
@@ -849,18 +851,18 @@ void LSkatApp::slotReceiveInput(KEMessage *msg,int )
printf
(
"MESSAGE **** %s ****
\n
"
,
message
.
latin1
());
}
}
if
(
msg
->
HasKey
(
QCString
(
"EndGame"
)))
if
(
msg
->
HasKey
(
Q
3
CString
(
"EndGame"
)))
{
KEMessage
*
msg2
=
new
KEMessage
;
msg2
->
AddData
(
QCString
(
"Terminate"
),(
short
)
1
);
msg2
->
AddData
(
Q
3
CString
(
"Terminate"
),(
short
)
1
);
if
(
mInput
->
QueryType
(
0
)
==
KG_INPUTTYPE_PROCESS
)
mInput
->
SendMsg
(
msg2
,
0
);
if
(
mInput
->
QueryType
(
1
)
==
KG_INPUTTYPE_PROCESS
)
mInput
->
SendMsg
(
msg2
,
1
);
delete
msg2
;
msg
->
GetData
(
QCString
(
"EndGame"
),
move
);
msg
->
GetData
(
Q
3
CString
(
"EndGame"
),
move
);
message
=
i18n
(
"Remote player ended game..."
);
KMessageBox
::
information
(
this
,
message
);
slotStatusMsg
(
message
);
...
...
@@ -870,19 +872,19 @@ void LSkatApp::slotReceiveInput(KEMessage *msg,int )
slotStatusNames
();
}
if
(
msg
->
HasKey
(
QCString
(
"Move"
)))
if
(
msg
->
HasKey
(
Q
3
CString
(
"Move"
)))
{
slotStatusMsg
(
i18n
(
"Ready"
));
msg
->
GetData
(
QCString
(
"Move"
),
player
);
msg
->
GetData
(
QCString
(
"MoveX"
),
x
);
msg
->
GetData
(
QCString
(
"MoveY"
),
y
);
remotesend
=
msg
->
HasKey
(
QCString
(
"RemoteMove"
));
msg
->
GetData
(
Q
3
CString
(
"Move"
),
player
);
msg
->
GetData
(
Q
3
CString
(
"MoveX"
),
x
);
msg
->
GetData
(
Q
3
CString
(
"MoveY"
),
y
);
remotesend
=
msg
->
HasKey
(
Q
3
CString
(
"RemoteMove"
));
if
(
remotesend
&&
doc
->
IsRemoteSwitch
())
player
=
1
-
player
;
Move
((
int
)
x
,(
int
)
y
,(
int
)
player
,
remotesend
);
}
// Client key is automatically added by message system !!!
if
(
msg
->
HasKey
(
QCString
(
"Client"
)))
if
(
msg
->
HasKey
(
Q
3
CString
(
"Client"
)))
{
if
(
global_debug
>
5
)
printf
(
"We are client and extracting game data now.
\n
"
);
...
...
@@ -895,7 +897,7 @@ void LSkatApp::slotReceiveInput(KEMessage *msg,int )
mInput
->
Next
(
doc
->
GetStartPlayer
());
}
// Server key is automatically added by message system !!!
if
(
msg
->
HasKey
(
QCString
(
"Server"
)))
if
(
msg
->
HasKey
(
Q
3
CString
(
"Server"
)))
{
if
(
global_debug
>
5
)
printf
(
"We are server now.
\n
"
);
...
...
@@ -969,10 +971,10 @@ void LSkatApp::Move(int x,int y,int player,bool remote)
{
msg
=
new
KEMessage
;
if
(
doc
->
IsRemoteSwitch
())
player
=
1
-
player
;
msg
->
AddData
(
QCString
(
"Move"
),(
short
)
player
);
msg
->
AddData
(
QCString
(
"MoveX"
),(
short
)
x
);
msg
->
AddData
(
QCString
(
"MoveY"
),(
short
)
y
);
msg
->
AddData
(
QCString
(
"RemoteMove"
),(
short
)
1
);
msg
->
AddData
(
Q
3
CString
(
"Move"
),(
short
)
player
);
msg
->
AddData
(
Q
3
CString
(
"MoveX"
),(
short
)
x
);
msg
->
AddData
(
Q
3
CString
(
"MoveY"
),(
short
)
y
);
msg
->
AddData
(
Q
3
CString
(
"RemoteMove"
),(
short
)
1
);
if
(
mInput
->
QueryType
(
0
)
==
KG_INPUTTYPE_REMOTE
)
mInput
->
SendMsg
(
msg
,
0
);
if
(
mInput
->
QueryType
(
1
)
==
KG_INPUTTYPE_REMOTE
)
...
...
@@ -1004,22 +1006,22 @@ void LSkatApp::PrepareGame(KEMessage *msg)
if
(
!
msg
)
return
;
msg
->
AddData
(
QCString
(
"Cards"
),(
char
*
)
doc
->
GetCardP
(),
NO_OF_CARDS
*
sizeof
(
int
));
msg
->
AddData
(
QCString
(
"Startplayer"
),(
short
)
doc
->
GetStartPlayer
());
msg
->
AddData
(
QCString
(
"CurrentPlayer"
),(
short
)
doc
->
GetCurrentPlayer
());
msg
->
AddData
(
Q
3
CString
(
"Cards"
),(
char
*
)
doc
->
GetCardP
(),
NO_OF_CARDS
*
sizeof
(
int
));
msg
->
AddData
(
Q
3
CString
(
"Startplayer"
),(
short
)
doc
->
GetStartPlayer
());
msg
->
AddData
(
Q
3
CString
(
"CurrentPlayer"
),(
short
)
doc
->
GetCurrentPlayer
());
if
(
doc
->
GetPlayedBy
(
0
)
==
KG_INPUTTYPE_REMOTE
)
msg
->
AddData
(
QCString
(
"RemoteIs"
),(
short
)
0
);
msg
->
AddData
(
Q
3
CString
(
"RemoteIs"
),(
short
)
0
);
else
if
(
doc
->
GetPlayedBy
(
1
)
==
KG_INPUTTYPE_REMOTE
)
msg
->
AddData
(
QCString
(
"RemoteIs"
),(
short
)
1
);
msg
->
AddData
(
QCString
(
"Trump"
),(
short
)
doc
->
GetTrump
());
msg
->
AddData
(
Q
3
CString
(
"RemoteIs"
),(
short
)
1
);
msg
->
AddData
(
Q
3
CString
(
"Trump"
),(
short
)
doc
->
GetTrump
());
// For computer player
// -1 or the current played card
msg
->
AddData
(
QCString
(
"CurrentMove"
),(
short
)
doc
->
GetMove
(
doc
->
GetStartPlayer
()));
msg
->
AddData
(
QCString
(
"Height"
),(
char
*
)
doc
->
GetCardHeightP
(),
NO_OF_CARDS
/
2
*
sizeof
(
int
));
msg
->
AddData
(
QCString
(
"No"
),(
short
)
doc
->
GetMoveNo
());
msg
->
AddData
(
QCString
(
"Sc1"
),(
short
)
doc
->
GetScore
(
0
));
msg
->
AddData
(
QCString
(
"Sc2"
),(
short
)
doc
->
GetScore
(
1
));
msg
->
AddData
(
QCString
(
"Level"
),(
short
)
doc
->
GetComputerLevel
());
msg
->
AddData
(
Q
3
CString
(
"CurrentMove"
),(
short
)
doc
->
GetMove
(
doc
->
GetStartPlayer
()));
msg
->
AddData
(
Q
3
CString
(
"Height"
),(
char
*
)
doc
->
GetCardHeightP
(),
NO_OF_CARDS
/
2
*
sizeof
(
int
));
msg
->
AddData
(
Q
3
CString
(
"No"
),(
short
)
doc
->
GetMoveNo
());
msg
->
AddData
(
Q
3
CString
(
"Sc1"
),(
short
)
doc
->
GetScore
(
0
));
msg
->
AddData
(
Q
3
CString
(
"Sc2"
),(
short
)
doc
->
GetScore
(
1
));
msg
->
AddData
(
Q
3
CString
(
"Level"
),(
short
)
doc
->
GetComputerLevel
());
}
void
LSkatApp
::
ExtractGame
(
KEMessage
*
msg
)
...
...
@@ -1029,7 +1031,7 @@ void LSkatApp::ExtractGame(KEMessage *msg)
// Do we have to switch players?
bool
switchit
;
short
remote
;
msg
->
GetData
(
QCString
(
"RemoteIs"
),
remote
);
msg
->
GetData
(
Q
3
CString
(
"RemoteIs"
),
remote
);
if
(
doc
->
GetPlayedBy
(
remote
)
==
KG_INPUTTYPE_REMOTE
)
switchit
=
true
;
else
switchit
=
false
;
...
...
@@ -1038,10 +1040,10 @@ void LSkatApp::ExtractGame(KEMessage *msg)
int
*
cards
;
char
*
p
;
short
trump
;
msg
->
GetData
(
QCString
(
"Startplayer"
),
start
);
msg
->
GetData
(
QCString
(
"Cards"
),
p
,
size
);
msg
->
GetData
(
Q
3
CString
(
"Startplayer"
),
start
);
msg
->
GetData
(
Q
3
CString
(
"Cards"
),
p
,
size
);
cards
=
(
int
*
)
p
;
msg
->
GetData
(
QCString
(
"Trump"
),
trump
);
msg
->
GetData
(
Q
3
CString
(
"Trump"
),
trump
);
if
(
size
!=
NO_OF_CARDS
*
sizeof
(
int
))
{
printf
(
"Error: Transmission of cards failed..wrong sizes
\n
"
);
...
...
lskat/lskat.h
View file @
a9f2de1d
...
...
@@ -24,7 +24,7 @@
#endif
// include files for Qt
#include <qstrlist.h>
#include <q
3
strlist.h>
// include files for KDE
#include <kapplication.h>
...
...
@@ -200,7 +200,7 @@ protected: // Protected attributes
private:
/** contains the recently used filenames */
QStrList
recentFiles
;
Q
3
StrList
recentFiles
;
/** the configuration object of the application */
KConfig
*
config
;
...
...
lskat/lskatdoc.cpp
View file @
a9f2de1d
...
...
@@ -18,6 +18,9 @@
// include files for Qt
#include <qdir.h>
#include <qfileinfo.h>
//Added by qt3to4:
#include <Q3CString>
#include <Q3PtrList>
#include <time.h>
#include <unistd.h>
#include <stdlib.h>
...
...
@@ -34,14 +37,14 @@
#include "lskatview.h"
#include <kcarddialog.h>
QPtrList
<
LSkatView
>
*
LSkatDoc
::
pViewList
=
0L
;
Q
3
PtrList
<
LSkatView
>
*
LSkatDoc
::
pViewList
=
0L
;
LSkatDoc
::
LSkatDoc
(
QWidget
*
parent
,
const
char
*
name
)
:
QObject
(
parent
,
name
)
{
int
i
;
if
(
!
pViewList
)
{
pViewList
=
new
QPtrList
<
LSkatView
>
();
pViewList
=
new
Q
3
PtrList
<
LSkatView
>
();
}
pViewList
->
setAutoDelete
(
true
);
...
...
@@ -744,7 +747,7 @@ void LSkatDoc::ReadConfig(KConfig *config)
config
->
setGroup
(
"Par