QTfrontend/ammoSchemeModel.cpp
changeset 1968 f32b18c5d495
parent 1940 bbdca883b5f9
child 1974 77a9416ceead
equal deleted inserted replaced
1967:213d368a002f 1968:f32b18c5d495
    39 		<< QVariant(5)             // case prob      13
    39 		<< QVariant(5)             // case prob      13
    40 		;
    40 		;
    41 
    41 
    42 AmmoSchemeModel::AmmoSchemeModel(QObject* parent, const QString & fileName) :
    42 AmmoSchemeModel::AmmoSchemeModel(QObject* parent, const QString & fileName) :
    43 	QAbstractTableModel(parent),
    43 	QAbstractTableModel(parent),
    44 	numberOfDefaultSchemes(2),
    44 	numberOfDefaultSchemes(3),
    45 	fileConfig(fileName, QSettings::IniFormat)
    45 	fileConfig(fileName, QSettings::IniFormat)
    46 {
    46 {
    47 	QStringList predefSchemesNames;
    47 	QStringList predefSchemesNames;
    48 	predefSchemesNames
    48 	predefSchemesNames
    49 		<< "Default"
    49 		<< "Default"
    50 		<< "Pro mode";
    50 		<< "Pro mode"
       
    51 		<< "Shoppa";
    51 	
    52 	
    52 	spNames = QStringList()
    53 	spNames = QStringList()
    53 		<< "name"             //  0
    54 		<< "name"             //  0
    54 		<< "fortsmode"        //  1
    55 		<< "fortsmode"        //  1
    55 		<< "divteams"         //  2
    56 		<< "divteams"         //  2
    66 		<< "caseprobability"  // 13
    67 		<< "caseprobability"  // 13
    67 		;
    68 		;
    68 
    69 
    69 	QList<QVariant> proMode;
    70 	QList<QVariant> proMode;
    70 	proMode
    71 	proMode
    71 		<< QVariant("Pro mode")    // name           0
    72 		<< predefSchemesNames[1]   // name           0
    72 		<< QVariant(false)         // fortsmode      1
    73 		<< QVariant(false)         // fortsmode      1
    73 		<< QVariant(false)         // team divide    2
    74 		<< QVariant(false)         // team divide    2
    74 		<< QVariant(false)         // solid land     3
    75 		<< QVariant(false)         // solid land     3
    75 		<< QVariant(false)         // border         4
    76 		<< QVariant(false)         // border         4
    76 		<< QVariant(false)         // low gravity    5
    77 		<< QVariant(false)         // low gravity    5
    82 		<< QVariant(100)           // init health    11
    83 		<< QVariant(100)           // init health    11
    83 		<< QVariant(15)            // sudden death   12
    84 		<< QVariant(15)            // sudden death   12
    84 		<< QVariant(0)             // case prob      13
    85 		<< QVariant(0)             // case prob      13
    85 		;
    86 		;
    86 
    87 
       
    88 	QList<QVariant> shoppa;
       
    89 	shoppa
       
    90 		<< predefSchemesNames[2]   // name           0
       
    91 		<< QVariant(false)         // fortsmode      1
       
    92 		<< QVariant(false)         // team divide    2
       
    93 		<< QVariant(true)          // solid land     3
       
    94 		<< QVariant(true)          // border         4
       
    95 		<< QVariant(false)         // low gravity    5
       
    96 		<< QVariant(false)         // laser sight    6
       
    97 		<< QVariant(false)         // invulnerable   7
       
    98 		<< QVariant(false)         // add mines      8
       
    99 		<< QVariant(100)           // damage modfier 9
       
   100 		<< QVariant(30)            // turn time      10
       
   101 		<< QVariant(100)           // init health    11
       
   102 		<< QVariant(50)            // sudden death   12
       
   103 		<< QVariant(0)             // case prob      13
       
   104 		;
       
   105 
    87 	schemes.append(defaultScheme);
   106 	schemes.append(defaultScheme);
    88 	schemes.append(proMode);
   107 	schemes.append(proMode);
       
   108 	schemes.append(shoppa);
    89 
   109 
    90 
   110 
    91 	int size = fileConfig.beginReadArray("schemes");
   111 	int size = fileConfig.beginReadArray("schemes");
    92 	for (int i = 0; i < size; ++i) {
   112 	for (int i = 0; i < size; ++i) {
    93 		fileConfig.setArrayIndex(i);
   113 		fileConfig.setArrayIndex(i);