summaryrefslogtreecommitdiff
path: root/src/defaults.cpp
blob: 8a0f18a3827481479e368345caa29a2861bc88dc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*
 *  The Mana Client
 *  Copyright (C) 2010-2012  The Mana Developers
 *
 *  This file is part of The Mana Client.
 *
 *  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
 *  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, see <http://www.gnu.org/licenses/>.
 */

#include "defaults.h"

#include "client.h"

VariableData *createData(int defData)
{
    return new IntData(defData);
}

VariableData *createData(double defData)
{
    return new FloatData(defData);
}

VariableData *createData(float defData)
{
    return new FloatData(defData);
}

VariableData *createData(const std::string &defData)
{
    return new StringData(defData);
}

VariableData *createData(const char* defData)
{
    return new StringData(defData);
}

VariableData *createData(bool defData)
{
    return new BoolData(defData);
}

template<typename T>
void AddDEF(DefaultsData *defaultsData, const char *key, T value)
{
    defaultsData->insert(std::make_pair(key, createData(value)));
}

DefaultsData* getBrandingDefaults()
{
    auto *brandingData = new DefaultsData;
    // Init config defaults
    AddDEF(brandingData, "wallpapersPath", "");
    AddDEF(brandingData, "wallpaperFile", "");
    AddDEF(brandingData, "appName", "Mana");
    AddDEF(brandingData, "appIcon", "icons/mana");
    AddDEF(brandingData, "loginMusic", "system/Magick - Real.ogg");
    AddDEF(brandingData, "defaultServer", "");
    AddDEF(brandingData, "defaultPort", DEFAULT_PORT);
    AddDEF(brandingData, "defaultServerType", "tmwathena");
    AddDEF(brandingData, "appShort", "mana");
    AddDEF(brandingData, "defaultUpdateHost", "");
    AddDEF(brandingData, "helpPath", "");
    AddDEF(brandingData, "onlineServerList", "");
    AddDEF(brandingData, "guiThemePath", "");
    AddDEF(brandingData, "theme", "");
    AddDEF(brandingData, "font", "fonts/dejavusans.ttf");
    AddDEF(brandingData, "boldFont", "fonts/dejavusans-bold.ttf");
    AddDEF(brandingData, "monoFont", "fonts/dejavusans-mono.ttf");

    return brandingData;
}

DefaultsData* getPathsDefaults()
{
    auto *pathsData = new DefaultsData;
    // Init paths.xml defaults
    AddDEF(pathsData, "itemIcons", "graphics/items/");
    AddDEF(pathsData, "unknownItemFile", "unknown-item.png");
    AddDEF(pathsData, "sprites", "graphics/sprites/");
    AddDEF(pathsData, "spriteErrorFile", "error.xml");

    AddDEF(pathsData, "particles", "graphics/particles/");
    AddDEF(pathsData, "levelUpEffectFile", "levelup.particle.xml");
    AddDEF(pathsData, "portalEffectFile", "warparea.particle.xml");
    AddDEF(pathsData, "hitEffectId", 26);
    AddDEF(pathsData, "criticalHitEffectId", 28);

    // This is makes sure that actors positioned on the center of a tile have
    // their sprite aligned to the bottom of that tile. The default maintains
    // compatibility with existing sprites.
    AddDEF(pathsData, "spriteOffsetY", 16);

    AddDEF(pathsData, "minimaps", "graphics/minimaps/");
    AddDEF(pathsData, "maps", "maps/");

    AddDEF(pathsData, "sfx", "sfx/");
    AddDEF(pathsData, "attackSfxFile", "fist-swish.ogg");
    AddDEF(pathsData, "music", "music/");

    AddDEF(pathsData, "wallpapers", "graphics/images/");
    AddDEF(pathsData, "wallpaperFile", "login_wallpaper.png");

    AddDEF(pathsData, "help", "help/");

    return pathsData;
}

#undef AddDEF