1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-04 03:40:14 +00:00

fixed Topic selected event

Fix rebase
This commit is contained in:
fteppe 2022-10-14 00:41:59 +02:00 committed by florent.teppe
parent c283ea0ae8
commit 09d461a8cd
5 changed files with 24 additions and 20 deletions

View File

@ -65,9 +65,9 @@ namespace CSMWorld
/// Works like getAppendIndex unless an overloaded method uses the record pointer /// Works like getAppendIndex unless an overloaded method uses the record pointer
/// to get additional info about the record that results in an alternative index. /// to get additional info about the record that results in an alternative index.
int getAppendIndex(const std::string& id, UniversalId::Type type) const override int getAppendIndex(const ESM::RefId& id, UniversalId::Type type) const override
{ {
return getInsertIndex(id, type); return getInsertIndex(id.getRefIdString(), type);
} }
bool reorderRows(int baseIndex, const std::vector<int>& newOrder) override; bool reorderRows(int baseIndex, const std::vector<int>& newOrder) override;

View File

@ -10,6 +10,7 @@
#include <osg/ref_ptr> #include <osg/ref_ptr>
#include "../../model/world/cellcoordinates.hpp" #include "../../model/world/cellcoordinates.hpp"
#include <components/esm/refid.hpp>
#include "instancedragmodes.hpp" #include "instancedragmodes.hpp"
class QModelIndex; class QModelIndex;

View File

@ -120,8 +120,8 @@ namespace
Gui::MWList* list = getWidget<Gui::MWList>(QuestsList); Gui::MWList* list = getWidget<Gui::MWList>(QuestsList);
list->eventItemSelected += MyGUI::newDelegate(this, &JournalWindowImpl::notifyQuestClicked); list->eventItemSelected += MyGUI::newDelegate(this, &JournalWindowImpl::notifyQuestClicked);
//Gui::MWList* topicsList = getWidget<Gui::MWList>(TopicsList); Gui::MWList* topicsList = getWidget<Gui::MWList>(TopicsList);
//topicsList->eventItemSelected += MyGUI::newDelegate(this, &JournalWindowImpl::notifyTopicSelected); topicsList->eventItemSelected += MyGUI::newDelegate(this, &JournalWindowImpl::notifyTopicSelected);
{ {
MWGui::BookPage::ClickCallback callback; MWGui::BookPage::ClickCallback callback;
@ -417,8 +417,9 @@ namespace
MWBase::Environment::get().getWindowManager()->playSound(ESM::sBookPageSoundId); MWBase::Environment::get().getWindowManager()->playSound(ESM::sBookPageSoundId);
} }
void notifyTopicSelected(const ESM::RefId& topic, int id) void notifyTopicSelected(const std::string& topicIdString, int id)
{ {
ESM::RefId topic = ESM::RefId::stringRefId(topicIdString);
const MWBase::Journal* journal = MWBase::Environment::get().getJournal(); const MWBase::Journal* journal = MWBase::Environment::get().getJournal();
intptr_t topicId = 0; /// \todo get rid of intptr ids intptr_t topicId = 0; /// \todo get rid of intptr ids
for (MWBase::Journal::TTopicIter i = journal->topicBegin(); i != journal->topicEnd(); ++i) for (MWBase::Journal::TTopicIter i = journal->topicBegin(); i != journal->topicEnd(); ++i)

View File

@ -2043,16 +2043,15 @@ namespace MWMechanics
if (!godmode) if (!godmode)
{ {
// reduce fatigue // reduce fatigue
const MWWorld::Store<ESM::GameSetting>& gmst = world->getStore().get<ESM::GameSetting>();
float fatigueLoss = 0; float fatigueLoss = 0;
static const float fFatigueRunBase = gmst.find(ESM::RefId::stringRefId("fFatigueRunBase"))->mValue.getFloat(); static const float fFatigueRunBase = gmst.find("fFatigueRunBase")->mValue.getFloat();
static const float fFatigueRunMult = gmst.find(ESM::RefId::stringRefId("fFatigueRunMult"))->mValue.getFloat(); static const float fFatigueRunMult = gmst.find("fFatigueRunMult")->mValue.getFloat();
static const float fFatigueSwimWalkBase = gmst.find(ESM::RefId::stringRefId("fFatigueSwimWalkBase"))->mValue.getFloat(); static const float fFatigueSwimWalkBase = gmst.find("fFatigueSwimWalkBase")->mValue.getFloat();
static const float fFatigueSwimRunBase = gmst.find(ESM::RefId::stringRefId("fFatigueSwimRunBase"))->mValue.getFloat(); static const float fFatigueSwimRunBase = gmst.find("fFatigueSwimRunBase")->mValue.getFloat();
static const float fFatigueSwimWalkMult = gmst.find(ESM::RefId::stringRefId("fFatigueSwimWalkMult"))->mValue.getFloat(); static const float fFatigueSwimWalkMult = gmst.find("fFatigueSwimWalkMult")->mValue.getFloat();
static const float fFatigueSwimRunMult = gmst.find(ESM::RefId::stringRefId("fFatigueSwimRunMult"))->mValue.getFloat(); static const float fFatigueSwimRunMult = gmst.find("fFatigueSwimRunMult")->mValue.getFloat();
static const float fFatigueSneakBase = gmst.find(ESM::RefId::stringRefId("fFatigueSneakBase"))->mValue.getFloat(); static const float fFatigueSneakBase = gmst.find("fFatigueSneakBase")->mValue.getFloat();
static const float fFatigueSneakMult = gmst.find(ESM::RefId::stringRefId("fFatigueSneakMult"))->mValue.getFloat(); static const float fFatigueSneakMult = gmst.find("fFatigueSneakMult")->mValue.getFloat();
if (cls.getEncumbrance(mPtr) <= cls.getCapacity(mPtr)) if (cls.getEncumbrance(mPtr) <= cls.getCapacity(mPtr))
{ {
@ -2159,16 +2158,19 @@ namespace MWMechanics
if (mPtr.getClass().isNpc()) if (mPtr.getClass().isNpc())
{ {
std::string_view sound; const ESM::RefId* sound = nullptr;
static const ESM::RefId defaultLandWater = ESM::RefId::stringRefId("DefaultLandWater");
static const ESM::RefId defaultLand = ESM::RefId::stringRefId("DefaultLand");
osg::Vec3f pos(mPtr.getRefData().getPosition().asVec3()); osg::Vec3f pos(mPtr.getRefData().getPosition().asVec3());
if (world->isUnderwater(mPtr.getCell(), pos) || world->isWalkingOnWater(mPtr)) if (world->isUnderwater(mPtr.getCell(), pos) || world->isWalkingOnWater(mPtr))
sound = "DefaultLandWater"; sound = &defaultLandWater;
else if (onground) else if (onground)
sound = "DefaultLand"; sound = &defaultLand;
if (!sound.empty()) if (sound && !sound->empty())
sndMgr->playSound3D( sndMgr->playSound3D(
mPtr, sound, 1.f, 1.f, MWSound::Type::Foot, MWSound::PlayMode::NoPlayerLocal); mPtr, *sound, 1.f, 1.f, MWSound::Type::Foot, MWSound::PlayMode::NoPlayerLocal);
} }
} }

View File

@ -437,7 +437,7 @@ namespace MWWorld
}; };
Misc::forEachUnique(refs.rbegin(), refs.rend(), equalByRefNum, incrementRefCount); Misc::forEachUnique(refs.rbegin(), refs.rend(), equalByRefNum, incrementRefCount);
auto& store = getWritable<ESM::Miscellaneous>().mStatic; auto& store = getWritable<ESM::Miscellaneous>().mStatic;
for (const std::string& id : keyIDs) for (const auto& id : keyIDs)
{ {
auto it = store.find(id); auto it = store.find(id);
if (it != store.end()) if (it != store.end())