forked from mirror/openmw-tes3mp
quest entries are added to main journal now
This commit is contained in:
parent
792de880cf
commit
f3fecdc627
3 changed files with 28 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
|
||||
#include "journal.hpp"
|
||||
|
||||
#include "../mwworld/environment.hpp"
|
||||
|
||||
#include <iostream>
|
||||
namespace MWDialogue
|
||||
|
@ -11,6 +12,7 @@ namespace MWDialogue
|
|||
|
||||
void Journal::addEntry (const std::string& id, int index)
|
||||
{
|
||||
mJournal.push_back (JournalEntry::makeFromQuest (id, index, *mEnvironment.mWorld));
|
||||
std::cout << "journal: " << id << " at " << index << std::endl;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include <components/esm_store/store.hpp>
|
||||
|
||||
#include "../mwworld/world.hpp"
|
||||
|
||||
namespace MWDialogue
|
||||
{
|
||||
JournalEntry::JournalEntry() {}
|
||||
|
@ -24,4 +26,20 @@ namespace MWDialogue
|
|||
|
||||
throw std::runtime_error ("unknown info ID " + mInfoId + " for topic " + mTopic);
|
||||
}
|
||||
|
||||
JournalEntry JournalEntry::makeFromQuest (const std::string& topic, int index,
|
||||
const MWWorld::World& world)
|
||||
{
|
||||
const ESM::Dialogue *dialogue = world.getStore().dialogs.find (topic);
|
||||
|
||||
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
|
||||
iter!=dialogue->mInfo.end(); ++iter)
|
||||
if (iter->data.disposition==index) /// \todo cleanup info structure
|
||||
{
|
||||
int day = world.getGlobalVariable ("dayspassed").mLong;
|
||||
return JournalEntry (day, topic, iter->id);
|
||||
}
|
||||
|
||||
throw std::runtime_error ("unknown journal index for topic " + topic);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,11 @@ namespace ESMS
|
|||
struct ESMStore;
|
||||
}
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
class World;
|
||||
}
|
||||
|
||||
namespace MWDialogue
|
||||
{
|
||||
/// \brief a quest or dialogue entry with a timestamp
|
||||
|
@ -22,6 +27,9 @@ namespace MWDialogue
|
|||
JournalEntry (int day, const std::string& topic, const std::string& infoId);
|
||||
|
||||
std::string getText (const ESMS::ESMStore& store) const;
|
||||
|
||||
static JournalEntry makeFromQuest (const std::string& topic, int index,
|
||||
const MWWorld::World& world);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue