Legends-of-Azeroth-Pandaria-5.4.8

Форк
0
85 строк · 2.0 Кб
1
/*
2
 * Copyright (C) 2005-2013 MaNGOS <http://www.getmangos.com/>
3
 * Copyright (C) 2008-2013 Trinity <http://www.trinitycore.org/>
4
 *
5
 * This program is free software; you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation; either version 2 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
 */
19

20
#define _CRT_SECURE_NO_DEPRECATE
21

22
#include "wdt.h"
23

24
u_map_fcc MWMOMagic = { {'O', 'M', 'W', 'M'} };
25
u_map_fcc MPHDMagic = { {'D', 'H', 'P', 'M'} };
26
u_map_fcc MAINMagic = { {'N', 'I', 'A', 'M'} };
27

28
bool wdt_MWMO::prepareLoadedData()
29
{
30
    if (fcc != MWMOMagic.fcc)
31
        return false;
32
    return true;
33
}
34

35
bool wdt_MPHD::prepareLoadedData()
36
{
37
    if (fcc != MPHDMagic.fcc)
38
        return false;
39
    return true;
40
}
41

42
bool wdt_MAIN::prepareLoadedData()
43
{
44
    if (fcc != MAINMagic.fcc)
45
        return false;
46
    return true;
47
}
48

49
WDT_file::WDT_file()
50
{
51
    mphd = 0;
52
    main = 0;
53
    wmo  = 0;
54
}
55

56
WDT_file::~WDT_file()
57
{
58
    free();
59
}
60

61
void WDT_file::free()
62
{
63
    mphd = 0;
64
    main = 0;
65
    wmo  = 0;
66
    FileLoader::free();
67
}
68

69
bool WDT_file::prepareLoadedData()
70
{
71
    // Check parent
72
    if (!FileLoader::prepareLoadedData())
73
        return false;
74

75
    mphd = reinterpret_cast<wdt_MPHD*>((uint8*)version+version->size+8);
76
    if (!mphd->prepareLoadedData())
77
        return false;
78
    main = (wdt_MAIN *)((uint8*)mphd + mphd->size+8);
79
    if (!main->prepareLoadedData())
80
        return false;
81
    wmo = (wdt_MWMO *)((uint8*)main+ main->size+8);
82
    if (!wmo->prepareLoadedData())
83
        wmo = NULL; // optional as of cataclysm
84
    return true;
85
}
86

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.