summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2013-04-27 16:43:59 +0200
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2013-04-27 19:23:03 +0200
commit1a99d37d059df95f6a144c4f9e9fa85dacefd185 (patch)
tree0d8042ccc063567989c0e944d8a086b41c79210f
parentacf585aa5354367b771c7e3b136671d5bc938c79 (diff)
downloadmana-client-1a99d37d059df95f6a144c4f9e9fa85dacefd185.tar.gz
mana-client-1a99d37d059df95f6a144c4f9e9fa85dacefd185.tar.bz2
mana-client-1a99d37d059df95f6a144c4f9e9fa85dacefd185.tar.xz
mana-client-1a99d37d059df95f6a144c4f9e9fa85dacefd185.zip
Always read the attributes.xml file
This way it can also be used when connecting to a tmwAthena server for customizing the min/max of attributes and the amount of starting points. Mantis-issue: 501 Reviewed-by: Ablu
-rw-r--r--mana.files7
-rw-r--r--src/CMakeLists.txt4
-rw-r--r--src/net/manaserv/charhandler.cpp4
-rw-r--r--src/net/manaserv/generalhandler.cpp5
-rw-r--r--src/net/manaserv/playerhandler.cpp6
-rw-r--r--src/net/tmwa/charserverhandler.cpp6
-rw-r--r--src/net/tmwa/generalhandler.cpp19
-rw-r--r--src/resources/attributes.cpp (renamed from src/net/manaserv/attributes.cpp)19
-rw-r--r--src/resources/attributes.h (renamed from src/net/manaserv/attributes.h)10
9 files changed, 47 insertions, 33 deletions
diff --git a/mana.files b/mana.files
index be668387..dbfddc00 100644
--- a/mana.files
+++ b/mana.files
@@ -18,7 +18,8 @@ data/help/index.txt
data/help/support.txt
data/help/windows.txt
data/icons/CMakeLists.txt
-docs/FAQ.txt
+data/sfx/CMakeLists.txt
+data/sfx/system/CMakeLists.txt
docs/HACKING.txt
docs/example.mana
docs/items.txt
@@ -340,8 +341,6 @@ src/net/logindata.h
src/net/loginhandler.h
src/net/manaserv/adminhandler.cpp
src/net/manaserv/adminhandler.h
-src/net/manaserv/attributes.cpp
-src/net/manaserv/attributes.h
src/net/manaserv/beinghandler.cpp
src/net/manaserv/beinghandler.h
src/net/manaserv/buysellhandler.cpp
@@ -468,6 +467,8 @@ src/resources/ambientlayer.cpp
src/resources/ambientlayer.h
src/resources/animation.cpp
src/resources/animation.h
+src/resources/attributes.cpp
+src/resources/attributes.h
src/resources/beinginfo.cpp
src/resources/beinginfo.h
src/resources/dye.cpp
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index f7483cfa..32ac5426 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -365,6 +365,8 @@ SET(SRCS
resources/ambientlayer.h
resources/animation.cpp
resources/animation.h
+ resources/attributes.cpp
+ resources/attributes.h
resources/beinginfo.cpp
resources/beinginfo.h
resources/dye.cpp
@@ -593,8 +595,6 @@ SET(SRCS_TMWA
SET(SRCS_MANA
net/manaserv/adminhandler.cpp
net/manaserv/adminhandler.h
- net/manaserv/attributes.cpp
- net/manaserv/attributes.h
net/manaserv/beinghandler.cpp
net/manaserv/beinghandler.h
net/manaserv/buysellhandler.cpp
diff --git a/src/net/manaserv/charhandler.cpp b/src/net/manaserv/charhandler.cpp
index e809bfac..ece8e108 100644
--- a/src/net/manaserv/charhandler.cpp
+++ b/src/net/manaserv/charhandler.cpp
@@ -1,7 +1,7 @@
/*
* The Mana Client
* Copyright (C) 2004-2009 The Mana World Development Team
- * Copyright (C) 2009-2012 The Mana Developers
+ * Copyright (C) 2009-2013 The Mana Developers
*
* This file is part of The Mana Client.
*
@@ -39,8 +39,8 @@
#include "net/manaserv/messagein.h"
#include "net/manaserv/messageout.h"
#include "net/manaserv/manaserv_protocol.h"
-#include "net/manaserv/attributes.h"
+#include "resources/attributes.h"
#include "resources/hairdb.h"
#include "utils/dtor.h"
diff --git a/src/net/manaserv/generalhandler.cpp b/src/net/manaserv/generalhandler.cpp
index d1fa41fe..c6b2af18 100644
--- a/src/net/manaserv/generalhandler.cpp
+++ b/src/net/manaserv/generalhandler.cpp
@@ -1,7 +1,7 @@
/*
* The Mana Client
* Copyright (C) 2009 The Mana World Development Team
- * Copyright (C) 2009-2012 The Mana Developers
+ * Copyright (C) 2009-2013 The Mana Developers
*
* This file is part of The Mana Client.
*
@@ -47,9 +47,10 @@
#include "net/manaserv/partyhandler.h"
#include "net/manaserv/playerhandler.h"
#include "net/manaserv/specialhandler.h"
-#include "net/manaserv/attributes.h"
#include "net/manaserv/tradehandler.h"
+#include "resources/attributes.h"
+
#include "utils/gettext.h"
#include <list>
diff --git a/src/net/manaserv/playerhandler.cpp b/src/net/manaserv/playerhandler.cpp
index 484e551a..c1f78f67 100644
--- a/src/net/manaserv/playerhandler.cpp
+++ b/src/net/manaserv/playerhandler.cpp
@@ -1,7 +1,7 @@
/*
* The Mana Client
* Copyright (C) 2004-2009 The Mana World Development Team
- * Copyright (C) 2009-2012 The Mana Developers
+ * Copyright (C) 2009-2013 The Mana Developers
*
* This file is part of The Mana Client.
*
@@ -20,7 +20,6 @@
*/
#include "net/manaserv/playerhandler.h"
-#include "net/manaserv/beinghandler.h"
#include "client.h"
#include "effectmanager.h"
@@ -43,7 +42,8 @@
#include "net/manaserv/messagein.h"
#include "net/manaserv/messageout.h"
#include "net/manaserv/manaserv_protocol.h"
-#include "net/manaserv/attributes.h"
+
+#include "resources/attributes.h"
/**
* Max. distance in tiles we are willing to scroll after a teleport;
diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp
index ce193821..cc242951 100644
--- a/src/net/tmwa/charserverhandler.cpp
+++ b/src/net/tmwa/charserverhandler.cpp
@@ -38,6 +38,7 @@
#include "net/tmwa/network.h"
#include "net/tmwa/protocol.h"
+#include "resources/attributes.h"
#include "resources/hairdb.h"
#include "utils/dtor.h"
@@ -278,7 +279,10 @@ void CharServerHandler::setCharCreateDialog(CharCreateDialog *window)
const Token &token =
static_cast<LoginHandler*>(Net::getLoginHandler())->getToken();
- mCharCreateDialog->setAttributes(attributes, 30, 1, 9);
+ mCharCreateDialog->setAttributes(attributes,
+ Attributes::getCreationPoints(),
+ Attributes::getAttributeMinimum(),
+ Attributes::getAttributeMaximum());
mCharCreateDialog->setFixedGender(true, token.sex);
}
diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp
index 6c2bcddb..0ce16691 100644
--- a/src/net/tmwa/generalhandler.cpp
+++ b/src/net/tmwa/generalhandler.cpp
@@ -1,7 +1,7 @@
/*
* The Mana Client
* Copyright (C) 2009 The Mana World Development Team
- * Copyright (C) 2009-2012 The Mana Developers
+ * Copyright (C) 2009-2013 The Mana Developers
*
* This file is part of The Mana Client.
*
@@ -57,11 +57,11 @@
#include "net/tmwa/gui/guildtab.h"
#include "net/tmwa/gui/partytab.h"
+#include "resources/attributes.h"
#include "resources/itemdb.h"
#include "utils/gettext.h"
-#include <assert.h>
#include <list>
extern Net::GeneralHandler *generalHandler;
@@ -108,6 +108,7 @@ GeneralHandler::GeneralHandler():
setStatsList(stats);
+ listen(Event::ClientChannel);
listen(Event::GameChannel);
}
@@ -185,12 +186,17 @@ void GeneralHandler::reload()
static_cast<LoginHandler*>(mLoginHandler.get())->clearWorlds();
static_cast<CharServerHandler*>(mCharHandler.get())->setCharCreateDialog(0);
static_cast<CharServerHandler*>(mCharHandler.get())->setCharSelectDialog(0);
+
+ Attributes::unload();
+ Attributes::load();
}
void GeneralHandler::unload()
{
if (mNetwork)
mNetwork->clearHandlers();
+
+ Attributes::unload();
}
void GeneralHandler::flushNetwork()
@@ -220,7 +226,14 @@ void GeneralHandler::clearHandlers()
void GeneralHandler::event(Event::Channel channel,
const Event &event)
{
- if (channel == Event::GameChannel)
+ if (channel == Event::ClientChannel)
+ {
+ if (event.getType() == Event::LoadingDatabases)
+ {
+ Attributes::load();
+ }
+ }
+ else if (channel == Event::GameChannel)
{
if (event.getType() == Event::GuiWindowsLoaded)
{
diff --git a/src/net/manaserv/attributes.cpp b/src/resources/attributes.cpp
index e754a6a9..c4c67fba 100644
--- a/src/net/manaserv/attributes.cpp
+++ b/src/resources/attributes.cpp
@@ -1,6 +1,6 @@
/*
* The Mana Client
- * Copyright (C) 2010-2012 The Mana Developers
+ * Copyright (C) 2010-2013 The Mana Developers
*
* This file is part of The Mana Client.
*
@@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "net/manaserv/attributes.h"
+#include "resources/attributes.h"
#include "log.h"
#include "playerinfo.h"
@@ -35,11 +35,10 @@
#include <map>
#define DEFAULT_ATTRIBUTESDB_FILE "attributes.xml"
-#define DEFAULT_POINTS 60
+#define DEFAULT_POINTS 30
#define DEFAULT_MIN_PTS 1
-#define DEFAULT_MAX_PTS 20
+#define DEFAULT_MAX_PTS 9
-namespace ManaServ {
namespace Attributes {
typedef struct
@@ -67,9 +66,9 @@ namespace Attributes {
static std::vector<std::string> attributeLabels;
/** Characters creation points. */
- static unsigned int creationPoints = 0;
- static unsigned int attributeMinimum = 0;
- static unsigned int attributeMaximum = 0;
+ static unsigned int creationPoints = DEFAULT_POINTS;
+ static unsigned int attributeMinimum = DEFAULT_MIN_PTS;
+ static unsigned int attributeMaximum = DEFAULT_MAX_PTS;
unsigned int getCreationPoints()
{
@@ -381,8 +380,7 @@ namespace Attributes {
TagMap::const_iterator it, it_end;
for (it = tags.begin(), it_end = tags.end(); it != it_end; ++it)
- dbStats.push_back(ItemStat(it->first,
- it->second));
+ dbStats.push_back(ItemStat(it->first, it->second));
setStatsList(dbStats);
}
@@ -405,4 +403,3 @@ namespace Attributes {
}
} // namespace Attributes
-} // namespace ManaServ
diff --git a/src/net/manaserv/attributes.h b/src/resources/attributes.h
index e004d16c..7124ba94 100644
--- a/src/net/manaserv/attributes.h
+++ b/src/resources/attributes.h
@@ -1,6 +1,6 @@
/*
* The Mana Client
- * Copyright (C) 2010-2012 The Mana Developers
+ * Copyright (C) 2010-2013 The Mana Developers
*
* This file is part of The Mana Client.
*
@@ -18,13 +18,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef NET_MANASERV_ATTRIBUTES_H
-#define NET_MANASERV_ATTRIBUTES_H
+#ifndef RESOURCES_ATTRIBUTES_H
+#define RESOURCES_ATTRIBUTES_H
#include <string>
#include <vector>
-namespace ManaServ {
namespace Attributes {
void load();
@@ -65,6 +64,5 @@ namespace Attributes {
unsigned int getAttributeMaximum();
} // namespace Attributes
-} // namespace ManaServ
-#endif // NET_MANASERV_ATTRIBUTES_H
+#endif // RESOURCES_ATTRIBUTES_H