Fix debian/rules to build in BUILD/ dir.
[tagua/yd.git] / src / icsgamedata.cpp
blobb735bdab5b7bbf61194233fe2a19cddf57ad9899
1 /*
2 Copyright (c) 2006-2008 Paolo Capriotti <p.capriotti@gmail.com>
3 (c) 2006-2007 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.
9 */
11 #include "icsgamedata.h"
12 #include <KDebug>
13 #include "tagua.h"
14 #include "gameinfo.h"
15 #include "variants.h"
17 ICSGameData::ICSGameData()
18 : index(0) {
19 setType("");
22 ICSGameData::ICSGameData(int index, const QString& type)
23 : index(index) {
24 setType(type);
27 void ICSGameData::setType(const QString& type) {
28 variant = Variants::instance().get(GameInfo::variantCode(type));
29 if (!variant) {
30 kError() << "No variant corresponding to " << type;
32 else if (!(icsapi = variant->icsAPI())) {
33 // There's no ICSAPI in this variant.
34 // This means we cannot use it for ICS stuff, so we
35 // fall back to the dummy variant.
36 // TODO