-
Notifications
You must be signed in to change notification settings - Fork 0
/
levelliste.cpp
45 lines (38 loc) · 889 Bytes
/
levelliste.cpp
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
#include "levelliste.h"
Levelliste::Levelliste(Levelliste *levelList)
{
*this = *levelList;
}
Levelliste::Levelliste(QVector<QVariant> model)
{
// init QVector
this->list = new QVector<Level*>();
// generate level and add to list
// highscore has 7 propertys so i = i + 7
if(model.size()>1){
for (int i = 0; i<model.size(); i=i+6)
{
// create new Level
Level* temp = new Level(model.mid(i, 6));
// add pointer to list
this->levelEintragen(temp);
}
}
}
int Levelliste::levelZaehlen()
{
return this->list->size();
}
Level* Levelliste::levelHolen(int index)
{
return this->list->at(index);
}
void Levelliste::levelEintragen(Level* l)
{
this->list->append(l);
}
void Levelliste::levelEntfernen(int index)
{
delete this->list->at(index);
this->list->remove(index);
}