forked from jaildesigner-jailgames/jaildoctors_dilemma
Mensajes de consola opcionales
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
#include <sstream>
|
||||
|
||||
// Carga las variables y texturas desde un fichero de mapa de tiles
|
||||
std::vector<int> loadRoomTileFile(std::string file_path)
|
||||
std::vector<int> loadRoomTileFile(std::string file_path, bool verbose)
|
||||
{
|
||||
std::vector<int> tileMapFile;
|
||||
const std::string filename = file_path.substr(file_path.find_last_of("\\/") + 1);
|
||||
@@ -37,20 +37,26 @@ std::vector<int> loadRoomTileFile(std::string file_path)
|
||||
}
|
||||
|
||||
// Cierra el fichero
|
||||
std::cout << "TileMap loaded: " << filename.c_str() << std::endl;
|
||||
if (verbose)
|
||||
{
|
||||
std::cout << "TileMap loaded: " << filename.c_str() << std::endl;
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
|
||||
else
|
||||
{ // El fichero no se puede abrir
|
||||
std::cout << "Warning: Unable to open " << filename.c_str() << " file" << std::endl;
|
||||
if (verbose)
|
||||
{
|
||||
std::cout << "Warning: Unable to open " << filename.c_str() << " file" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
return tileMapFile;
|
||||
}
|
||||
|
||||
// Carga las variables desde un fichero de mapa
|
||||
room_t loadRoomFile(std::string file_path)
|
||||
room_t loadRoomFile(std::string file_path, bool verbose)
|
||||
{
|
||||
room_t room;
|
||||
room.itemColor1 = "yellow";
|
||||
@@ -84,7 +90,10 @@ room_t loadRoomFile(std::string file_path)
|
||||
// Procesa las dos subcadenas
|
||||
if (!setEnemy(&enemy, line.substr(0, pos), line.substr(pos + 1, line.length())))
|
||||
{
|
||||
std::cout << "Warning: file " << filename.c_str() << "\n, unknown parameter \"" << line.substr(0, pos).c_str() << "\"" << std::endl;
|
||||
if (verbose)
|
||||
{
|
||||
std::cout << "Warning: file " << filename.c_str() << "\n, unknown parameter \"" << line.substr(0, pos).c_str() << "\"" << std::endl;
|
||||
}
|
||||
}
|
||||
} while (line != "[/enemy]");
|
||||
|
||||
@@ -110,6 +119,7 @@ room_t loadRoomFile(std::string file_path)
|
||||
// Procesa las dos subcadenas
|
||||
if (!setItem(&item, line.substr(0, pos), line.substr(pos + 1, line.length())))
|
||||
{
|
||||
if (verbose)
|
||||
{
|
||||
std::cout << "Warning: file " << filename.c_str() << "\n, unknown parameter \"" << line.substr(0, pos).c_str() << "\"" << std::endl;
|
||||
}
|
||||
@@ -129,6 +139,7 @@ room_t loadRoomFile(std::string file_path)
|
||||
// Procesa las dos subcadenas
|
||||
if (!setVars(&room, line.substr(0, pos), line.substr(pos + 1, line.length())))
|
||||
{
|
||||
if (verbose)
|
||||
{
|
||||
std::cout << "Warning: file " << filename.c_str() << "\n, unknown parameter \"" << line.substr(0, pos).c_str() << "\"" << std::endl;
|
||||
}
|
||||
@@ -137,6 +148,7 @@ room_t loadRoomFile(std::string file_path)
|
||||
}
|
||||
|
||||
// Cierra el fichero
|
||||
if (verbose)
|
||||
{
|
||||
std::cout << "Room loaded: " << filename.c_str() << std::endl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user