diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-01-26 13:30:24 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-01-26 13:30:24 +0300 |
commit | 1a9330a5f6cd753b4155ac74db104cb0ffa095c9 (patch) | |
tree | d3d24cfc1101b99e2055a9330b2e31522512f0c3 /src | |
parent | 793e570728840dd788f9104e54828c1530016d61 (diff) | |
download | manaverse-1a9330a5f6cd753b4155ac74db104cb0ffa095c9.tar.gz manaverse-1a9330a5f6cd753b4155ac74db104cb0ffa095c9.tar.bz2 manaverse-1a9330a5f6cd753b4155ac74db104cb0ffa095c9.tar.xz manaverse-1a9330a5f6cd753b4155ac74db104cb0ffa095c9.zip |
Allow open cart window only if cart status effect enabled.
Diffstat (limited to 'src')
-rw-r--r-- | src/actions/windows.cpp | 8 | ||||
-rw-r--r-- | src/being/actorsprite.cpp | 5 | ||||
-rw-r--r-- | src/being/actorsprite.h | 7 | ||||
-rw-r--r-- | src/defaults.cpp | 1 | ||||
-rw-r--r-- | src/statuseffect.cpp | 5 | ||||
-rw-r--r-- | src/statuseffect.h | 1 |
6 files changed, 24 insertions, 3 deletions
diff --git a/src/actions/windows.cpp b/src/actions/windows.cpp index 9a7743590..91d965748 100644 --- a/src/actions/windows.cpp +++ b/src/actions/windows.cpp @@ -22,6 +22,8 @@ #include "actions/actiondef.h" +#include "being/localplayer.h" + #include "gui/dialogsmanager.h" #include "gui/windows/bankwindow.h" @@ -277,8 +279,12 @@ impHandler0(bankWindowShow) impHandler0(cartWindowShow) { - if (!serverFeatures->haveCart()) + if (!serverFeatures->haveCart() + || !localPlayer + || !localPlayer->getHaveCart()) + { return false; + } showHideWindow(cartWindow); return true; diff --git a/src/being/actorsprite.cpp b/src/being/actorsprite.cpp index b6c4ea360..a2e7524cc 100644 --- a/src/being/actorsprite.cpp +++ b/src/being/actorsprite.cpp @@ -72,7 +72,8 @@ ActorSprite::ActorSprite(const int id) : mCursorPaddingX(0), mCursorPaddingY(0), mMustResetParticles(false), - mPoison(false) + mPoison(false), + mHaveCart(false) { } @@ -219,6 +220,8 @@ void ActorSprite::updateStatusEffect(const int index, const bool newStatus) return; if (effect->isPoison() && getType() == ActorType::Player) setPoison(newStatus); + if (localPlayer == this) + setHaveCart(newStatus); handleStatusEffect(effect, index); } diff --git a/src/being/actorsprite.h b/src/being/actorsprite.h index b9889490c..02a17ea07 100644 --- a/src/being/actorsprite.h +++ b/src/being/actorsprite.h @@ -171,6 +171,12 @@ class ActorSprite notfinal : public CompoundSprite, public Actor bool getPoison() const A_WARN_UNUSED { return mPoison; } + void setHaveCart(const bool b) + { mHaveCart = b; } + + bool getHaveCart() const A_WARN_UNUSED + { return mHaveCart; } + protected: /** * Notify self that the stun mode has been updated. Invoked by @@ -232,6 +238,7 @@ class ActorSprite notfinal : public CompoundSprite, public Actor /** Reset particle status effects on next redraw? */ bool mMustResetParticles; bool mPoison; + bool mHaveCart; }; #endif // BEING_ACTORSPRITE_H diff --git a/src/defaults.cpp b/src/defaults.cpp index 5e0b2d031..9abd9bb14 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -578,6 +578,7 @@ DefaultsData* getPathsDefaults() AddDEF("defaultcommandsPatchFile", "defaultcommands_patch.xml"); AddDEF("defaultcommandsPatchDir", "defaultcommands.d"); AddDEF("poisonEffectName", "poison"); + AddDEF("cartEffectName", "cart"); return configData; } diff --git a/src/statuseffect.cpp b/src/statuseffect.cpp index b9499fc2e..987529631 100644 --- a/src/statuseffect.cpp +++ b/src/statuseffect.cpp @@ -49,7 +49,8 @@ StatusEffect::StatusEffect() : mIcon(), mAction(), mPersistentParticleEffect(false), - mIsPoison(false) + mIsPoison(false), + mIsCart(false) { } @@ -198,6 +199,8 @@ void StatusEffect::loadXmlFile(const std::string &fileName) startEffect->mIsPoison = (name == paths.getStringValue("poisonEffectName")); + startEffect->mIsCart = + (name == paths.getStringValue("cartEffectName")); startEffect->mMessage = XML::getProperty( node, "start-message", ""); startEffect->mSFXEffect = XML::getProperty( diff --git a/src/statuseffect.h b/src/statuseffect.h index 392a942f6..143124948 100644 --- a/src/statuseffect.h +++ b/src/statuseffect.h @@ -124,6 +124,7 @@ class StatusEffect final std::string mAction; bool mPersistentParticleEffect; bool mIsPoison; + bool mIsCart; }; #endif // STATUSEFFECT_H |