From 618750f42b9935292858dfdea229efe24550fcce Mon Sep 17 00:00:00 2001 From: xiaoyu Date: Tue, 30 Jun 2026 11:16:11 +0800 Subject: [PATCH] 修复 xcode 26 c++代码编译失败。 --- ios/Runner/Wowgame/Classes/game_toy/ToyResourceUtilities.cpp | 11 ----------- ios/Runner/Wowgame/Classes/game_toy/ToyResourceUtilities.h | 2 +- ios/Runner/Wowgame/Classes/game_toy/ToySimpleActionParser.cpp | 3 +-- ios/Runner/Wowgame/Classes/game_toy/ToySoundUtils.cpp | 2 +- ios/Runner/Wowgame/Classes/game_toy/ToySoundUtils.h | 2 +- ios/Runner/Wowgame/Classes/game_toy/ToySoundsRepo.cpp | 9 ++++----- 6 files changed, 8 insertions(+), 21 deletions(-) diff --git a/ios/Runner/Wowgame/Classes/game_toy/ToyResourceUtilities.cpp b/ios/Runner/Wowgame/Classes/game_toy/ToyResourceUtilities.cpp index fc10231..57610e9 100644 --- a/ios/Runner/Wowgame/Classes/game_toy/ToyResourceUtilities.cpp +++ b/ios/Runner/Wowgame/Classes/game_toy/ToyResourceUtilities.cpp @@ -40,16 +40,6 @@ std::string ToyResourceUtilities::getFullPathForDownloadedFile(const std::string // return resDownloadDir + "/" + path; } -std::vector ToyResourceUtilities::getFullPathsForDownloadedFiles(const std::vector& paths, bool areDeviceDependent) -{ - std::vector fullPaths; - fullPaths.reserve(paths.size()); - for(const auto& path : paths){ - fullPaths.push_back(this->getFullPathForDownloadedFile(path, areDeviceDependent)); - } - return fullPaths; -} - std::vector ToyResourceUtilities::getFullPathsForDownloadedFiles(const std::vector& paths, bool areDeviceDependent) { std::vector fullPaths; @@ -59,4 +49,3 @@ std::vector ToyResourceUtilities::getFullPathsForDownloadedFiles(co } return fullPaths; } - diff --git a/ios/Runner/Wowgame/Classes/game_toy/ToyResourceUtilities.h b/ios/Runner/Wowgame/Classes/game_toy/ToyResourceUtilities.h index dd0249b..4ae0640 100644 --- a/ios/Runner/Wowgame/Classes/game_toy/ToyResourceUtilities.h +++ b/ios/Runner/Wowgame/Classes/game_toy/ToyResourceUtilities.h @@ -11,6 +11,7 @@ #include "json/document.h" #include +#include class ToyResourceUtilities { @@ -27,7 +28,6 @@ class ToyResourceUtilities std::string getDownloadedResourcesPath(bool deviceDependentFiles = true); std::string getFullPathForDownloadedFile(const std::string& path, bool isDeviceDependent = true); - std::vector getFullPathsForDownloadedFiles(const std::vector& paths, bool areDeviceDependent = true); std::vector getFullPathsForDownloadedFiles(const std::vector& paths, bool areDeviceDependent = true); protected: diff --git a/ios/Runner/Wowgame/Classes/game_toy/ToySimpleActionParser.cpp b/ios/Runner/Wowgame/Classes/game_toy/ToySimpleActionParser.cpp index 4178ea9..fc68e64 100644 --- a/ios/Runner/Wowgame/Classes/game_toy/ToySimpleActionParser.cpp +++ b/ios/Runner/Wowgame/Classes/game_toy/ToySimpleActionParser.cpp @@ -307,7 +307,7 @@ cocos2d::Action* ToySimpleActionParser::parsePlayRandomSoundAction(const rapidjs auto stopEffects = !ToyJSONParseUtils::hasMemberBool(*storedActionObject, "keepPreviousSounds") || ToyJSONParseUtils::checkMemberBool(*storedActionObject, "keepPreviousSounds", false) ? true : false; if(ToyJSONParseUtils::hasMemberArray(*storedActionObject, "sounds")){ - std::vector sounds; + std::vector sounds; for(const auto& sound : (*storedActionObject)["sounds"].GetArray()){ sounds.push_back(sound.GetString()); } @@ -567,4 +567,3 @@ cocos2d::Action* ToySimpleActionParser::parseRandomObjectSwapAction(const rapidj - diff --git a/ios/Runner/Wowgame/Classes/game_toy/ToySoundUtils.cpp b/ios/Runner/Wowgame/Classes/game_toy/ToySoundUtils.cpp index 798c5c1..b870faa 100644 --- a/ios/Runner/Wowgame/Classes/game_toy/ToySoundUtils.cpp +++ b/ios/Runner/Wowgame/Classes/game_toy/ToySoundUtils.cpp @@ -10,7 +10,7 @@ #include "ToyMathUtils.h" #include "ToySoundsRepo.h" - unsigned int ToySoundUtils::playRandomSound(std::string soundFolderPath, std::vector soundNames, bool stopEffects){ + unsigned int ToySoundUtils::playRandomSound(std::string soundFolderPath, std::vector soundNames, bool stopEffects){ auto soundsLength = soundNames.size(); if(soundsLength > 0){ diff --git a/ios/Runner/Wowgame/Classes/game_toy/ToySoundUtils.h b/ios/Runner/Wowgame/Classes/game_toy/ToySoundUtils.h index af44810..0347d58 100644 --- a/ios/Runner/Wowgame/Classes/game_toy/ToySoundUtils.h +++ b/ios/Runner/Wowgame/Classes/game_toy/ToySoundUtils.h @@ -16,7 +16,7 @@ class ToySoundUtils { public: - static unsigned int playRandomSound(std::string soundFolderPath = "", std::vector soundNames = std::vector(), bool stopEffects = true); + static unsigned int playRandomSound(std::string soundFolderPath = "", std::vector soundNames = std::vector(), bool stopEffects = true); }; diff --git a/ios/Runner/Wowgame/Classes/game_toy/ToySoundsRepo.cpp b/ios/Runner/Wowgame/Classes/game_toy/ToySoundsRepo.cpp index c8af35e..7cc6426 100644 --- a/ios/Runner/Wowgame/Classes/game_toy/ToySoundsRepo.cpp +++ b/ios/Runner/Wowgame/Classes/game_toy/ToySoundsRepo.cpp @@ -33,21 +33,21 @@ ToySoundsRepo::SoundInfo ToySoundsRepo::gameLetsStartIntroSound(){ } ToySoundsRepo::SoundInfo ToySoundsRepo::hooraySound(){ - std::vector hooraySounds = {/*"games/g_yes.mp3",*/ "games/g_whoo_hoo.mp3", "games/g_yeah.mp3"}; + std::vector hooraySounds = {/*"games/g_yes.mp3",*/ "games/g_whoo_hoo.mp3", "games/g_yeah.mp3"}; auto soundFilename = ToyMathUtils::getRandomElement(hooraySounds); auto fp = soundsFolder + soundFilename; return SoundInfo(fp, soundDuration(fp)); } ToySoundsRepo::SoundInfo ToySoundsRepo::oopsSound(){ - std::vector oopsSounds = {"games/g_oops.mp3", "games/g_no.mp3", "games/g_uh_oh.mp3"}; + std::vector oopsSounds = {"games/g_oops.mp3", "games/g_no.mp3", "games/g_uh_oh.mp3"}; auto soundFilename = ToyMathUtils::getRandomElement(oopsSounds); auto fp = soundsFolder + soundFilename; return SoundInfo(fp, soundDuration(fp)); } ToySoundsRepo::SoundInfo ToySoundsRepo::pureOopsSound(){ - std::vector oopsSounds = {"games/g_oops.mp3", "games/g_uh_oh.mp3"}; + std::vector oopsSounds = {"games/g_oops.mp3", "games/g_uh_oh.mp3"}; auto soundFilename = ToyMathUtils::getRandomElement(oopsSounds); auto fp = soundsFolder + soundFilename; return SoundInfo(fp, soundDuration(fp)); @@ -84,7 +84,7 @@ ToySoundsRepo::SoundInfo ToySoundsRepo::hurryUpSound(){ } ToySoundsRepo::SoundInfo ToySoundsRepo::tooSlowSound(){ - std::vector hooraySounds = {"games/g_slow.mp3", "games/g_slow2.mp3"}; + std::vector hooraySounds = {"games/g_slow.mp3", "games/g_slow2.mp3"}; auto soundFilename = ToyMathUtils::getRandomElement(hooraySounds); auto fp = soundsFolder + soundFilename; return SoundInfo(fp, soundDuration(fp)); @@ -211,4 +211,3 @@ void ToySoundsRepo::parseSoundInfoFile(std::string soundFolderPath, std::string } } } - -- libgit2 0.22.2