From ddd589d3f64108e6c077ea5e7029b2abf8bd18a3 Mon Sep 17 00:00:00 2001 From: Eduardo MG Date: Wed, 21 Aug 2024 23:02:11 -0600 Subject: [PATCH] Trying to fix compilation for PSP Replace nullptr with NULL --- projects/mtg/src/Rules.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/projects/mtg/src/Rules.cpp b/projects/mtg/src/Rules.cpp index d124f8e96..17ab992ac 100644 --- a/projects/mtg/src/Rules.cpp +++ b/projects/mtg/src/Rules.cpp @@ -505,7 +505,7 @@ Player* Rules::loadPlayerRandomCommanderFromFile(GameObserver* observer, int isA if (!outFile.is_open()) { std::cerr << "Failed to create file: User/commander/commander.txt" << std::endl; - return nullptr; + return NULL; } outFile << "670972" << std::endl; outFile.close(); @@ -515,7 +515,7 @@ Player* Rules::loadPlayerRandomCommanderFromFile(GameObserver* observer, int isA if (!file.is_open()) { std::cerr << "Failed to open file after creation: User/commander/commander.txt" << std::endl; - return nullptr; + return NULL; } } @@ -563,7 +563,7 @@ Player* Rules::loadPlayerRandomCommanderFromFile(GameObserver* observer, int isA { int commanderIntId = std::atoi(commanderIds[i].c_str()); MTGCard* card = MTGCollection()->getCardById(commanderIntId); - if (card != nullptr) + if (card != NULL) { validCommanderIds.push_back(commanderIds[i]); } @@ -581,7 +581,7 @@ Player* Rules::loadPlayerRandomCommanderFromFile(GameObserver* observer, int isA } // Randomly select a commander ID - std::srand(static_cast(std::time(nullptr))); + std::srand(static_cast(time(NULL))); int randomIndex = std::rand() % validCommanderIds.size(); std::string commanderId = validCommanderIds[randomIndex]; @@ -590,7 +590,7 @@ Player* Rules::loadPlayerRandomCommanderFromFile(GameObserver* observer, int isA if (!cmdTempDeck->add(commanderIntId)) { std::cerr << "Failed to add commander card with ID: " << commanderId << std::endl; - return nullptr; + return NULL; } MTGDeck* tempDeck = NEW MTGDeck(MTGCollection()); @@ -601,10 +601,10 @@ Player* Rules::loadPlayerRandomCommanderFromFile(GameObserver* observer, int isA DeckDataWrapper* myCommandZone = NEW DeckDataWrapper(cmdTempDeck); MTGCard* commander = myCommandZone->getCard(0, true); - if (commander == nullptr) + if (commander == NULL) { std::cerr << "Invalid commander card retrieved from the command zone." << std::endl; - return nullptr; + return NULL; } std::stringstream cid; @@ -645,7 +645,7 @@ Player* Rules::loadPlayerRandomCommanderFromFile(GameObserver* observer, int isA std::string deckFile = "random"; std::string deckFileSmall = "random"; - Player* player = nullptr; + Player* player = NULL; if (!isAI) // Human Player player = NEW HumanPlayer(observer, deckFile, deckFileSmall, false, tempDeck); else