eliminat el soport per a arguments

This commit is contained in:
2026-03-29 17:32:06 +02:00
parent 77b844065e
commit fd2e2f1014
3 changed files with 12 additions and 39 deletions

View File

@@ -44,14 +44,16 @@
#endif
// Constructor
Director::Director(std::vector<std::string> const& args) {
Director::Director() {
std::cout << "Game start" << '\n';
// Crea e inicializa las opciones del programa
Options::init();
// Comprueba los parametros del programa
executable_path_ = getPath(checkProgramArguments(args));
// Obtiene la ruta del ejecutable
std::string base = SDL_GetBasePath();
if (!base.empty() && base.back() == '/') base.pop_back();
executable_path_ = base;
// Crea la carpeta del sistema donde guardar datos
createSystemFolder("jailgames");
@@ -234,28 +236,6 @@ Director::~Director() {
std::cout << "\nBye!" << '\n';
}
// Comprueba los parametros del programa
auto Director::checkProgramArguments(std::vector<std::string> const& args) -> std::string { // NOLINT(readability-identifier-naming)
// Iterar sobre los argumentos del programa (saltando args[0] que es el ejecutable)
for (std::size_t i = 1; i < args.size(); ++i) {
const std::string& argument = args[i];
if (argument == "--console") {
Options::console = true;
} else if (argument == "--infiniteLives") {
Options::cheats.infinite_lives = Options::Cheat::State::ENABLED;
} else if (argument == "--invincible") {
Options::cheats.invincible = Options::Cheat::State::ENABLED;
} else if (argument == "--jailEnabled") {
Options::cheats.jail_is_open = Options::Cheat::State::ENABLED;
} else if (argument == "--altSkin") {
Options::game.player_skin = 2;
}
}
return args[0];
}
// Crea la carpeta del sistema donde guardar datos
void Director::createSystemFolder(const std::string& folder) { // NOLINT(readability-convert-member-functions-to-static)
#ifdef _WIN32

View File

@@ -3,19 +3,17 @@
#include <SDL3/SDL.h>
#include <string> // Para string
#include <vector> // Para vector
class Director {
public:
explicit Director(std::vector<std::string> const& args); // Constructor
~Director(); // Destructor
static auto run() -> int; // Bucle principal
Director(); // Constructor
~Director(); // Destructor
static auto run() -> int; // Bucle principal
private:
// --- Variables ---
std::string executable_path_; // Path del ejecutable
std::string system_folder_; // Carpeta del sistema donde guardar datos
static auto checkProgramArguments(std::vector<std::string> const& args) -> std::string; // Comprueba los parametros del programa
std::string executable_path_; // Path del ejecutable
std::string system_folder_; // Carpeta del sistema donde guardar datos
// --- Funciones ---
void createSystemFolder(const std::string& folder); // Crea la carpeta del sistema donde guardar datos