forked from hamidrezakks/ssl-visual-planner
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplayoffplansql.h
82 lines (66 loc) · 1.95 KB
/
playoffplansql.h
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
#ifndef PLAYOFFPLANSQL_H
#define PLAYOFFPLANSQL_H
#include "base.h"
#include <QtSql/QSql>
#include <QtSql/QSqlDatabase>
#include <QtSql/QSqlQuery>
#include <QList>
#include <QDebug>
#include <QMessageBox>
#include <QtSql/QSqlError>
struct planStruct {
QList<PlayOffRobot> AgentPlan[6];
POMODE planMode;
int agentSize;
POInitPos initPos;
QString tags;
unsigned int chance;
double lastDist;
};
struct planMData {
POMODE planMode;
int agentSize;
QString tags;
unsigned int chance;
double lastDist;
};
class playOffPlanSQL
{
private:
public:
playOffPlanSQL();
~playOffPlanSQL();
bool changeSQLDir(QString directory);
void savePlan();
int loadPlan();
int getPlanSize();
void loadEachPlan(planStruct &_plan, QString _name);
bool loadSQLtoStruct(QSqlQuery _query, int _rIndex, PlayOffRobot &temp);
QList<planStruct> planList;
int addPlan(QList<PlayOffRobot> tPlan[6],
POInitPos tInitPos,
POMODE tPOMode,
QString tags,
int agentSize,
int itemId,
unsigned int _chance = 1,
double _lastDist = 1.5);
int findMaxSteps(planStruct &_plan);
void addEachPlanToSql(planStruct _plan, QString tName);
void addStepToSql(QString tName, int tid,
QList<PlayOffRobot> &tA1,
QList<PlayOffRobot> &tA2,
QList<PlayOffRobot> &tA3,
QList<PlayOffRobot> &tA4,
QList<PlayOffRobot> &tA5,
QList<PlayOffRobot> &tA6);
QString convertStructToSQLCmd(int _agentId, PlayOffRobot tStep);
QString convertEmptyStructToSQLCmd();
void insertPlanToQList(QList<PlayOffRobot> _planList[6], planMData &mData, int index);
QSqlDatabase planSQL;
void disableSQL();
void enableSQL();
void cleanPlans();
void removePlan(int index);
};
#endif // PLAYOFFPLANSQL_H