New command line option --plain to print contents of scripts, books, dialogs.

actorid
Miroslav Puda 12 years ago
parent 3cebb41459
commit d3d5cb4edf

@ -51,6 +51,7 @@ struct Arguments
unsigned int raw_given; unsigned int raw_given;
unsigned int quiet_given; unsigned int quiet_given;
unsigned int loadcells_given; unsigned int loadcells_given;
bool plain_given;
std::string mode; std::string mode;
std::string encoding; std::string encoding;
@ -77,6 +78,9 @@ bool parseOptions (int argc, char** argv, Arguments &info)
("type,t", bpo::value< std::vector<std::string> >(), ("type,t", bpo::value< std::vector<std::string> >(),
"Show only records of this type (four character record code). May " "Show only records of this type (four character record code). May "
"be specified multiple times. Only affects dump mode.") "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.") ("quiet,q", "Supress all record information. Useful for speed tests.")
("loadcells,C", "Browse through contents of all cells.") ("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.raw_given = variables.count ("raw");
info.quiet_given = variables.count ("quiet"); info.quiet_given = variables.count ("quiet");
info.loadcells_given = variables.count ("loadcells"); info.loadcells_given = variables.count ("loadcells");
info.plain_given = (variables.count("plain") > 0);
// Font encoding settings // Font encoding settings
info.encoding = variables["encoding"].as<std::string>(); info.encoding = variables["encoding"].as<std::string>();
@ -343,6 +348,7 @@ int load(Arguments& info)
} }
record->setId(id); record->setId(id);
record->setFlags((int) flags); record->setFlags((int) flags);
record->setPrintPlain(info.plain_given);
record->load(esm); record->load(esm);
if (!quiet && interested) record->print(); if (!quiet && interested) record->print();

@ -464,12 +464,17 @@ void Record<ESM::Book>::print()
std::cout << " IsScroll: " << mData.mData.mIsScroll << std::endl; std::cout << " IsScroll: " << mData.mData.mIsScroll << std::endl;
std::cout << " SkillID: " << mData.mData.mSkillID << std::endl; std::cout << " SkillID: " << mData.mData.mSkillID << std::endl;
std::cout << " Enchantment Points: " << mData.mData.mEnchant << std::endl; std::cout << " Enchantment Points: " << mData.mData.mEnchant << std::endl;
std::cout << " Text: [skipped]" << std::endl; if (mPrintPlain)
// Skip until multi-line fields is controllable by a command line option. {
// Mildly problematic because there are no parameter to print() currently. std::cout << " Text:" << std::endl;
// std::cout << "-------------------------------------------" << std::endl; std::cout << "START--------------------------------------" << std::endl;
// std::cout << mData.mText << std::endl; std::cout << mData.mText << std::endl;
// std::cout << "-------------------------------------------" << std::endl; std::cout << "END----------------------------------------" << std::endl;
}
else
{
std::cout << " Text: [skipped]" << std::endl;
}
} }
template<> template<>
@ -755,12 +760,17 @@ void Record<ESM::DialInfo>::print()
if (mData.mResultScript != "") if (mData.mResultScript != "")
{ {
std::cout << " Result Script: [skipped]" << std::endl; if (mPrintPlain)
// Skip until multi-line fields is controllable by a command line option. {
// Mildly problematic because there are no parameter to print() currently. std::cout << " Result Script:" << std::endl;
// std::cout << "-------------------------------------------" << std::endl; std::cout << "START--------------------------------------" << std::endl;
// std::cout << mData.mResultScript << std::endl; std::cout << mData.mResultScript << std::endl;
// std::cout << "-------------------------------------------" << std::endl; std::cout << "END----------------------------------------" << std::endl;
}
else
{
std::cout << " Result Script: [skipped]" << std::endl;
}
} }
std::cout << " Quest Status: " << questStatusLabel(mData.mQuestStatus) std::cout << " Quest Status: " << questStatusLabel(mData.mQuestStatus)
@ -1171,12 +1181,18 @@ void Record<ESM::Script>::print()
std::cout << " Script Data Size: " << mData.mData.mScriptDataSize << std::endl; std::cout << " Script Data Size: " << mData.mData.mScriptDataSize << std::endl;
std::cout << " Table Size: " << mData.mData.mStringTableSize << std::endl; std::cout << " Table Size: " << mData.mData.mStringTableSize << std::endl;
std::cout << " Script: [skipped]" << std::endl; if (mPrintPlain)
// Skip until multi-line fields is controllable by a command line option. {
// Mildly problematic because there are no parameter to print() currently. std::cout << " Script:" << std::endl;
// std::cout << "-------------------------------------------" << std::endl; std::cout << "START--------------------------------------" << std::endl;
// std::cout << s->scriptText << std::endl; std::cout << mData.mScriptText << std::endl;
// std::cout << "-------------------------------------------" << std::endl; std::cout << "END----------------------------------------" << std::endl;
}
else
{
std::cout << " Script: [skipped]" << std::endl;
}
std::vector<std::string>::iterator vit; std::vector<std::string>::iterator vit;
for (vit = mData.mVarNames.begin(); vit != mData.mVarNames.end(); vit++) for (vit = mData.mVarNames.begin(); vit != mData.mVarNames.end(); vit++)
std::cout << " Variable: " << *vit << std::endl; std::cout << " Variable: " << *vit << std::endl;

@ -21,9 +21,10 @@ namespace EsmTool
std::string mId; std::string mId;
int mFlags; int mFlags;
ESM::NAME mType; ESM::NAME mType;
bool mPrintPlain;
public: public:
RecordBase () {} RecordBase () { mPrintPlain = false; }
virtual ~RecordBase() {} virtual ~RecordBase() {}
const std::string &getId() const { const std::string &getId() const {
@ -46,6 +47,14 @@ namespace EsmTool
return mType; return mType;
} }
bool getPrintPlain() const {
return mPrintPlain;
}
void setPrintPlain(bool plain) {
mPrintPlain = plain;
}
virtual void load(ESM::ESMReader &esm) = 0; virtual void load(ESM::ESMReader &esm) = 0;
virtual void save(ESM::ESMWriter &esm) = 0; virtual void save(ESM::ESMWriter &esm) = 0;
virtual void print() = 0; virtual void print() = 0;

Loading…
Cancel
Save