summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-04-29 00:46:25 +0200
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-04-29 00:46:25 +0200
commit7e7e322fca22299a79630b8fe0bcb7e36c39e47a (patch)
tree518775a5b9596dcc50fccc0558c13c786821dede
parentb00d3ffb2054e0ae96b602ba46589ef408d5a23d (diff)
downloadmana-7e7e322fca22299a79630b8fe0bcb7e36c39e47a.tar.gz
mana-7e7e322fca22299a79630b8fe0bcb7e36c39e47a.tar.bz2
mana-7e7e322fca22299a79630b8fe0bcb7e36c39e47a.tar.xz
mana-7e7e322fca22299a79630b8fe0bcb7e36c39e47a.zip
Made the client load the skills.xml again.
This, instead of the protocol specific filenames that are mana-skills.xml and ea-skills.xml. This is backward compatible as the old skills.xml file was once used before the 0.0.29.1 release which is the last alive from the 0.0.x serie. The skills.xml will have to added to world data to make this working, though. (Done in another patch.)
-rw-r--r--src/gui/skilldialog.cpp17
-rw-r--r--src/gui/skilldialog.h4
-rw-r--r--src/net/manaserv/generalhandler.cpp2
-rw-r--r--src/net/tmwa/generalhandler.cpp2
4 files changed, 15 insertions, 10 deletions
diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp
index 207e3ded..b48df8df 100644
--- a/src/gui/skilldialog.cpp
+++ b/src/gui/skilldialog.cpp
@@ -54,6 +54,8 @@
#include <set>
#include <string>
+#define SKILLS_FILE "skills.xml"
+
class SkillModel;
class SkillEntry;
@@ -230,8 +232,7 @@ SkillDialog::SkillDialog():
SkillDialog::~SkillDialog()
{
- // Clear gui
- loadSkills("");
+ clearSkills();
}
void SkillDialog::action(const gcn::ActionEvent &event)
@@ -279,7 +280,7 @@ void SkillDialog::update()
}
}
-void SkillDialog::loadSkills(const std::string &file)
+void SkillDialog::clearSkills()
{
// Fixes issues with removing tabs
if (mTabs->getSelectedTabIndex() != -1)
@@ -296,11 +297,13 @@ void SkillDialog::loadSkills(const std::string &file)
delete_all(mSkills);
mSkills.clear();
+}
- if (file.length() == 0)
- return;
+void SkillDialog::loadSkills()
+{
+ clearSkills();
- XML::Document doc(file);
+ XML::Document doc(SKILLS_FILE);
xmlNodePtr root = doc.rootNode();
int setCount = 0;
@@ -311,7 +314,7 @@ void SkillDialog::loadSkills(const std::string &file)
if (!root || !xmlStrEqual(root->name, BAD_CAST "skills"))
{
- logger->log("Error loading skills file: %s", file.c_str());
+ logger->log("Error loading skills file: %s", SKILLS_FILE);
if (Net::getNetworkType() == ServerInfo::TMWATHENA)
{
diff --git a/src/gui/skilldialog.h b/src/gui/skilldialog.h
index 95f8ef25..40fa988d 100644
--- a/src/gui/skilldialog.h
+++ b/src/gui/skilldialog.h
@@ -65,7 +65,9 @@ class SkillDialog : public Window, public gcn::ActionListener
*/
void update();
- void loadSkills(const std::string &file);
+ void loadSkills();
+
+ void clearSkills();
void setModifiable(int id, bool modifiable);
diff --git a/src/net/manaserv/generalhandler.cpp b/src/net/manaserv/generalhandler.cpp
index 0d3073f1..4f6ade4e 100644
--- a/src/net/manaserv/generalhandler.cpp
+++ b/src/net/manaserv/generalhandler.cpp
@@ -166,7 +166,7 @@ void GeneralHandler::flushNetwork()
void GeneralHandler::guiWindowsLoaded()
{
inventoryWindow->setSplitAllowed(true);
- skillDialog->loadSkills("mana-skills.xml");
+ skillDialog->loadSkills();
specialsWindow->loadSpecials("specials.xml");
player_node->setExpNeeded(100);
diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp
index 14f48055..12768807 100644
--- a/src/net/tmwa/generalhandler.cpp
+++ b/src/net/tmwa/generalhandler.cpp
@@ -212,7 +212,7 @@ void GeneralHandler::flushNetwork()
void GeneralHandler::guiWindowsLoaded()
{
inventoryWindow->setSplitAllowed(false);
- skillDialog->loadSkills("ea-skills.xml");
+ skillDialog->loadSkills();
statusWindow->addAttribute(STR, _("Strength"), true, "");
statusWindow->addAttribute(AGI, _("Agility"), true, "");