summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-05 12:20:58 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-06 01:18:57 +0300
commit2cdf1b18d5593dfecacfc7b2e113c404dc64d1f4 (patch)
tree2c0feb59deb99dbd45338ed813177c6826b543fb
parent57978a09e9d32a44a95823716d790065d73f977a (diff)
downloadmanaplus-2cdf1b18d5593dfecacfc7b2e113c404dc64d1f4.tar.gz
manaplus-2cdf1b18d5593dfecacfc7b2e113c404dc64d1f4.tar.bz2
manaplus-2cdf1b18d5593dfecacfc7b2e113c404dc64d1f4.tar.xz
manaplus-2cdf1b18d5593dfecacfc7b2e113c404dc64d1f4.zip
Use skill type struct in skill info.
-rw-r--r--src/gui/widgets/skillinfo.cpp2
-rw-r--r--src/gui/widgets/skillinfo.h4
-rw-r--r--src/gui/windows/skilldialog.cpp4
-rw-r--r--src/gui/windows/skilldialog.h6
-rw-r--r--src/net/ea/skillhandler.cpp7
-rw-r--r--src/net/eathena/skillhandler.cpp3
-rw-r--r--src/net/tmwa/skillhandler.cpp3
-rw-r--r--src/resources/skilltype.h1
8 files changed, 20 insertions, 10 deletions
diff --git a/src/gui/widgets/skillinfo.cpp b/src/gui/widgets/skillinfo.cpp
index 93b9bcf60..bd889865d 100644
--- a/src/gui/widgets/skillinfo.cpp
+++ b/src/gui/widgets/skillinfo.cpp
@@ -48,7 +48,7 @@ SkillInfo::SkillInfo() :
skillLevelWidth(0),
id(0),
range(0),
- type(0),
+ type(SkillType::Unknown),
modifiable(false),
visible(false)
{
diff --git a/src/gui/widgets/skillinfo.h b/src/gui/widgets/skillinfo.h
index f096da9ac..10d6191df 100644
--- a/src/gui/widgets/skillinfo.h
+++ b/src/gui/widgets/skillinfo.h
@@ -25,6 +25,8 @@
#include "gui/color.h"
+#include "resources/skilltype.h"
+
#include <vector>
#include <map>
#include <string>
@@ -53,7 +55,7 @@ struct SkillInfo final
int skillLevelWidth;
unsigned int id;
int range;
- int type;
+ SkillType::SkillType type;
bool modifiable;
bool visible;
diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp
index 73a023005..7be86ec1b 100644
--- a/src/gui/windows/skilldialog.cpp
+++ b/src/gui/windows/skilldialog.cpp
@@ -345,7 +345,7 @@ void SkillDialog::loadXmlFile(const std::string &fileName)
bool SkillDialog::updateSkill(const int id,
const int range,
const bool modifiable,
- const int type)
+ const SkillType::SkillType type)
{
const SkillMap::const_iterator it = mSkills.find(id);
@@ -369,7 +369,7 @@ void SkillDialog::addSkill(const int id,
const int level,
const int range,
const bool modifiable,
- const int type)
+ const SkillType::SkillType type)
{
if (mDefaultModel)
{
diff --git a/src/gui/windows/skilldialog.h b/src/gui/windows/skilldialog.h
index 39082c1e7..8e2c325a0 100644
--- a/src/gui/windows/skilldialog.h
+++ b/src/gui/windows/skilldialog.h
@@ -27,6 +27,8 @@
#include "listeners/actionlistener.h"
+#include "resources/skilltype.h"
+
class Button;
class Label;
class SkillModel;
@@ -76,14 +78,14 @@ class SkillDialog final : public Window,
bool updateSkill(const int id,
const int range,
const bool modifiable,
- const int type);
+ const SkillType::SkillType type);
void addSkill(const int id,
const std::string &name,
const int level,
const int range,
const bool modifiable,
- const int type);
+ const SkillType::SkillType type);
SkillInfo* getSkill(const int id) const A_WARN_UNUSED;
diff --git a/src/net/ea/skillhandler.cpp b/src/net/ea/skillhandler.cpp
index f3c2a6982..8a7f42d82 100644
--- a/src/net/ea/skillhandler.cpp
+++ b/src/net/ea/skillhandler.cpp
@@ -88,8 +88,11 @@ void SkillHandler::processPlayerSkillUp(Net::MessageIn &msg)
PlayerInfo::setSkillLevel(skillId, level);
if (skillDialog)
{
- if (!skillDialog->updateSkill(skillId, range, up, 0))
- skillDialog->addSkill(skillId, "", level, range, up, 0);
+ if (!skillDialog->updateSkill(skillId, range, up, SkillType::Unknown))
+ {
+ skillDialog->addSkill(skillId, "", level,
+ range, up, SkillType::Unknown);
+ }
}
}
diff --git a/src/net/eathena/skillhandler.cpp b/src/net/eathena/skillhandler.cpp
index 09580b8fc..1f2d9a8ba 100644
--- a/src/net/eathena/skillhandler.cpp
+++ b/src/net/eathena/skillhandler.cpp
@@ -107,7 +107,8 @@ void SkillHandler::processPlayerSkills(Net::MessageIn &msg)
for (int k = 0; k < skillCount; k++)
{
const int skillId = msg.readInt16("skill id");
- const int inf = msg.readInt32("inf");
+ const SkillType::SkillType inf = static_cast<SkillType::SkillType>(
+ msg.readInt32("inf"));
const int level = msg.readInt16("skill level");
msg.readInt16("sp");
const int range = msg.readInt16("range");
diff --git a/src/net/tmwa/skillhandler.cpp b/src/net/tmwa/skillhandler.cpp
index 8b0d6f662..65f86d4bc 100644
--- a/src/net/tmwa/skillhandler.cpp
+++ b/src/net/tmwa/skillhandler.cpp
@@ -109,7 +109,8 @@ void SkillHandler::processPlayerSkills(Net::MessageIn &msg)
for (int k = 0; k < skillCount; k++)
{
const int skillId = msg.readInt16();
- const int inf = msg.readInt16();
+ const SkillType::SkillType inf = static_cast<SkillType::SkillType>(
+ msg.readInt16());
msg.skip(2); // skill pool flags
const int level = msg.readInt16();
msg.readInt16(); // sp
diff --git a/src/resources/skilltype.h b/src/resources/skilltype.h
index 79384762f..27860cac1 100644
--- a/src/resources/skilltype.h
+++ b/src/resources/skilltype.h
@@ -25,6 +25,7 @@ namespace SkillType
{
enum SkillType
{
+ Unknown = 0,
Attack = 1,
Ground = 2,
Self = 4,