/* * Copyright (C) 2005-2011 MaNGOS * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "vmapexport.h" #include "adtfile.h" #include #include #ifdef WIN32 #define snprintf _snprintf #endif char * GetPlainName(char * FileName) { char * szTemp; if((szTemp = strrchr(FileName, '\\')) != NULL) FileName = szTemp + 1; return FileName; } void fixnamen(char *name, size_t len) { for (size_t i=0; i0 && name[i]>='A' && name[i]<='Z' && isalpha(name[i-1])) { name[i] |= 0x20; } else if ((i==0 || !isalpha(name[i-1])) && name[i]>='a' && name[i]<='z') { name[i] &= ~0x20; } } //extension in lowercase for(size_t i=len-3; i= 4 ? path.substr(path.size()-4,4) : ""; std::transform( ext3.begin(), ext3.end(), ext3.begin(), ::tolower ); if(ext3 == ".mdx") { // replace .mdx -> .m2 path.erase(path.length()-2,2); path.append("2"); } // >= 3.1.0 ADT MMDX section store filename.m2 filenames for corresponded .m2 file // nothing do char szLocalFile[1024]; snprintf(szLocalFile, 1024, "%s/%s", szWorkDirWmo, s); FILE * output = fopen(szLocalFile,"rb"); if(!output) { Model m2(path); if(m2.open()) m2.ConvertToVMAPModel(szLocalFile); } else fclose(output); } delete[] buf; } } else if (!strcmp(fourcc,"MWMO")) { if (size) { char *buf = new char[size]; ADT.read(buf, size); char *p=buf; int q = 0; WmoInstansName = new string[size]; while (p