summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-13 16:22:46 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-13 16:22:46 +0300
commitf40b3cd12dd2e2c65d02816c450e5645fba84109 (patch)
tree280e582f4a188cacc97973be3994a24b38218ed2 /src
parent767e9a19a27ecf4b7f5ea88e958c818fc56db9fd (diff)
downloadmanaplus-f40b3cd12dd2e2c65d02816c450e5645fba84109.tar.gz
manaplus-f40b3cd12dd2e2c65d02816c450e5645fba84109.tar.bz2
manaplus-f40b3cd12dd2e2c65d02816c450e5645fba84109.tar.xz
manaplus-f40b3cd12dd2e2c65d02816c450e5645fba84109.zip
For skill units in context menu show creator name or id.
Diffstat (limited to 'src')
-rw-r--r--src/being/being.cpp3
-rw-r--r--src/being/being.h9
-rw-r--r--src/gui/popups/popupmenu.cpp24
-rw-r--r--src/net/eathena/beingrecv.cpp6
4 files changed, 38 insertions, 4 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index f1617e64e..9b8be8ec8 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -236,6 +236,9 @@ Being::Being(const BeingId id,
mKarma(0),
mManner(0),
mAreaSize(11),
+#ifdef EATHENA_SUPPORT
+ mCreatorId(BeingId_zero),
+#endif
mTeamId(0U),
mLook(0U),
mBadgesCount(0U),
diff --git a/src/being/being.h b/src/being/being.h
index 585b59a43..31c28d28f 100644
--- a/src/being/being.h
+++ b/src/being/being.h
@@ -925,6 +925,12 @@ class Being notfinal : public ActorSprite,
{ return mSpiritBalls; }
void stopCast(const bool b) override final;
+
+ void setCreatorId(const BeingId id)
+ { mCreatorId = id; }
+
+ BeingId getCreatorId() const noexcept A_WARN_UNUSED
+ { return mCreatorId; }
#endif
void setKarma(const int karma) restrict2 noexcept
@@ -1170,6 +1176,9 @@ class Being notfinal : public ActorSprite,
int mKarma;
int mManner;
int mAreaSize;
+#ifdef EATHENA_SUPPORT
+ BeingId mCreatorId;
+#endif
uint16_t mTeamId;
uint16_t mLook;
uint16_t mBadgesCount;
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index 2405743c5..811efc881 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -160,7 +160,12 @@ void PopupMenu::showPopup(const int x, const int y, const Being *const being)
mY = y;
const std::string &name = mName;
- mBrowserBox->addRow(name + being->getGenderSignWithSpace());
+#ifdef EATHENA_SUPPORT
+ if (being->getType() != ActorType::SkillUnit)
+#endif
+ {
+ mBrowserBox->addRow(name + being->getGenderSignWithSpace());
+ }
switch (being->getType())
{
@@ -409,8 +414,23 @@ void PopupMenu::showPopup(const int x, const int y, const Being *const being)
}
break;
case ActorType::SkillUnit:
- // +++ need impliment menu
+ {
+ const BeingId id = being->getCreatorId();
+ std::string creatorName;
+ Being *const creator = actorManager->findBeing(id);
+ if (creator)
+ creatorName = creator->getName();
+ else
+ creatorName = actorManager->getSeenPlayerById(id);
+
+ if (creatorName.empty())
+ creatorName = strprintf("?%d", CAST_S32(id));
+
+ mBrowserBox->addRow(strprintf("%s (%s)",
+ name.c_str(),
+ creatorName.c_str()));
break;
+ }
#endif
case ActorType::Avatar:
case ActorType::Unknown:
diff --git a/src/net/eathena/beingrecv.cpp b/src/net/eathena/beingrecv.cpp
index c5c7acfcc..18c8c11b5 100644
--- a/src/net/eathena/beingrecv.cpp
+++ b/src/net/eathena/beingrecv.cpp
@@ -1186,7 +1186,7 @@ void BeingRecv::processSkillEntry(Net::MessageIn &msg)
{
msg.readInt16("len");
const BeingId id = msg.readBeingId("skill unit id");
- msg.readBeingId("creator accound id");
+ const BeingId creatorId = msg.readBeingId("creator accound id");
const int x = msg.readInt16("x");
const int y = msg.readInt16("y");
const int job = msg.readInt32("job");
@@ -1199,6 +1199,7 @@ void BeingRecv::processSkillEntry(Net::MessageIn &msg)
dstBeing->setAction(BeingAction::STAND, 0);
dstBeing->setTileCoords(x, y);
dstBeing->setLevel(level);
+ dstBeing->setCreatorId(creatorId);
}
void BeingRecv::processPlaterStatusChange(Net::MessageIn &msg)
@@ -1757,7 +1758,7 @@ void BeingRecv::processSolveCharName(Net::MessageIn &msg)
void BeingRecv::processGraffiti(Net::MessageIn &msg)
{
const BeingId id = msg.readBeingId("graffiti id");
- msg.readBeingId("creator id");
+ const BeingId creatorId = msg.readBeingId("creator id");
const int x = msg.readInt16("x");
const int y = msg.readInt16("y");
const int job = msg.readUInt8("job");
@@ -1773,6 +1774,7 @@ void BeingRecv::processGraffiti(Net::MessageIn &msg)
dstBeing->setTileCoords(x, y);
dstBeing->setShowName(true);
dstBeing->setName(text);
+ dstBeing->setCreatorId(creatorId);
}
void BeingRecv::applyPlayerAction(Net::MessageIn &msg,