-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsalle.cpp
More file actions
32 lines (24 loc) · 856 Bytes
/
salle.cpp
File metadata and controls
32 lines (24 loc) · 856 Bytes
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
#include "salle.h"
Salle::Salle(Coord _haut_gauche, Coord _bas_droite, std::vector<Coord>& _portes)
: haut_gauche(_haut_gauche), bas_droite(_bas_droite), portes(_portes)
{
centre.x = (haut_gauche.x + bas_droite.x ) / 2;
centre.y = (haut_gauche.y + bas_droite.y ) / 2;
}
void Salle::DessinerSalle(Carte& carte)
{
for (int i = haut_gauche.x ; i <= bas_droite.x ; i++ )
carte.tableau[haut_gauche.y][i] = 1;
for (int i = haut_gauche.x ; i <= bas_droite.x ; i++ )
carte.tableau[bas_droite.y][i] = 1;
for (int i = haut_gauche.y ; i <= bas_droite.y ; i++ )
carte.tableau[i][haut_gauche.x] = 1;
for (int i = haut_gauche.y ; i <= bas_droite.y ; i++ )
carte.tableau[i][bas_droite.x] = 1;
for ( int i = 0 ; i < portes.size() ; ++i )
{
int x = portes[i].x;
int y = portes[i].y;
carte.tableau[y][x] = 0;
}
}