Eliminados todos los std:: del código

This commit is contained in:
2023-09-16 12:44:40 +02:00
parent 71be364141
commit 4a2d27dc59
35 changed files with 539 additions and 504 deletions

View File

@@ -100,11 +100,11 @@ void Director::initOnline()
{ // Establece el servidor y el puerto
jscore::init(options->online.server, options->online.port);
const std::string caption = options->online.jailerID + " IS LOGGED IN";
const string caption = options->online.jailerID + " IS LOGGED IN";
screen->showNotification(caption);
if (options->console)
{
std::cout << caption << std::endl;
cout << caption << endl;
}
}
}
@@ -214,12 +214,12 @@ bool Director::loadConfig()
bool success = true;
// Versión actual del fichero
const std::string configVersion = options->configVersion;
const string configVersion = options->configVersion;
options->configVersion = "";
// Variables para manejar el fichero
std::string line;
std::ifstream file(asset->get("config.txt"));
string line;
ifstream file(asset->get("config.txt"));
// Si el fichero se puede abrir
if (file.good())
@@ -227,9 +227,9 @@ bool Director::loadConfig()
// Procesa el fichero linea a linea
if (options->console)
{
std::cout << "Reading file config.txt\n";
cout << "Reading file config.txt\n";
}
while (std::getline(file, line))
while (getline(file, line))
{
// Comprueba que la linea no sea un comentario
if (line.substr(0, 1) != "#")
@@ -241,8 +241,8 @@ bool Director::loadConfig()
{
if (options->console)
{
std::cout << "Warning: file config.txt\n";
std::cout << "unknown parameter " << line.substr(0, pos).c_str() << std::endl;
cout << "Warning: file config.txt\n";
cout << "unknown parameter " << line.substr(0, pos).c_str() << endl;
}
success = false;
}
@@ -252,7 +252,7 @@ bool Director::loadConfig()
// Cierra el fichero
if (options->console)
{
std::cout << "Closing file config.txt\n\n";
cout << "Closing file config.txt\n\n";
}
file.close();
}
@@ -307,20 +307,20 @@ bool Director::saveConfig()
bool success = true;
// Crea y abre el fichero de texto
std::ofstream file(asset->get("config.txt"));
ofstream file(asset->get("config.txt"));
if (file.good())
{
if (options->console)
{
std::cout << asset->get("config.txt") << " open for writing" << std::endl;
cout << asset->get("config.txt") << " open for writing" << endl;
}
}
else
{
if (options->console)
{
std::cout << asset->get("config.txt") << " can't be opened" << std::endl;
cout << asset->get("config.txt") << " can't be opened" << endl;
}
}
@@ -359,7 +359,7 @@ bool Director::saveConfig()
file << "videoMode=SDL_WINDOW_FULLSCREEN_DESKTOP\n";
}
file << "windowSize=" + std::to_string(options->windowSize) + "\n";
file << "windowSize=" + to_string(options->windowSize) + "\n";
if (options->filter == FILTER_NEAREST)
{
@@ -374,14 +374,14 @@ bool Director::saveConfig()
file << "integerScale=" + boolToString(options->integerScale) + "\n";
file << "keepAspect=" + boolToString(options->keepAspect) + "\n";
file << "borderEnabled=" + boolToString(options->borderEnabled) + "\n";
file << "borderWidth=" + std::to_string(options->borderWidth) + "\n";
file << "borderHeight=" + std::to_string(options->borderHeight) + "\n";
file << "palette=" + std::to_string(options->palette) + "\n";
file << "borderWidth=" + to_string(options->borderWidth) + "\n";
file << "borderHeight=" + to_string(options->borderHeight) + "\n";
file << "palette=" + to_string(options->palette) + "\n";
file << "\n## ONLINE OPTIONS\n";
file << "enabled=" + boolToString(options->online.enabled) + "\n";
file << "server=" + options->online.server + "\n";
file << "port=" + std::to_string(options->online.port) + "\n";
file << "port=" + to_string(options->online.port) + "\n";
file << "jailerID=" + options->online.jailerID + "\n";
file << "\n## NOTIFICATION OPTIONS\n";
@@ -418,18 +418,18 @@ bool Director::saveConfig()
}
// Crea la carpeta del sistema donde guardar datos
void Director::createSystemFolder(std::string folder)
void Director::createSystemFolder(string folder)
{
#ifdef _WIN32
systemFolder = std::string(getenv("APPDATA")) + "/" + folder;
systemFolder = string(getenv("APPDATA")) + "/" + folder;
#elif __APPLE__
struct passwd *pw = getpwuid(getuid());
const char *homedir = pw->pw_dir;
systemFolder = std::string(homedir) + "/Library/Application Support" + "/" + folder;
systemFolder = string(homedir) + "/Library/Application Support" + "/" + folder;
#elif __linux__
struct passwd *pw = getpwuid(getuid());
const char *homedir = pw->pw_dir;
systemFolder = std::string(homedir) + "/." + folder;
systemFolder = string(homedir) + "/." + folder;
#endif
struct stat st = {0};
@@ -471,12 +471,12 @@ void Director::loadResources(section_t *section)
{
if (options->console)
{
std::cout << "** LOAD RESOURCES" << std::endl;
cout << "** LOAD RESOURCES" << endl;
}
if (section->name == SECTION_PROG_LOGO)
{
std::vector<std::string> textureList;
vector<string> textureList;
textureList.push_back("jailgames.png");
textureList.push_back("since_1998.png");
@@ -485,7 +485,7 @@ void Director::loadResources(section_t *section)
else if (section->name == SECTION_PROG_INTRO)
{
std::vector<std::string> textureList;
vector<string> textureList;
textureList.push_back("loading_screen_bn.png");
textureList.push_back("loading_screen_color.png");
textureList.push_back("loading_screen_bn_zxarne.png");
@@ -496,7 +496,7 @@ void Director::loadResources(section_t *section)
else if (section->name == SECTION_PROG_TITLE)
{
std::vector<std::string> textureList;
vector<string> textureList;
textureList.push_back("loading_screen_color.png");
textureList.push_back("loading_screen_color_zxarne.png");
textureList.push_back("smb2.png");
@@ -506,7 +506,7 @@ void Director::loadResources(section_t *section)
resource->loadTextures(textureList);
// Offsets
std::vector<std::string> offsetsList;
vector<string> offsetsList;
offsetsList.push_back("smb2.txt");
offsetsList.push_back("debug.txt");
@@ -516,20 +516,20 @@ void Director::loadResources(section_t *section)
else if (section->name == SECTION_PROG_CREDITS)
{
// Texturas
std::vector<std::string> textureList;
vector<string> textureList;
textureList.push_back("shine.png");
textureList.push_back("smb2.png");
resource->loadTextures(textureList);
// Animaciones
std::vector<std::string> animationList;
vector<string> animationList;
animationList.push_back("shine.ani");
resource->loadAnimations(animationList);
// Offsets
std::vector<std::string> offsetsList;
vector<string> offsetsList;
offsetsList.push_back("smb2.txt");
resource->loadOffsets(offsetsList);
@@ -538,7 +538,7 @@ void Director::loadResources(section_t *section)
else if (section->name == SECTION_PROG_ENDING)
{
// Texturas
std::vector<std::string> textureList;
vector<string> textureList;
textureList.push_back("ending1.png");
textureList.push_back("ending1_zxarne.png");
textureList.push_back("ending2.png");
@@ -554,7 +554,7 @@ void Director::loadResources(section_t *section)
resource->loadTextures(textureList);
// Offsets
std::vector<std::string> offsetsList;
vector<string> offsetsList;
offsetsList.push_back("smb2.txt");
resource->loadOffsets(offsetsList);
@@ -563,7 +563,7 @@ void Director::loadResources(section_t *section)
else if (section->name == SECTION_PROG_ENDING2)
{
// Texturas
std::vector<std::string> textureList;
vector<string> textureList;
// Texto
textureList.push_back("smb2.png");
@@ -629,7 +629,7 @@ void Director::loadResources(section_t *section)
resource->loadTextures(textureList);
// Animaciones
std::vector<std::string> animationList;
vector<string> animationList;
// Enemigos
animationList.push_back("abad.ani");
@@ -692,7 +692,7 @@ void Director::loadResources(section_t *section)
resource->loadAnimations(animationList);
// Offsets
std::vector<std::string> offsetsList;
vector<string> offsetsList;
offsetsList.push_back("smb2.txt");
resource->loadOffsets(offsetsList);
@@ -701,7 +701,7 @@ void Director::loadResources(section_t *section)
else if (section->name == SECTION_PROG_GAME_OVER)
{
// Texturas
std::vector<std::string> textureList;
vector<string> textureList;
textureList.push_back("smb2.png");
textureList.push_back("player_game_over.png");
textureList.push_back("tv.png");
@@ -709,14 +709,14 @@ void Director::loadResources(section_t *section)
resource->loadTextures(textureList);
// Animaciones
std::vector<std::string> animationList;
vector<string> animationList;
animationList.push_back("player_game_over.ani");
animationList.push_back("tv.ani");
resource->loadAnimations(animationList);
// Offsets
std::vector<std::string> offsetsList;
vector<string> offsetsList;
offsetsList.push_back("smb2.txt");
resource->loadOffsets(offsetsList);
@@ -725,7 +725,7 @@ void Director::loadResources(section_t *section)
else if (section->name == SECTION_PROG_GAME || section->name == SECTION_PROG_DEMO)
{
// Texturas
std::vector<std::string> textureList;
vector<string> textureList;
// Jugador
if (options->cheat.altSkin)
@@ -810,7 +810,7 @@ void Director::loadResources(section_t *section)
resource->loadTextures(textureList);
// Animaciones
std::vector<std::string> animationList;
vector<string> animationList;
// Jugador
if (options->cheat.altSkin)
@@ -884,14 +884,14 @@ void Director::loadResources(section_t *section)
resource->loadAnimations(animationList);
// Offsets
std::vector<std::string> offsetsList;
vector<string> offsetsList;
offsetsList.push_back("smb2.txt");
offsetsList.push_back("debug.txt");
resource->loadOffsets(offsetsList);
// TileMaps
std::vector<std::string> tileMapList;
vector<string> tileMapList;
tileMapList.push_back("01.tmx");
tileMapList.push_back("02.tmx");
tileMapList.push_back("03.tmx");
@@ -956,7 +956,7 @@ void Director::loadResources(section_t *section)
resource->loadTileMaps(tileMapList);
// Habitaciones
std::vector<std::string> roomList;
vector<string> roomList;
roomList.push_back("01.room");
roomList.push_back("02.room");
roomList.push_back("03.room");
@@ -1023,12 +1023,12 @@ void Director::loadResources(section_t *section)
if (options->console)
{
std::cout << "** RESOURCES LOADED" << std::endl;
cout << "** RESOURCES LOADED" << endl;
}
}
// Asigna variables a partir de dos cadenas
bool Director::setOptions(options_t *options, std::string var, std::string value)
bool Director::setOptions(options_t *options, string var, string value)
{
// Indicador de éxito en la asignación
bool success = true;
@@ -1072,7 +1072,7 @@ bool Director::setOptions(options_t *options, std::string var, std::string value
else if (var == "windowSize")
{
options->windowSize = std::stoi(value);
options->windowSize = stoi(value);
if ((options->windowSize < 1) || (options->windowSize > 4))
{
options->windowSize = 3;
@@ -1113,17 +1113,17 @@ bool Director::setOptions(options_t *options, std::string var, std::string value
else if (var == "borderWidth")
{
options->borderWidth = std::stoi(value);
options->borderWidth = stoi(value);
}
else if (var == "borderHeight")
{
options->borderHeight = std::stoi(value);
options->borderHeight = stoi(value);
}
else if (var == "palette")
{
const int pal = std::stoi(value);
const int pal = stoi(value);
if (pal == 0)
{
@@ -1152,7 +1152,7 @@ bool Director::setOptions(options_t *options, std::string var, std::string value
{
value = "0";
}
options->online.port = std::stoi(value);
options->online.port = stoi(value);
}
else if (var == "jailerID")
@@ -1222,7 +1222,6 @@ void Director::initInput()
input->bindKey(input_right, SDL_SCANCODE_RIGHT);
input->bindKey(input_up, SDL_SCANCODE_UP);
input->bindKey(input_down, SDL_SCANCODE_DOWN);
}
else if (options->keys == ctrl_opqa)
{
@@ -1290,21 +1289,21 @@ bool Director::initSDL()
{
if (options->console)
{
std::cout << "SDL could not initialize!\nSDL Error: " << SDL_GetError() << std::endl;
cout << "SDL could not initialize!\nSDL Error: " << SDL_GetError() << endl;
}
success = false;
}
else
{
// Inicia el generador de numeros aleatorios
std::srand(static_cast<unsigned int>(SDL_GetTicks()));
srand(static_cast<unsigned int>(SDL_GetTicks()));
// Establece el filtro de la textura a nearest
if (!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, std::to_string(options->filter).c_str()))
if (!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, to_string(options->filter).c_str()))
{
if (options->console)
{
std::cout << "Warning: Nearest texture filtering not enabled!\n";
cout << "Warning: Nearest texture filtering not enabled!\n";
}
}
@@ -1322,7 +1321,7 @@ bool Director::initSDL()
{
if (options->console)
{
std::cout << "Window could not be created!\nSDL Error: " << SDL_GetError() << std::endl;
cout << "Window could not be created!\nSDL Error: " << SDL_GetError() << endl;
}
success = false;
}
@@ -1342,7 +1341,7 @@ bool Director::initSDL()
{
if (options->console)
{
std::cout << "Renderer could not be created!\nSDL Error: " << SDL_GetError() << std::endl;
cout << "Renderer could not be created!\nSDL Error: " << SDL_GetError() << endl;
}
success = false;
}
@@ -1362,7 +1361,7 @@ bool Director::initSDL()
if (options->console)
{
std::cout << std::endl;
cout << endl;
}
return success;
}
@@ -1371,9 +1370,9 @@ bool Director::initSDL()
bool Director::setFileList()
{
#ifdef MACOS_BUNDLE
const std::string prefix = "/../Resources";
const string prefix = "/../Resources";
#else
const std::string prefix = "";
const string prefix = "";
#endif
// Texto
@@ -1722,7 +1721,7 @@ void Director::runLogo()
{
if (options->console)
{
std::cout << "\n* SECTION: LOGO" << std::endl;
cout << "\n* SECTION: LOGO" << endl;
}
loadResources(section);
logo = new Logo(renderer, screen, resource, asset, input, options, section);
@@ -1736,7 +1735,7 @@ void Director::runIntro()
{
if (options->console)
{
std::cout << "\n* SECTION: INTRO" << std::endl;
cout << "\n* SECTION: INTRO" << endl;
}
loadResources(section);
intro = new Intro(renderer, screen, resource, asset, input, options, section);
@@ -1750,7 +1749,7 @@ void Director::runTitle()
{
if (options->console)
{
std::cout << "\n* SECTION: TITLE" << std::endl;
cout << "\n* SECTION: TITLE" << endl;
}
if ((JA_GetMusicState() == JA_MUSIC_INVALID) || (JA_GetMusicState() == JA_MUSIC_STOPPED))
{
@@ -1768,7 +1767,7 @@ void Director::runCredits()
{
if (options->console)
{
std::cout << "\n* SECTION: CREDITS" << std::endl;
cout << "\n* SECTION: CREDITS" << endl;
}
loadResources(section);
credits = new Credits(renderer, screen, resource, asset, input, options, section);
@@ -1782,7 +1781,7 @@ void Director::runDemo()
{
if (options->console)
{
std::cout << "\n* SECTION: DEMO" << std::endl;
cout << "\n* SECTION: DEMO" << endl;
}
loadResources(section);
demo = new Demo(renderer, screen, resource, asset, input, options, section, debug);
@@ -1796,7 +1795,7 @@ void Director::runEnterID()
{
if (options->console)
{
std::cout << "\n* SECTION: ENTER_ID" << std::endl;
cout << "\n* SECTION: ENTER_ID" << endl;
}
// loadResources(section);
enterID = new EnterID(renderer, screen, asset, options, section);
@@ -1810,7 +1809,7 @@ void Director::runEnding()
{
if (options->console)
{
std::cout << "\n* SECTION: ENDING" << std::endl;
cout << "\n* SECTION: ENDING" << endl;
}
loadResources(section);
ending = new Ending(renderer, screen, resource, asset, input, options, section);
@@ -1824,7 +1823,7 @@ void Director::runEnding2()
{
if (options->console)
{
std::cout << "\n* SECTION: ENDING2" << std::endl;
cout << "\n* SECTION: ENDING2" << endl;
}
loadResources(section);
ending2 = new Ending2(renderer, screen, resource, asset, input, options, section);
@@ -1838,7 +1837,7 @@ void Director::runGameOver()
{
if (options->console)
{
std::cout << "\n* SECTION: GAME OVER" << std::endl;
cout << "\n* SECTION: GAME OVER" << endl;
}
loadResources(section);
gameOver = new GameOver(renderer, screen, resource, asset, input, options, section);
@@ -1852,7 +1851,7 @@ void Director::runGame()
{
if (options->console)
{
std::cout << "\n* SECTION: GAME" << std::endl;
cout << "\n* SECTION: GAME" << endl;
}
JA_StopMusic();
loadResources(section);