Skip to content

Commit be85a52

Browse files
author
incorporado
committed
Recibe la matriz como char*
1 parent 3e69389 commit be85a52

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

TP2/src/Cliente/vista/VistaJuego.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ bool VistaJuego::iniciar(SocketCliente* pSocket,ControladorEvento* evento,std::s
6363
}
6464

6565
void VistaJuego::cargarMatriz(){
66+
this->estadoNivel->setMatriz(this->vistaFactory.getMatriz());
6667
/*std::string matriz = this->vistaFactory.getMatriz();
6768
for (int i = 0; i < this->vistaNivel.getAltoDeNivelEnTiles(); i++){
6869
for (int j = 0; j < this->vistaNivel.getAnchoDeNivelEnTiles(); j++){

TP2/src/Servidor/modelo/EstadoNivel.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,12 @@ string EstadoNivel::getMatriz(){
6969
std::string matriz(this->_nivel,_alto*_ancho);
7070
return matriz;
7171
}
72+
73+
void EstadoNivel::setMatriz(std::string mapa){
74+
for (int i = 0; i < this->_alto; i++){
75+
for (int j = 0; j < this->_ancho; j++){
76+
int fila = i * this->_ancho;
77+
this->_nivel[j+ fila] = mapa[fila+j];
78+
}
79+
}
80+
}

TP2/src/Servidor/modelo/EstadoNivel.h

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ class EstadoNivel {
2424

2525
void visitar(int x, int y);
2626

27+
void setMatriz(std::string);
28+
2729
char visibilidad(int x, int y);
2830

2931
std::string getMatriz();

0 commit comments

Comments
 (0)