Ingredient effects now correctly hide until the player has discovered them

pull/16/head
scrawl 12 years ago
parent 274ff530dc
commit c71656493d

@ -12,6 +12,9 @@
#include "../mwworld/cellstore.hpp"
#include "../mwworld/physicssystem.hpp"
#include "../mwworld/actioneat.hpp"
#include "../mwworld/player.hpp"
#include "../mwmechanics/npcstats.hpp"
#include "../mwgui/tooltips.hpp"
@ -154,6 +157,10 @@ namespace MWClass
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
}
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer();
MWMechanics::NpcStats& npcStats = MWWorld::Class::get(player).getNpcStats (player);
int alchemySkill = npcStats.getSkill (ESM::Skill::Alchemy).getBase();
MWGui::Widgets::SpellEffectList list;
for (int i=0; i<4; ++i)
{
@ -163,6 +170,12 @@ namespace MWClass
params.mEffectID = ref->mBase->mData.mEffectID[i];
params.mAttribute = ref->mBase->mData.mAttributes[i];
params.mSkill = ref->mBase->mData.mSkills[i];
params.mKnown = ( (i == 0 && alchemySkill >= 15)
|| (i == 1 && alchemySkill >= 30)
|| (i == 2 && alchemySkill >= 45)
|| (i == 3 && alchemySkill >= 60));
list.push_back(params);
}
info.effects = list;

@ -390,8 +390,13 @@ void MWSpellEffect::setSpellEffect(const SpellEffectParams& params)
void MWSpellEffect::updateWidgets()
{
if (!mWindowManager)
if (!mEffectParams.mKnown)
{
mTextWidget->setCaption ("?");
mRequestedWidth = mTextWidget->getTextSize().width + 24;
mImageWidget->setImageTexture ("");
return;
}
const MWWorld::ESMStore &store =
MWBase::Environment::get().getWorld()->getStore();
@ -400,7 +405,6 @@ void MWSpellEffect::updateWidgets()
store.get<ESM::MagicEffect>().search(mEffectParams.mEffectID);
assert(magicEffect);
assert(mWindowManager);
std::string pt = mWindowManager->getGameSettingString("spoint", "");
std::string pts = mWindowManager->getGameSettingString("spoints", "");

@ -37,12 +37,15 @@ namespace MWGui
, mEffectID(-1)
, mNoTarget(false)
, mIsConstant(false)
, mKnown(true)
{
}
bool mNoTarget; // potion effects for example have no target (target is always the player)
bool mIsConstant; // constant effect means that duration will not be displayed
bool mKnown; // is this effect known to the player? (If not, will display as a question mark instead)
// value of -1 here means the effect is unknown to the player
short mEffectID;

Loading…
Cancel
Save