Trabajando en las estadisticas online

This commit is contained in:
2022-11-18 20:06:07 +01:00
parent 2665b93b70
commit fd0bebf533
6 changed files with 158 additions and 24 deletions

View File

@@ -63,7 +63,9 @@ room_t loadRoomFile(std::string file_path, bool verbose)
room.itemColor2 = "magenta";
room.autoSurfaceDirection = 1;
const std::string filename = file_path.substr(file_path.find_last_of("\\/") + 1);
const std::string fileName = file_path.substr(file_path.find_last_of("\\/") + 1);
room.number = fileName.substr(0, fileName.find_last_of("."));
std::string line;
std::ifstream file(file_path);
@@ -94,7 +96,7 @@ room_t loadRoomFile(std::string file_path, bool verbose)
{
if (verbose)
{
std::cout << "Warning: file " << filename.c_str() << "\n, unknown parameter \"" << line.substr(0, pos).c_str() << "\"" << std::endl;
std::cout << "Warning: file " << fileName.c_str() << "\n, unknown parameter \"" << line.substr(0, pos).c_str() << "\"" << std::endl;
}
}
} while (line != "[/enemy]");
@@ -123,7 +125,7 @@ room_t loadRoomFile(std::string file_path, bool verbose)
{
if (verbose)
{
std::cout << "Warning: file " << filename.c_str() << "\n, unknown parameter \"" << line.substr(0, pos).c_str() << "\"" << std::endl;
std::cout << "Warning: file " << fileName.c_str() << "\n, unknown parameter \"" << line.substr(0, pos).c_str() << "\"" << std::endl;
}
}
@@ -143,7 +145,7 @@ room_t loadRoomFile(std::string file_path, bool verbose)
{
if (verbose)
{
std::cout << "Warning: file " << filename.c_str() << "\n, unknown parameter \"" << line.substr(0, pos).c_str() << "\"" << std::endl;
std::cout << "Warning: file " << fileName.c_str() << "\n, unknown parameter \"" << line.substr(0, pos).c_str() << "\"" << std::endl;
}
}
}
@@ -152,7 +154,7 @@ room_t loadRoomFile(std::string file_path, bool verbose)
// Cierra el fichero
if (verbose)
{
std::cout << "Room loaded: " << filename.c_str() << std::endl;
std::cout << "Room loaded: " << fileName.c_str() << std::endl;
}
file.close();
}
@@ -160,7 +162,7 @@ room_t loadRoomFile(std::string file_path, bool verbose)
else
{
{
std::cout << "Warning: Unable to open " << filename.c_str() << " file" << std::endl;
std::cout << "Warning: Unable to open " << fileName.c_str() << " file" << std::endl;
}
}
@@ -400,6 +402,7 @@ Room::Room(room_t *room, SDL_Renderer *renderer, Screen *screen, Asset *asset, o
this->debug = debug;
this->options = options;
number = room->number;
name = room->name;
bgColor = room->bgColor;
borderColor = room->borderColor;