1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
|
/****************************************************************
**
** Attal : Lords of Doom
**
** dataTheme.cpp
** class for gathering all informations about theme (data part)
**
** Version : $Id: dataTheme.cpp,v 1.7 2004/08/07 10:08:45 audoux Exp $
**
** Author(s) : Pascal Audoux
**
** Date : 03/06/2001
**
** Licence :
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2, or (at your option)
** any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
****************************************************************/
#include "dataTheme.h"
// generic include files
// include files for QT
// application specific include files
DataTheme DataTheme;
void indentation( QTextStream * ts, int num )
{
for( int i = 0; i < num; i++ ) {
(*ts) << "\t";
}
}
//
// ----- DataTheme -----
//
DataTheme::DataTheme()
{
_isLoaded = false;
}
bool DataTheme::init()
{
_isLoaded = general.init();
_isLoaded = _isLoaded && artefacts.init();
_isLoaded = _isLoaded && teams.init();
_isLoaded = _isLoaded && resources.init();
_isLoaded = _isLoaded && decorations.init();
_isLoaded = _isLoaded && creatures.init();
_isLoaded = _isLoaded && techList.init();
_isLoaded = _isLoaded && lordCategories.init();
_isLoaded = _isLoaded && lords.init();
_isLoaded = _isLoaded && bases.init();
_isLoaded = _isLoaded && buildings.init();
_isLoaded = _isLoaded && tiles.init();
_isLoaded = _isLoaded && specifications.init();
_isLoaded = _isLoaded && machines.init();
_isLoaded = _isLoaded && lordExperience.init();
_isLoaded = _isLoaded && _category.init();
return isLoaded();
}
void DataTheme::save()
{
general.save();
artefacts.save();
teams.save();
resources.save();
decorations.save();
creatures.save();
techList.save();
lordCategories.save();
lords.save();
bases.save();
buildings.save();
tiles.save();
specifications.save();
machines.save();
lordExperience.save();
_category.save();
}
void DataTheme::clear()
{
general.clear();
artefacts.clear();
teams.clear();
resources.clear();
decorations.clear();
creatures.clear();
techList.clearing();
lordCategories.clear();
lords.clear();
bases.clear();
buildings.save();
tiles.clear();
specifications.clear();
machines.clear();
lordExperience.clear();
_category.clear();
}
QString DataTheme::getCategoryName( uint categ )
{
QString ret = _category.getCategoryName( categ );
return ret;
}
uint DataTheme::computeCategory( int nb )
{
uint ret = _category.computeCategory( nb );
return ret;
}
QString DataTheme::computeCategoryName( int nb )
{
QString ret = _category.getCategoryName( nb );
return ret;
}
uint DataTheme::getRandomInCategory( uchar categ )
{
uint ret = _category.getRandomInCategory(categ);
return ret;
}
uint DataTheme::getLordCategory( LordCategoryModel * category )
{
uint ret = 0;
uint nbCat = lordCategories.count();
for( uint i = 0; i < nbCat; i++ ) {
if( category == lordCategories.at( i ) ) {
ret = i;
break;
}
}
return ret;
}
|