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 "journal.hpp"
|
||||||
|
|
||||||
|
#include "../mwworld/environment.hpp"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
namespace MWDialogue
|
namespace MWDialogue
|
||||||
|
@ -11,6 +12,7 @@ namespace MWDialogue
|
||||||
|
|
||||||
void Journal::addEntry (const std::string& id, int index)
|
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;
|
std::cout << "journal: " << id << " at " << index << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
#include <components/esm_store/store.hpp>
|
#include <components/esm_store/store.hpp>
|
||||||
|
|
||||||
|
#include "../mwworld/world.hpp"
|
||||||
|
|
||||||
namespace MWDialogue
|
namespace MWDialogue
|
||||||
{
|
{
|
||||||
JournalEntry::JournalEntry() {}
|
JournalEntry::JournalEntry() {}
|
||||||
|
@ -24,4 +26,20 @@ namespace MWDialogue
|
||||||
|
|
||||||
throw std::runtime_error ("unknown info ID " + mInfoId + " for topic " + mTopic);
|
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;
|
struct ESMStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace MWWorld
|
||||||
|
{
|
||||||
|
class World;
|
||||||
|
}
|
||||||
|
|
||||||
namespace MWDialogue
|
namespace MWDialogue
|
||||||
{
|
{
|
||||||
/// \brief a quest or dialogue entry with a timestamp
|
/// \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);
|
JournalEntry (int day, const std::string& topic, const std::string& infoId);
|
||||||
|
|
||||||
std::string getText (const ESMS::ESMStore& store) const;
|
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