From 6f6ef67685d9351802dc340acf9999449cf8968e Mon Sep 17 00:00:00 2001 From: killerwife Date: Thu, 26 Oct 2023 12:43:07 +0200 Subject: [PATCH] Vehicles: Minor fixup of usage on windows Closes https://github.com/cmangos/mangos-wotlk/pull/436 --- contrib/extractor/System.cpp | 7 +++++-- contrib/extractor_scripts/ExtractResources.sh | 4 ++++ src/game/Models/M2Stores.cpp | 4 +++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/contrib/extractor/System.cpp b/contrib/extractor/System.cpp index 8d71f6e4f42..a3495906cb6 100644 --- a/contrib/extractor/System.cpp +++ b/contrib/extractor/System.cpp @@ -1,6 +1,8 @@ +#define _CRT_SECURE_NO_DEPRECATE +#define __STDC_LIMIT_MACROS + #include #include -#define _CRT_SECURE_NO_DEPRECATE #include #include @@ -129,7 +131,7 @@ void Usage(char* prg) "%s -[var] [value]\n"\ "-i set input path\n"\ "-o set output path\n"\ - "-e extract only MAP(1)/DBC(2)/Camera(4) - standard: all(15)\n"\ + "-e extract only MAP(1)/DBC(2)/Camera(4)/Attachment(8) - standard: all(15)\n"\ "-f height stored as int (less map size but lost some accuracy) 1 by default\n"\ "Example: %s -f 0 -i \"c:\\games\\game\"", prg, prg); exit(1); @@ -1128,6 +1130,7 @@ void ExtractCreatureModelFiles(int locale, bool basicLocale) auto pos = thisFile.find_last_of('\\'); std::string pureName = thisFile; + std::replace(pureName.begin(), pureName.end(), '\\', '_'); filename += pureName; if (FileExists(filename.c_str())) diff --git a/contrib/extractor_scripts/ExtractResources.sh b/contrib/extractor_scripts/ExtractResources.sh index 5927c969efd..006c8309330 100755 --- a/contrib/extractor_scripts/ExtractResources.sh +++ b/contrib/extractor_scripts/ExtractResources.sh @@ -276,6 +276,10 @@ fi ## Extract creature models if [ "$USE_MODELS" = "1" ] && [ "$USE_AD" = "0" ] then + if [ ! -d "${OUTPUT_PATH:-.}/vmaps" ] + then + mkdir "${OUTPUT_PATH:-.}/vmaps" + fi echo "$(date): Start extraction of model files..." | tee -a $LOG_FILE $PREFIX/ad -e 8 | tee -a $DETAIL_LOG_FILE echo "$(date): Extracting of model files finished" | tee -a $LOG_FILE diff --git a/src/game/Models/M2Stores.cpp b/src/game/Models/M2Stores.cpp index 47997335cd9..2440e9b6aaa 100644 --- a/src/game/Models/M2Stores.cpp +++ b/src/game/Models/M2Stores.cpp @@ -273,7 +273,9 @@ void LoadM2Attachments(std::string const& dataPath) { std::string filename = dataPath; filename.append("CreatureModels/"); - filename.append(dbcentry->ModelPath); + std::string modelPath = dbcentry->ModelPath; + std::replace(modelPath.begin(), modelPath.end(), '\\', '_'); + filename.append(modelPath); // Replace mdx to .m2 size_t loc = filename.find(".mdx");