2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@gmail.com>
3 (c) 2006 Maurizio Monge <maurizio.monge@kdemail.net>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
14 GameInfo::GameInfo(const Player
& white
, const Player
& black
,
15 const QString
& rated
, const QString
& type
,
16 int time
, int increment
)
22 , m_increment(increment
)
24 m_variant
= variantCode(m_type
);
27 GameInfo::GameInfo(QRegExp
& pattern
, int offset
)
28 : m_white(Player(pattern
.cap(offset
), pattern
.cap(offset
+ 1).toInt()))
29 , m_black(Player(pattern
.cap(offset
+ 2), pattern
.cap(offset
+ 3).toInt()))
30 , m_rated(pattern
.cap(offset
+ 4))
31 , m_type(pattern
.cap(offset
+ 5))
32 , m_time(pattern
.cap(offset
+ 6).toInt())
33 , m_increment(pattern
.cap(offset
+ 7).toInt())
35 m_variant
= variantCode(m_type
);
38 QString
GameInfo::variantCode(const QString
& type
) {
39 if (type
== "blitz" || type
== "standard" || type
== "lightning"
40 || type
== "untimed" || type
== "chess")
42 else if (type
== "atomic")
44 else if (type
== "crazyhouse")