2
This file is part of the KDE games library
3
Copyright (C) 2001 Andreas Beckermann (b_mann@gmx.de)
4
Copyright (C) 2001 Martin Heni (kde at heni-online.de)
6
This library is free software; you can redistribute it and/or
7
modify it under the terms of the GNU Library General Public
8
License version 2 as published by the Free Software Foundation.
10
This library is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
Library General Public License for more details.
15
You should have received a copy of the GNU Library General Public License
16
along with this library; see the file COPYING.LIB. If not, write to
17
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
Boston, MA 02110-1301, USA.
21
#include "kgameerror.h"
22
#include "kgamemessage.h"
26
QByteArray KGameError::errVersion(int remoteVersion)
29
QDataStream s(&b, QIODevice::WriteOnly);
30
s << (qint32)KGameMessage::version();
31
s << (qint32)remoteVersion;
35
QByteArray KGameError::errCookie(int localCookie, int remoteCookie)
38
QDataStream s(&b, QIODevice::WriteOnly);
39
s << (qint32)localCookie;
40
s << (qint32)remoteCookie;
44
QString KGameError::errorText(int errorCode, const QByteArray& message)
46
QDataStream s(message);
47
return errorText(errorCode, s);
50
QString KGameError::errorText(int errorCode, QDataStream& s)
60
text = i18n("Cookie mismatch!\nExpected Cookie: %1\nReceived Cookie: %2", cookie1, cookie2);
69
text = i18n("KGame Version mismatch!\nExpected Version: %1\nReceived Version: %2\n", version1, version2);
73
text = i18n("Unknown error code %1", errorCode);