-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMap.cpp
58 lines (50 loc) · 1.44 KB
/
Map.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
46
47
48
49
50
51
52
53
54
55
56
57
#include <QList>
#include <QPolygonF>
#include <math.h>
#include "GameInfo.h"
#include "Map.h"
GameMap::GameMap(GameInfo *info)
{
Info = info;
Size.setRect(0.0, 0.0, 3000.0,3000.0); /// Óêàçàòü ðàçìåðû îáëàñòè (âñåé êàðòû)
Buildings = new QList<QPolygonF *>;
Roads = new QList<QPolygonF *>;
Waters = new QList<QPolygonF *>;
/// Çäåñü äîëæíà áûòü èíèöèàëèçàöèÿ ìàòðèöû çàãðóæåííûõ ñåêòîðîâ êàðòû
LoadLocation();
}
GameMap::~GameMap()
{
}
void GameMap::LoadLocation(QRectF *Location)
{
if (!Location)
{ // Çàãðóçêà âñåé êàðòû
/***/
for (int j=0; j<3; j++)
for (int i=0; i<4; i++)
{
QPolygonF *poly = new QPolygonF;
(*poly) << QPointF(200.0+200.0*i, 200.0+100.0*j) << QPointF(375.0+200.0*i, 200.0+100.0*j)
<< QPointF(375.0+200.0*i, 275.0+100.0*j) << QPointF(200.0+200.0*i, 275.0+100.0*j);
Buildings->append(poly);
}
{
QPolygonF *poly = new QPolygonF;
(*poly) << QPointF(0.0, 0.0) << QPointF(1000.0, 2000.0) << QPointF(3000.0, 3000.0)
<< QPointF(3000.0, 3070.0) << QPointF(1000.0, 2070.0) << QPointF(0.0, 70.0);
Roads->append(poly);
}
{
QPolygonF *poly = new QPolygonF;
(*poly) << QPointF(0.0, 2930.0) << QPointF(2000.0, 2300.0) << QPointF(3000.0, 0.0)
<< QPointF(3000.0, 70.0) << QPointF(2000.0, 2370.0) << QPointF(0.0, 3000.0);
Waters->append(poly);
}
/***/
}
else
{
/// Çäåñü äîëæíà áûòü çàãðóçêà òðåáóåìîé ÷àñòè êàðòû
}
}