fix: els globos tenien un parell de setters mal asignats per culpa de buscar y reemplazar
fix: els globos verds s'inicialitzaven amb vy = 0 per gastar abs en lloc de fabs fix: corregit un bug milenari que de sempre havia creat els balloons verds al popar al pare amb la meitat de velocitat en y. Lo que jo no se es com anava res. Supose que ara el joc serà un poc mes xungo. Quan rebotaven en el piso ja se'ls posava la velocitat bona (crec)
This commit is contained in:
@@ -210,45 +210,16 @@ DemoData loadDemoDataFromFile(const std::string &file_path)
|
||||
DemoData dd;
|
||||
|
||||
// Indicador de éxito en la carga
|
||||
const std::string file_name = file_path.substr(file_path.find_last_of("\\/") + 1);
|
||||
auto file = SDL_RWFromFile(file_path.c_str(), "r+b");
|
||||
if (!file)
|
||||
{
|
||||
std::cerr << "Error: Fichero no encontrado " << file_path << std::endl;
|
||||
throw std::runtime_error("Fichero no encontrado: " + file_path);
|
||||
}
|
||||
/*{ // El fichero no existe
|
||||
std::cout << "Warning: Unable to open " << file_name.c_str() << " file" << std::endl;
|
||||
|
||||
// Creamos el fichero para escritura
|
||||
file = SDL_RWFromFile(file_path.c_str(), "w+b");
|
||||
|
||||
// Si ha creado el fichero
|
||||
if (file)
|
||||
{
|
||||
std::cout << "New file (" << file_name.c_str() << ") created!" << std::endl;
|
||||
|
||||
// Inicializas los datos y los guarda en el fichero
|
||||
for (int i = 0; i < TOTAL_DEMO_DATA; ++i)
|
||||
{
|
||||
DemoKeys dk = DemoKeys();
|
||||
dd.push_back(dk);
|
||||
SDL_RWwrite(file, &dk, sizeof(DemoKeys), 1);
|
||||
}
|
||||
|
||||
// Cerramos el fichero
|
||||
SDL_RWclose(file);
|
||||
}
|
||||
else
|
||||
{ // Si no puede crear el fichero
|
||||
std::cout << "Error: Unable to create file " << file_name.c_str() << std::endl;
|
||||
}
|
||||
}*/
|
||||
// El fichero existe
|
||||
else
|
||||
{
|
||||
// Mensaje de proceder a la carga de los datos
|
||||
// std::cout << "Reading file: " << file_name.c_str() << std::endl;
|
||||
const std::string file_name = file_path.substr(file_path.find_last_of("\\/") + 1);
|
||||
printWithDots("DemoData : ", file_name, "[ LOADED ]");
|
||||
|
||||
// Lee todos los datos del fichero y los deja en el destino
|
||||
for (int i = 0; i < TOTAL_DEMO_DATA; ++i)
|
||||
@@ -260,9 +231,6 @@ DemoData loadDemoDataFromFile(const std::string &file_path)
|
||||
|
||||
// Cierra el fichero
|
||||
SDL_RWclose(file);
|
||||
|
||||
// Mensaje de datos cargados a la carga de los datos
|
||||
printWithDots("DemoData : ", file_name, "[ LOADED ]");
|
||||
}
|
||||
|
||||
return dd;
|
||||
|
||||
Reference in New Issue
Block a user