AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
adtfile.cpp File Reference
#include "adtfile.h"
#include "vmapexport.h"
#include <cstdio>

Go to the source code of this file.

Functions

char const * GetPlainName (char const *FileName)
 
char * GetPlainName (char *FileName)
 
void fixnamen (char *name, std::size_t len)
 
void fixname2 (char *name, std::size_t len)
 
char * GetExtension (char *FileName)
 

Function Documentation

◆ fixname2()

void fixname2 ( char *  name,
std::size_t  len 
)
63{
64 if (len < 3)
65 return;
66
67 for (std::size_t i = 0; i < len - 3; i++)
68 if (name[i] == ' ')
69 name[i] = '_';
70}

Referenced by ExtractGameobjectModels(), Doodad::ExtractSet(), ExtractSingleModel(), ExtractSingleWmo(), ADTFile::init(), WDTFile::init(), and WMORoot::open().

◆ fixnamen()

void fixnamen ( char *  name,
std::size_t  len 
)
45{
46 if (len < 3)
47 return;
48
49 for (std::size_t i = 0; i < len - 3; i++)
50 {
51 if (i > 0 && name[i] >= 'A' && name[i] <= 'Z' && isalpha(name[i - 1]))
52 name[i] |= 0x20;
53 else if ((i == 0 || !isalpha(name[i - 1])) && name[i] >= 'a' && name[i] <= 'z')
54 name[i] &= ~0x20;
55 }
56
57 //extension in lowercase
58 for (std::size_t i = len - 3; i < len; i++)
59 name[i] |= 0x20;
60}

Referenced by ExtractGameobjectModels(), Doodad::ExtractSet(), ExtractSingleModel(), ExtractSingleWmo(), ADTFile::init(), WDTFile::init(), and WMORoot::open().

◆ GetExtension()

char * GetExtension ( char *  FileName)
73{
74 if (char* szTemp = strrchr(FileName, '.'))
75 return szTemp;
76 return nullptr;
77}

Referenced by ExtractGameobjectModels().

◆ GetPlainName() [1/2]

char * GetPlainName ( char *  FileName)
36{
37 char* szTemp;
38
39 if ((szTemp = strrchr(FileName, '\\')) != nullptr)
40 FileName = szTemp + 1;
41 return FileName;
42}

◆ GetPlainName() [2/2]

char const * GetPlainName ( char const *  FileName)
27{
28 const char* szTemp;
29
30 if ((szTemp = strrchr(FileName, '\\')) != nullptr)
31 FileName = szTemp + 1;
32 return FileName;
33}

Referenced by ExtractGameobjectModels(), Doodad::ExtractSet(), ExtractSingleModel(), ExtractSingleWmo(), ADTFile::init(), and WMORoot::open().