Commit a2abc8ab authored by Laurent Montel's avatar Laurent Montel 😁

Compile/link

svn path=/branches/work/kde4/kdegames/lskat/; revision=421249
parent 3b77e526
......@@ -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(Q3CString("KLogSendMsg")))
{
char *p;
int size;
FILE *fp;
msg->GetData(QCString("KLogSendMsg"),p,size);
msg->GetData(Q3CString("KLogSendMsg"),p,size);
if (p && (fp=fopen(p,"a")) )
{
fprintf(fp,"------------------------------------\n");
......@@ -60,7 +62,7 @@ bool KChildConnect::SendMsg(KEMessage *msg)
// Send string to parent
bool KChildConnect::Send(QString str)
{
if (!str || str.length()<1) return true; // no need to send crap
if (!str.isNull() || str.length()<1) return true; // no need to send crap
printf("%s",str.latin1());
fflush(stdout);
return true;
......@@ -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(Q3CString(it));
}
// printf("+- CHILDprocess:: GOT MESSAGE::Emmiting slotReceiveMsg\n");
......
......@@ -10,7 +10,7 @@
#define _KCHILDCONNECT_H_
#include <qobject.h>
#include <qstrlist.h>
#include <q3strlist.h>
#include "KEMessage.h"
......@@ -19,7 +19,7 @@ class KChildConnect: public QObject
Q_OBJECT
protected:
QStrList inputcache;
Q3StrList inputcache;
bool input_pending;
QString inputbuffer;
int ID;
......
......@@ -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=Q3CString("");
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=Q3CString(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(Q3CString(it));
s+=EntryToString(it,entry);
}
s+=KEMESSAGE_TAIL+KEMESSAGE_CR;
......@@ -239,7 +242,7 @@ bool KEMessage::AddString(QString s)
QString key;
KMessageEntry *entry=new KMessageEntry;
key=StringToEntry(s,entry);
if (!key) return false;
if (!key.isNull()) return false;
AddEntry(key,entry);
return true;
}
......@@ -287,7 +290,7 @@ uint KEMessage::QueryNumberOfKeys()
{
return keys.count();
}
QStrList *KEMessage::QueryKeys()
Q3StrList *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(Q3CString(it));
newentry=new KMessageEntry;
*newentry=*entry;
AddEntry(QCString(it),newentry);
AddEntry(Q3CString(it),newentry);
}
// return *newmsg;
......
......@@ -19,25 +19,25 @@
#include <string.h>
#include <qstring.h>
#include <qstrlist.h>
#include <qdict.h>
#include <q3strlist.h>
#include <q3dict.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(Q3CString("BEGIN_V1000"))
#define KEMESSAGE_TAIL QString(Q3CString("END_V1000"))
#define KEMESSAGE_CR QString(Q3CString("\n"))
#define KEMESSAGE_SEP QString(Q3CString(":::"))
class KEMessage
{
private:
QStrList keys;
QDict<KMessageEntry> dict;
Q3StrList keys;
Q3Dict<KMessageEntry> dict;
protected:
void AddEntry(QString key,KMessageEntry *entry);
public:
QStrList *QueryKeys();
Q3StrList *QueryKeys();
uint QueryNumberOfKeys();
void AddDataType(QString key,int size,const char *data,KGM_TYPE type);
void AddData(QString key,short data);
......
......@@ -10,7 +10,7 @@
#include <stdlib.h>
#include <string.h>
#include <qstring.h>
#include <Q3CString>
#include "KInputChildProcess.h"
#include "KInputChildProcess.moc"
......
......@@ -21,6 +21,8 @@
#include <string.h>
#include <stdlib.h>
#include "lskatproc.h"
//Added by qt3to4:
#include <Q3CString>
#define MIN_TIME 1000 // usec
......@@ -379,17 +381,17 @@ short x,y;
SendDebug("Receiv Msg");
// end of process
if (msg->HasKey(QCString("Terminate")))
if (msg->HasKey(Q3CString("Terminate")))
{
Terminate();
}
// Init of process
if (msg->HasKey(QCString("Init")))
if (msg->HasKey(Q3CString("Init")))
{
// No init necessary
}
// Make a move
if (msg->HasKey(QCString("Cards")))
if (msg->HasKey(Q3CString("Cards")))
{
SendDebug("Process HasKey(Cards)");
// new game object
......@@ -422,9 +424,9 @@ short x,y;
// report move
msg->RemoveAll();
msg->AddData(QCString("Move"),game.currentplayer);
msg->AddData(QCString("MoveX"),x);
msg->AddData(QCString("MoveY"),y);
msg->AddData(Q3CString("Move"),game.currentplayer);
msg->AddData(Q3CString("MoveX"),x);
msg->AddData(Q3CString("MoveY"),y);
//timee=time(0);
// Sleep a minimum amount to slow down moves
......@@ -451,29 +453,29 @@ int lgame::ExtractGame(KEMessage *msg)
char *p;
int size;
msg->GetData(QCString("Startplayer"),startplayer);
msg->GetData(QCString("CurrentPlayer"),currentplayer);
msg->GetData(QCString("Cards"),p,size);
msg->GetData(QCString("Level"),level);
msg->GetData(Q3CString("Startplayer"),startplayer);
msg->GetData(Q3CString("CurrentPlayer"),currentplayer);
msg->GetData(Q3CString("Cards"),p,size);
msg->GetData(Q3CString("Level"),level);
level--; // start with level 0
for (i=0;i<NO_OF_CARDS;i++)
{
card[i]=((int *)p)[i];
}
msg->GetData(QCString("Height"),p,size);
msg->GetData(Q3CString("Height"),p,size);
for (i=0;i<NO_OF_TILES;i++)
{
cardheight[i]=((int *)p)[i];
}
msg->GetData(QCString("Trump"),tmp);
msg->GetData(Q3CString("Trump"),tmp);
trump=(CCOLOUR)tmp;
short mm;
msg->GetData(QCString("CurrentMove"),mm);
msg->GetData(Q3CString("CurrentMove"),mm);
curmove[1-currentplayer]=(int)mm;
curmove[currentplayer]=-1;
msg->GetData(QCString("No"),movenumber);
msg->GetData(QCString("Sc1"),score[0]);
msg->GetData(QCString("Sc2"),score[1]);
msg->GetData(Q3CString("No"),movenumber);
msg->GetData(Q3CString("Sc1"),score[0]);
msg->GetData(Q3CString("Sc2"),score[1]);
return 1;
}
......@@ -586,7 +588,7 @@ int lskatproc::GetComputerMove(lgame game,short &x,short &y,int rek)
void lskatproc::SendDebug(const char *s)
{
KEMessage *msg=new KEMessage;
msg->AddData(QCString("Debug"),s);
msg->AddData(Q3CString("Debug"),s);
// msg->AddData("KLogSendMsg","debug.log");
// DEBUG
// SendMsg(msg);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment