forked from mirror/openmw-tes3mp
Merge remote-tracking branch 'pakanek/esmtool_plain_script'
This commit is contained in:
commit
9d67cd6251
3 changed files with 55 additions and 22 deletions
|
@ -51,6 +51,7 @@ struct Arguments
|
|||
unsigned int raw_given;
|
||||
unsigned int quiet_given;
|
||||
unsigned int loadcells_given;
|
||||
bool plain_given;
|
||||
|
||||
std::string mode;
|
||||
std::string encoding;
|
||||
|
@ -77,6 +78,9 @@ bool parseOptions (int argc, char** argv, Arguments &info)
|
|||
("type,t", bpo::value< std::vector<std::string> >(),
|
||||
"Show only records of this type (four character record code). May "
|
||||
"be specified multiple times. Only affects dump mode.")
|
||||
("plain,p", "Print contents of dialogs, books and scripts. "
|
||||
"(skipped by default)"
|
||||
"Only affects dump mode.")
|
||||
("quiet,q", "Supress all record information. Useful for speed tests.")
|
||||
("loadcells,C", "Browse through contents of all cells.")
|
||||
|
||||
|
@ -161,6 +165,7 @@ bool parseOptions (int argc, char** argv, Arguments &info)
|
|||
info.raw_given = variables.count ("raw");
|
||||
info.quiet_given = variables.count ("quiet");
|
||||
info.loadcells_given = variables.count ("loadcells");
|
||||
info.plain_given = (variables.count("plain") > 0);
|
||||
|
||||
// Font encoding settings
|
||||
info.encoding = variables["encoding"].as<std::string>();
|
||||
|
@ -343,6 +348,7 @@ int load(Arguments& info)
|
|||
}
|
||||
record->setId(id);
|
||||
record->setFlags((int) flags);
|
||||
record->setPrintPlain(info.plain_given);
|
||||
record->load(esm);
|
||||
if (!quiet && interested) record->print();
|
||||
|
||||
|
|
|
@ -464,12 +464,17 @@ void Record<ESM::Book>::print()
|
|||
std::cout << " IsScroll: " << mData.mData.mIsScroll << std::endl;
|
||||
std::cout << " SkillID: " << mData.mData.mSkillID << std::endl;
|
||||
std::cout << " Enchantment Points: " << mData.mData.mEnchant << std::endl;
|
||||
if (mPrintPlain)
|
||||
{
|
||||
std::cout << " Text:" << std::endl;
|
||||
std::cout << "START--------------------------------------" << std::endl;
|
||||
std::cout << mData.mText << std::endl;
|
||||
std::cout << "END----------------------------------------" << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << " Text: [skipped]" << std::endl;
|
||||
// Skip until multi-line fields is controllable by a command line option.
|
||||
// Mildly problematic because there are no parameter to print() currently.
|
||||
// std::cout << "-------------------------------------------" << std::endl;
|
||||
// std::cout << mData.mText << std::endl;
|
||||
// std::cout << "-------------------------------------------" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
template<>
|
||||
|
@ -753,15 +758,6 @@ void Record<ESM::DialInfo>::print()
|
|||
if (mData.mSound != "")
|
||||
std::cout << " Sound File: " << mData.mSound << std::endl;
|
||||
|
||||
if (mData.mResultScript != "")
|
||||
{
|
||||
std::cout << " Result Script: [skipped]" << std::endl;
|
||||
// Skip until multi-line fields is controllable by a command line option.
|
||||
// Mildly problematic because there are no parameter to print() currently.
|
||||
// std::cout << "-------------------------------------------" << std::endl;
|
||||
// std::cout << mData.mResultScript << std::endl;
|
||||
// std::cout << "-------------------------------------------" << std::endl;
|
||||
}
|
||||
|
||||
std::cout << " Quest Status: " << questStatusLabel(mData.mQuestStatus)
|
||||
<< " (" << mData.mQuestStatus << ")" << std::endl;
|
||||
|
@ -771,6 +767,21 @@ void Record<ESM::DialInfo>::print()
|
|||
std::vector<ESM::DialInfo::SelectStruct>::iterator sit;
|
||||
for (sit = mData.mSelects.begin(); sit != mData.mSelects.end(); sit++)
|
||||
std::cout << " Select Rule: " << ruleString(*sit) << std::endl;
|
||||
|
||||
if (mData.mResultScript != "")
|
||||
{
|
||||
if (mPrintPlain)
|
||||
{
|
||||
std::cout << " Result Script:" << std::endl;
|
||||
std::cout << "START--------------------------------------" << std::endl;
|
||||
std::cout << mData.mResultScript << std::endl;
|
||||
std::cout << "END----------------------------------------" << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << " Result Script: [skipped]" << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<>
|
||||
|
@ -1171,12 +1182,7 @@ void Record<ESM::Script>::print()
|
|||
std::cout << " Script Data Size: " << mData.mData.mScriptDataSize << std::endl;
|
||||
std::cout << " Table Size: " << mData.mData.mStringTableSize << std::endl;
|
||||
|
||||
std::cout << " Script: [skipped]" << std::endl;
|
||||
// Skip until multi-line fields is controllable by a command line option.
|
||||
// Mildly problematic because there are no parameter to print() currently.
|
||||
// std::cout << "-------------------------------------------" << std::endl;
|
||||
// std::cout << s->scriptText << std::endl;
|
||||
// std::cout << "-------------------------------------------" << std::endl;
|
||||
|
||||
std::vector<std::string>::iterator vit;
|
||||
for (vit = mData.mVarNames.begin(); vit != mData.mVarNames.end(); vit++)
|
||||
std::cout << " Variable: " << *vit << std::endl;
|
||||
|
@ -1186,6 +1192,18 @@ void Record<ESM::Script>::print()
|
|||
for (cit = mData.mScriptData.begin(); cit != mData.mScriptData.end(); cit++)
|
||||
std::cout << boost::format("%02X") % (int)(*cit);
|
||||
std::cout << std::endl;
|
||||
|
||||
if (mPrintPlain)
|
||||
{
|
||||
std::cout << " Script:" << std::endl;
|
||||
std::cout << "START--------------------------------------" << std::endl;
|
||||
std::cout << mData.mScriptText << std::endl;
|
||||
std::cout << "END----------------------------------------" << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << " Script: [skipped]" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
template<>
|
||||
|
|
|
@ -21,9 +21,10 @@ namespace EsmTool
|
|||
std::string mId;
|
||||
int mFlags;
|
||||
ESM::NAME mType;
|
||||
bool mPrintPlain;
|
||||
|
||||
public:
|
||||
RecordBase () {}
|
||||
RecordBase () { mPrintPlain = false; }
|
||||
virtual ~RecordBase() {}
|
||||
|
||||
const std::string &getId() const {
|
||||
|
@ -46,6 +47,14 @@ namespace EsmTool
|
|||
return mType;
|
||||
}
|
||||
|
||||
bool getPrintPlain() const {
|
||||
return mPrintPlain;
|
||||
}
|
||||
|
||||
void setPrintPlain(bool plain) {
|
||||
mPrintPlain = plain;
|
||||
}
|
||||
|
||||
virtual void load(ESM::ESMReader &esm) = 0;
|
||||
virtual void save(ESM::ESMWriter &esm) = 0;
|
||||
virtual void print() = 0;
|
||||
|
|
Loading…
Reference in a new issue