mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-20 10:23:51 +00:00
added journal entry struct
This commit is contained in:
parent
e4a0702bb4
commit
5851e0a28c
3 changed files with 58 additions and 0 deletions
|
@ -71,10 +71,12 @@ source_group(apps\\openmw\\mwgui FILES ${GAMEGUI_HEADER} ${GAMEGUI})
|
||||||
set(GAMEDIALOGUE_HEADER
|
set(GAMEDIALOGUE_HEADER
|
||||||
mwdialogue/dialoguemanager.hpp
|
mwdialogue/dialoguemanager.hpp
|
||||||
mwdialogue/journal.hpp
|
mwdialogue/journal.hpp
|
||||||
|
mwdialogue/journalentry.hpp
|
||||||
)
|
)
|
||||||
set(GAMEDIALOGUE
|
set(GAMEDIALOGUE
|
||||||
mwdialogue/dialoguemanager.cpp
|
mwdialogue/dialoguemanager.cpp
|
||||||
mwdialogue/journal.cpp
|
mwdialogue/journal.cpp
|
||||||
|
mwdialogue/journalentry.cpp
|
||||||
)
|
)
|
||||||
source_group(apps\\openmw\\mwdialogue FILES ${GAMEDIALOGUE_HEADER} ${GAMEDIALOGUE})
|
source_group(apps\\openmw\\mwdialogue FILES ${GAMEDIALOGUE_HEADER} ${GAMEDIALOGUE})
|
||||||
|
|
||||||
|
|
27
apps/openmw/mwdialogue/journalentry.cpp
Normal file
27
apps/openmw/mwdialogue/journalentry.cpp
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
|
||||||
|
#include "journalentry.hpp"
|
||||||
|
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
|
#include <components/esm_store/store.hpp>
|
||||||
|
|
||||||
|
namespace MWDialogue
|
||||||
|
{
|
||||||
|
JournalEntry::JournalEntry() {}
|
||||||
|
|
||||||
|
JournalEntry::JournalEntry (int day, const std::string& topic, const std::string& infoId)
|
||||||
|
: mDay (day), mTopic (topic), mInfoId (infoId)
|
||||||
|
{}
|
||||||
|
|
||||||
|
std::string JournalEntry::getText (const ESMS::ESMStore& store) const
|
||||||
|
{
|
||||||
|
const ESM::Dialogue *dialogue = store.dialogs.find (mTopic);
|
||||||
|
|
||||||
|
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
|
||||||
|
iter!=dialogue->mInfo.end(); ++iter)
|
||||||
|
if (iter->id==mInfoId)
|
||||||
|
return iter->response;
|
||||||
|
|
||||||
|
throw std::runtime_error ("unknown info ID " + mInfoId + " for topic " + mTopic);
|
||||||
|
}
|
||||||
|
}
|
29
apps/openmw/mwdialogue/journalentry.hpp
Normal file
29
apps/openmw/mwdialogue/journalentry.hpp
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
#ifndef GAME_MMDIALOGUE_JOURNALENTRY_H
|
||||||
|
#define GAME_MWDIALOGUE_JOURNALENTRY_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace ESMS
|
||||||
|
{
|
||||||
|
struct ESMStore;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace MWDialogue
|
||||||
|
{
|
||||||
|
/// \brief a quest or dialogue entry with a timestamp
|
||||||
|
struct JournalEntry
|
||||||
|
{
|
||||||
|
int mDay;
|
||||||
|
std::string mTopic;
|
||||||
|
std::string mInfoId;
|
||||||
|
|
||||||
|
JournalEntry();
|
||||||
|
|
||||||
|
JournalEntry (int day, const std::string& topic, const std::string& infoId);
|
||||||
|
|
||||||
|
std::string getText (const ESMS::ESMStore& store) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in a new issue